cutadapt-1.15/0000775000175000017500000000000013205527004013775 5ustar marcelmarcel00000000000000cutadapt-1.15/PKG-INFO0000664000175000017500000000542513205527004015100 0ustar marcelmarcel00000000000000Metadata-Version: 1.1 Name: cutadapt Version: 1.15 Summary: trim adapters from high-throughput sequencing reads Home-page: https://cutadapt.readthedocs.io/ Author: Marcel Martin Author-email: marcel.martin@scilifelab.se License: MIT Description: .. image:: https://travis-ci.org/marcelm/cutadapt.svg?branch=master :target: https://travis-ci.org/marcelm/cutadapt .. image:: https://img.shields.io/pypi/v/cutadapt.svg?branch=master :target: https://pypi.python.org/pypi/cutadapt ======== cutadapt ======== Cutadapt finds and removes adapter sequences, primers, poly-A tails and other types of unwanted sequence from your high-throughput sequencing reads. Cleaning your data in this way is often required: Reads from small-RNA sequencing contain the 3’ sequencing adapter because the read is longer than the molecule that is sequenced. Amplicon reads start with a primer sequence. Poly-A tails are useful for pulling out RNA from your sample, but often you don’t want them to be in your reads. Cutadapt helps with these trimming tasks by finding the adapter or primer sequences in an error-tolerant way. It can also modify and filter reads in various ways. Adapter sequences can contain IUPAC wildcard characters. Also, paired-end reads and even colorspace data is supported. If you want, you can also just demultiplex your input data, without removing adapter sequences at all. Cutadapt comes with an extensive suite of automated tests and is available under the terms of the MIT license. If you use cutadapt, please cite `DOI:10.14806/ej.17.1.200 `_ . Links ----- * `Documentation `_ * `Source code `_ * `Report an issue `_ * `Project page on PyPI (Python package index) `_ * `Follow @marcelm_ on Twitter `_ * `Wrapper for the Galaxy platform `_ Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Console Classifier: Intended Audience :: Science/Research Classifier: License :: OSI Approved :: MIT License Classifier: Natural Language :: English Classifier: Programming Language :: Cython Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Scientific/Engineering :: Bio-Informatics cutadapt-1.15/src/0000775000175000017500000000000013205527004014564 5ustar marcelmarcel00000000000000cutadapt-1.15/src/cutadapt/0000775000175000017500000000000013205527004016371 5ustar marcelmarcel00000000000000cutadapt-1.15/src/cutadapt/_seqio.pyx0000664000175000017500000001464113205526454020430 0ustar marcelmarcel00000000000000# kate: syntax Python; # cython: profile=False, emit_code_comments=False from __future__ import print_function, division, absolute_import from xopen import xopen from .seqio import _shorten, FormatError, SequenceReader cimport cython # It would be nice to be able to have the first parameter be a # unsigned char[:] (memory view), but this fails with a BufferError # when a bytes object is passed in. # See ctypedef fused bytes_or_bytearray: bytes bytearray #@cython.boundscheck(False) def head(bytes_or_bytearray buf, Py_ssize_t lines): """ Skip forward by a number of lines in the given buffer and return how many bytes this corresponds to. """ cdef: Py_ssize_t pos = 0 Py_ssize_t linebreaks_seen = 0 Py_ssize_t length = len(buf) unsigned char* data = buf while linebreaks_seen < lines and pos < length: if data[pos] == '\n': linebreaks_seen += 1 pos += 1 return pos def fastq_head(bytes_or_bytearray buf, Py_ssize_t end=-1): """ Return an integer length such that buf[:length] contains the highest possible number of complete four-line records. If end is -1, the full buffer is searched. Otherwise only buf[:end]. """ cdef: Py_ssize_t pos = 0 Py_ssize_t linebreaks = 0 Py_ssize_t length = len(buf) unsigned char* data = buf Py_ssize_t record_start = 0 if end != -1: length = min(length, end) while True: while pos < length and data[pos] != '\n': pos += 1 if pos == length: break pos += 1 linebreaks += 1 if linebreaks == 4: linebreaks = 0 record_start = pos # Reached the end of the data block return record_start def two_fastq_heads(bytes_or_bytearray buf1, bytes_or_bytearray buf2, Py_ssize_t end1, Py_ssize_t end2): """ Skip forward in the two buffers by multiples of four lines. Return a tuple (length1, length2) such that buf1[:length1] and buf2[:length2] contain the same number of lines (where the line number is divisible by four). """ cdef: Py_ssize_t pos1 = 0, pos2 = 0 Py_ssize_t linebreaks = 0 unsigned char* data1 = buf1 unsigned char* data2 = buf2 Py_ssize_t record_start1 = 0 Py_ssize_t record_start2 = 0 while True: while pos1 < end1 and data1[pos1] != '\n': pos1 += 1 if pos1 == end1: break pos1 += 1 while pos2 < end2 and data2[pos2] != '\n': pos2 += 1 if pos2 == end2: break pos2 += 1 linebreaks += 1 if linebreaks == 4: linebreaks = 0 record_start1 = pos1 record_start2 = pos2 # Hit the end of the data block return record_start1, record_start2 cdef class Sequence(object): """ A record in a FASTQ file. Also used for FASTA (then the qualities attribute is None). qualities is a string and it contains the qualities encoded as ascii(qual+33). If an adapter has been matched to the sequence, the 'match' attribute is set to the corresponding Match instance. """ cdef: public str name public str sequence public str qualities public bint second_header public object match def __init__(self, str name, str sequence, str qualities=None, bint second_header=False, match=None): """Set qualities to None if there are no quality values""" self.name = name self.sequence = sequence self.qualities = qualities self.second_header = second_header self.match = match if qualities is not None and len(qualities) != len(sequence): rname = _shorten(name) raise FormatError("In read named {0!r}: length of quality sequence ({1}) and length " "of read ({2}) do not match".format( rname, len(qualities), len(sequence))) def __getitem__(self, key): """slicing""" return self.__class__( self.name, self.sequence[key], self.qualities[key] if self.qualities is not None else None, self.second_header, self.match) def __repr__(self): qstr = '' if self.qualities is not None: qstr = ', qualities={0!r}'.format(_shorten(self.qualities)) return ''.format(_shorten(self.name), _shorten(self.sequence), qstr) def __len__(self): return len(self.sequence) def __richcmp__(self, other, int op): if 2 <= op <= 3: eq = self.name == other.name and \ self.sequence == other.sequence and \ self.qualities == other.qualities if op == 2: return eq else: return not eq else: raise NotImplementedError() def __reduce__(self): return (Sequence, (self.name, self.sequence, self.qualities, self.second_header, self.match)) class FastqReader(SequenceReader): """ Reader for FASTQ files. Does not support multi-line FASTQ files. """ def __init__(self, file, sequence_class=Sequence): """ file is a filename or a file-like object. If file is a filename, then .gz files are supported. """ super(FastqReader, self).__init__(file) self.sequence_class = sequence_class self.delivers_qualities = True def __iter__(self): """ Yield Sequence objects """ cdef int i = 0 cdef int strip cdef str line, name, qualities, sequence, name2 sequence_class = self.sequence_class it = iter(self._file) line = next(it) if not (line and line[0] == '@'): raise FormatError("Line {0} in FASTQ file is expected to start with '@', but found {1!r}".format(i+1, line[:10])) strip = -2 if line.endswith('\r\n') else -1 name = line[1:strip] i = 1 for line in it: if i == 0: if not (line and line[0] == '@'): raise FormatError("Line {0} in FASTQ file is expected to start with '@', but found {1!r}".format(i+1, line[:10])) name = line[1:strip] elif i == 1: sequence = line[:strip] elif i == 2: if line == '+\n': # check most common case first name2 = '' else: line = line[:strip] if not (line and line[0] == '+'): raise FormatError("Line {0} in FASTQ file is expected to start with '+', but found {1!r}".format(i+1, line[:10])) if len(line) > 1: if not line[1:] == name: raise FormatError( "At line {0}: Sequence descriptions in the FASTQ file don't match " "({1!r} != {2!r}).\n" "The second sequence description must be either empty " "or equal to the first description.".format(i+1, name, line[1:])) second_header = True else: second_header = False elif i == 3: if len(line) == len(sequence) - strip: qualities = line[:strip] else: qualities = line.rstrip('\r\n') yield sequence_class(name, sequence, qualities, second_header=second_header) i = (i + 1) % 4 if i != 0: raise FormatError("FASTQ file ended prematurely") cutadapt-1.15/src/cutadapt/align.py0000664000175000017500000000217113205526454020046 0ustar marcelmarcel00000000000000# coding: utf-8 """ Alignment module. """ from __future__ import print_function, division, absolute_import from cutadapt._align import Aligner, compare_prefixes, locate # flags for global alignment # The interpretation of the first flag is: # An initial portion of seq1 may be skipped at no cost. # This is equivalent to saying that in the alignment, # gaps in the beginning of seq2 are free. # # The other flags have an equivalent meaning. START_WITHIN_SEQ1 = 1 START_WITHIN_SEQ2 = 2 STOP_WITHIN_SEQ1 = 4 STOP_WITHIN_SEQ2 = 8 # Use this to get regular semiglobal alignment # (all gaps in the beginning or end are free) SEMIGLOBAL = START_WITHIN_SEQ1 | START_WITHIN_SEQ2 | STOP_WITHIN_SEQ1 | STOP_WITHIN_SEQ2 def compare_suffixes(s1, s2, wildcard_ref=False, wildcard_query=False): """ Find out whether one string is the suffix of the other one, allowing mismatches. Used to find an anchored 3' adapter when no indels are allowed. """ s1 = s1[::-1] s2 = s2[::-1] _, length, _, _, matches, errors = compare_prefixes(s1, s2, wildcard_ref, wildcard_query) return (len(s1) - length, len(s1), len(s2) - length, len(s2), matches, errors) cutadapt-1.15/src/cutadapt/compat.py0000664000175000017500000000132413205526454020236 0ustar marcelmarcel00000000000000# coding: utf-8 """ Minimal Py2/Py3 compatibility library. """ from __future__ import print_function, division, absolute_import import sys PY3 = sys.version > '3' if PY3: maketrans = str.maketrans basestring = str zip = zip next = next def bytes_to_str(s): return s.decode('ascii') def str_to_bytes(s): return s.encode('ascii') def force_str(s): if isinstance(s, bytes): return s.decode('ascii') else: return s from io import StringIO else: def bytes_to_str(s): return s def str_to_bytes(s): return s def force_str(s): return s def next(it): return it.next() from string import maketrans basestring = basestring from itertools import izip as zip from StringIO import StringIO cutadapt-1.15/src/cutadapt/_qualtrim.c0000664000175000017500000032175713205526771020563 0ustar marcelmarcel00000000000000/* Generated by Cython 0.24 */ /* BEGIN: Cython Metadata { "distutils": {} } END: Cython Metadata */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) #error Cython requires Python 2.6+ or Python 3.2+. #else #define CYTHON_ABI "0_24" #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif #if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000 #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #undef SHIFT #undef BASE #undef MASK #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) #define Py_OptimizeFlag 0 #endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyType_Type #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 #endif #ifndef Py_TPFLAGS_HAVE_INDEX #define Py_TPFLAGS_HAVE_INDEX 0 #endif #ifndef Py_TPFLAGS_HAVE_NEWBUFFER #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) #else #define CYTHON_PEP393_ENABLED 0 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) #else #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) #else #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) #endif #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) #define PyObject_ASCII(o) PyObject_Repr(o) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) #else #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY #ifndef PyUnicode_InternFromString #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) #endif #endif #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) #elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 typedef struct { unaryfunc am_await; unaryfunc am_aiter; unaryfunc am_anext; } __Pyx_PyAsyncMethodsStruct; #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) #else #define __Pyx_PyType_AsAsync(obj) NULL #endif #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict #else #define CYTHON_RESTRICT #endif #endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #ifdef NAN #define __PYX_NAN() ((float) NAN) #else static CYTHON_INLINE float __PYX_NAN() { float value; memset(&value, 0xFF, sizeof(value)); return value; } #endif #define __PYX_ERR(f_index, lineno, Ln_error) \ { \ __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ } #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #define __PYX_HAVE__cutadapt___qualtrim #define __PYX_HAVE_API__cutadapt___qualtrim #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED # else # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 #define __PYX_DEFAULT_STRING_ENCODING "" #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #define __Pyx_uchar_cast(c) ((unsigned char)c) #define __Pyx_long_cast(x) ((long)x) #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ (sizeof(type) < sizeof(Py_ssize_t)) ||\ (sizeof(type) > sizeof(Py_ssize_t) &&\ likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX) &&\ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ v == (type)PY_SSIZE_T_MIN))) ||\ (sizeof(type) == sizeof(Py_ssize_t) &&\ (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX))) ) #if defined (__cplusplus) && __cplusplus >= 201103L #include #define __Pyx_sst_abs(value) std::abs(value) #elif SIZEOF_INT >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) abs(value) #elif SIZEOF_LONG >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) labs(value) #elif defined (_MSC_VER) && defined (_M_X64) #define __Pyx_sst_abs(value) _abs64(value) #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define __Pyx_sst_abs(value) llabs(value) #elif defined (__GNUC__) #define __Pyx_sst_abs(value) __builtin_llabs(value) #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) #define __Pyx_PyBytes_FromString PyBytes_FromString #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #if PY_MAJOR_VERSION < 3 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #else #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif #define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) #if PY_MAJOR_VERSION < 3 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } #else #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen #endif #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); #if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; PyObject* default_encoding = NULL; PyObject* ascii_chars_u = NULL; PyObject* ascii_chars_b = NULL; const char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; if (strcmp(default_encoding_c, "ascii") == 0) { __Pyx_sys_getdefaultencoding_not_ascii = 0; } else { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { ascii_chars[c] = c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); if (!ascii_chars_u) goto bad; ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { PyErr_Format( PyExc_ValueError, "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", default_encoding_c); goto bad; } Py_DECREF(ascii_chars_u); Py_DECREF(ascii_chars_b); } Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(default_encoding); Py_XDECREF(ascii_chars_u); Py_XDECREF(ascii_chars_b); return -1; } #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) #else #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT static char* __PYX_DEFAULT_STRING_ENCODING; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; PyObject* default_encoding = NULL; char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(default_encoding); return -1; } #endif #endif /* Test for GCC > 2.95 */ #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* !__GNUC__ or GCC < 2.95 */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_d; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static PyObject *__pyx_empty_unicode; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; static const char *__pyx_f[] = { "src/cutadapt/_qualtrim.pyx", }; /*--- Type declarations ---*/ /* --- Runtime support code (head) --- */ /* Refnanny.proto */ #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ } while (0) #define __Pyx_DECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_DECREF(tmp);\ } while (0) #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) /* PyObjectGetAttrStr.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_getattro)) return tp->tp_getattro(obj, attr_name); #if PY_MAJOR_VERSION < 3 if (likely(tp->tp_getattr)) return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); #endif return PyObject_GetAttr(obj, attr_name); } #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /* RaiseDoubleKeywords.proto */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /* ParseKeywords.proto */ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); /* ArgTypeTest.proto */ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /* GetItemInt.proto */ #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ __Pyx_GetItemInt_Generic(o, to_py_func(i)))) #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); /* UnicodeAsUCS4.proto */ static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject*); /* object_ord.proto */ #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyObject_Ord(c)\ (likely(PyUnicode_Check(c)) ? (long)__Pyx_PyUnicode_AsPy_UCS4(c) : __Pyx__PyObject_Ord(c)) #else #define __Pyx_PyObject_Ord(c) __Pyx__PyObject_Ord(c) #endif static long __Pyx__PyObject_Ord(PyObject* c); /* IncludeStringH.proto */ #include /* BytesEquals.proto */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /* UnicodeEquals.proto */ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /* StrEquals.proto */ #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals #else #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals #endif /* CodeObjectCache.proto */ typedef struct { PyCodeObject* code_object; int code_line; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; }; static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'cutadapt._qualtrim' */ #define __Pyx_MODULE_NAME "cutadapt._qualtrim" int __pyx_module_is_main_cutadapt___qualtrim = 0; /* Implementation of 'cutadapt._qualtrim' */ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_reversed; static PyObject *__pyx_builtin_xrange; static const char __pyx_k_G[] = "G"; static const char __pyx_k_i[] = "i"; static const char __pyx_k_q[] = "q"; static const char __pyx_k_s[] = "s"; static const char __pyx_k_base[] = "base"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_stop[] = "stop"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_bases[] = "bases"; static const char __pyx_k_max_i[] = "max_i"; static const char __pyx_k_range[] = "range"; static const char __pyx_k_start[] = "start"; static const char __pyx_k_cutoff[] = "cutoff"; static const char __pyx_k_xrange[] = "xrange"; static const char __pyx_k_max_qual[] = "max_qual"; static const char __pyx_k_reversed[] = "reversed"; static const char __pyx_k_sequence[] = "sequence"; static const char __pyx_k_qualities[] = "qualities"; static const char __pyx_k_cutoff_back[] = "cutoff_back"; static const char __pyx_k_cutoff_front[] = "cutoff_front"; static const char __pyx_k_Quality_trimming[] = "\nQuality trimming.\n"; static const char __pyx_k_cutadapt__qualtrim[] = "cutadapt._qualtrim"; static const char __pyx_k_nextseq_trim_index[] = "nextseq_trim_index"; static const char __pyx_k_quality_trim_index[] = "quality_trim_index"; static const char __pyx_k_home_marcel_scm_cutadapt_cutada[] = "/home/marcel/scm/cutadapt/cutadapt/src/cutadapt/_qualtrim.pyx"; static PyObject *__pyx_n_s_G; static PyObject *__pyx_n_s_base; static PyObject *__pyx_n_s_bases; static PyObject *__pyx_n_s_cutadapt__qualtrim; static PyObject *__pyx_n_s_cutoff; static PyObject *__pyx_n_s_cutoff_back; static PyObject *__pyx_n_s_cutoff_front; static PyObject *__pyx_kp_s_home_marcel_scm_cutadapt_cutada; static PyObject *__pyx_n_s_i; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_max_i; static PyObject *__pyx_n_s_max_qual; static PyObject *__pyx_n_s_nextseq_trim_index; static PyObject *__pyx_n_s_q; static PyObject *__pyx_n_s_qualities; static PyObject *__pyx_n_s_quality_trim_index; static PyObject *__pyx_n_s_range; static PyObject *__pyx_n_s_reversed; static PyObject *__pyx_n_s_s; static PyObject *__pyx_n_s_sequence; static PyObject *__pyx_n_s_start; static PyObject *__pyx_n_s_stop; static PyObject *__pyx_n_s_test; static PyObject *__pyx_n_s_xrange; static PyObject *__pyx_pf_8cutadapt_9_qualtrim_quality_trim_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_qualities, int __pyx_v_cutoff_front, int __pyx_v_cutoff_back, int __pyx_v_base); /* proto */ static PyObject *__pyx_pf_8cutadapt_9_qualtrim_2nextseq_trim_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sequence, int __pyx_v_cutoff, int __pyx_v_base); /* proto */ static PyObject *__pyx_tuple_; static PyObject *__pyx_tuple__3; static PyObject *__pyx_codeobj__2; static PyObject *__pyx_codeobj__4; /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_9_qualtrim_1quality_trim_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_8cutadapt_9_qualtrim_quality_trim_index[] = "\n\tFind the positions at which to trim low-quality ends from a nucleotide sequence.\n\tReturn tuple (start, stop) that indicates the good-quality segment.\n\n\tQualities are assumed to be ASCII-encoded as chr(qual + base).\n\n\tThe algorithm is the same as the one used by BWA within the function\n\t'bwa_trim_read':\n\t- Subtract the cutoff value from all qualities.\n\t- Compute partial sums from all indices to the end of the sequence.\n\t- Trim sequence at the index at which the sum is minimal.\n\t"; static PyMethodDef __pyx_mdef_8cutadapt_9_qualtrim_1quality_trim_index = {"quality_trim_index", (PyCFunction)__pyx_pw_8cutadapt_9_qualtrim_1quality_trim_index, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8cutadapt_9_qualtrim_quality_trim_index}; static PyObject *__pyx_pw_8cutadapt_9_qualtrim_1quality_trim_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_qualities = 0; int __pyx_v_cutoff_front; int __pyx_v_cutoff_back; int __pyx_v_base; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("quality_trim_index (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_qualities,&__pyx_n_s_cutoff_front,&__pyx_n_s_cutoff_back,&__pyx_n_s_base,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_qualities)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cutoff_front)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("quality_trim_index", 0, 3, 4, 1); __PYX_ERR(0, 7, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cutoff_back)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("quality_trim_index", 0, 3, 4, 2); __PYX_ERR(0, 7, __pyx_L3_error) } case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_base); if (value) { values[3] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "quality_trim_index") < 0)) __PYX_ERR(0, 7, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_qualities = ((PyObject*)values[0]); __pyx_v_cutoff_front = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_cutoff_front == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 7, __pyx_L3_error) __pyx_v_cutoff_back = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_cutoff_back == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 7, __pyx_L3_error) if (values[3]) { __pyx_v_base = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_base == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 7, __pyx_L3_error) } else { __pyx_v_base = ((int)33); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("quality_trim_index", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 7, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._qualtrim.quality_trim_index", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_qualities), (&PyString_Type), 1, "qualities", 1))) __PYX_ERR(0, 7, __pyx_L1_error) __pyx_r = __pyx_pf_8cutadapt_9_qualtrim_quality_trim_index(__pyx_self, __pyx_v_qualities, __pyx_v_cutoff_front, __pyx_v_cutoff_back, __pyx_v_base); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_9_qualtrim_quality_trim_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_qualities, int __pyx_v_cutoff_front, int __pyx_v_cutoff_back, int __pyx_v_base) { int __pyx_v_s; int __pyx_v_max_qual; int __pyx_v_stop; int __pyx_v_start; int __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; long __pyx_t_4; int __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; __Pyx_RefNannySetupContext("quality_trim_index", 0); __pyx_t_1 = PyObject_Length(__pyx_v_qualities); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 22, __pyx_L1_error) __pyx_v_stop = __pyx_t_1; __pyx_v_start = 0; __pyx_v_s = 0; __pyx_v_max_qual = 0; __pyx_t_1 = PyObject_Length(__pyx_v_qualities); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 29, __pyx_L1_error) for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_qualities, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_Ord(__pyx_t_3); if (unlikely(__pyx_t_4 == (long)(Py_UCS4)-1)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_s = (__pyx_v_s + (__pyx_v_cutoff_front - (__pyx_t_4 - __pyx_v_base))); __pyx_t_5 = ((__pyx_v_s < 0) != 0); if (__pyx_t_5) { goto __pyx_L4_break; } __pyx_t_5 = ((__pyx_v_s > __pyx_v_max_qual) != 0); if (__pyx_t_5) { __pyx_v_max_qual = __pyx_v_s; __pyx_v_start = (__pyx_v_i + 1); } } __pyx_L4_break:; __pyx_v_max_qual = 0; __pyx_v_s = 0; __pyx_t_1 = PyObject_Length(__pyx_v_qualities); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 40, __pyx_L1_error) for (__pyx_t_2 = __pyx_t_1-1; __pyx_t_2 >= 0; __pyx_t_2-=1) { __pyx_v_i = __pyx_t_2; __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_qualities, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_Ord(__pyx_t_3); if (unlikely(__pyx_t_4 == (long)(Py_UCS4)-1)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_s = (__pyx_v_s + (__pyx_v_cutoff_back - (__pyx_t_4 - __pyx_v_base))); __pyx_t_5 = ((__pyx_v_s < 0) != 0); if (__pyx_t_5) { goto __pyx_L8_break; } __pyx_t_5 = ((__pyx_v_s > __pyx_v_max_qual) != 0); if (__pyx_t_5) { __pyx_v_max_qual = __pyx_v_s; __pyx_v_stop = __pyx_v_i; } } __pyx_L8_break:; __pyx_t_5 = ((__pyx_v_start >= __pyx_v_stop) != 0); if (__pyx_t_5) { __pyx_t_2 = 0; __pyx_t_6 = 0; __pyx_v_start = __pyx_t_2; __pyx_v_stop = __pyx_t_6; } __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_start); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_stop); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_7); __pyx_t_3 = 0; __pyx_t_7 = 0; __pyx_r = __pyx_t_8; __pyx_t_8 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("cutadapt._qualtrim.quality_trim_index", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_9_qualtrim_3nextseq_trim_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_8cutadapt_9_qualtrim_2nextseq_trim_index[] = "\n\tVariant of the above quality trimming routine that works on NextSeq data.\n\tWith Illumina NextSeq, bases are encoded with two colors. 'No color' (a\n\tdark cycle) usually means that a 'G' was sequenced, but that also occurs\n\twhen sequencing falls off the end of the fragment. The read then contains\n\ta run of high-quality G bases in the end.\n\n\tThis routine works as the one above, but counts qualities belonging to 'G'\n\tbases as being equal to cutoff - 1.\n\t"; static PyMethodDef __pyx_mdef_8cutadapt_9_qualtrim_3nextseq_trim_index = {"nextseq_trim_index", (PyCFunction)__pyx_pw_8cutadapt_9_qualtrim_3nextseq_trim_index, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8cutadapt_9_qualtrim_2nextseq_trim_index}; static PyObject *__pyx_pw_8cutadapt_9_qualtrim_3nextseq_trim_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_sequence = 0; int __pyx_v_cutoff; int __pyx_v_base; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("nextseq_trim_index (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sequence,&__pyx_n_s_cutoff,&__pyx_n_s_base,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sequence)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cutoff)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("nextseq_trim_index", 0, 2, 3, 1); __PYX_ERR(0, 52, __pyx_L3_error) } case 2: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_base); if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "nextseq_trim_index") < 0)) __PYX_ERR(0, 52, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_sequence = values[0]; __pyx_v_cutoff = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_cutoff == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 52, __pyx_L3_error) if (values[2]) { __pyx_v_base = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_base == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 52, __pyx_L3_error) } else { __pyx_v_base = ((int)33); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("nextseq_trim_index", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 52, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._qualtrim.nextseq_trim_index", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8cutadapt_9_qualtrim_2nextseq_trim_index(__pyx_self, __pyx_v_sequence, __pyx_v_cutoff, __pyx_v_base); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_9_qualtrim_2nextseq_trim_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_sequence, int __pyx_v_cutoff, int __pyx_v_base) { PyObject *__pyx_v_bases = NULL; PyObject *__pyx_v_qualities = NULL; int __pyx_v_s; int __pyx_v_max_qual; int __pyx_v_max_i; int __pyx_v_i; int __pyx_v_q; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; int __pyx_t_3; long __pyx_t_4; int __pyx_t_5; __Pyx_RefNannySetupContext("nextseq_trim_index", 0); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sequence, __pyx_n_s_sequence); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_bases = __pyx_t_1; __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sequence, __pyx_n_s_qualities); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_qualities = __pyx_t_1; __pyx_t_1 = 0; __pyx_v_s = 0; __pyx_v_max_qual = 0; __pyx_t_2 = PyObject_Length(__pyx_v_qualities); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 68, __pyx_L1_error) __pyx_v_max_i = __pyx_t_2; __pyx_v_s = 0; __pyx_v_max_qual = 0; __pyx_t_2 = PyObject_Length(__pyx_v_qualities); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 73, __pyx_L1_error) __pyx_v_max_i = __pyx_t_2; for (__pyx_t_3 = __pyx_v_max_i-1; __pyx_t_3 >= 0; __pyx_t_3-=1) { __pyx_v_i = __pyx_t_3; __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_qualities, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyObject_Ord(__pyx_t_1); if (unlikely(__pyx_t_4 == (long)(Py_UCS4)-1)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_q = (__pyx_t_4 - __pyx_v_base); __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_bases, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_G, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_5) { __pyx_v_q = (__pyx_v_cutoff - 1); } __pyx_v_s = (__pyx_v_s + (__pyx_v_cutoff - __pyx_v_q)); __pyx_t_5 = ((__pyx_v_s < 0) != 0); if (__pyx_t_5) { goto __pyx_L4_break; } __pyx_t_5 = ((__pyx_v_s > __pyx_v_max_qual) != 0); if (__pyx_t_5) { __pyx_v_max_qual = __pyx_v_s; __pyx_v_max_i = __pyx_v_i; } } __pyx_L4_break:; __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_max_i); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("cutadapt._qualtrim.nextseq_trim_index", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_bases); __Pyx_XDECREF(__pyx_v_qualities); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { #if PY_VERSION_HEX < 0x03020000 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, #else PyModuleDef_HEAD_INIT, #endif "_qualtrim", __pyx_k_Quality_trimming, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_G, __pyx_k_G, sizeof(__pyx_k_G), 0, 0, 1, 1}, {&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1}, {&__pyx_n_s_bases, __pyx_k_bases, sizeof(__pyx_k_bases), 0, 0, 1, 1}, {&__pyx_n_s_cutadapt__qualtrim, __pyx_k_cutadapt__qualtrim, sizeof(__pyx_k_cutadapt__qualtrim), 0, 0, 1, 1}, {&__pyx_n_s_cutoff, __pyx_k_cutoff, sizeof(__pyx_k_cutoff), 0, 0, 1, 1}, {&__pyx_n_s_cutoff_back, __pyx_k_cutoff_back, sizeof(__pyx_k_cutoff_back), 0, 0, 1, 1}, {&__pyx_n_s_cutoff_front, __pyx_k_cutoff_front, sizeof(__pyx_k_cutoff_front), 0, 0, 1, 1}, {&__pyx_kp_s_home_marcel_scm_cutadapt_cutada, __pyx_k_home_marcel_scm_cutadapt_cutada, sizeof(__pyx_k_home_marcel_scm_cutadapt_cutada), 0, 0, 1, 0}, {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_max_i, __pyx_k_max_i, sizeof(__pyx_k_max_i), 0, 0, 1, 1}, {&__pyx_n_s_max_qual, __pyx_k_max_qual, sizeof(__pyx_k_max_qual), 0, 0, 1, 1}, {&__pyx_n_s_nextseq_trim_index, __pyx_k_nextseq_trim_index, sizeof(__pyx_k_nextseq_trim_index), 0, 0, 1, 1}, {&__pyx_n_s_q, __pyx_k_q, sizeof(__pyx_k_q), 0, 0, 1, 1}, {&__pyx_n_s_qualities, __pyx_k_qualities, sizeof(__pyx_k_qualities), 0, 0, 1, 1}, {&__pyx_n_s_quality_trim_index, __pyx_k_quality_trim_index, sizeof(__pyx_k_quality_trim_index), 0, 0, 1, 1}, {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, {&__pyx_n_s_reversed, __pyx_k_reversed, sizeof(__pyx_k_reversed), 0, 0, 1, 1}, {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1}, {&__pyx_n_s_sequence, __pyx_k_sequence, sizeof(__pyx_k_sequence), 0, 0, 1, 1}, {&__pyx_n_s_start, __pyx_k_start, sizeof(__pyx_k_start), 0, 0, 1, 1}, {&__pyx_n_s_stop, __pyx_k_stop, sizeof(__pyx_k_stop), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_n_s_xrange, __pyx_k_xrange, sizeof(__pyx_k_xrange), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 29, __pyx_L1_error) __pyx_builtin_reversed = __Pyx_GetBuiltinName(__pyx_n_s_reversed); if (!__pyx_builtin_reversed) __PYX_ERR(0, 40, __pyx_L1_error) #if PY_MAJOR_VERSION >= 3 __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_xrange) __PYX_ERR(0, 40, __pyx_L1_error) #else __pyx_builtin_xrange = __Pyx_GetBuiltinName(__pyx_n_s_xrange); if (!__pyx_builtin_xrange) __PYX_ERR(0, 40, __pyx_L1_error) #endif return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); __pyx_tuple_ = PyTuple_Pack(9, __pyx_n_s_qualities, __pyx_n_s_cutoff_front, __pyx_n_s_cutoff_back, __pyx_n_s_base, __pyx_n_s_s, __pyx_n_s_max_qual, __pyx_n_s_stop, __pyx_n_s_start, __pyx_n_s_i); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); __pyx_codeobj__2 = (PyObject*)__Pyx_PyCode_New(4, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple_, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_marcel_scm_cutadapt_cutada, __pyx_n_s_quality_trim_index, 7, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__2)) __PYX_ERR(0, 7, __pyx_L1_error) __pyx_tuple__3 = PyTuple_Pack(10, __pyx_n_s_sequence, __pyx_n_s_cutoff, __pyx_n_s_base, __pyx_n_s_bases, __pyx_n_s_qualities, __pyx_n_s_s, __pyx_n_s_max_qual, __pyx_n_s_max_i, __pyx_n_s_i, __pyx_n_s_q); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); __pyx_codeobj__4 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__3, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_marcel_scm_cutadapt_cutada, __pyx_n_s_nextseq_trim_index, 52, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__4)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC init_qualtrim(void); /*proto*/ PyMODINIT_FUNC init_qualtrim(void) #else PyMODINIT_FUNC PyInit__qualtrim(void); /*proto*/ PyMODINIT_FUNC PyInit__qualtrim(void) #endif { PyObject *__pyx_t_1 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__qualtrim(void)", 0); if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4("_qualtrim", __pyx_methods, __pyx_k_Quality_trimming, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_d); __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif if (__pyx_module_is_main_cutadapt___qualtrim) { if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "cutadapt._qualtrim")) { if (unlikely(PyDict_SetItemString(modules, "cutadapt._qualtrim", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif /*--- Builtin init code ---*/ if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8cutadapt_9_qualtrim_1quality_trim_index, NULL, __pyx_n_s_cutadapt__qualtrim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_quality_trim_index, __pyx_t_1) < 0) __PYX_ERR(0, 7, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8cutadapt_9_qualtrim_3nextseq_trim_index, NULL, __pyx_n_s_cutadapt__qualtrim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_nextseq_trim_index, __pyx_t_1) < 0) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { if (__pyx_d) { __Pyx_AddTraceback("init cutadapt._qualtrim", __pyx_clineno, __pyx_lineno, __pyx_filename); } Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init cutadapt._qualtrim"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* --- Runtime support code --- */ /* Refnanny */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); if (unlikely(!result)) { PyErr_Format(PyExc_NameError, #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); #else "name '%.200s' is not defined", PyString_AS_STRING(name)); #endif } return result; } /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } /* RaiseDoubleKeywords */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AsString(kw_name)); #endif } /* ParseKeywords */ static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; continue; } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { if ((**argname == key) || ( (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) && _PyString_Eq(**argname, key))) { goto arg_passed_twice; } argname++; } } } else #endif if (likely(PyUnicode_Check(key))) { while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; argname++; } } } else goto invalid_keyword_type; if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%.200s() got an unexpected keyword argument '%.200s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } /* ArgTypeTest */ static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { PyErr_Format(PyExc_TypeError, "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", name, type->tp_name, Py_TYPE(obj)->tp_name); } static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (likely(Py_TYPE(obj) == type)) return 1; #if PY_MAJOR_VERSION == 2 else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; #endif } else { if (likely(PyObject_TypeCheck(obj, type))) return 1; } __Pyx_RaiseArgumentTypeInvalid(name, obj, type); return 0; } /* GetItemInt */ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, i); Py_INCREF(r); return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else return PySequence_GetItem(o, i); #endif } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else return PySequence_GetItem(o, i); #endif } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (is_list || PyList_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { PyObject *r = PyList_GET_ITEM(o, n); Py_INCREF(r); return r; } } else if (PyTuple_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, n); Py_INCREF(r); return r; } } else { PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_item)) { if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { Py_ssize_t l = m->sq_length(o); if (likely(l >= 0)) { i += l; } else { if (!PyErr_ExceptionMatches(PyExc_OverflowError)) return NULL; PyErr_Clear(); } } return m->sq_item(o, i); } } #else if (is_list || PySequence_Check(o)) { return PySequence_GetItem(o, i); } #endif return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } /* UnicodeAsUCS4 */ static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject* x) { Py_ssize_t length; #if CYTHON_PEP393_ENABLED length = PyUnicode_GET_LENGTH(x); if (likely(length == 1)) { return PyUnicode_READ_CHAR(x, 0); } #else length = PyUnicode_GET_SIZE(x); if (likely(length == 1)) { return PyUnicode_AS_UNICODE(x)[0]; } #if Py_UNICODE_SIZE == 2 else if (PyUnicode_GET_SIZE(x) == 2) { Py_UCS4 high_val = PyUnicode_AS_UNICODE(x)[0]; if (high_val >= 0xD800 && high_val <= 0xDBFF) { Py_UCS4 low_val = PyUnicode_AS_UNICODE(x)[1]; if (low_val >= 0xDC00 && low_val <= 0xDFFF) { return 0x10000 + (((high_val & ((1<<10)-1)) << 10) | (low_val & ((1<<10)-1))); } } } #endif #endif PyErr_Format(PyExc_ValueError, "only single character unicode strings can be converted to Py_UCS4, " "got length %" CYTHON_FORMAT_SSIZE_T "d", length); return (Py_UCS4)-1; } /* object_ord */ static long __Pyx__PyObject_Ord(PyObject* c) { Py_ssize_t size; if (PyBytes_Check(c)) { size = PyBytes_GET_SIZE(c); if (likely(size == 1)) { return (unsigned char) PyBytes_AS_STRING(c)[0]; } #if PY_MAJOR_VERSION < 3 } else if (PyUnicode_Check(c)) { return (long)__Pyx_PyUnicode_AsPy_UCS4(c); #endif #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) } else if (PyByteArray_Check(c)) { size = PyByteArray_GET_SIZE(c); if (likely(size == 1)) { return (unsigned char) PyByteArray_AS_STRING(c)[0]; } #endif } else { PyErr_Format(PyExc_TypeError, "ord() expected string of length 1, but %.200s found", c->ob_type->tp_name); return (long)(Py_UCS4)-1; } PyErr_Format(PyExc_TypeError, "ord() expected a character, but string of length %zd found", size); return (long)(Py_UCS4)-1; } /* BytesEquals */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else if (s1 == s2) { return (equals == Py_EQ); } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { const char *ps1, *ps2; Py_ssize_t length = PyBytes_GET_SIZE(s1); if (length != PyBytes_GET_SIZE(s2)) return (equals == Py_NE); ps1 = PyBytes_AS_STRING(s1); ps2 = PyBytes_AS_STRING(s2); if (ps1[0] != ps2[0]) { return (equals == Py_NE); } else if (length == 1) { return (equals == Py_EQ); } else { int result = memcmp(ps1, ps2, (size_t)length); return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { return (equals == Py_NE); } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { return (equals == Py_NE); } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); Py_DECREF(py_result); return result; } #endif } /* UnicodeEquals */ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else #if PY_MAJOR_VERSION < 3 PyObject* owned_ref = NULL; #endif int s1_is_unicode, s2_is_unicode; if (s1 == s2) { goto return_eq; } s1_is_unicode = PyUnicode_CheckExact(s1); s2_is_unicode = PyUnicode_CheckExact(s2); #if PY_MAJOR_VERSION < 3 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { owned_ref = PyUnicode_FromObject(s2); if (unlikely(!owned_ref)) return -1; s2 = owned_ref; s2_is_unicode = 1; } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { owned_ref = PyUnicode_FromObject(s1); if (unlikely(!owned_ref)) return -1; s1 = owned_ref; s1_is_unicode = 1; } else if (((!s2_is_unicode) & (!s1_is_unicode))) { return __Pyx_PyBytes_Equals(s1, s2, equals); } #endif if (s1_is_unicode & s2_is_unicode) { Py_ssize_t length; int kind; void *data1, *data2; if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) return -1; length = __Pyx_PyUnicode_GET_LENGTH(s1); if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { goto return_ne; } kind = __Pyx_PyUnicode_KIND(s1); if (kind != __Pyx_PyUnicode_KIND(s2)) { goto return_ne; } data1 = __Pyx_PyUnicode_DATA(s1); data2 = __Pyx_PyUnicode_DATA(s2); if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { goto return_ne; } else if (length == 1) { goto return_eq; } else { int result = memcmp(data1, data2, (size_t)(length * kind)); #if PY_MAJOR_VERSION < 3 Py_XDECREF(owned_ref); #endif return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & s2_is_unicode) { goto return_ne; } else if ((s2 == Py_None) & s1_is_unicode) { goto return_ne; } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); Py_DECREF(py_result); return result; } return_eq: #if PY_MAJOR_VERSION < 3 Py_XDECREF(owned_ref); #endif return (equals == Py_EQ); return_ne: #if PY_MAJOR_VERSION < 3 Py_XDECREF(owned_ref); #endif return (equals == Py_NE); #endif } /* CodeObjectCache */ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; } while (start < end) { mid = start + (end - start) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { start = mid + 1; } else { return mid; } } if (code_line <= entries[mid].code_line) { return mid; } else { return mid + 1; } } static PyCodeObject *__pyx_find_code_object(int code_line) { PyCodeObject* code_object; int pos; if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { return NULL; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { return NULL; } code_object = __pyx_code_cache.entries[pos].code_object; Py_INCREF(code_object); return code_object; } static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = 64; __pyx_code_cache.count = 1; entries[0].code_line = code_line; entries[0].code_object = code_object; Py_INCREF(code_object); } return; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { PyCodeObject* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_DECREF(tmp); return; } if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = new_max; } for (i=__pyx_code_cache.count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; __pyx_code_cache.count++; Py_INCREF(code_object); } /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(filename); #else py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_code = __Pyx_PyCode_New( 0, 0, 0, 0, 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); Py_DECREF(py_funcname); return py_code; bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; py_code = __pyx_find_code_object(c_line ? c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; __pyx_insert_code_object(c_line ? c_line : py_line, py_code); } py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ __pyx_d, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ {\ func_type value = func_value;\ if (sizeof(target_type) < sizeof(func_type)) {\ if (unlikely(value != (func_type) (target_type) value)) {\ func_type zero = 0;\ if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ return (target_type) -1;\ if (is_unsigned && unlikely(value < zero))\ goto raise_neg_overflow;\ else\ goto raise_overflow;\ }\ }\ return (target_type) value;\ } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(int) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(int) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); } } else { if (sizeof(int) <= sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(int), little, !is_unsigned); } } /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(int) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (int) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) case 2: if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; case 3: if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; case 4: if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __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]))) } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (int) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(int) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) case -2: if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 2: if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -3: if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 3: if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -4: if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __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]))) } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 4: if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __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]))) } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; } #endif if (sizeof(int) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (int) -1; } } else { int val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (int) -1; val = __Pyx_PyInt_As_int(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); return (int) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to int"); return (int) -1; } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(long) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); } } else { if (sizeof(long) <= sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); } } /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(long) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (long) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) case 2: if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 3: if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 4: if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __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]))) } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (long) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(long) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) case -2: if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 2: if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -3: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 3: if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -4: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __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]))) } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 4: if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __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]))) } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; } #endif if (sizeof(long) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (long) -1; } } else { long val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (long) -1; val = __Pyx_PyInt_As_long(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); return (long) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long) -1; } /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); } return 0; } /* InitStrings */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); } static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if ( #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII __Pyx_sys_getdefaultencoding_not_ascii && #endif PyUnicode_Check(o)) { #if PY_VERSION_HEX < 0x03030000 char* defenc_c; PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); if (!defenc) return NULL; defenc_c = PyBytes_AS_STRING(defenc); #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII { char* end = defenc_c + PyBytes_GET_SIZE(defenc); char* c; for (c = defenc_c; c < end; c++) { if ((unsigned char) (*c) >= 128) { PyUnicode_AsASCIIString(o); return NULL; } } } #endif *length = PyBytes_GET_SIZE(defenc); return defenc_c; #else if (__Pyx_PyUnicode_READY(o) == -1) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (PyUnicode_IS_ASCII(o)) { *length = PyUnicode_GET_LENGTH(o); return PyUnicode_AsUTF8(o); } else { PyUnicode_AsASCIIString(o); return NULL; } #else return PyUnicode_AsUTF8AndSize(o, length); #endif #endif } else #endif #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); } else #endif { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); if (unlikely(r < 0)) { return NULL; } else { return result; } } } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_MAJOR_VERSION < 3 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return __Pyx_NewRef(x); m = Py_TYPE(x)->tp_as_number; #if PY_MAJOR_VERSION < 3 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_MAJOR_VERSION < 3 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%.4s__ returned non-%.4s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject *x; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(b))) { if (sizeof(Py_ssize_t) >= sizeof(long)) return PyInt_AS_LONG(b); else return PyInt_AsSsize_t(x); } #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)b)->ob_digit; const Py_ssize_t size = Py_SIZE(b); if (likely(__Pyx_sst_abs(size) <= 1)) { ival = likely(size) ? digits[0] : 0; if (size == -1) ival = -ival; return ival; } else { switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case 3: if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -3: if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case 4: if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { 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])); } break; case -4: if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { 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])); } break; } } #endif return PyLong_AsSsize_t(b); } x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); } #endif /* Py_PYTHON_H */ cutadapt-1.15/src/cutadapt/seqio.py0000664000175000017500000006616413205526454020110 0ustar marcelmarcel00000000000000# coding: utf-8 """ Sequence I/O classes: Reading and writing of FASTA and FASTQ files. TODO - Sequence.name should be Sequence.description or so (reserve .name for the part before the first space) """ from __future__ import print_function, division, absolute_import import sys from os.path import splitext from xopen import xopen from .compat import zip, basestring __author__ = "Marcel Martin" class FormatError(Exception): """ Raised when an input file (FASTA or FASTQ) is malformatted. """ def _shorten(s, n=100): """Shorten string s to at most n characters, appending "..." if necessary.""" if s is None: return None if len(s) > n: s = s[:n-3] + '...' return s class Sequence(object): """qualities is a string and it contains the qualities encoded as ascii(qual+33).""" def __init__(self, name, sequence, qualities=None, second_header=False, match=None): """Set qualities to None if there are no quality values""" self.name = name self.sequence = sequence self.qualities = qualities self.second_header = second_header self.match = match self.original_length = len(sequence) if qualities is not None: if len(qualities) != len(sequence): rname = _shorten(name) raise FormatError("In read named {0!r}: Length of quality sequence ({1}) and " "length of read ({2}) do not match".format(rname, len(qualities), len(sequence))) def __getitem__(self, key): """slicing""" return self.__class__( self.name, self.sequence[key], self.qualities[key] if self.qualities is not None else None, self.second_header, self.match) def __repr__(self): qstr = '' if self.qualities is not None: qstr = ', qualities={0!r}'.format(_shorten(self.qualities)) return ''.format( _shorten(self.name), _shorten(self.sequence), qstr) def __len__(self): return len(self.sequence) def __eq__(self, other): return self.name == other.name and \ self.sequence == other.sequence and \ self.qualities == other.qualities def __ne__(self, other): return not self.__eq__(other) class SequenceReader(object): """Read possibly compressed files containing sequences""" _close_on_exit = False paired = False def __init__(self, file): """ file is a path or a file-like object. In both cases, the file may be compressed (.gz, .bz2, .xz). """ if isinstance(file, basestring): file = xopen(file) self._close_on_exit = True self._file = file def close(self): if self._close_on_exit and self._file is not None: self._file.close() self._file = None def __enter__(self): if self._file is None: raise ValueError("I/O operation on closed SequenceReader") return self def __exit__(self, *args): self.close() try: from ._seqio import Sequence except ImportError: pass class ColorspaceSequence(Sequence): def __init__(self, name, sequence, qualities, primer=None, second_header=False, match=None): # In colorspace, the first character is the last nucleotide of the primer base # and the second character encodes the transition from the primer base to the # first real base of the read. if primer is None: self.primer = sequence[0:1] sequence = sequence[1:] else: self.primer = primer if qualities is not None and len(sequence) != len(qualities): rname = _shorten(name) raise FormatError("In read named {0!r}: length of colorspace quality " "sequence ({1}) and length of read ({2}) do not match (primer " "is: {3!r})".format(rname, len(qualities), len(sequence), self.primer)) super(ColorspaceSequence, self).__init__(name, sequence, qualities, second_header, match) if not self.primer in ('A', 'C', 'G', 'T'): raise FormatError("Primer base is {0!r} in read {1!r}, but it " "should be one of A, C, G, T.".format( self.primer, _shorten(name))) def __repr__(self): qstr = '' if self.qualities is not None: qstr = ', qualities={0!r}'.format(_shorten(self.qualities)) return ''.format( _shorten(self.name), self.primer, _shorten(self.sequence), qstr) def __getitem__(self, key): return self.__class__( self.name, self.sequence[key], self.qualities[key] if self.qualities is not None else None, self.primer, self.second_header, self.match) def __reduce__(self): return (ColorspaceSequence, (self.name, self.sequence, self.qualities, self.primer, self.second_header, self.match)) def sra_colorspace_sequence(name, sequence, qualities, second_header): """Factory for an SRA colorspace sequence (which has one quality value too many)""" return ColorspaceSequence(name, sequence, qualities[1:], second_header=second_header) class FileWithPrependedLine(object): """ A file-like object that allows to "prepend" a single line to an already opened file. That is, further reads on the file will return the provided line and only then the actual content. This is needed to solve the problem of autodetecting input from a stream: As soon as the first line has been read, we know the file type, but also that line is "gone" and unavailable for further processing. """ def __init__(self, file, line): """ file is an already opened file-like object. line is a single string (newline will be appended if not included) """ if not line.endswith('\n'): line += '\n' self.first_line = line self._file = file def __iter__(self): yield self.first_line for line in self._file: yield line def close(self): self._file.close() class FastaReader(SequenceReader): """ Reader for FASTA files. """ def __init__(self, file, keep_linebreaks=False, sequence_class=Sequence): """ file is a path or a file-like object. In both cases, the file may be compressed (.gz, .bz2, .xz). keep_linebreaks -- whether to keep newline characters in the sequence """ super(FastaReader, self).__init__(file) self.sequence_class = sequence_class self.delivers_qualities = False self._delimiter = '\n' if keep_linebreaks else '' def __iter__(self): """ Read next entry from the file (single entry at a time). """ name = None seq = [] for i, line in enumerate(self._file): # strip() also removes DOS line breaks line = line.strip() if not line: continue if line and line[0] == '>': if name is not None: yield self.sequence_class(name, self._delimiter.join(seq), None) name = line[1:] seq = [] elif line and line[0] == '#': continue elif name is not None: seq.append(line) else: raise FormatError("At line {0}: Expected '>' at beginning of " "FASTA record, but got {1!r}.".format(i+1, _shorten(line))) if name is not None: yield self.sequence_class(name, self._delimiter.join(seq), None) class ColorspaceFastaReader(FastaReader): def __init__(self, file, keep_linebreaks=False): super(ColorspaceFastaReader, self).__init__(file, keep_linebreaks, sequence_class=ColorspaceSequence) class FastqReader(SequenceReader): """ Reader for FASTQ files. Does not support multi-line FASTQ files. """ def __init__(self, file, sequence_class=Sequence): # TODO could be a class attribute """ file is a path or a file-like object. compressed files are supported. The sequence_class should be a class such as Sequence or ColorspaceSequence. """ super(FastqReader, self).__init__(file) self.sequence_class = sequence_class self.delivers_qualities = True def __iter__(self): """ Return tuples: (name, sequence, qualities). qualities is a string and it contains the unmodified, encoded qualities. """ i = 3 for i, line in enumerate(self._file): if i % 4 == 0: if not line.startswith('@'): raise FormatError("Line {0} in FASTQ file is expected to start with '@', " "but found {1!r}".format(i+1, line[:10])) name = line.strip()[1:] elif i % 4 == 1: sequence = line.strip() elif i % 4 == 2: line = line.strip() if not line.startswith('+'): raise FormatError("Line {0} in FASTQ file is expected to start with '+', " "but found {1!r}".format(i+1, line[:10])) if len(line) > 1: if line[1:] != name: raise FormatError( "At line {0}: Sequence descriptions in the FASTQ file do not match " "({1!r} != {2!r}).\n" "The second sequence description must be either empty " "or equal to the first description.".format( i+1, name, line[1:].rstrip())) second_header = True else: second_header = False elif i % 4 == 3: qualities = line.rstrip('\n\r') yield self.sequence_class(name, sequence, qualities, second_header=second_header) if i % 4 != 3: raise FormatError("FASTQ file ended prematurely") try: from ._seqio import FastqReader except ImportError: pass class ColorspaceFastqReader(FastqReader): def __init__(self, file): super(ColorspaceFastqReader, self).__init__(file, sequence_class=ColorspaceSequence) class SRAColorspaceFastqReader(FastqReader): def __init__(self, file): super(SRAColorspaceFastqReader, self).__init__(file, sequence_class=sra_colorspace_sequence) class FastaQualReader(object): """ Reader for reads that are stored in .(CS)FASTA and .QUAL files. """ delivers_qualities = True paired = False def __init__(self, fastafile, qualfile, sequence_class=Sequence): """ fastafile and qualfile are filenames or file-like objects. If a filename is used, then .gz files are recognized. The objects returned when iteritng over this file are instances of the given sequence_class. """ self.fastareader = FastaReader(fastafile) self.qualreader = FastaReader(qualfile, keep_linebreaks=True) self.sequence_class = sequence_class def __iter__(self): """ Yield Sequence objects. """ # conversion dictionary: maps strings to the appropriate ASCII-encoded character conv = dict() for i in range(-5, 256 - 33): conv[str(i)] = chr(i + 33) for fastaread, qualread in zip(self.fastareader, self.qualreader): if fastaread.name != qualread.name: raise FormatError("The read names in the FASTA and QUAL file " "do not match ({0!r} != {1!r})".format(fastaread.name, qualread.name)) try: qualities = ''.join([conv[value] for value in qualread.sequence.split()]) except KeyError as e: raise FormatError("Within read named {0!r}: Found invalid quality " "value {1}".format(fastaread.name, e)) assert fastaread.name == qualread.name yield self.sequence_class(fastaread.name, fastaread.sequence, qualities) def close(self): self.fastareader.close() self.qualreader.close() def __enter__(self): return self def __exit__(self, *args): self.close() class ColorspaceFastaQualReader(FastaQualReader): def __init__(self, fastafile, qualfile): super(ColorspaceFastaQualReader, self).__init__(fastafile, qualfile, sequence_class=ColorspaceSequence) def sequence_names_match(r1, r2): """ Check whether the sequences r1 and r2 have identical names, ignoring a suffix of '1' or '2'. Some old paired-end reads have names that end in '/1' and '/2'. Also, the fastq-dump tool (used for converting SRA files to FASTQ) appends a .1 and .2 to paired-end reads if option -I is used. """ name1 = r1.name.split(None, 1)[0] name2 = r2.name.split(None, 1)[0] if name1[-1:] in '12' and name2[-1:] in '12': name1 = name1[:-1] name2 = name2[:-1] return name1 == name2 class PairedSequenceReader(object): """ Read paired-end reads from two files. Wraps two SequenceReader instances, making sure that reads are properly paired. """ paired = True def __init__(self, file1, file2, colorspace=False, fileformat=None): self.reader1 = open(file1, colorspace=colorspace, fileformat=fileformat) self.reader2 = open(file2, colorspace=colorspace, fileformat=fileformat) self.delivers_qualities = self.reader1.delivers_qualities def __iter__(self): """ Iterate over the paired reads. Each item is a pair of Sequence objects. """ # Avoid usage of zip() below since it will consume one item too many. it1, it2 = iter(self.reader1), iter(self.reader2) while True: try: r1 = next(it1) except StopIteration: # End of file 1. Make sure that file 2 is also at end. try: next(it2) raise FormatError("Reads are improperly paired. There are more reads in " "file 2 than in file 1.") except StopIteration: pass break try: r2 = next(it2) except StopIteration: raise FormatError("Reads are improperly paired. There are more reads in " "file 1 than in file 2.") if not sequence_names_match(r1, r2): raise FormatError("Reads are improperly paired. Read name '{0}' " "in file 1 does not match '{1}' in file 2.".format(r1.name, r2.name)) yield (r1, r2) def close(self): self.reader1.close() self.reader2.close() def __enter__(self): return self def __exit__(self, *args): self.close() class InterleavedSequenceReader(object): """ Read paired-end reads from an interleaved FASTQ file. """ paired = True def __init__(self, file, colorspace=False, fileformat=None): self.reader = open(file, colorspace=colorspace, fileformat=fileformat) self.delivers_qualities = self.reader.delivers_qualities def __iter__(self): # Avoid usage of zip() below since it will consume one item too many. it = iter(self.reader) for r1 in it: try: r2 = next(it) except StopIteration: raise FormatError("Interleaved input file incomplete: Last record " "{!r} has no partner.".format(r1.name)) if not sequence_names_match(r1, r2): raise FormatError("Reads are improperly paired. Name {0!r} " "(first) does not match {1!r} (second).".format(r1.name, r2.name)) yield (r1, r2) def close(self): self.reader.close() def __enter__(self): return self def __exit__(self, *args): self.close() class FileWriter(object): def __init__(self, file): if isinstance(file, str): self._file = xopen(file, 'w') self._close_on_exit = True else: self._file = file self._close_on_exit = False def close(self): if self._close_on_exit: self._file.close() def __enter__(self): if self._file.closed: raise ValueError("I/O operation on closed file") return self def __exit__(self, *args): self.close() class SingleRecordWriter(object): """Public interface to single-record files""" def write(self, record): raise NotImplementedError() class FastaWriter(FileWriter, SingleRecordWriter): """ Write FASTA-formatted sequences to a file. """ def __init__(self, file, line_length=None): """ If line_length is not None, the lines will be wrapped after line_length characters. """ FileWriter.__init__(self, file) self.line_length = line_length if line_length != 0 else None def write(self, name_or_seq, sequence=None): """Write an entry to the the FASTA file. If only one parameter (name_or_seq) is given, it must have attributes .name and .sequence, which are then used. Otherwise, the first parameter must be the name and the second the sequence. The effect is that you can write this: writer.write("name", "ACCAT") or writer.write(Sequence("name", "ACCAT")) """ if sequence is None: name = name_or_seq.name sequence = name_or_seq.sequence else: name = name_or_seq if self.line_length is not None: print('>{0}'.format(name), file=self._file) for i in range(0, len(sequence), self.line_length): print(sequence[i:i+self.line_length], file=self._file) if len(sequence) == 0: print(file=self._file) else: print('>{0}'.format(name), sequence, file=self._file, sep='\n') class ColorspaceFastaWriter(FastaWriter): def write(self, record): name = record.name sequence = record.primer + record.sequence super(ColorspaceFastaWriter, self).write(name, sequence) class FastqWriter(FileWriter, SingleRecordWriter): """ Write sequences with qualities in FASTQ format. FASTQ files are formatted like this: @read name SEQUENCE + QUALITIS """ def write(self, record): """ Write a Sequence record to the the FASTQ file. The record must have attributes .name, .sequence and .qualities. """ name2 = record.name if record.second_header else '' s = ('@' + record.name + '\n' + record.sequence + '\n+' + name2 + '\n' + record.qualities + '\n') self._file.write(s) def writeseq(self, name, sequence, qualities): print("@{0:s}\n{1:s}\n+\n{2:s}".format( name, sequence, qualities), file=self._file) class ColorspaceFastqWriter(FastqWriter): def write(self, record): name = record.name sequence = record.primer + record.sequence qualities = record.qualities super(ColorspaceFastqWriter, self).writeseq(name, sequence, qualities) class PairRecordWriter(object): """Public interface to paired-record files""" def write(self, read1, read2): raise NotImplementedError() def close(self): raise NotImplementedError() def __enter__(self): # TODO do not allow this twice return self def __exit__(self, *args): self.close() class PairedSequenceWriter(PairRecordWriter): def __init__(self, file1, file2, colorspace=False, fileformat='fastq', qualities=None): self._writer1 = open(file1, colorspace=colorspace, fileformat=fileformat, mode='w', qualities=qualities) self._writer2 = open(file2, colorspace=colorspace, fileformat=fileformat, mode='w', qualities=qualities) def write(self, read1, read2): self._writer1.write(read1) self._writer2.write(read2) def close(self): self._writer1.close() self._writer2.close() class InterleavedSequenceWriter(PairRecordWriter): """ Write paired-end reads to an interleaved FASTA or FASTQ file """ def __init__(self, file, colorspace=False, fileformat='fastq', qualities=None): self._writer = open( file, colorspace=colorspace, fileformat=fileformat, mode='w', qualities=qualities) def write(self, read1, read2): self._writer.write(read1) self._writer.write(read2) def close(self): self._writer.close() class UnknownFileType(Exception): """ Raised when open could not autodetect the file type. """ # TODO rename def open(file1, file2=None, qualfile=None, colorspace=False, fileformat=None, interleaved=False, mode='r', qualities=None): """ Open sequence files in FASTA or FASTQ format for reading or writing. This is a factory that returns an instance of one of the ...Reader or ...Writer classes also defined in this module. file1, file2, qualfile -- Paths to regular or compressed files or file-like objects. Use file1 if data is single-end. If also file2 is provided, sequences are paired. If qualfile is given, then file1 must be a FASTA file and sequences are single-end. One of file2 and qualfile must always be None (no paired-end data is supported when reading qualfiles). mode -- Either 'r' for reading or 'w' for writing. interleaved -- If True, then file1 contains interleaved paired-end data. file2 and qualfile must be None in this case. colorspace -- If True, instances of the Colorspace... classes are returned. fileformat -- If set to None, file format is autodetected from the file name extension. Set to 'fasta', 'fastq', or 'sra-fastq' to not auto-detect. Colorspace is not auto-detected and must always be requested explicitly. qualities -- When mode is 'w' and fileformat is None, this can be set to True or False to specify whether the written sequences will have quality values. This is is used in two ways: * If the output format cannot be determined (unrecognized extension etc), no exception is raised, but fasta or fastq format is chosen appropriately. * When False (no qualities available), an exception is raised when the auto-detected output format is FASTQ. """ if mode not in ('r', 'w'): raise ValueError("Mode must be 'r' or 'w'") if interleaved and (file2 is not None or qualfile is not None): raise ValueError("When interleaved is set, file2 and qualfile must be None") if file2 is not None and qualfile is not None: raise ValueError("Setting both file2 and qualfile is not supported") if file2 is not None: if mode == 'r': return PairedSequenceReader(file1, file2, colorspace, fileformat) else: return PairedSequenceWriter(file1, file2, colorspace, fileformat, qualities) if interleaved: if mode == 'r': return InterleavedSequenceReader(file1, colorspace, fileformat) else: return InterleavedSequenceWriter(file1, colorspace, fileformat, qualities) if qualfile is not None: if mode == 'w': raise NotImplementedError('Writing to csfasta/qual not supported') if colorspace: # read from .(CS)FASTA/.QUAL return ColorspaceFastaQualReader(file1, qualfile) else: return FastaQualReader(file1, qualfile) # All the multi-file things have been dealt with, delegate rest to the # single-file function. return _seqopen1(file1, colorspace=colorspace, fileformat=fileformat, mode=mode, qualities=qualities) def _detect_format_from_name(name): """ name -- file name Return 'fasta', 'fastq' or None if the format could not be detected. """ name = name.lower() for ext in ('.gz', '.xz', '.bz2'): if name.endswith(ext): name = name[:-len(ext)] break name, ext = splitext(name) if ext in ['.fasta', '.fa', '.fna', '.csfasta', '.csfa']: return 'fasta' elif ext in ['.fastq', '.fq'] or (ext == '.txt' and name.endswith('_sequence')): return 'fastq' return None def _seqopen1(file, colorspace=False, fileformat=None, mode='r', qualities=None): """ Open a single sequence file. See description above. """ if mode == 'r': fastq_handler = ColorspaceFastqReader if colorspace else FastqReader fasta_handler = ColorspaceFastaReader if colorspace else FastaReader elif mode == 'w': fastq_handler = ColorspaceFastqWriter if colorspace else FastqWriter fasta_handler = ColorspaceFastaWriter if colorspace else FastaWriter else: raise ValueError("Mode must be 'r' or 'w'") if fileformat: # Explict file format given fileformat = fileformat.lower() if fileformat == 'fasta': return fasta_handler(file) elif fileformat == 'fastq': return fastq_handler(file) elif fileformat == 'sra-fastq' and colorspace: if mode == 'w': raise NotImplementedError('Writing to sra-fastq not supported') return SRAColorspaceFastqReader(file) else: raise UnknownFileType("File format {0!r} is unknown (expected " "'sra-fastq' (only for colorspace), 'fasta' or 'fastq').".format(fileformat)) # Detect file format name = None if file == "-": file = sys.stdin if mode == 'r' else sys.stdout elif isinstance(file, basestring): name = file elif hasattr(file, "name"): # seems to be an open file-like object name = file.name format = _detect_format_from_name(name) if name else None if format is None and mode == 'w' and qualities is not None: # Format not recognized, but we know whether to use a format with or without qualities format = 'fastq' if qualities else 'fasta' if mode == 'r' and format is None: # No format detected so far. Try to read from the file. if hasattr(file, 'peek'): first_char = file.peek(1) new_file = file else: first_line = file.readline() first_char = first_line[0:1] new_file = FileWithPrependedLine(file, first_line) if first_char == '#': # A comment char - only valid for some FASTA variants (csfasta) format = 'fasta' elif first_char == '>': format = 'fasta' elif first_char == '@': format = 'fastq' elif first_char == '': # Empty input. Pretend this is FASTQ format = 'fastq' else: raise UnknownFileType( 'Could not determine whether file {!r} is FASTA or FASTQ. The file extension was ' 'not available or not recognized and the first character in the file ({!r}) is ' 'unexpected.'.format(file, first_char)) file = new_file if format is None: assert mode == 'w' raise UnknownFileType('Cannot determine whether to write in FASTA or FASTQ format') if format == 'fastq' and mode == 'w' and qualities is False: raise ValueError( 'Output format cannot be FASTQ since no quality values are available.') return fastq_handler(file) if format == 'fastq' else fasta_handler(file) def find_fasta_record_end(buf, end): """ Search for the end of the last complete FASTA record within buf[:end] """ pos = buf.rfind(b'\n>', 0, end) if pos != -1: return pos + 1 if buf[0:1] == b'>': return 0 raise FormatError('FASTA does not start with ">"') def find_fastq_record_end(buf, end=None): """ Search for the end of the last complete *two* FASTQ records in buf[:end]. Two FASTQ records are required to ensure that read pairs in interleaved paired-end data are not split. """ linebreaks = buf.count(b'\n', 0, end) right = end for _ in range(linebreaks % 8 + 1): right = buf.rfind(b'\n', 0, right) # Note that this works even if linebreaks == 0: # rfind() returns -1 and adding 1 gives index 0, # which is correct. return right + 1 def read_chunks_from_file(f, buffer_size=4*1024**2): """ Read a chunk of complete FASTA or FASTQ records from a file. The size of a chunk is at most buffer_size. f needs to be a file opened in binary mode. The yielded memoryview objects become invalid on the next iteration. """ # This buffer is re-used in each iteration. buf = bytearray(buffer_size) # Read one byte to determine file format. # If there is a comment char, we assume FASTA! start = f.readinto(memoryview(buf)[0:1]) if start == 1 and buf[0:1] == b'@': find_record_end = find_fastq_record_end elif start == 1 and buf[0:1] == b'#' or buf[0:1] == b'>': find_record_end = find_fasta_record_end elif start > 0: raise UnknownFileType('Input file format unknown') # Layout of buf # # |-- complete records --| # +---+------------------+---------+-------+ # | | | | | # +---+------------------+---------+-------+ # ^ ^ ^ ^ ^ # 0 start end bufend len(buf) # # buf[0:start] is the 'leftover' data that could not be processed # in the previous iteration because it contained an incomplete # FASTA or FASTQ record. while True: if start == len(buf): raise OverflowError('FASTA/FASTQ record does not fit into buffer') bufend = f.readinto(memoryview(buf)[start:]) + start if start == bufend: # End of file break end = find_record_end(buf, bufend) assert end <= bufend if end > 0: yield memoryview(buf)[0:end] start = bufend - end assert start >= 0 buf[0:start] = buf[end:bufend] if start > 0: yield memoryview(buf)[0:start] def read_paired_chunks(f, f2, buffer_size=4*1024**2): buf1 = bytearray(buffer_size) buf2 = bytearray(buffer_size) # Read one byte to make sure are processing FASTQ start1 = f.readinto(memoryview(buf1)[0:1]) start2 = f2.readinto(memoryview(buf2)[0:1]) if (start1 == 1 and buf1[0:1] != b'@') or (start2 == 1 and buf2[0:1] != b'@'): raise FormatError('Paired-end data must be in FASTQ format when using multiple cores') while True: bufend1 = f.readinto(memoryview(buf1)[start1:]) + start1 if start1 == bufend1: break bufend2 = f2.readinto(memoryview(buf2)[start2:]) + start2 if start2 == bufend2: break end1, end2 = two_fastq_heads(buf1, buf2, bufend1, bufend2) assert end1 <= bufend1 assert end2 <= bufend2 if end1 > 0 or end2 > 0: yield (memoryview(buf1)[0:end1], memoryview(buf2)[0:end2]) start1 = bufend1 - end1 assert start1 >= 0 buf1[0:start1] = buf1[end1:bufend1] start2 = bufend2 - end2 assert start2 >= 0 buf2[0:start2] = buf2[end2:bufend2] if start1 > 0 or start2 > 0: yield (memoryview(buf1)[0:start1], memoryview(buf2)[0:start2]) from ._seqio import head, fastq_head, two_fastq_heads # re-exported cutadapt-1.15/src/cutadapt/_align.c0000664000175000017500000134737713205526771020026 0ustar marcelmarcel00000000000000/* Generated by Cython 0.24 */ /* BEGIN: Cython Metadata { "distutils": { "depends": [] } } END: Cython Metadata */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) #error Cython requires Python 2.6+ or Python 3.2+. #else #define CYTHON_ABI "0_24" #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif #if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000 #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #undef SHIFT #undef BASE #undef MASK #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) #define Py_OptimizeFlag 0 #endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyType_Type #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 #endif #ifndef Py_TPFLAGS_HAVE_INDEX #define Py_TPFLAGS_HAVE_INDEX 0 #endif #ifndef Py_TPFLAGS_HAVE_NEWBUFFER #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) #else #define CYTHON_PEP393_ENABLED 0 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) #else #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) #else #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) #endif #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) #define PyObject_ASCII(o) PyObject_Repr(o) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) #else #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY #ifndef PyUnicode_InternFromString #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) #endif #endif #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) #elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 typedef struct { unaryfunc am_await; unaryfunc am_aiter; unaryfunc am_anext; } __Pyx_PyAsyncMethodsStruct; #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) #else #define __Pyx_PyType_AsAsync(obj) NULL #endif #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict #else #define CYTHON_RESTRICT #endif #endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #ifdef NAN #define __PYX_NAN() ((float) NAN) #else static CYTHON_INLINE float __PYX_NAN() { float value; memset(&value, 0xFF, sizeof(value)); return value; } #endif #define __PYX_ERR(f_index, lineno, Ln_error) \ { \ __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ } #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #define __PYX_HAVE__cutadapt___align #define __PYX_HAVE_API__cutadapt___align #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED # else # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 #define __PYX_DEFAULT_STRING_ENCODING "" #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #define __Pyx_uchar_cast(c) ((unsigned char)c) #define __Pyx_long_cast(x) ((long)x) #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ (sizeof(type) < sizeof(Py_ssize_t)) ||\ (sizeof(type) > sizeof(Py_ssize_t) &&\ likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX) &&\ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ v == (type)PY_SSIZE_T_MIN))) ||\ (sizeof(type) == sizeof(Py_ssize_t) &&\ (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX))) ) #if defined (__cplusplus) && __cplusplus >= 201103L #include #define __Pyx_sst_abs(value) std::abs(value) #elif SIZEOF_INT >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) abs(value) #elif SIZEOF_LONG >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) labs(value) #elif defined (_MSC_VER) && defined (_M_X64) #define __Pyx_sst_abs(value) _abs64(value) #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define __Pyx_sst_abs(value) llabs(value) #elif defined (__GNUC__) #define __Pyx_sst_abs(value) __builtin_llabs(value) #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) #define __Pyx_PyBytes_FromString PyBytes_FromString #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #if PY_MAJOR_VERSION < 3 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #else #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif #define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) #if PY_MAJOR_VERSION < 3 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } #else #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen #endif #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); #if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; PyObject* default_encoding = NULL; PyObject* ascii_chars_u = NULL; PyObject* ascii_chars_b = NULL; const char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; if (strcmp(default_encoding_c, "ascii") == 0) { __Pyx_sys_getdefaultencoding_not_ascii = 0; } else { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { ascii_chars[c] = c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); if (!ascii_chars_u) goto bad; ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { PyErr_Format( PyExc_ValueError, "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", default_encoding_c); goto bad; } Py_DECREF(ascii_chars_u); Py_DECREF(ascii_chars_b); } Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(default_encoding); Py_XDECREF(ascii_chars_u); Py_XDECREF(ascii_chars_b); return -1; } #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) #else #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT static char* __PYX_DEFAULT_STRING_ENCODING; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; PyObject* default_encoding = NULL; char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(default_encoding); return -1; } #endif #endif /* Test for GCC > 2.95 */ #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* !__GNUC__ or GCC < 2.95 */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_d; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static PyObject *__pyx_empty_unicode; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; static const char *__pyx_f[] = { "src/cutadapt/_align.pyx", }; /*--- Type declarations ---*/ struct __pyx_obj_8cutadapt_6_align_Aligner; struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__; struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_1_genexpr; struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_2_genexpr; struct __pyx_t_8cutadapt_6_align__Entry; typedef struct __pyx_t_8cutadapt_6_align__Entry __pyx_t_8cutadapt_6_align__Entry; struct __pyx_t_8cutadapt_6_align__Match; typedef struct __pyx_t_8cutadapt_6_align__Match __pyx_t_8cutadapt_6_align__Match; struct __pyx_t_8cutadapt_6_align__Entry { int cost; int matches; int origin; }; struct __pyx_t_8cutadapt_6_align__Match { int origin; int cost; int matches; int ref_stop; int query_stop; }; struct __pyx_obj_8cutadapt_6_align_Aligner { PyObject_HEAD int m; __pyx_t_8cutadapt_6_align__Entry *column; double max_error_rate; int flags; int _insertion_cost; int _deletion_cost; int _min_overlap; int wildcard_ref; int wildcard_query; int debug; PyObject *_dpmatrix; PyObject *_reference; PyObject *str_reference; }; struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__ { PyObject_HEAD PyObject *__pyx_v_row; PyObject *__pyx_v_self; }; struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_1_genexpr { PyObject_HEAD struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__ *__pyx_outer_scope; PyObject *__pyx_v_c; PyObject *__pyx_t_0; Py_ssize_t __pyx_t_1; PyObject *(*__pyx_t_2)(PyObject *); }; struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_2_genexpr { PyObject_HEAD struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__ *__pyx_outer_scope; PyObject *__pyx_v_v; PyObject *__pyx_t_0; Py_ssize_t __pyx_t_1; PyObject *(*__pyx_t_2)(PyObject *); }; /* --- Runtime support code (head) --- */ /* Refnanny.proto */ #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ } while (0) #define __Pyx_DECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_DECREF(tmp);\ } while (0) #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) /* PyObjectGetAttrStr.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_getattro)) return tp->tp_getattro(obj, attr_name); #if PY_MAJOR_VERSION < 3 if (likely(tp->tp_getattr)) return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); #endif return PyObject_GetAttr(obj, attr_name); } #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); /* PyObjectCall.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); #else #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif /* py_dict_items.proto */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d); /* UnpackUnboundCMethod.proto */ typedef struct { PyObject *type; PyObject **method_name; PyCFunction func; PyObject *method; int flag; } __Pyx_CachedCFunction; /* CallUnboundCMethod0.proto */ static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self); #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_CallUnboundCMethod0(cfunc, self)\ ((likely((cfunc)->func)) ?\ (likely((cfunc)->flag == METH_NOARGS) ? (*((cfunc)->func))(self, NULL) :\ (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ? ((*(PyCFunctionWithKeywords)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\ ((cfunc)->flag == METH_VARARGS ? (*((cfunc)->func))(self, __pyx_empty_tuple) : __Pyx__CallUnboundCMethod0(cfunc, self)))) :\ __Pyx__CallUnboundCMethod0(cfunc, self)) #else #define __Pyx_CallUnboundCMethod0(cfunc, self) __Pyx__CallUnboundCMethod0(cfunc, self) #endif /* RaiseTooManyValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); /* RaiseNeedMoreValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); /* IterFinish.proto */ static CYTHON_INLINE int __Pyx_IterFinish(void); /* UnpackItemEndCheck.proto */ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /* UnicodeAsUCS4.proto */ static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject*); /* object_ord.proto */ #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyObject_Ord(c)\ (likely(PyUnicode_Check(c)) ? (long)__Pyx_PyUnicode_AsPy_UCS4(c) : __Pyx__PyObject_Ord(c)) #else #define __Pyx_PyObject_Ord(c) __Pyx__PyObject_Ord(c) #endif static long __Pyx__PyObject_Ord(PyObject* c); /* SetItemIntByteArray.proto */ #define __Pyx_SetItemInt_ByteArray(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_SetItemInt_ByteArray_Fast(o, (Py_ssize_t)i, v, wraparound, boundscheck) :\ (PyErr_SetString(PyExc_IndexError, "bytearray index out of range"), -1)) static CYTHON_INLINE int __Pyx_SetItemInt_ByteArray_Fast(PyObject* string, Py_ssize_t i, unsigned char v, int wraparound, int boundscheck); /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif /* PyObjectCallOneArg.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); /* PyObjectCallNoArg.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); #else #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) #endif /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /* RaiseDoubleKeywords.proto */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /* ParseKeywords.proto */ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); /* PyIntBinop.proto */ #if CYTHON_COMPILING_IN_CPYTHON static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace); #else #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\ (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) #endif /* ListCompAppend.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { PyListObject* L = (PyListObject*) list; Py_ssize_t len = Py_SIZE(list); if (likely(L->allocated > len)) { Py_INCREF(x); PyList_SET_ITEM(list, len, x); Py_SIZE(list) = len+1; return 0; } return PyList_Append(list, x); } #else #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) #endif /* PyObjectSetAttrStr.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_setattro)) return tp->tp_setattro(obj, attr_name, value); #if PY_MAJOR_VERSION < 3 if (likely(tp->tp_setattr)) return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); #endif return PyObject_SetAttr(obj, attr_name, value); } #else #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) #endif /* GetItemInt.proto */ #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ __Pyx_GetItemInt_Generic(o, to_py_func(i)))) #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); /* SetItemInt.proto */ #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, int wraparound, int boundscheck); /* None.proto */ static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname); /* StringJoin.proto */ #if PY_MAJOR_VERSION < 3 #define __Pyx_PyString_Join __Pyx_PyBytes_Join #define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v)) #else #define __Pyx_PyString_Join PyUnicode_Join #define __Pyx_PyBaseString_Join PyUnicode_Join #endif #if CYTHON_COMPILING_IN_CPYTHON #if PY_MAJOR_VERSION < 3 #define __Pyx_PyBytes_Join _PyString_Join #else #define __Pyx_PyBytes_Join _PyBytes_Join #endif #else static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values); #endif /* ListAppend.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { PyListObject* L = (PyListObject*) list; Py_ssize_t len = Py_SIZE(list); if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { Py_INCREF(x); PyList_SET_ITEM(list, len, x); Py_SIZE(list) = len+1; return 0; } return PyList_Append(list, x); } #else #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif /* ArgTypeTest.proto */ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /* PyThreadStateGet.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign #endif /* PyErrFetchRestore.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /* GetModuleGlobalName.proto */ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /* ForceInitThreads.proto */ #ifndef __PYX_FORCE_INIT_THREADS #define __PYX_FORCE_INIT_THREADS 0 #endif /* IncludeStringH.proto */ #include /* FetchCommonType.proto */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); /* CythonFunction.proto */ #define __Pyx_CyFunction_USED 1 #include #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 #define __Pyx_CYFUNCTION_CCLASS 0x04 #define __Pyx_CyFunction_GetClosure(f)\ (((__pyx_CyFunctionObject *) (f))->func_closure) #define __Pyx_CyFunction_GetClassObj(f)\ (((__pyx_CyFunctionObject *) (f))->func_classobj) #define __Pyx_CyFunction_Defaults(type, f)\ ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) typedef struct { PyCFunctionObject func; #if PY_VERSION_HEX < 0x030500A0 PyObject *func_weakreflist; #endif PyObject *func_dict; PyObject *func_name; PyObject *func_qualname; PyObject *func_doc; PyObject *func_globals; PyObject *func_code; PyObject *func_closure; PyObject *func_classobj; void *defaults; int defaults_pyobjects; int flags; PyObject *defaults_tuple; PyObject *defaults_kwdict; PyObject *(*defaults_getter)(PyObject *); PyObject *func_annotations; } __pyx_CyFunctionObject; static PyTypeObject *__pyx_CyFunctionType = 0; #define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\ __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code) static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *self, PyObject *module, PyObject *globals, PyObject* code); static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, size_t size, int pyobjects); static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, PyObject *tuple); static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, PyObject *dict); static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, PyObject *dict); static int __pyx_CyFunction_init(void); /* CalculateMetaclass.proto */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); /* Py3ClassCreate.proto */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc); static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); /* CodeObjectCache.proto */ typedef struct { PyCodeObject* code_object; int code_line; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; }; static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE unsigned char __Pyx_PyInt_As_unsigned_char(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* SwapException.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); #endif /* PyObjectCallMethod1.proto */ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); /* CoroutineBase.proto */ typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyObject *); typedef struct { PyObject_HEAD __pyx_coroutine_body_t body; PyObject *closure; PyObject *exc_type; PyObject *exc_value; PyObject *exc_traceback; PyObject *gi_weakreflist; PyObject *classobj; PyObject *yieldfrom; PyObject *gi_name; PyObject *gi_qualname; int resume_label; char is_running; } __pyx_CoroutineObject; static __pyx_CoroutineObject *__Pyx__Coroutine_New(PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *closure, PyObject *name, PyObject *qualname); static int __Pyx_Coroutine_clear(PyObject *self); #if 1 || PY_VERSION_HEX < 0x030300B0 static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue); #else #define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue) #endif /* PatchModuleWithCoroutine.proto */ static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code); /* PatchGeneratorABC.proto */ static int __Pyx_patch_abc(void); /* Generator.proto */ #define __Pyx_Generator_USED static PyTypeObject *__pyx_GeneratorType = 0; #define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType) #define __Pyx_Generator_New(body, closure, name, qualname)\ __Pyx__Coroutine_New(__pyx_GeneratorType, body, closure, name, qualname) static PyObject *__Pyx_Generator_Next(PyObject *self); static int __pyx_Generator_init(void); /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'cpython.mem' */ /* Module declarations from 'cutadapt._align' */ static PyTypeObject *__pyx_ptype_8cutadapt_6_align_Aligner = 0; static PyTypeObject *__pyx_ptype_8cutadapt_6_align___pyx_scope_struct____str__ = 0; static PyTypeObject *__pyx_ptype_8cutadapt_6_align___pyx_scope_struct_1_genexpr = 0; static PyTypeObject *__pyx_ptype_8cutadapt_6_align___pyx_scope_struct_2_genexpr = 0; static PyObject *__pyx_v_8cutadapt_6_align_ACGT_TABLE = 0; static PyObject *__pyx_v_8cutadapt_6_align_IUPAC_TABLE = 0; #define __Pyx_MODULE_NAME "cutadapt._align" int __pyx_module_is_main_cutadapt___align = 0; /* Implementation of 'cutadapt._align' */ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_zip; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_MemoryError; static const char __pyx_k_[] = "\000"; static const char __pyx_k_A[] = "A"; static const char __pyx_k_B[] = "B"; static const char __pyx_k_C[] = "C"; static const char __pyx_k_D[] = "D"; static const char __pyx_k_G[] = "G"; static const char __pyx_k_H[] = "H"; static const char __pyx_k_K[] = "K"; static const char __pyx_k_M[] = "M"; static const char __pyx_k_N[] = "N"; static const char __pyx_k_R[] = "R"; static const char __pyx_k_S[] = "S"; static const char __pyx_k_T[] = "T"; static const char __pyx_k_U[] = "U"; static const char __pyx_k_V[] = "V"; static const char __pyx_k_W[] = "W"; static const char __pyx_k_X[] = "X"; static const char __pyx_k_Y[] = "Y"; static const char __pyx_k_c[] = "c"; static const char __pyx_k_d[] = "d"; static const char __pyx_k_i[] = "i"; static const char __pyx_k_j[] = "j"; static const char __pyx_k_m[] = "m"; static const char __pyx_k_n[] = "n"; static const char __pyx_k_r[] = "r"; static const char __pyx_k_t[] = "t"; static const char __pyx_k_v[] = "v"; static const char __pyx_k__5[] = " "; static const char __pyx_k__6[] = " "; static const char __pyx_k__7[] = " "; static const char __pyx_k__8[] = "\n"; static const char __pyx_k__19[] = "_"; static const char __pyx_k_doc[] = "__doc__"; static const char __pyx_k_ref[] = "ref"; static const char __pyx_k_row[] = "row"; static const char __pyx_k_str[] = "__str__"; static const char __pyx_k_zip[] = "zip"; static const char __pyx_k_0_2d[] = "{0:2d}"; static const char __pyx_k_args[] = "args"; static const char __pyx_k_cost[] = "cost"; static const char __pyx_k_init[] = "__init__"; static const char __pyx_k_join[] = "join"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_rows[] = "_rows"; static const char __pyx_k_self[] = "self"; static const char __pyx_k_send[] = "send"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_ascii[] = "ascii"; static const char __pyx_k_close[] = "close"; static const char __pyx_k_flags[] = "flags"; static const char __pyx_k_items[] = "items"; static const char __pyx_k_iupac[] = "iupac"; static const char __pyx_k_lower[] = "lower"; static const char __pyx_k_q_ptr[] = "q_ptr"; static const char __pyx_k_query[] = "query"; static const char __pyx_k_r_ptr[] = "r_ptr"; static const char __pyx_k_range[] = "range"; static const char __pyx_k_rjust[] = "rjust"; static const char __pyx_k_throw[] = "throw"; static const char __pyx_k_encode[] = "encode"; static const char __pyx_k_format[] = "format"; static const char __pyx_k_length[] = "length"; static const char __pyx_k_locate[] = "locate"; static const char __pyx_k_module[] = "__module__"; static const char __pyx_k_rows_2[] = "rows"; static const char __pyx_k_aligner[] = "aligner"; static const char __pyx_k_genexpr[] = "genexpr"; static const char __pyx_k_matches[] = "matches"; static const char __pyx_k_prepare[] = "__prepare__"; static const char __pyx_k_DPMatrix[] = "DPMatrix"; static const char __pyx_k_qualname[] = "__qualname__"; static const char __pyx_k_metaclass[] = "__metaclass__"; static const char __pyx_k_ref_bytes[] = "ref_bytes"; static const char __pyx_k_reference[] = "reference"; static const char __pyx_k_set_entry[] = "set_entry"; static const char __pyx_k_translate[] = "translate"; static const char __pyx_k_ValueError[] = "ValueError"; static const char __pyx_k_acgt_table[] = "_acgt_table"; static const char __pyx_k_MemoryError[] = "MemoryError"; static const char __pyx_k_iupac_table[] = "_iupac_table"; static const char __pyx_k_min_overlap[] = "min_overlap"; static const char __pyx_k_query_bytes[] = "query_bytes"; static const char __pyx_k_wildcard_ref[] = "wildcard_ref"; static const char __pyx_k_compare_ascii[] = "compare_ascii"; static const char __pyx_k_DPMatrix___str[] = "DPMatrix.__str__"; static const char __pyx_k_max_error_rate[] = "max_error_rate"; static const char __pyx_k_wildcard_query[] = "wildcard_query"; static const char __pyx_k_DPMatrix___init[] = "DPMatrix.__init__"; static const char __pyx_k_cutadapt__align[] = "cutadapt._align"; static const char __pyx_k_compare_prefixes[] = "compare_prefixes"; static const char __pyx_k_STOP_WITHIN_QUERY[] = "STOP_WITHIN_QUERY"; static const char __pyx_k_DPMatrix_set_entry[] = "DPMatrix.set_entry"; static const char __pyx_k_START_WITHIN_QUERY[] = "START_WITHIN_QUERY"; static const char __pyx_k_STOP_WITHIN_REFERENCE[] = "STOP_WITHIN_REFERENCE"; static const char __pyx_k_START_WITHIN_REFERENCE[] = "START_WITHIN_REFERENCE"; static const char __pyx_k_DPMatrix___str___locals_genexpr[] = "DPMatrix.__str__..genexpr"; static const char __pyx_k_Insertion_deletion_cost_must_be[] = "Insertion/deletion cost must be at leat 1"; static const char __pyx_k_Representation_of_the_dynamic_p[] = "\n\tRepresentation of the dynamic-programming matrix.\n\n\tThis used only when debugging is enabled in the Aligner class since the\n\tmatrix is normally not stored in full.\n\n\tEntries in the matrix may be None, in which case that value was not\n\tcomputed.\n\t"; static const char __pyx_k_home_marcel_scm_cutadapt_cutada[] = "/home/marcel/scm/cutadapt/cutadapt/src/cutadapt/_align.pyx"; static const char __pyx_k_Minimum_overlap_must_be_at_least[] = "Minimum overlap must be at least 1"; static PyObject *__pyx_kp_b_; static PyObject *__pyx_kp_s_0_2d; static PyObject *__pyx_n_s_A; static PyObject *__pyx_n_s_B; static PyObject *__pyx_n_s_C; static PyObject *__pyx_n_s_D; static PyObject *__pyx_n_s_DPMatrix; static PyObject *__pyx_n_s_DPMatrix___init; static PyObject *__pyx_n_s_DPMatrix___str; static PyObject *__pyx_n_s_DPMatrix___str___locals_genexpr; static PyObject *__pyx_n_s_DPMatrix_set_entry; static PyObject *__pyx_n_s_G; static PyObject *__pyx_n_s_H; static PyObject *__pyx_kp_s_Insertion_deletion_cost_must_be; static PyObject *__pyx_n_s_K; static PyObject *__pyx_n_s_M; static PyObject *__pyx_n_s_MemoryError; static PyObject *__pyx_kp_s_Minimum_overlap_must_be_at_least; static PyObject *__pyx_n_s_N; static PyObject *__pyx_n_s_R; static PyObject *__pyx_kp_s_Representation_of_the_dynamic_p; static PyObject *__pyx_n_s_S; static PyObject *__pyx_n_s_START_WITHIN_QUERY; static PyObject *__pyx_n_s_START_WITHIN_REFERENCE; static PyObject *__pyx_n_s_STOP_WITHIN_QUERY; static PyObject *__pyx_n_s_STOP_WITHIN_REFERENCE; static PyObject *__pyx_n_s_T; static PyObject *__pyx_n_s_U; static PyObject *__pyx_n_s_V; static PyObject *__pyx_n_s_ValueError; static PyObject *__pyx_n_s_W; static PyObject *__pyx_n_s_X; static PyObject *__pyx_n_s_Y; static PyObject *__pyx_n_s__19; static PyObject *__pyx_kp_s__5; static PyObject *__pyx_kp_s__6; static PyObject *__pyx_kp_s__7; static PyObject *__pyx_kp_s__8; static PyObject *__pyx_n_s_acgt_table; static PyObject *__pyx_n_s_aligner; static PyObject *__pyx_n_s_args; static PyObject *__pyx_n_s_ascii; static PyObject *__pyx_n_s_c; static PyObject *__pyx_n_s_close; static PyObject *__pyx_n_s_compare_ascii; static PyObject *__pyx_n_s_compare_prefixes; static PyObject *__pyx_n_s_cost; static PyObject *__pyx_n_s_cutadapt__align; static PyObject *__pyx_n_s_d; static PyObject *__pyx_n_s_doc; static PyObject *__pyx_n_s_encode; static PyObject *__pyx_n_s_flags; static PyObject *__pyx_n_s_format; static PyObject *__pyx_n_s_genexpr; static PyObject *__pyx_kp_s_home_marcel_scm_cutadapt_cutada; static PyObject *__pyx_n_s_i; static PyObject *__pyx_n_s_init; static PyObject *__pyx_n_s_items; static PyObject *__pyx_n_s_iupac; static PyObject *__pyx_n_s_iupac_table; static PyObject *__pyx_n_s_j; static PyObject *__pyx_n_s_join; static PyObject *__pyx_n_s_length; static PyObject *__pyx_n_s_locate; static PyObject *__pyx_n_s_lower; static PyObject *__pyx_n_s_m; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_matches; static PyObject *__pyx_n_s_max_error_rate; static PyObject *__pyx_n_s_metaclass; static PyObject *__pyx_n_s_min_overlap; static PyObject *__pyx_n_s_module; static PyObject *__pyx_n_s_n; static PyObject *__pyx_n_s_prepare; static PyObject *__pyx_n_s_q_ptr; static PyObject *__pyx_n_s_qualname; static PyObject *__pyx_n_s_query; static PyObject *__pyx_n_s_query_bytes; static PyObject *__pyx_n_s_r; static PyObject *__pyx_n_s_r_ptr; static PyObject *__pyx_n_s_range; static PyObject *__pyx_n_s_ref; static PyObject *__pyx_n_s_ref_bytes; static PyObject *__pyx_n_s_reference; static PyObject *__pyx_n_s_rjust; static PyObject *__pyx_n_s_row; static PyObject *__pyx_n_s_rows; static PyObject *__pyx_n_s_rows_2; static PyObject *__pyx_n_s_self; static PyObject *__pyx_n_s_send; static PyObject *__pyx_n_s_set_entry; static PyObject *__pyx_n_s_str; static PyObject *__pyx_n_s_t; static PyObject *__pyx_n_s_test; static PyObject *__pyx_n_s_throw; static PyObject *__pyx_n_s_translate; static PyObject *__pyx_n_s_v; static PyObject *__pyx_n_s_wildcard_query; static PyObject *__pyx_n_s_wildcard_ref; static PyObject *__pyx_n_s_zip; static PyObject *__pyx_pf_8cutadapt_6_align__acgt_table(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_align_2_iupac_table(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_align_8DPMatrix___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_query); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_align_8DPMatrix_2set_entry(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, PyObject *__pyx_v_cost); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_align_8DPMatrix_7__str___genexpr(PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_align_8DPMatrix_7__str___3genexpr(PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_align_8DPMatrix_4__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static int __pyx_pf_8cutadapt_6_align_7Aligner___cinit__(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self, PyObject *__pyx_v_reference, double __pyx_v_max_error_rate, int __pyx_v_flags, int __pyx_v_wildcard_ref, int __pyx_v_wildcard_query); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_align_7Aligner_11min_overlap___get__(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self); /* proto */ static int __pyx_pf_8cutadapt_6_align_7Aligner_11min_overlap_2__set__(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self, int __pyx_v_value); /* proto */ static int __pyx_pf_8cutadapt_6_align_7Aligner_10indel_cost___set__(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_align_7Aligner_9reference___get__(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self); /* proto */ static int __pyx_pf_8cutadapt_6_align_7Aligner_9reference_2__set__(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self, PyObject *__pyx_v_reference); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_align_7Aligner_8dpmatrix___get__(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_align_7Aligner_2enable_debug(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_align_7Aligner_4locate(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self, PyObject *__pyx_v_query); /* proto */ static void __pyx_pf_8cutadapt_6_align_7Aligner_6__dealloc__(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_align_4locate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_query, double __pyx_v_max_error_rate, int __pyx_v_flags, int __pyx_v_wildcard_ref, int __pyx_v_wildcard_query, int __pyx_v_min_overlap); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_align_6compare_prefixes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ref, PyObject *__pyx_v_query, int __pyx_v_wildcard_ref, int __pyx_v_wildcard_query); /* proto */ static PyObject *__pyx_tp_new_8cutadapt_6_align_Aligner(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_8cutadapt_6_align___pyx_scope_struct____str__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_8cutadapt_6_align___pyx_scope_struct_1_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_8cutadapt_6_align___pyx_scope_struct_2_genexpr(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_items = {0, &__pyx_n_s_items, 0, 0, 0}; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_2; static PyObject *__pyx_int_4; static PyObject *__pyx_int_8; static PyObject *__pyx_int_256; static PyObject *__pyx_tuple__2; static PyObject *__pyx_tuple__3; static PyObject *__pyx_tuple__4; static PyObject *__pyx_tuple__9; static PyObject *__pyx_tuple__10; static PyObject *__pyx_tuple__11; static PyObject *__pyx_tuple__12; static PyObject *__pyx_tuple__13; static PyObject *__pyx_tuple__14; static PyObject *__pyx_tuple__15; static PyObject *__pyx_tuple__17; static PyObject *__pyx_tuple__20; static PyObject *__pyx_tuple__22; static PyObject *__pyx_tuple__24; static PyObject *__pyx_tuple__26; static PyObject *__pyx_tuple__28; static PyObject *__pyx_codeobj__16; static PyObject *__pyx_codeobj__18; static PyObject *__pyx_codeobj__21; static PyObject *__pyx_codeobj__23; static PyObject *__pyx_codeobj__25; static PyObject *__pyx_codeobj__27; static PyObject *__pyx_codeobj__29; /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_align_1_acgt_table(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_8cutadapt_6_align__acgt_table[] = "\n\tReturn a translation table that maps A, C, G, T characters to the lower\n\tfour bits of a byte. Other characters (including possibly IUPAC characters)\n\tare mapped to zero.\n\n\tLowercase versions are also translated, and U is treated the same as T.\n\t"; static PyMethodDef __pyx_mdef_8cutadapt_6_align_1_acgt_table = {"_acgt_table", (PyCFunction)__pyx_pw_8cutadapt_6_align_1_acgt_table, METH_NOARGS, __pyx_doc_8cutadapt_6_align__acgt_table}; static PyObject *__pyx_pw_8cutadapt_6_align_1_acgt_table(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_acgt_table (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_align__acgt_table(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_align__acgt_table(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_v_d = NULL; PyObject *__pyx_v_t = NULL; PyObject *__pyx_v_c = NULL; PyObject *__pyx_v_v = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; Py_ssize_t __pyx_t_3; PyObject *(*__pyx_t_4)(PyObject *); PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *(*__pyx_t_8)(PyObject *); unsigned char __pyx_t_9; long __pyx_t_10; __Pyx_RefNannySetupContext("_acgt_table", 0); __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_A, __pyx_int_1) < 0) __PYX_ERR(0, 33, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_C, __pyx_int_2) < 0) __PYX_ERR(0, 33, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_G, __pyx_int_4) < 0) __PYX_ERR(0, 33, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_T, __pyx_int_8) < 0) __PYX_ERR(0, 33, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_U, __pyx_int_8) < 0) __PYX_ERR(0, 33, __pyx_L1_error) __pyx_v_d = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyByteArray_Type)), __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_int_256); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(PyByteArray_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytearray", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 34, __pyx_L1_error) __pyx_v_t = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyDict_Items(__pyx_v_d); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { if (likely(!__pyx_t_4)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 35, __pyx_L1_error) #else __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 35, __pyx_L1_error) #else __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } } else { __pyx_t_2 = __pyx_t_4(__pyx_t_1); if (unlikely(!__pyx_t_2)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 35, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_2); } if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 35, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_5 = PyList_GET_ITEM(sequence, 0); __pyx_t_6 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); #else __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_5); index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 35, __pyx_L1_error) __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 35, __pyx_L1_error) __pyx_L6_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6); __pyx_t_6 = 0; __pyx_t_9 = __Pyx_PyInt_As_unsigned_char(__pyx_v_v); if (unlikely((__pyx_t_9 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0, 36, __pyx_L1_error) __pyx_t_10 = __Pyx_PyObject_Ord(__pyx_v_c); if (unlikely(__pyx_t_10 == (long)(Py_UCS4)-1)) __PYX_ERR(0, 36, __pyx_L1_error) if (unlikely(__Pyx_SetItemInt_ByteArray(__pyx_v_t, __pyx_t_10, __pyx_t_9, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0)) __PYX_ERR(0, 36, __pyx_L1_error) __pyx_t_9 = __Pyx_PyInt_As_unsigned_char(__pyx_v_v); if (unlikely((__pyx_t_9 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0, 37, __pyx_L1_error) __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_c, __pyx_n_s_lower); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); } } if (__pyx_t_5) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_10 = __Pyx_PyObject_Ord(__pyx_t_2); if (unlikely(__pyx_t_10 == (long)(Py_UCS4)-1)) __PYX_ERR(0, 37, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__Pyx_SetItemInt_ByteArray(__pyx_v_t, __pyx_t_10, __pyx_t_9, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0)) __PYX_ERR(0, 37, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_t); __Pyx_GIVEREF(__pyx_v_t); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_t); __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyBytes_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("cutadapt._align._acgt_table", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_d); __Pyx_XDECREF(__pyx_v_t); __Pyx_XDECREF(__pyx_v_c); __Pyx_XDECREF(__pyx_v_v); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_align_3_iupac_table(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_8cutadapt_6_align_2_iupac_table[] = "\n\tReturn a translation table for IUPAC characters.\n\n\tThe table maps ASCII-encoded IUPAC nucleotide characters to bytes in which\n\tthe four least significant bits are used to represent one nucleotide each.\n\n\tWhether two characters x and y match can then be checked with the\n\texpression \"x & y != 0\".\n\t"; static PyMethodDef __pyx_mdef_8cutadapt_6_align_3_iupac_table = {"_iupac_table", (PyCFunction)__pyx_pw_8cutadapt_6_align_3_iupac_table, METH_NOARGS, __pyx_doc_8cutadapt_6_align_2_iupac_table}; static PyObject *__pyx_pw_8cutadapt_6_align_3_iupac_table(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_iupac_table (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_align_2_iupac_table(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_align_2_iupac_table(CYTHON_UNUSED PyObject *__pyx_self) { long __pyx_v_A; long __pyx_v_C; long __pyx_v_G; long __pyx_v_T; PyObject *__pyx_v_iupac = NULL; PyObject *__pyx_v_t = NULL; PyObject *__pyx_v_c = NULL; PyObject *__pyx_v_v = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; Py_ssize_t __pyx_t_3; PyObject *(*__pyx_t_4)(PyObject *); PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *(*__pyx_t_8)(PyObject *); unsigned char __pyx_t_9; long __pyx_t_10; __Pyx_RefNannySetupContext("_iupac_table", 0); __pyx_v_A = 1; __pyx_v_C = 2; __pyx_v_G = 4; __pyx_v_T = 8; __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_X, __pyx_int_0) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_A); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_A, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_C); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_C, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_G); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_G, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_T); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_T, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v_T); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_U, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_A | __pyx_v_G)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_R, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_C | __pyx_v_T)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_Y, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_G | __pyx_v_C)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_S, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_A | __pyx_v_T)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_W, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_G | __pyx_v_T)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_K, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_long((__pyx_v_A | __pyx_v_C)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_M, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_long(((__pyx_v_C | __pyx_v_G) | __pyx_v_T)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_B, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_long(((__pyx_v_A | __pyx_v_G) | __pyx_v_T)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_D, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_long(((__pyx_v_A | __pyx_v_C) | __pyx_v_T)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_H, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_long(((__pyx_v_A | __pyx_v_C) | __pyx_v_G)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 71, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_V, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_From_long((((__pyx_v_A | __pyx_v_C) | __pyx_v_G) | __pyx_v_T)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_N, __pyx_t_2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_iupac = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&PyByteArray_Type)), __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_int_256); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(PyByteArray_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytearray", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 74, __pyx_L1_error) __pyx_v_t = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyDict_Items(__pyx_v_iupac); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 75, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { if (likely(!__pyx_t_4)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 75, __pyx_L1_error) #else __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 75, __pyx_L1_error) #else __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } } else { __pyx_t_2 = __pyx_t_4(__pyx_t_1); if (unlikely(!__pyx_t_2)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 75, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_2); } if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 75, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_5 = PyList_GET_ITEM(sequence, 0); __pyx_t_6 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); #else __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 75, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_5); index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 75, __pyx_L1_error) __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 75, __pyx_L1_error) __pyx_L6_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6); __pyx_t_6 = 0; __pyx_t_9 = __Pyx_PyInt_As_unsigned_char(__pyx_v_v); if (unlikely((__pyx_t_9 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0, 76, __pyx_L1_error) __pyx_t_10 = __Pyx_PyObject_Ord(__pyx_v_c); if (unlikely(__pyx_t_10 == (long)(Py_UCS4)-1)) __PYX_ERR(0, 76, __pyx_L1_error) if (unlikely(__Pyx_SetItemInt_ByteArray(__pyx_v_t, __pyx_t_10, __pyx_t_9, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0)) __PYX_ERR(0, 76, __pyx_L1_error) __pyx_t_9 = __Pyx_PyInt_As_unsigned_char(__pyx_v_v); if (unlikely((__pyx_t_9 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0, 77, __pyx_L1_error) __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_c, __pyx_n_s_lower); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); } } if (__pyx_t_5) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_10 = __Pyx_PyObject_Ord(__pyx_t_2); if (unlikely(__pyx_t_10 == (long)(Py_UCS4)-1)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__Pyx_SetItemInt_ByteArray(__pyx_v_t, __pyx_t_10, __pyx_t_9, long, 1, __Pyx_PyInt_From_long, 0, 1, 1) < 0)) __PYX_ERR(0, 77, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_t); __Pyx_GIVEREF(__pyx_v_t); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_t); __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&PyBytes_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("cutadapt._align._iupac_table", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_iupac); __Pyx_XDECREF(__pyx_v_t); __Pyx_XDECREF(__pyx_v_c); __Pyx_XDECREF(__pyx_v_v); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_align_8DPMatrix_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_8cutadapt_6_align_8DPMatrix_1__init__ = {"__init__", (PyCFunction)__pyx_pw_8cutadapt_6_align_8DPMatrix_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_8cutadapt_6_align_8DPMatrix_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_reference = 0; PyObject *__pyx_v_query = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_reference,&__pyx_n_s_query,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reference)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(0, 95, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(0, 95, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 95, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_self = values[0]; __pyx_v_reference = values[1]; __pyx_v_query = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 95, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._align.DPMatrix.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8cutadapt_6_align_8DPMatrix___init__(__pyx_self, __pyx_v_self, __pyx_v_reference, __pyx_v_query); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_align_8DPMatrix___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_query) { PyObject *__pyx_v_m = NULL; PyObject *__pyx_v_n = NULL; CYTHON_UNUSED PyObject *__pyx_v__ = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *(*__pyx_t_5)(PyObject *); PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__init__", 0); __pyx_t_1 = PyObject_Length(__pyx_v_reference); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 96, __pyx_L1_error) __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_m = __pyx_t_2; __pyx_t_2 = 0; __pyx_t_1 = PyObject_Length(__pyx_v_query); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 97, __pyx_L1_error) __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_v_n = __pyx_t_2; __pyx_t_2 = 0; __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_m, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_1 = 0; __pyx_t_5 = NULL; } else { __pyx_t_1 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 98, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_4))) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 98, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } else { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 98, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif } } else { __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 98, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_3); } __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_AddObjC(__pyx_v_n, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyList_SET_ITEM(__pyx_t_6, 0, Py_None); { PyObject* __pyx_temp = PyNumber_InPlaceMultiply(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_temp)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_temp); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = __pyx_temp; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_6))) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_rows, __pyx_t_2) < 0) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_reference, __pyx_v_reference) < 0) __PYX_ERR(0, 99, __pyx_L1_error) if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_query, __pyx_v_query) < 0) __PYX_ERR(0, 100, __pyx_L1_error) /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("cutadapt._align.DPMatrix.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_m); __Pyx_XDECREF(__pyx_v_n); __Pyx_XDECREF(__pyx_v__); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_align_8DPMatrix_3set_entry(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_8cutadapt_6_align_8DPMatrix_2set_entry[] = "\n\t\tSet an entry in the dynamic programming matrix.\n\t\t"; static PyMethodDef __pyx_mdef_8cutadapt_6_align_8DPMatrix_3set_entry = {"set_entry", (PyCFunction)__pyx_pw_8cutadapt_6_align_8DPMatrix_3set_entry, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8cutadapt_6_align_8DPMatrix_2set_entry}; static PyObject *__pyx_pw_8cutadapt_6_align_8DPMatrix_3set_entry(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; int __pyx_v_i; int __pyx_v_j; PyObject *__pyx_v_cost = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_entry (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_i,&__pyx_n_s_j,&__pyx_n_s_cost,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_i)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("set_entry", 1, 4, 4, 1); __PYX_ERR(0, 102, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_j)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("set_entry", 1, 4, 4, 2); __PYX_ERR(0, 102, __pyx_L3_error) } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_cost)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("set_entry", 1, 4, 4, 3); __PYX_ERR(0, 102, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "set_entry") < 0)) __PYX_ERR(0, 102, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_self = values[0]; __pyx_v_i = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_i == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L3_error) __pyx_v_j = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_j == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L3_error) __pyx_v_cost = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("set_entry", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 102, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._align.DPMatrix.set_entry", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8cutadapt_6_align_8DPMatrix_2set_entry(__pyx_self, __pyx_v_self, __pyx_v_i, __pyx_v_j, __pyx_v_cost); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_align_8DPMatrix_2set_entry(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, int __pyx_v_i, int __pyx_v_j, PyObject *__pyx_v_cost) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("set_entry", 0); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_rows); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__Pyx_SetItemInt(__pyx_t_2, __pyx_v_j, __pyx_v_cost, int, 1, __Pyx_PyInt_From_int, 0, 1, 1) < 0)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("cutadapt._align.DPMatrix.set_entry", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_align_8DPMatrix_5__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_8cutadapt_6_align_8DPMatrix_4__str__[] = "\n\t\tReturn a representation of the matrix as a string.\n\t\t"; static PyMethodDef __pyx_mdef_8cutadapt_6_align_8DPMatrix_5__str__ = {"__str__", (PyCFunction)__pyx_pw_8cutadapt_6_align_8DPMatrix_5__str__, METH_O, __pyx_doc_8cutadapt_6_align_8DPMatrix_4__str__}; static PyObject *__pyx_pw_8cutadapt_6_align_8DPMatrix_5__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_align_8DPMatrix_4__str__(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_8cutadapt_6_align_8DPMatrix_7__str___2generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_align_8DPMatrix_7__str___genexpr(PyObject *__pyx_self) { struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_1_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("genexpr", 0); __pyx_cur_scope = (struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_1_genexpr *)__pyx_tp_new_8cutadapt_6_align___pyx_scope_struct_1_genexpr(__pyx_ptype_8cutadapt_6_align___pyx_scope_struct_1_genexpr, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__ *) __pyx_self; __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_8cutadapt_6_align_8DPMatrix_7__str___2generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_DPMatrix___str___locals_genexpr); if (unlikely(!gen)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; } /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("cutadapt._align.DPMatrix.__str__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_8cutadapt_6_align_8DPMatrix_7__str___2generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_1_genexpr *__pyx_cur_scope = ((struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_1_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; Py_ssize_t __pyx_t_3; PyObject *(*__pyx_t_4)(PyObject *); PyObject *__pyx_t_5 = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("None", 0); switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L6_resume_from_yield; default: /* CPython raises the right error here */ __Pyx_RefNannyFinishContext(); return NULL; } __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 112, __pyx_L1_error) if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); __PYX_ERR(0, 112, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_self, __pyx_n_s_query); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; __pyx_t_4 = NULL; } else { __pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { if (likely(!__pyx_t_4)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 112, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 112, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_4(__pyx_t_2); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 112, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_c); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_c, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_c, __pyx_n_s_rjust); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; __Pyx_XGIVEREF(__pyx_t_2); __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; __pyx_cur_scope->__pyx_t_1 = __pyx_t_3; __pyx_cur_scope->__pyx_t_2 = __pyx_t_4; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); /* return from generator, yielding value */ __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; __pyx_t_2 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_2); __pyx_t_3 = __pyx_cur_scope->__pyx_t_1; __pyx_t_4 = __pyx_cur_scope->__pyx_t_2; if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 112, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* function exit code */ PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_r = 0; __pyx_generator->resume_label = -1; __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_8cutadapt_6_align_8DPMatrix_7__str___5generator1(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_align_8DPMatrix_7__str___3genexpr(PyObject *__pyx_self) { struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_2_genexpr *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("genexpr", 0); __pyx_cur_scope = (struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_2_genexpr *)__pyx_tp_new_8cutadapt_6_align___pyx_scope_struct_2_genexpr(__pyx_ptype_8cutadapt_6_align___pyx_scope_struct_2_genexpr, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); __pyx_cur_scope->__pyx_outer_scope = (struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__ *) __pyx_self; __Pyx_INCREF(((PyObject *)__pyx_cur_scope->__pyx_outer_scope)); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_outer_scope); { __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_8cutadapt_6_align_8DPMatrix_7__str___5generator1, (PyObject *) __pyx_cur_scope, __pyx_n_s_genexpr, __pyx_n_s_DPMatrix___str___locals_genexpr); if (unlikely(!gen)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; } /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("cutadapt._align.DPMatrix.__str__.genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_8cutadapt_6_align_8DPMatrix_7__str___5generator1(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_2_genexpr *__pyx_cur_scope = ((struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_2_genexpr *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; PyObject *(*__pyx_t_3)(PyObject *); PyObject *__pyx_t_4 = NULL; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("None", 0); switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L6_resume_from_yield; default: /* CPython raises the right error here */ __Pyx_RefNannyFinishContext(); return NULL; } __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 114, __pyx_L1_error) if (unlikely(!__pyx_cur_scope->__pyx_outer_scope->__pyx_v_row)) { __Pyx_RaiseClosureNameError("row"); __PYX_ERR(0, 114, __pyx_L1_error) } if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_row)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_row)) { __pyx_t_1 = __pyx_cur_scope->__pyx_outer_scope->__pyx_v_row; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_3 = NULL; } else { __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_outer_scope->__pyx_v_row); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 114, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_3)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 114, __pyx_L1_error) #else __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 114, __pyx_L1_error) #else __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif } } else { __pyx_t_4 = __pyx_t_3(__pyx_t_1); if (unlikely(!__pyx_t_4)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 114, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_4); } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_v); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_v, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = (__pyx_cur_scope->__pyx_v_v == Py_None); if ((__pyx_t_5 != 0)) { __Pyx_INCREF(__pyx_kp_s__5); __pyx_t_4 = __pyx_kp_s__5; } else { __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_0_2d, __pyx_n_s_format); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); } } if (!__pyx_t_8) { __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_cur_scope->__pyx_v_v); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); } else { __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_v); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_v); PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_cur_scope->__pyx_v_v); __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_4 = __pyx_t_6; __pyx_t_6 = 0; } __pyx_r = __pyx_t_4; __pyx_t_4 = 0; __Pyx_XGIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; __pyx_cur_scope->__pyx_t_2 = __pyx_t_3; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); /* return from generator, yielding value */ __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L6_resume_from_yield:; __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; __pyx_t_3 = __pyx_cur_scope->__pyx_t_2; if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 114, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* function exit code */ PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("genexpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_r = 0; __pyx_generator->resume_label = -1; __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_align_8DPMatrix_4__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__ *__pyx_cur_scope; PyObject *__pyx_v_rows = NULL; PyObject *__pyx_v_c = NULL; PyObject *__pyx_v_r = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; Py_ssize_t __pyx_t_4; PyObject *(*__pyx_t_5)(PyObject *); PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *(*__pyx_t_8)(PyObject *); int __pyx_t_9; __Pyx_RefNannySetupContext("__str__", 0); __pyx_cur_scope = (struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__ *)__pyx_tp_new_8cutadapt_6_align___pyx_scope_struct____str__(__pyx_ptype_8cutadapt_6_align___pyx_scope_struct____str__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); __pyx_cur_scope->__pyx_v_self = __pyx_v_self; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self); __pyx_t_1 = __pyx_pf_8cutadapt_6_align_8DPMatrix_7__str___genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyString_Join(__pyx_kp_s__7, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyNumber_Add(__pyx_kp_s__6, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = 0; __pyx_v_rows = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_reference); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyNumber_Add(__pyx_kp_s__7, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_rows); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_5 = NULL; } else { __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 113, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { if (likely(!__pyx_t_5)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 113, __pyx_L1_error) #else __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } else { if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 113, __pyx_L1_error) #else __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } } else { __pyx_t_2 = __pyx_t_5(__pyx_t_3); if (unlikely(!__pyx_t_2)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 113, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_2); } if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { PyObject* sequence = __pyx_t_2; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 113, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_1 = PyList_GET_ITEM(sequence, 0); __pyx_t_6 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_6); #else __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); #endif __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { Py_ssize_t index = -1; __pyx_t_7 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_6); if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) __PYX_ERR(0, 113, __pyx_L1_error) __pyx_t_8 = NULL; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; goto __pyx_L6_unpacking_done; __pyx_L5_unpacking_failed:; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 113, __pyx_L1_error) __pyx_L6_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_c, __pyx_t_1); __pyx_t_1 = 0; __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_row); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_row, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = PyNumber_Add(__pyx_v_c, __pyx_kp_s__7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = __pyx_pf_8cutadapt_6_align_8DPMatrix_7__str___3genexpr(((PyObject*)__pyx_cur_scope)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_1 = __Pyx_PyString_Join(__pyx_kp_s__7, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF_SET(__pyx_v_r, __pyx_t_6); __pyx_t_6 = 0; __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_rows, __pyx_v_r); if (unlikely(__pyx_t_9 == -1)) __PYX_ERR(0, 115, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyString_Join(__pyx_kp_s__8, __pyx_v_rows); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("cutadapt._align.DPMatrix.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_rows); __Pyx_XDECREF(__pyx_v_c); __Pyx_XDECREF(__pyx_v_r); __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_8cutadapt_6_align_7Aligner_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_8cutadapt_6_align_7Aligner_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_reference = 0; double __pyx_v_max_error_rate; int __pyx_v_flags; int __pyx_v_wildcard_ref; int __pyx_v_wildcard_query; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_reference,&__pyx_n_s_max_error_rate,&__pyx_n_s_flags,&__pyx_n_s_wildcard_ref,&__pyx_n_s_wildcard_query,0}; PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reference)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_error_rate)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 5, 1); __PYX_ERR(0, 200, __pyx_L3_error) } case 2: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flags); if (value) { values[2] = value; kw_args--; } } case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_wildcard_ref); if (value) { values[3] = value; kw_args--; } } case 4: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_wildcard_query); if (value) { values[4] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 200, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_reference = ((PyObject*)values[0]); __pyx_v_max_error_rate = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_max_error_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L3_error) if (values[2]) { __pyx_v_flags = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L3_error) } else { __pyx_v_flags = ((int)15); } if (values[3]) { __pyx_v_wildcard_ref = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_wildcard_ref == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L3_error) } else { __pyx_v_wildcard_ref = ((int)0); } if (values[4]) { __pyx_v_wildcard_query = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_wildcard_query == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L3_error) } else { __pyx_v_wildcard_query = ((int)0); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 200, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._align.Aligner.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_reference), (&PyString_Type), 1, "reference", 1))) __PYX_ERR(0, 200, __pyx_L1_error) __pyx_r = __pyx_pf_8cutadapt_6_align_7Aligner___cinit__(((struct __pyx_obj_8cutadapt_6_align_Aligner *)__pyx_v_self), __pyx_v_reference, __pyx_v_max_error_rate, __pyx_v_flags, __pyx_v_wildcard_ref, __pyx_v_wildcard_query); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_8cutadapt_6_align_7Aligner___cinit__(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self, PyObject *__pyx_v_reference, double __pyx_v_max_error_rate, int __pyx_v_flags, int __pyx_v_wildcard_ref, int __pyx_v_wildcard_query) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); __pyx_v_self->max_error_rate = __pyx_v_max_error_rate; __pyx_v_self->flags = __pyx_v_flags; __pyx_v_self->wildcard_ref = __pyx_v_wildcard_ref; __pyx_v_self->wildcard_query = __pyx_v_wildcard_query; __Pyx_INCREF(__pyx_v_reference); __Pyx_GIVEREF(__pyx_v_reference); __Pyx_GOTREF(__pyx_v_self->str_reference); __Pyx_DECREF(__pyx_v_self->str_reference); __pyx_v_self->str_reference = __pyx_v_reference; if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reference, __pyx_v_reference) < 0) __PYX_ERR(0, 206, __pyx_L1_error) __pyx_v_self->_min_overlap = 1; __pyx_v_self->debug = 0; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->_dpmatrix); __Pyx_DECREF(__pyx_v_self->_dpmatrix); __pyx_v_self->_dpmatrix = Py_None; __pyx_v_self->_insertion_cost = 1; __pyx_v_self->_deletion_cost = 1; /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("cutadapt._align.Aligner.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_align_7Aligner_11min_overlap_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_8cutadapt_6_align_7Aligner_11min_overlap_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_align_7Aligner_11min_overlap___get__(((struct __pyx_obj_8cutadapt_6_align_Aligner *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_align_7Aligner_11min_overlap___get__(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_min_overlap); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 215, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("cutadapt._align.Aligner.min_overlap.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_8cutadapt_6_align_7Aligner_11min_overlap_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/ static int __pyx_pw_8cutadapt_6_align_7Aligner_11min_overlap_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) { int __pyx_v_value; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); assert(__pyx_arg_value); { __pyx_v_value = __Pyx_PyInt_As_int(__pyx_arg_value); if (unlikely((__pyx_v_value == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._align.Aligner.min_overlap.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8cutadapt_6_align_7Aligner_11min_overlap_2__set__(((struct __pyx_obj_8cutadapt_6_align_Aligner *)__pyx_v_self), ((int)__pyx_v_value)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_8cutadapt_6_align_7Aligner_11min_overlap_2__set__(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self, int __pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__set__", 0); __pyx_t_1 = ((__pyx_v_value < 1) != 0); if (__pyx_t_1) { __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 219, __pyx_L1_error) } __pyx_v_self->_min_overlap = __pyx_v_value; /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("cutadapt._align.Aligner.min_overlap.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_8cutadapt_6_align_7Aligner_10indel_cost_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pw_8cutadapt_6_align_7Aligner_10indel_cost_1__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_align_7Aligner_10indel_cost___set__(((struct __pyx_obj_8cutadapt_6_align_Aligner *)__pyx_v_self), ((PyObject *)__pyx_v_value)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_8cutadapt_6_align_7Aligner_10indel_cost___set__(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; __Pyx_RefNannySetupContext("__set__", 0); __pyx_t_1 = PyObject_RichCompare(__pyx_v_value, __pyx_int_1, Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error) __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 229, __pyx_L1_error) } __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 230, __pyx_L1_error) __pyx_v_self->_insertion_cost = __pyx_t_3; __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 231, __pyx_L1_error) __pyx_v_self->_deletion_cost = __pyx_t_3; /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("cutadapt._align.Aligner.indel_cost.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_align_7Aligner_9reference_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_8cutadapt_6_align_7Aligner_9reference_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_align_7Aligner_9reference___get__(((struct __pyx_obj_8cutadapt_6_align_Aligner *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_align_7Aligner_9reference___get__(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->_reference); __pyx_r = __pyx_v_self->_reference; goto __pyx_L0; /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_8cutadapt_6_align_7Aligner_9reference_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_reference); /*proto*/ static int __pyx_pw_8cutadapt_6_align_7Aligner_9reference_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_reference) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_reference), (&PyString_Type), 1, "reference", 1))) __PYX_ERR(0, 237, __pyx_L1_error) __pyx_r = __pyx_pf_8cutadapt_6_align_7Aligner_9reference_2__set__(((struct __pyx_obj_8cutadapt_6_align_Aligner *)__pyx_v_self), ((PyObject*)__pyx_v_reference)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_8cutadapt_6_align_7Aligner_9reference_2__set__(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self, PyObject *__pyx_v_reference) { __pyx_t_8cutadapt_6_align__Entry *__pyx_v_mem; int __pyx_r; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__set__", 0); __pyx_t_1 = PyObject_Length(__pyx_v_reference); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 238, __pyx_L1_error) __pyx_v_mem = ((__pyx_t_8cutadapt_6_align__Entry *)PyMem_Realloc(__pyx_v_self->column, ((__pyx_t_1 + 1) * (sizeof(__pyx_t_8cutadapt_6_align__Entry))))); __pyx_t_2 = ((!(__pyx_v_mem != 0)) != 0); if (__pyx_t_2) { PyErr_NoMemory(); __PYX_ERR(0, 240, __pyx_L1_error) } __pyx_v_self->column = __pyx_v_mem; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_reference, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; 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, 242, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_4); __Pyx_GOTREF(__pyx_v_self->_reference); __Pyx_DECREF(__pyx_v_self->_reference); __pyx_v_self->_reference = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; __pyx_t_1 = PyObject_Length(__pyx_v_reference); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 243, __pyx_L1_error) __pyx_v_self->m = __pyx_t_1; __pyx_t_2 = (__pyx_v_self->wildcard_ref != 0); if (__pyx_t_2) { __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_reference, __pyx_n_s_translate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_5) { __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_8cutadapt_6_align_IUPAC_TABLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } else { __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_INCREF(__pyx_v_8cutadapt_6_align_IUPAC_TABLE); __Pyx_GIVEREF(__pyx_v_8cutadapt_6_align_IUPAC_TABLE); PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_8cutadapt_6_align_IUPAC_TABLE); __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; 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, 245, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_4); __Pyx_GOTREF(__pyx_v_self->_reference); __Pyx_DECREF(__pyx_v_self->_reference); __pyx_v_self->_reference = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4; } __pyx_t_2 = (__pyx_v_self->wildcard_query != 0); if (__pyx_t_2) { __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_reference, __pyx_n_s_translate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_6) { __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_8cutadapt_6_align_ACGT_TABLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } else { __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL; __Pyx_INCREF(__pyx_v_8cutadapt_6_align_ACGT_TABLE); __Pyx_GIVEREF(__pyx_v_8cutadapt_6_align_ACGT_TABLE); PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_8cutadapt_6_align_ACGT_TABLE); __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; 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, 247, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_4); __Pyx_GOTREF(__pyx_v_self->_reference); __Pyx_DECREF(__pyx_v_self->_reference); __pyx_v_self->_reference = ((PyObject*)__pyx_t_4); __pyx_t_4 = 0; } __pyx_L4:; __Pyx_INCREF(__pyx_v_reference); __Pyx_GIVEREF(__pyx_v_reference); __Pyx_GOTREF(__pyx_v_self->str_reference); __Pyx_DECREF(__pyx_v_self->str_reference); __pyx_v_self->str_reference = __pyx_v_reference; /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("cutadapt._align.Aligner.reference.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_align_7Aligner_8dpmatrix_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_8cutadapt_6_align_7Aligner_8dpmatrix_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_align_7Aligner_8dpmatrix___get__(((struct __pyx_obj_8cutadapt_6_align_Aligner *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_align_7Aligner_8dpmatrix___get__(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->_dpmatrix); __pyx_r = __pyx_v_self->_dpmatrix; goto __pyx_L0; /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_align_7Aligner_3enable_debug(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_8cutadapt_6_align_7Aligner_2enable_debug[] = "\n\t\tStore the dynamic programming matrix while running the locate() method\n\t\tand make it available in the .dpmatrix attribute.\n\t\t"; static PyObject *__pyx_pw_8cutadapt_6_align_7Aligner_3enable_debug(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("enable_debug (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_align_7Aligner_2enable_debug(((struct __pyx_obj_8cutadapt_6_align_Aligner *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_align_7Aligner_2enable_debug(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("enable_debug", 0); __pyx_v_self->debug = 1; /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_align_7Aligner_5locate(PyObject *__pyx_v_self, PyObject *__pyx_v_query); /*proto*/ static char __pyx_doc_8cutadapt_6_align_7Aligner_4locate[] = "\n\t\tlocate(query) -> (refstart, refstop, querystart, querystop, matches, errors)\n\n\t\tFind the query within the reference associated with this aligner. The\n\t\tintervals (querystart, querystop) and (refstart, refstop) give the\n\t\tlocation of the match.\n\n\t\tThat is, the substrings query[querystart:querystop] and\n\t\tself.reference[refstart:refstop] were found to align best to each other,\n\t\twith the given number of matches and the given number of errors.\n\n\t\tThe alignment itself is not returned.\n\t\t"; static PyObject *__pyx_pw_8cutadapt_6_align_7Aligner_5locate(PyObject *__pyx_v_self, PyObject *__pyx_v_query) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("locate (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_query), (&PyString_Type), 1, "query", 1))) __PYX_ERR(0, 265, __pyx_L1_error) __pyx_r = __pyx_pf_8cutadapt_6_align_7Aligner_4locate(((struct __pyx_obj_8cutadapt_6_align_Aligner *)__pyx_v_self), ((PyObject*)__pyx_v_query)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_align_7Aligner_4locate(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self, PyObject *__pyx_v_query) { char *__pyx_v_s1; PyObject *__pyx_v_query_bytes = 0; char *__pyx_v_s2; int __pyx_v_m; int __pyx_v_n; __pyx_t_8cutadapt_6_align__Entry *__pyx_v_column; double __pyx_v_max_error_rate; int __pyx_v_start_in_ref; int __pyx_v_start_in_query; int __pyx_v_stop_in_ref; int __pyx_v_stop_in_query; int __pyx_v_compare_ascii; int __pyx_v_i; int __pyx_v_j; int __pyx_v_k; int __pyx_v_max_n; int __pyx_v_min_n; __pyx_t_8cutadapt_6_align__Match __pyx_v_best; int __pyx_v_last; int __pyx_v_cost_diag; int __pyx_v_cost_deletion; int __pyx_v_cost_insertion; int __pyx_v_origin; int __pyx_v_cost; int __pyx_v_matches; int __pyx_v_length; int __pyx_v_characters_equal; __pyx_t_8cutadapt_6_align__Entry __pyx_v_tmp_entry; long __pyx_v_first_i; int __pyx_v_start1; int __pyx_v_start2; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations char *__pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; Py_ssize_t __pyx_t_5; __pyx_t_8cutadapt_6_align__Entry *__pyx_t_6; double __pyx_t_7; int __pyx_t_8; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; int __pyx_t_11; int __pyx_t_12; int __pyx_t_13; long __pyx_t_14; long __pyx_t_15; int __pyx_t_16; long __pyx_t_17; PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; __Pyx_RefNannySetupContext("locate", 0); __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_self->_reference); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 279, __pyx_L1_error) __pyx_v_s1 = __pyx_t_1; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 280, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 280, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 280, __pyx_L1_error) __pyx_v_query_bytes = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_query_bytes); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 281, __pyx_L1_error) __pyx_v_s2 = __pyx_t_1; __pyx_t_4 = __pyx_v_self->m; __pyx_v_m = __pyx_t_4; __pyx_t_5 = PyObject_Length(__pyx_v_query); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 283, __pyx_L1_error) __pyx_v_n = __pyx_t_5; __pyx_t_6 = __pyx_v_self->column; __pyx_v_column = __pyx_t_6; __pyx_t_7 = __pyx_v_self->max_error_rate; __pyx_v_max_error_rate = __pyx_t_7; __pyx_v_start_in_ref = (__pyx_v_self->flags & 1); __pyx_v_start_in_query = (__pyx_v_self->flags & 2); __pyx_v_stop_in_ref = (__pyx_v_self->flags & 4); __pyx_v_stop_in_query = (__pyx_v_self->flags & 8); __pyx_t_8 = (__pyx_v_self->wildcard_query != 0); if (__pyx_t_8) { __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_query_bytes, __pyx_n_s_translate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (!__pyx_t_9) { __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_8cutadapt_6_align_IUPAC_TABLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } else { __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; __Pyx_INCREF(__pyx_v_8cutadapt_6_align_IUPAC_TABLE); __Pyx_GIVEREF(__pyx_v_8cutadapt_6_align_IUPAC_TABLE); PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_v_8cutadapt_6_align_IUPAC_TABLE); __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_query_bytes, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_query_bytes); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 293, __pyx_L1_error) __pyx_v_s2 = __pyx_t_1; goto __pyx_L3; } __pyx_t_8 = (__pyx_v_self->wildcard_ref != 0); if (__pyx_t_8) { __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_query_bytes, __pyx_n_s_translate); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 295, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_10 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_10)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (!__pyx_t_10) { __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_8cutadapt_6_align_ACGT_TABLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 295, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); } else { __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 295, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_10); __pyx_t_10 = NULL; __Pyx_INCREF(__pyx_v_8cutadapt_6_align_ACGT_TABLE); __Pyx_GIVEREF(__pyx_v_8cutadapt_6_align_ACGT_TABLE); PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_8cutadapt_6_align_ACGT_TABLE); __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 295, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 295, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_query_bytes, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_query_bytes); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 296, __pyx_L1_error) __pyx_v_s2 = __pyx_t_1; } __pyx_L3:; __pyx_t_11 = (__pyx_v_self->wildcard_query != 0); if (!__pyx_t_11) { } else { __pyx_t_8 = __pyx_t_11; goto __pyx_L4_bool_binop_done; } __pyx_t_11 = (__pyx_v_self->wildcard_ref != 0); __pyx_t_8 = __pyx_t_11; __pyx_L4_bool_binop_done:; __pyx_v_compare_ascii = (!__pyx_t_8); __pyx_v_k = ((int)(__pyx_v_max_error_rate * __pyx_v_m)); __pyx_v_max_n = __pyx_v_n; __pyx_v_min_n = 0; __pyx_t_8 = ((!(__pyx_v_start_in_query != 0)) != 0); if (__pyx_t_8) { __pyx_t_4 = (__pyx_v_m + __pyx_v_k); __pyx_t_12 = __pyx_v_n; if (((__pyx_t_4 < __pyx_t_12) != 0)) { __pyx_t_13 = __pyx_t_4; } else { __pyx_t_13 = __pyx_t_12; } __pyx_v_max_n = __pyx_t_13; } __pyx_t_8 = ((!(__pyx_v_stop_in_query != 0)) != 0); if (__pyx_t_8) { __pyx_t_13 = ((__pyx_v_n - __pyx_v_m) - __pyx_v_k); __pyx_t_14 = 0; if (((__pyx_t_13 > __pyx_t_14) != 0)) { __pyx_t_15 = __pyx_t_13; } else { __pyx_t_15 = __pyx_t_14; } __pyx_v_min_n = __pyx_t_15; } __pyx_t_11 = ((!(__pyx_v_start_in_ref != 0)) != 0); if (__pyx_t_11) { } else { __pyx_t_8 = __pyx_t_11; goto __pyx_L9_bool_binop_done; } __pyx_t_11 = ((!(__pyx_v_start_in_query != 0)) != 0); __pyx_t_8 = __pyx_t_11; __pyx_L9_bool_binop_done:; if (__pyx_t_8) { __pyx_t_15 = (__pyx_v_m + 1); for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_15; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; (__pyx_v_column[__pyx_v_i]).matches = 0; __pyx_t_4 = __pyx_v_min_n; __pyx_t_12 = __pyx_v_i; if (((__pyx_t_4 > __pyx_t_12) != 0)) { __pyx_t_16 = __pyx_t_4; } else { __pyx_t_16 = __pyx_t_12; } (__pyx_v_column[__pyx_v_i]).cost = (__pyx_t_16 * __pyx_v_self->_insertion_cost); (__pyx_v_column[__pyx_v_i]).origin = 0; } goto __pyx_L8; } __pyx_t_11 = (__pyx_v_start_in_ref != 0); if (__pyx_t_11) { } else { __pyx_t_8 = __pyx_t_11; goto __pyx_L13_bool_binop_done; } __pyx_t_11 = ((!(__pyx_v_start_in_query != 0)) != 0); __pyx_t_8 = __pyx_t_11; __pyx_L13_bool_binop_done:; if (__pyx_t_8) { __pyx_t_15 = (__pyx_v_m + 1); for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_15; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; (__pyx_v_column[__pyx_v_i]).matches = 0; (__pyx_v_column[__pyx_v_i]).cost = (__pyx_v_min_n * __pyx_v_self->_insertion_cost); __pyx_t_16 = (__pyx_v_min_n - __pyx_v_i); __pyx_t_14 = 0; if (((__pyx_t_16 < __pyx_t_14) != 0)) { __pyx_t_17 = __pyx_t_16; } else { __pyx_t_17 = __pyx_t_14; } (__pyx_v_column[__pyx_v_i]).origin = __pyx_t_17; } goto __pyx_L8; } __pyx_t_11 = ((!(__pyx_v_start_in_ref != 0)) != 0); if (__pyx_t_11) { } else { __pyx_t_8 = __pyx_t_11; goto __pyx_L17_bool_binop_done; } __pyx_t_11 = (__pyx_v_start_in_query != 0); __pyx_t_8 = __pyx_t_11; __pyx_L17_bool_binop_done:; if (__pyx_t_8) { __pyx_t_15 = (__pyx_v_m + 1); for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_15; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; (__pyx_v_column[__pyx_v_i]).matches = 0; (__pyx_v_column[__pyx_v_i]).cost = (__pyx_v_i * __pyx_v_self->_insertion_cost); __pyx_t_16 = (__pyx_v_min_n - __pyx_v_i); __pyx_t_17 = 0; if (((__pyx_t_16 > __pyx_t_17) != 0)) { __pyx_t_14 = __pyx_t_16; } else { __pyx_t_14 = __pyx_t_17; } (__pyx_v_column[__pyx_v_i]).origin = __pyx_t_14; } goto __pyx_L8; } /*else*/ { __pyx_t_15 = (__pyx_v_m + 1); for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_15; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; (__pyx_v_column[__pyx_v_i]).matches = 0; __pyx_t_16 = __pyx_v_min_n; __pyx_t_4 = __pyx_v_i; if (((__pyx_t_16 < __pyx_t_4) != 0)) { __pyx_t_12 = __pyx_t_16; } else { __pyx_t_12 = __pyx_t_4; } (__pyx_v_column[__pyx_v_i]).cost = (__pyx_t_12 * __pyx_v_self->_insertion_cost); (__pyx_v_column[__pyx_v_i]).origin = (__pyx_v_min_n - __pyx_v_i); } } __pyx_L8:; __pyx_t_8 = (__pyx_v_self->debug != 0); if (__pyx_t_8) { __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_DPMatrix); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 = NULL; __pyx_t_5 = 0; if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } __pyx_t_10 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (__pyx_t_9) { __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; } __Pyx_INCREF(__pyx_v_self->str_reference); __Pyx_GIVEREF(__pyx_v_self->str_reference); PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_5, __pyx_v_self->str_reference); __Pyx_INCREF(__pyx_v_query); __Pyx_GIVEREF(__pyx_v_query); PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_5, __pyx_v_query); __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->_dpmatrix); __Pyx_DECREF(__pyx_v_self->_dpmatrix); __pyx_v_self->_dpmatrix = __pyx_t_3; __pyx_t_3 = 0; __pyx_t_15 = (__pyx_v_m + 1); for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_15; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_dpmatrix, __pyx_n_s_set_entry); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_min_n); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_18 = __Pyx_PyInt_From_int((__pyx_v_column[__pyx_v_i]).cost); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); __pyx_t_19 = NULL; __pyx_t_5 = 0; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_19)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_19); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } __pyx_t_20 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); if (__pyx_t_19) { __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19); __pyx_t_19 = NULL; } __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_20, 0+__pyx_t_5, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_20, 1+__pyx_t_5, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_20, 2+__pyx_t_5, __pyx_t_18); __pyx_t_10 = 0; __pyx_t_9 = 0; __pyx_t_18 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_20, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } } __pyx_v_best.ref_stop = __pyx_v_m; __pyx_v_best.query_stop = __pyx_v_n; __pyx_v_best.cost = (__pyx_v_m + __pyx_v_n); __pyx_v_best.origin = 0; __pyx_v_best.matches = 0; __pyx_t_15 = (__pyx_v_k + 1); __pyx_t_13 = __pyx_v_m; if (((__pyx_t_15 < __pyx_t_13) != 0)) { __pyx_t_14 = __pyx_t_15; } else { __pyx_t_14 = __pyx_t_13; } __pyx_v_last = __pyx_t_14; __pyx_t_8 = (__pyx_v_start_in_ref != 0); if (__pyx_t_8) { __pyx_v_last = __pyx_v_m; } { #ifdef WITH_THREAD PyThreadState *_save; Py_UNBLOCK_THREADS #endif /*try:*/ { __pyx_t_14 = (__pyx_v_max_n + 1); for (__pyx_t_13 = (__pyx_v_min_n + 1); __pyx_t_13 < __pyx_t_14; __pyx_t_13+=1) { __pyx_v_j = __pyx_t_13; __pyx_v_tmp_entry = (__pyx_v_column[0]); __pyx_t_8 = (__pyx_v_start_in_query != 0); if (__pyx_t_8) { (__pyx_v_column[0]).origin = __pyx_v_j; goto __pyx_L32; } /*else*/ { (__pyx_v_column[0]).cost = (__pyx_v_j * __pyx_v_self->_insertion_cost); } __pyx_L32:; __pyx_t_15 = (__pyx_v_last + 1); for (__pyx_t_12 = 1; __pyx_t_12 < __pyx_t_15; __pyx_t_12+=1) { __pyx_v_i = __pyx_t_12; __pyx_t_8 = (__pyx_v_compare_ascii != 0); if (__pyx_t_8) { __pyx_v_characters_equal = ((__pyx_v_s1[(__pyx_v_i - 1)]) == (__pyx_v_s2[(__pyx_v_j - 1)])); goto __pyx_L35; } /*else*/ { __pyx_v_characters_equal = (((__pyx_v_s1[(__pyx_v_i - 1)]) & (__pyx_v_s2[(__pyx_v_j - 1)])) != 0); } __pyx_L35:; __pyx_t_8 = (__pyx_v_characters_equal != 0); if (__pyx_t_8) { __pyx_t_16 = __pyx_v_tmp_entry.cost; __pyx_v_cost = __pyx_t_16; __pyx_t_16 = __pyx_v_tmp_entry.origin; __pyx_v_origin = __pyx_t_16; __pyx_v_matches = (__pyx_v_tmp_entry.matches + 1); goto __pyx_L36; } /*else*/ { __pyx_v_cost_diag = (__pyx_v_tmp_entry.cost + 1); __pyx_v_cost_deletion = ((__pyx_v_column[__pyx_v_i]).cost + __pyx_v_self->_deletion_cost); __pyx_v_cost_insertion = ((__pyx_v_column[(__pyx_v_i - 1)]).cost + __pyx_v_self->_insertion_cost); __pyx_t_11 = ((__pyx_v_cost_diag <= __pyx_v_cost_deletion) != 0); if (__pyx_t_11) { } else { __pyx_t_8 = __pyx_t_11; goto __pyx_L38_bool_binop_done; } __pyx_t_11 = ((__pyx_v_cost_diag <= __pyx_v_cost_insertion) != 0); __pyx_t_8 = __pyx_t_11; __pyx_L38_bool_binop_done:; if (__pyx_t_8) { __pyx_v_cost = __pyx_v_cost_diag; __pyx_t_16 = __pyx_v_tmp_entry.origin; __pyx_v_origin = __pyx_t_16; __pyx_t_16 = __pyx_v_tmp_entry.matches; __pyx_v_matches = __pyx_t_16; goto __pyx_L37; } __pyx_t_8 = ((__pyx_v_cost_insertion <= __pyx_v_cost_deletion) != 0); if (__pyx_t_8) { __pyx_v_cost = __pyx_v_cost_insertion; __pyx_t_16 = (__pyx_v_column[(__pyx_v_i - 1)]).origin; __pyx_v_origin = __pyx_t_16; __pyx_t_16 = (__pyx_v_column[(__pyx_v_i - 1)]).matches; __pyx_v_matches = __pyx_t_16; goto __pyx_L37; } /*else*/ { __pyx_v_cost = __pyx_v_cost_deletion; __pyx_t_16 = (__pyx_v_column[__pyx_v_i]).origin; __pyx_v_origin = __pyx_t_16; __pyx_t_16 = (__pyx_v_column[__pyx_v_i]).matches; __pyx_v_matches = __pyx_t_16; } __pyx_L37:; } __pyx_L36:; __pyx_v_tmp_entry = (__pyx_v_column[__pyx_v_i]); (__pyx_v_column[__pyx_v_i]).cost = __pyx_v_cost; (__pyx_v_column[__pyx_v_i]).origin = __pyx_v_origin; (__pyx_v_column[__pyx_v_i]).matches = __pyx_v_matches; } __pyx_t_8 = (__pyx_v_self->debug != 0); if (__pyx_t_8) { { #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); #endif /*try:*/ { __pyx_t_15 = (__pyx_v_last + 1); for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_15; __pyx_t_12+=1) { __pyx_v_i = __pyx_t_12; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->_dpmatrix, __pyx_n_s_set_entry); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 429, __pyx_L44_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 429, __pyx_L44_error) __Pyx_GOTREF(__pyx_t_20); __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_j); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 429, __pyx_L44_error) __Pyx_GOTREF(__pyx_t_18); __pyx_t_9 = __Pyx_PyInt_From_int((__pyx_v_column[__pyx_v_i]).cost); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 429, __pyx_L44_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = NULL; __pyx_t_5 = 0; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_10)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } __pyx_t_19 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 429, __pyx_L44_error) __Pyx_GOTREF(__pyx_t_19); if (__pyx_t_10) { __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_10); __pyx_t_10 = NULL; } __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_19, 0+__pyx_t_5, __pyx_t_20); __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_19, 1+__pyx_t_5, __pyx_t_18); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_19, 2+__pyx_t_5, __pyx_t_9); __pyx_t_20 = 0; __pyx_t_18 = 0; __pyx_t_9 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_19, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 429, __pyx_L44_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } } /*finally:*/ { /*normal exit:*/{ #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif goto __pyx_L45; } __pyx_L44_error: { #ifdef WITH_THREAD PyGILState_Release(__pyx_gilstate_save); #endif goto __pyx_L28_error; } __pyx_L45:; } } } while (1) { __pyx_t_11 = ((__pyx_v_last >= 0) != 0); if (__pyx_t_11) { } else { __pyx_t_8 = __pyx_t_11; goto __pyx_L50_bool_binop_done; } __pyx_t_11 = (((__pyx_v_column[__pyx_v_last]).cost > __pyx_v_k) != 0); __pyx_t_8 = __pyx_t_11; __pyx_L50_bool_binop_done:; if (!__pyx_t_8) break; __pyx_v_last = (__pyx_v_last - 1); } __pyx_t_8 = ((__pyx_v_last < __pyx_v_m) != 0); if (__pyx_t_8) { __pyx_v_last = (__pyx_v_last + 1); goto __pyx_L52; } __pyx_t_8 = (__pyx_v_stop_in_query != 0); if (__pyx_t_8) { __pyx_t_15 = 0; __pyx_t_12 = (__pyx_v_column[__pyx_v_m]).origin; if (((__pyx_t_15 < __pyx_t_12) != 0)) { __pyx_t_17 = __pyx_t_15; } else { __pyx_t_17 = __pyx_t_12; } __pyx_v_length = (__pyx_v_m + __pyx_t_17); __pyx_t_12 = (__pyx_v_column[__pyx_v_m]).cost; __pyx_v_cost = __pyx_t_12; __pyx_t_12 = (__pyx_v_column[__pyx_v_m]).matches; __pyx_v_matches = __pyx_t_12; __pyx_t_11 = ((__pyx_v_length >= __pyx_v_self->_min_overlap) != 0); if (__pyx_t_11) { } else { __pyx_t_8 = __pyx_t_11; goto __pyx_L54_bool_binop_done; } __pyx_t_11 = ((__pyx_v_cost <= (__pyx_v_length * __pyx_v_max_error_rate)) != 0); if (__pyx_t_11) { } else { __pyx_t_8 = __pyx_t_11; goto __pyx_L54_bool_binop_done; } __pyx_t_11 = ((__pyx_v_matches > __pyx_v_best.matches) != 0); if (!__pyx_t_11) { } else { __pyx_t_8 = __pyx_t_11; goto __pyx_L54_bool_binop_done; } __pyx_t_11 = ((__pyx_v_matches == __pyx_v_best.matches) != 0); if (__pyx_t_11) { } else { __pyx_t_8 = __pyx_t_11; goto __pyx_L54_bool_binop_done; } __pyx_t_11 = ((__pyx_v_cost < __pyx_v_best.cost) != 0); __pyx_t_8 = __pyx_t_11; __pyx_L54_bool_binop_done:; if (__pyx_t_8) { __pyx_v_best.matches = __pyx_v_matches; __pyx_v_best.cost = __pyx_v_cost; __pyx_t_12 = (__pyx_v_column[__pyx_v_m]).origin; __pyx_v_best.origin = __pyx_t_12; __pyx_v_best.ref_stop = __pyx_v_m; __pyx_v_best.query_stop = __pyx_v_j; __pyx_t_11 = ((__pyx_v_cost == 0) != 0); if (__pyx_t_11) { } else { __pyx_t_8 = __pyx_t_11; goto __pyx_L60_bool_binop_done; } __pyx_t_11 = ((__pyx_v_matches == __pyx_v_m) != 0); __pyx_t_8 = __pyx_t_11; __pyx_L60_bool_binop_done:; if (__pyx_t_8) { goto __pyx_L31_break; } } } __pyx_L52:; } __pyx_L31_break:; } /*finally:*/ { /*normal exit:*/{ #ifdef WITH_THREAD Py_BLOCK_THREADS #endif goto __pyx_L29; } __pyx_L28_error: { #ifdef WITH_THREAD Py_BLOCK_THREADS #endif goto __pyx_L1_error; } __pyx_L29:; } } __pyx_t_8 = ((__pyx_v_max_n == __pyx_v_n) != 0); if (__pyx_t_8) { if ((__pyx_v_stop_in_ref != 0)) { __pyx_t_14 = 0; } else { __pyx_t_14 = __pyx_v_m; } __pyx_v_first_i = __pyx_t_14; __pyx_t_14 = (__pyx_v_m + 1); for (__pyx_t_13 = __pyx_v_first_i; __pyx_t_13 < __pyx_t_14; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; __pyx_t_17 = 0; __pyx_t_12 = (__pyx_v_column[__pyx_v_i]).origin; if (((__pyx_t_17 < __pyx_t_12) != 0)) { __pyx_t_15 = __pyx_t_17; } else { __pyx_t_15 = __pyx_t_12; } __pyx_v_length = (__pyx_v_i + __pyx_t_15); __pyx_t_12 = (__pyx_v_column[__pyx_v_i]).cost; __pyx_v_cost = __pyx_t_12; __pyx_t_12 = (__pyx_v_column[__pyx_v_i]).matches; __pyx_v_matches = __pyx_t_12; __pyx_t_11 = ((__pyx_v_length >= __pyx_v_self->_min_overlap) != 0); if (__pyx_t_11) { } else { __pyx_t_8 = __pyx_t_11; goto __pyx_L66_bool_binop_done; } __pyx_t_11 = ((__pyx_v_cost <= (__pyx_v_length * __pyx_v_max_error_rate)) != 0); if (__pyx_t_11) { } else { __pyx_t_8 = __pyx_t_11; goto __pyx_L66_bool_binop_done; } __pyx_t_11 = ((__pyx_v_matches > __pyx_v_best.matches) != 0); if (!__pyx_t_11) { } else { __pyx_t_8 = __pyx_t_11; goto __pyx_L66_bool_binop_done; } __pyx_t_11 = ((__pyx_v_matches == __pyx_v_best.matches) != 0); if (__pyx_t_11) { } else { __pyx_t_8 = __pyx_t_11; goto __pyx_L66_bool_binop_done; } __pyx_t_11 = ((__pyx_v_cost < __pyx_v_best.cost) != 0); __pyx_t_8 = __pyx_t_11; __pyx_L66_bool_binop_done:; if (__pyx_t_8) { __pyx_v_best.matches = __pyx_v_matches; __pyx_v_best.cost = __pyx_v_cost; __pyx_t_12 = (__pyx_v_column[__pyx_v_i]).origin; __pyx_v_best.origin = __pyx_t_12; __pyx_v_best.ref_stop = __pyx_v_i; __pyx_v_best.query_stop = __pyx_v_n; } } } __pyx_t_8 = ((__pyx_v_best.cost == (__pyx_v_m + __pyx_v_n)) != 0); if (__pyx_t_8) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_None); __pyx_r = Py_None; goto __pyx_L0; } __pyx_t_8 = ((__pyx_v_best.origin >= 0) != 0); if (__pyx_t_8) { __pyx_v_start1 = 0; __pyx_t_13 = __pyx_v_best.origin; __pyx_v_start2 = __pyx_t_13; goto __pyx_L72; } /*else*/ { __pyx_v_start1 = (-__pyx_v_best.origin); __pyx_v_start2 = 0; } __pyx_L72:; #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!(((__pyx_v_best.ref_stop - __pyx_v_start1) > 0) != 0))) { PyErr_SetNone(PyExc_AssertionError); __PYX_ERR(0, 482, __pyx_L1_error) } } #endif __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_start1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_best.ref_stop); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_19 = __Pyx_PyInt_From_int(__pyx_v_start2); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_best.query_stop); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_best.matches); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); __pyx_t_20 = __Pyx_PyInt_From_int(__pyx_v_best.cost); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); __pyx_t_10 = PyTuple_New(6); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_t_19); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 3, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_10, 4, __pyx_t_18); __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_10, 5, __pyx_t_20); __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_19 = 0; __pyx_t_9 = 0; __pyx_t_18 = 0; __pyx_t_20 = 0; __pyx_r = __pyx_t_10; __pyx_t_10 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_18); __Pyx_XDECREF(__pyx_t_19); __Pyx_XDECREF(__pyx_t_20); __Pyx_AddTraceback("cutadapt._align.Aligner.locate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_query_bytes); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static void __pyx_pw_8cutadapt_6_align_7Aligner_7__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_8cutadapt_6_align_7Aligner_7__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_8cutadapt_6_align_7Aligner_6__dealloc__(((struct __pyx_obj_8cutadapt_6_align_Aligner *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_8cutadapt_6_align_7Aligner_6__dealloc__(struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); PyMem_Free(__pyx_v_self->column); /* function exit code */ __Pyx_RefNannyFinishContext(); } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_align_5locate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_8cutadapt_6_align_5locate = {"locate", (PyCFunction)__pyx_pw_8cutadapt_6_align_5locate, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_8cutadapt_6_align_5locate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_reference = 0; PyObject *__pyx_v_query = 0; double __pyx_v_max_error_rate; int __pyx_v_flags; int __pyx_v_wildcard_ref; int __pyx_v_wildcard_query; int __pyx_v_min_overlap; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("locate (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_reference,&__pyx_n_s_query,&__pyx_n_s_max_error_rate,&__pyx_n_s_flags,&__pyx_n_s_wildcard_ref,&__pyx_n_s_wildcard_query,&__pyx_n_s_min_overlap,0}; PyObject* values[7] = {0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_reference)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("locate", 0, 3, 7, 1); __PYX_ERR(0, 489, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_max_error_rate)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("locate", 0, 3, 7, 2); __PYX_ERR(0, 489, __pyx_L3_error) } case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_flags); if (value) { values[3] = value; kw_args--; } } case 4: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_wildcard_ref); if (value) { values[4] = value; kw_args--; } } case 5: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_wildcard_query); if (value) { values[5] = value; kw_args--; } } case 6: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_min_overlap); if (value) { values[6] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "locate") < 0)) __PYX_ERR(0, 489, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_reference = ((PyObject*)values[0]); __pyx_v_query = ((PyObject*)values[1]); __pyx_v_max_error_rate = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_max_error_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 489, __pyx_L3_error) if (values[3]) { __pyx_v_flags = __Pyx_PyInt_As_int(values[3]); if (unlikely((__pyx_v_flags == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 489, __pyx_L3_error) } else { __pyx_v_flags = ((int)15); } if (values[4]) { __pyx_v_wildcard_ref = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_wildcard_ref == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 489, __pyx_L3_error) } else { __pyx_v_wildcard_ref = ((int)0); } if (values[5]) { __pyx_v_wildcard_query = __Pyx_PyObject_IsTrue(values[5]); if (unlikely((__pyx_v_wildcard_query == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 489, __pyx_L3_error) } else { __pyx_v_wildcard_query = ((int)0); } if (values[6]) { __pyx_v_min_overlap = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_min_overlap == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 489, __pyx_L3_error) } else { __pyx_v_min_overlap = ((int)1); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("locate", 0, 3, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 489, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._align.locate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_reference), (&PyString_Type), 1, "reference", 1))) __PYX_ERR(0, 489, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_query), (&PyString_Type), 1, "query", 1))) __PYX_ERR(0, 489, __pyx_L1_error) __pyx_r = __pyx_pf_8cutadapt_6_align_4locate(__pyx_self, __pyx_v_reference, __pyx_v_query, __pyx_v_max_error_rate, __pyx_v_flags, __pyx_v_wildcard_ref, __pyx_v_wildcard_query, __pyx_v_min_overlap); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_align_4locate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_reference, PyObject *__pyx_v_query, double __pyx_v_max_error_rate, int __pyx_v_flags, int __pyx_v_wildcard_ref, int __pyx_v_wildcard_query, int __pyx_v_min_overlap) { struct __pyx_obj_8cutadapt_6_align_Aligner *__pyx_v_aligner = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("locate", 0); __pyx_t_1 = PyFloat_FromDouble(__pyx_v_max_error_rate); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_flags); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_wildcard_ref); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyBool_FromLong(__pyx_v_wildcard_query); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_reference); __Pyx_GIVEREF(__pyx_v_reference); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_reference); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_4); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_8cutadapt_6_align_Aligner), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 490, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_aligner = ((struct __pyx_obj_8cutadapt_6_align_Aligner *)__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_min_overlap); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_aligner), __pyx_n_s_min_overlap, __pyx_t_4) < 0) __PYX_ERR(0, 491, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_r); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_aligner), __pyx_n_s_locate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } if (!__pyx_t_3) { __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_query); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } else { __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL; __Pyx_INCREF(__pyx_v_query); __Pyx_GIVEREF(__pyx_v_query); PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_query); __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 492, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("cutadapt._align.locate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_aligner); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_align_7compare_prefixes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_8cutadapt_6_align_6compare_prefixes[] = "\n\tFind out whether one string is the prefix of the other one, allowing\n\tIUPAC wildcards in ref and/or query if the appropriate flag is set.\n\n\tThis is used to find an anchored 5' adapter (type 'FRONT') in the 'no indels' mode.\n\tThis is very simple as only the number of errors needs to be counted.\n\n\tThis function returns a tuple compatible with what Aligner.locate outputs.\n\t"; static PyMethodDef __pyx_mdef_8cutadapt_6_align_7compare_prefixes = {"compare_prefixes", (PyCFunction)__pyx_pw_8cutadapt_6_align_7compare_prefixes, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8cutadapt_6_align_6compare_prefixes}; static PyObject *__pyx_pw_8cutadapt_6_align_7compare_prefixes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_ref = 0; PyObject *__pyx_v_query = 0; int __pyx_v_wildcard_ref; int __pyx_v_wildcard_query; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("compare_prefixes (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ref,&__pyx_n_s_query,&__pyx_n_s_wildcard_ref,&__pyx_n_s_wildcard_query,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ref)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_query)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("compare_prefixes", 0, 2, 4, 1); __PYX_ERR(0, 495, __pyx_L3_error) } case 2: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_wildcard_ref); if (value) { values[2] = value; kw_args--; } } case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_wildcard_query); if (value) { values[3] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compare_prefixes") < 0)) __PYX_ERR(0, 495, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_ref = ((PyObject*)values[0]); __pyx_v_query = ((PyObject*)values[1]); if (values[2]) { __pyx_v_wildcard_ref = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_wildcard_ref == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 495, __pyx_L3_error) } else { __pyx_v_wildcard_ref = ((int)0); } if (values[3]) { __pyx_v_wildcard_query = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_wildcard_query == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 495, __pyx_L3_error) } else { __pyx_v_wildcard_query = ((int)0); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("compare_prefixes", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 495, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._align.compare_prefixes", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ref), (&PyString_Type), 1, "ref", 1))) __PYX_ERR(0, 495, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_query), (&PyString_Type), 1, "query", 1))) __PYX_ERR(0, 495, __pyx_L1_error) __pyx_r = __pyx_pf_8cutadapt_6_align_6compare_prefixes(__pyx_self, __pyx_v_ref, __pyx_v_query, __pyx_v_wildcard_ref, __pyx_v_wildcard_query); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_align_6compare_prefixes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ref, PyObject *__pyx_v_query, int __pyx_v_wildcard_ref, int __pyx_v_wildcard_query) { int __pyx_v_m; int __pyx_v_n; PyObject *__pyx_v_query_bytes = 0; PyObject *__pyx_v_ref_bytes = 0; char *__pyx_v_r_ptr; char *__pyx_v_q_ptr; int __pyx_v_length; int __pyx_v_i; int __pyx_v_matches; int __pyx_v_compare_ascii; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; char *__pyx_t_10; PyObject *__pyx_t_11 = NULL; __Pyx_RefNannySetupContext("compare_prefixes", 0); __pyx_t_1 = PyObject_Length(__pyx_v_ref); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 505, __pyx_L1_error) __pyx_v_m = __pyx_t_1; __pyx_t_1 = PyObject_Length(__pyx_v_query); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 506, __pyx_L1_error) __pyx_v_n = __pyx_t_1; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_query, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!(likely(PyBytes_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(0, 507, __pyx_L1_error) __pyx_v_query_bytes = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_ref, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; 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, 508, __pyx_L1_error) __pyx_v_ref_bytes = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __pyx_v_n; __pyx_t_5 = __pyx_v_m; if (((__pyx_t_4 < __pyx_t_5) != 0)) { __pyx_t_6 = __pyx_t_4; } else { __pyx_t_6 = __pyx_t_5; } __pyx_v_length = __pyx_t_6; __pyx_v_matches = 0; __pyx_v_compare_ascii = 0; __pyx_t_7 = (__pyx_v_wildcard_ref != 0); if (__pyx_t_7) { __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_ref_bytes, __pyx_n_s_translate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 516, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_8) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_8cutadapt_6_align_IUPAC_TABLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } else { __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 516, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; __Pyx_INCREF(__pyx_v_8cutadapt_6_align_IUPAC_TABLE); __Pyx_GIVEREF(__pyx_v_8cutadapt_6_align_IUPAC_TABLE); PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_8cutadapt_6_align_IUPAC_TABLE); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 516, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; 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, 516, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_ref_bytes, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0; goto __pyx_L3; } __pyx_t_7 = (__pyx_v_wildcard_query != 0); if (__pyx_t_7) { __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_ref_bytes, __pyx_n_s_translate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 518, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_9) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_8cutadapt_6_align_ACGT_TABLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 518, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } else { __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 518, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL; __Pyx_INCREF(__pyx_v_8cutadapt_6_align_ACGT_TABLE); __Pyx_GIVEREF(__pyx_v_8cutadapt_6_align_ACGT_TABLE); PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_8cutadapt_6_align_ACGT_TABLE); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 518, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; 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, 518, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_ref_bytes, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0; goto __pyx_L3; } /*else*/ { __pyx_v_compare_ascii = 1; } __pyx_L3:; __pyx_t_7 = (__pyx_v_wildcard_query != 0); if (__pyx_t_7) { __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_query_bytes, __pyx_n_s_translate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 522, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_8) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_8cutadapt_6_align_IUPAC_TABLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 522, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } else { __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 522, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; __Pyx_INCREF(__pyx_v_8cutadapt_6_align_IUPAC_TABLE); __Pyx_GIVEREF(__pyx_v_8cutadapt_6_align_IUPAC_TABLE); PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_8cutadapt_6_align_IUPAC_TABLE); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 522, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; 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, 522, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_query_bytes, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0; goto __pyx_L4; } __pyx_t_7 = (__pyx_v_wildcard_ref != 0); if (__pyx_t_7) { __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_query_bytes, __pyx_n_s_translate); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 524, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_9) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_8cutadapt_6_align_ACGT_TABLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 524, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } else { __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 524, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __pyx_t_9 = NULL; __Pyx_INCREF(__pyx_v_8cutadapt_6_align_ACGT_TABLE); __Pyx_GIVEREF(__pyx_v_8cutadapt_6_align_ACGT_TABLE); PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_8cutadapt_6_align_ACGT_TABLE); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 524, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; 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, 524, __pyx_L1_error) __Pyx_DECREF_SET(__pyx_v_query_bytes, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0; } __pyx_L4:; __pyx_t_7 = (__pyx_v_compare_ascii != 0); if (__pyx_t_7) { __pyx_t_6 = __pyx_v_length; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_6; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_ref, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 528, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_query, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 528, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = PyObject_RichCompare(__pyx_t_2, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 528, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 528, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (__pyx_t_7) { __pyx_v_matches = (__pyx_v_matches + 1); } } goto __pyx_L5; } /*else*/ { __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_v_ref_bytes); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 531, __pyx_L1_error) __pyx_v_r_ptr = __pyx_t_10; __pyx_t_10 = __Pyx_PyObject_AsString(__pyx_v_query_bytes); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 532, __pyx_L1_error) __pyx_v_q_ptr = __pyx_t_10; __pyx_t_6 = __pyx_v_length; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_6; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; __pyx_t_7 = ((((__pyx_v_r_ptr[__pyx_v_i]) & (__pyx_v_q_ptr[__pyx_v_i])) != 0) != 0); if (__pyx_t_7) { __pyx_v_matches = (__pyx_v_matches + 1); } } } __pyx_L5:; __Pyx_XDECREF(__pyx_r); __pyx_t_8 = __Pyx_PyInt_From_int(__pyx_v_length); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_length); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_matches); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 = __Pyx_PyInt_From_int((__pyx_v_length - __pyx_v_matches)); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_11 = PyTuple_New(6); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 538, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_8); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_int_0); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_11, 3, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_11, 4, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 5, __pyx_t_9); __pyx_t_8 = 0; __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_9 = 0; __pyx_r = __pyx_t_11; __pyx_t_11 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_11); __Pyx_AddTraceback("cutadapt._align.compare_prefixes", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_query_bytes); __Pyx_XDECREF(__pyx_v_ref_bytes); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_tp_new_8cutadapt_6_align_Aligner(PyTypeObject *t, PyObject *a, PyObject *k) { struct __pyx_obj_8cutadapt_6_align_Aligner *p; PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; p = ((struct __pyx_obj_8cutadapt_6_align_Aligner *)o); p->_dpmatrix = Py_None; Py_INCREF(Py_None); p->_reference = ((PyObject*)Py_None); Py_INCREF(Py_None); p->str_reference = ((PyObject*)Py_None); Py_INCREF(Py_None); if (unlikely(__pyx_pw_8cutadapt_6_align_7Aligner_1__cinit__(o, a, k) < 0)) { Py_DECREF(o); o = 0; } return o; } static void __pyx_tp_dealloc_8cutadapt_6_align_Aligner(PyObject *o) { struct __pyx_obj_8cutadapt_6_align_Aligner *p = (struct __pyx_obj_8cutadapt_6_align_Aligner *)o; #if PY_VERSION_HEX >= 0x030400a1 if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif PyObject_GC_UnTrack(o); { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); ++Py_REFCNT(o); __pyx_pw_8cutadapt_6_align_7Aligner_7__dealloc__(o); --Py_REFCNT(o); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->_dpmatrix); Py_CLEAR(p->_reference); Py_CLEAR(p->str_reference); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_8cutadapt_6_align_Aligner(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_8cutadapt_6_align_Aligner *p = (struct __pyx_obj_8cutadapt_6_align_Aligner *)o; if (p->_dpmatrix) { e = (*v)(p->_dpmatrix, a); if (e) return e; } return 0; } static int __pyx_tp_clear_8cutadapt_6_align_Aligner(PyObject *o) { PyObject* tmp; struct __pyx_obj_8cutadapt_6_align_Aligner *p = (struct __pyx_obj_8cutadapt_6_align_Aligner *)o; tmp = ((PyObject*)p->_dpmatrix); p->_dpmatrix = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyObject *__pyx_getprop_8cutadapt_6_align_7Aligner_min_overlap(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_8cutadapt_6_align_7Aligner_11min_overlap_1__get__(o); } static int __pyx_setprop_8cutadapt_6_align_7Aligner_min_overlap(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { return __pyx_pw_8cutadapt_6_align_7Aligner_11min_overlap_3__set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); return -1; } } static int __pyx_setprop_8cutadapt_6_align_7Aligner_indel_cost(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { return __pyx_pw_8cutadapt_6_align_7Aligner_10indel_cost_1__set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); return -1; } } static PyObject *__pyx_getprop_8cutadapt_6_align_7Aligner_reference(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_8cutadapt_6_align_7Aligner_9reference_1__get__(o); } static int __pyx_setprop_8cutadapt_6_align_7Aligner_reference(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { return __pyx_pw_8cutadapt_6_align_7Aligner_9reference_3__set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); return -1; } } static PyObject *__pyx_getprop_8cutadapt_6_align_7Aligner_dpmatrix(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_8cutadapt_6_align_7Aligner_8dpmatrix_1__get__(o); } static PyMethodDef __pyx_methods_8cutadapt_6_align_Aligner[] = { {"enable_debug", (PyCFunction)__pyx_pw_8cutadapt_6_align_7Aligner_3enable_debug, METH_NOARGS, __pyx_doc_8cutadapt_6_align_7Aligner_2enable_debug}, {"locate", (PyCFunction)__pyx_pw_8cutadapt_6_align_7Aligner_5locate, METH_O, __pyx_doc_8cutadapt_6_align_7Aligner_4locate}, {0, 0, 0, 0} }; static struct PyGetSetDef __pyx_getsets_8cutadapt_6_align_Aligner[] = { {(char *)"min_overlap", __pyx_getprop_8cutadapt_6_align_7Aligner_min_overlap, __pyx_setprop_8cutadapt_6_align_7Aligner_min_overlap, (char *)0, 0}, {(char *)"indel_cost", 0, __pyx_setprop_8cutadapt_6_align_7Aligner_indel_cost, (char *)"\n\t\tMatches cost 0, mismatches cost 1. Only insertion/deletion costs can be\n\t\tchanged.\n\t\t", 0}, {(char *)"reference", __pyx_getprop_8cutadapt_6_align_7Aligner_reference, __pyx_setprop_8cutadapt_6_align_7Aligner_reference, (char *)0, 0}, {(char *)"dpmatrix", __pyx_getprop_8cutadapt_6_align_7Aligner_dpmatrix, 0, (char *)"\n\t\tThe dynamic programming matrix as a DPMatrix object. This attribute is\n\t\tusually None, unless debugging has been enabled with enable_debug().\n\t\t", 0}, {0, 0, 0, 0, 0} }; static PyTypeObject __pyx_type_8cutadapt_6_align_Aligner = { PyVarObject_HEAD_INIT(0, 0) "cutadapt._align.Aligner", /*tp_name*/ sizeof(struct __pyx_obj_8cutadapt_6_align_Aligner), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_8cutadapt_6_align_Aligner, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ "\n\tTODO documentation still uses s1 (reference) and s2 (query).\n\n\tLocate one string within another by computing an optimal semiglobal\n\talignment between string1 and string2.\n\n\tThe alignment uses unit costs, which means that mismatches, insertions and deletions are\n\tcounted as one error.\n\n\tflags is a bitwise 'or' of the allowed flags.\n\tTo allow skipping of a prefix of string1 at no cost, set the\n\tSTART_WITHIN_SEQ1 flag.\n\tTo allow skipping of a prefix of string2 at no cost, set the\n\tSTART_WITHIN_SEQ2 flag.\n\tIf both are set, a prefix of string1 or of string1 is skipped,\n\tnever both.\n\tSimilarly, set STOP_WITHIN_SEQ1 and STOP_WITHIN_SEQ2 to\n\tallow skipping of suffixes of string1 or string2. Again, when both\n\tflags are set, never suffixes in both strings are skipped.\n\tIf all flags are set, this results in standard semiglobal alignment.\n\n\tThe skipped parts are described with two intervals (start1, stop1),\n\t(start2, stop2).\n\n\tFor example, an optimal semiglobal alignment of SISSI and MISSISSIPPI looks like this:\n\n\t---SISSI---\n\tMISSISSIPPI\n\n\tstart1, stop1 = 0, 5\n\tstart2, stop2 = 3, 8\n\t(with zero errors)\n\n\tThe aligned parts are string1[start1:stop1] and string2[start2:stop2].\n\n\tThe error rate is: errors / length where length is (stop1 - start1).\n\n\tAn optimal alignment fulfills all of these criteria:\n\n\t- its error_rate is at most max_error_rate\n\t- Among those alignments with error_rate <= max_error_rate, the alignment contains\n\t a maximal number of matches (there is no alignment with more matches).\n\t- If there are multiple alignments with the same no. of matches, then one that\n\t has minimal no. of errors is chosen.\n\t- If there are still multiple candidates, choose the alignment that starts at the\n\t leftmost position within the read.\n\n\tThe alignment itself is not returned, only the tuple\n\t(start1, stop1, start2, stop2, matches, errors), where the first four fields have the\n\tmeaning as describ""ed, matches is the number of matches and errors is the number of\n\terrors in the alignment.\n\n\tIt is always the case that at least one of start1 and start2 is zero.\n\n\tIUPAC wildcard characters can be allowed in the reference and the query\n\tby setting the appropriate flags.\n\n\tIf neither flag is set, the full ASCII alphabet is used for comparison.\n\tIf any of the flags is set, all non-IUPAC characters in the sequences\n\tcompare as 'not equal'.\n\t", /*tp_doc*/ __pyx_tp_traverse_8cutadapt_6_align_Aligner, /*tp_traverse*/ __pyx_tp_clear_8cutadapt_6_align_Aligner, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_8cutadapt_6_align_Aligner, /*tp_methods*/ 0, /*tp_members*/ __pyx_getsets_8cutadapt_6_align_Aligner, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_8cutadapt_6_align_Aligner, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__ *__pyx_freelist_8cutadapt_6_align___pyx_scope_struct____str__[8]; static int __pyx_freecount_8cutadapt_6_align___pyx_scope_struct____str__ = 0; static PyObject *__pyx_tp_new_8cutadapt_6_align___pyx_scope_struct____str__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8cutadapt_6_align___pyx_scope_struct____str__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__)))) { o = (PyObject*)__pyx_freelist_8cutadapt_6_align___pyx_scope_struct____str__[--__pyx_freecount_8cutadapt_6_align___pyx_scope_struct____str__]; memset(o, 0, sizeof(struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } return o; } static void __pyx_tp_dealloc_8cutadapt_6_align___pyx_scope_struct____str__(PyObject *o) { struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__ *p = (struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__ *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_row); Py_CLEAR(p->__pyx_v_self); if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8cutadapt_6_align___pyx_scope_struct____str__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__)))) { __pyx_freelist_8cutadapt_6_align___pyx_scope_struct____str__[__pyx_freecount_8cutadapt_6_align___pyx_scope_struct____str__++] = ((struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__ *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } static int __pyx_tp_traverse_8cutadapt_6_align___pyx_scope_struct____str__(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__ *p = (struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__ *)o; if (p->__pyx_v_row) { e = (*v)(p->__pyx_v_row, a); if (e) return e; } if (p->__pyx_v_self) { e = (*v)(p->__pyx_v_self, a); if (e) return e; } return 0; } static int __pyx_tp_clear_8cutadapt_6_align___pyx_scope_struct____str__(PyObject *o) { PyObject* tmp; struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__ *p = (struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__ *)o; tmp = ((PyObject*)p->__pyx_v_row); p->__pyx_v_row = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_self); p->__pyx_v_self = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyTypeObject __pyx_type_8cutadapt_6_align___pyx_scope_struct____str__ = { PyVarObject_HEAD_INIT(0, 0) "cutadapt._align.__pyx_scope_struct____str__", /*tp_name*/ sizeof(struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_8cutadapt_6_align___pyx_scope_struct____str__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_8cutadapt_6_align___pyx_scope_struct____str__, /*tp_traverse*/ __pyx_tp_clear_8cutadapt_6_align___pyx_scope_struct____str__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_8cutadapt_6_align___pyx_scope_struct____str__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_1_genexpr *__pyx_freelist_8cutadapt_6_align___pyx_scope_struct_1_genexpr[8]; static int __pyx_freecount_8cutadapt_6_align___pyx_scope_struct_1_genexpr = 0; static PyObject *__pyx_tp_new_8cutadapt_6_align___pyx_scope_struct_1_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8cutadapt_6_align___pyx_scope_struct_1_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_1_genexpr)))) { o = (PyObject*)__pyx_freelist_8cutadapt_6_align___pyx_scope_struct_1_genexpr[--__pyx_freecount_8cutadapt_6_align___pyx_scope_struct_1_genexpr]; memset(o, 0, sizeof(struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_1_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } return o; } static void __pyx_tp_dealloc_8cutadapt_6_align___pyx_scope_struct_1_genexpr(PyObject *o) { struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_1_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_c); Py_CLEAR(p->__pyx_t_0); if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8cutadapt_6_align___pyx_scope_struct_1_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_1_genexpr)))) { __pyx_freelist_8cutadapt_6_align___pyx_scope_struct_1_genexpr[__pyx_freecount_8cutadapt_6_align___pyx_scope_struct_1_genexpr++] = ((struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_1_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } static int __pyx_tp_traverse_8cutadapt_6_align___pyx_scope_struct_1_genexpr(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_1_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } if (p->__pyx_v_c) { e = (*v)(p->__pyx_v_c, a); if (e) return e; } if (p->__pyx_t_0) { e = (*v)(p->__pyx_t_0, a); if (e) return e; } return 0; } static int __pyx_tp_clear_8cutadapt_6_align___pyx_scope_struct_1_genexpr(PyObject *o) { PyObject* tmp; struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_1_genexpr *p = (struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_1_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); p->__pyx_outer_scope = ((struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__ *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_c); p->__pyx_v_c = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_t_0); p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyTypeObject __pyx_type_8cutadapt_6_align___pyx_scope_struct_1_genexpr = { PyVarObject_HEAD_INIT(0, 0) "cutadapt._align.__pyx_scope_struct_1_genexpr", /*tp_name*/ sizeof(struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_1_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_8cutadapt_6_align___pyx_scope_struct_1_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_8cutadapt_6_align___pyx_scope_struct_1_genexpr, /*tp_traverse*/ __pyx_tp_clear_8cutadapt_6_align___pyx_scope_struct_1_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_8cutadapt_6_align___pyx_scope_struct_1_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_2_genexpr *__pyx_freelist_8cutadapt_6_align___pyx_scope_struct_2_genexpr[8]; static int __pyx_freecount_8cutadapt_6_align___pyx_scope_struct_2_genexpr = 0; static PyObject *__pyx_tp_new_8cutadapt_6_align___pyx_scope_struct_2_genexpr(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8cutadapt_6_align___pyx_scope_struct_2_genexpr > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_2_genexpr)))) { o = (PyObject*)__pyx_freelist_8cutadapt_6_align___pyx_scope_struct_2_genexpr[--__pyx_freecount_8cutadapt_6_align___pyx_scope_struct_2_genexpr]; memset(o, 0, sizeof(struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_2_genexpr)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } return o; } static void __pyx_tp_dealloc_8cutadapt_6_align___pyx_scope_struct_2_genexpr(PyObject *o) { struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_2_genexpr *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_outer_scope); Py_CLEAR(p->__pyx_v_v); Py_CLEAR(p->__pyx_t_0); if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8cutadapt_6_align___pyx_scope_struct_2_genexpr < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_2_genexpr)))) { __pyx_freelist_8cutadapt_6_align___pyx_scope_struct_2_genexpr[__pyx_freecount_8cutadapt_6_align___pyx_scope_struct_2_genexpr++] = ((struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_2_genexpr *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } static int __pyx_tp_traverse_8cutadapt_6_align___pyx_scope_struct_2_genexpr(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_2_genexpr *)o; if (p->__pyx_outer_scope) { e = (*v)(((PyObject*)p->__pyx_outer_scope), a); if (e) return e; } if (p->__pyx_v_v) { e = (*v)(p->__pyx_v_v, a); if (e) return e; } if (p->__pyx_t_0) { e = (*v)(p->__pyx_t_0, a); if (e) return e; } return 0; } static int __pyx_tp_clear_8cutadapt_6_align___pyx_scope_struct_2_genexpr(PyObject *o) { PyObject* tmp; struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_2_genexpr *p = (struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_2_genexpr *)o; tmp = ((PyObject*)p->__pyx_outer_scope); p->__pyx_outer_scope = ((struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct____str__ *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_v); p->__pyx_v_v = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_t_0); p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyTypeObject __pyx_type_8cutadapt_6_align___pyx_scope_struct_2_genexpr = { PyVarObject_HEAD_INIT(0, 0) "cutadapt._align.__pyx_scope_struct_2_genexpr", /*tp_name*/ sizeof(struct __pyx_obj_8cutadapt_6_align___pyx_scope_struct_2_genexpr), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_8cutadapt_6_align___pyx_scope_struct_2_genexpr, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_8cutadapt_6_align___pyx_scope_struct_2_genexpr, /*tp_traverse*/ __pyx_tp_clear_8cutadapt_6_align___pyx_scope_struct_2_genexpr, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_8cutadapt_6_align___pyx_scope_struct_2_genexpr, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { #if PY_VERSION_HEX < 0x03020000 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, #else PyModuleDef_HEAD_INIT, #endif "_align", 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_b_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 0, 0}, {&__pyx_kp_s_0_2d, __pyx_k_0_2d, sizeof(__pyx_k_0_2d), 0, 0, 1, 0}, {&__pyx_n_s_A, __pyx_k_A, sizeof(__pyx_k_A), 0, 0, 1, 1}, {&__pyx_n_s_B, __pyx_k_B, sizeof(__pyx_k_B), 0, 0, 1, 1}, {&__pyx_n_s_C, __pyx_k_C, sizeof(__pyx_k_C), 0, 0, 1, 1}, {&__pyx_n_s_D, __pyx_k_D, sizeof(__pyx_k_D), 0, 0, 1, 1}, {&__pyx_n_s_DPMatrix, __pyx_k_DPMatrix, sizeof(__pyx_k_DPMatrix), 0, 0, 1, 1}, {&__pyx_n_s_DPMatrix___init, __pyx_k_DPMatrix___init, sizeof(__pyx_k_DPMatrix___init), 0, 0, 1, 1}, {&__pyx_n_s_DPMatrix___str, __pyx_k_DPMatrix___str, sizeof(__pyx_k_DPMatrix___str), 0, 0, 1, 1}, {&__pyx_n_s_DPMatrix___str___locals_genexpr, __pyx_k_DPMatrix___str___locals_genexpr, sizeof(__pyx_k_DPMatrix___str___locals_genexpr), 0, 0, 1, 1}, {&__pyx_n_s_DPMatrix_set_entry, __pyx_k_DPMatrix_set_entry, sizeof(__pyx_k_DPMatrix_set_entry), 0, 0, 1, 1}, {&__pyx_n_s_G, __pyx_k_G, sizeof(__pyx_k_G), 0, 0, 1, 1}, {&__pyx_n_s_H, __pyx_k_H, sizeof(__pyx_k_H), 0, 0, 1, 1}, {&__pyx_kp_s_Insertion_deletion_cost_must_be, __pyx_k_Insertion_deletion_cost_must_be, sizeof(__pyx_k_Insertion_deletion_cost_must_be), 0, 0, 1, 0}, {&__pyx_n_s_K, __pyx_k_K, sizeof(__pyx_k_K), 0, 0, 1, 1}, {&__pyx_n_s_M, __pyx_k_M, sizeof(__pyx_k_M), 0, 0, 1, 1}, {&__pyx_n_s_MemoryError, __pyx_k_MemoryError, sizeof(__pyx_k_MemoryError), 0, 0, 1, 1}, {&__pyx_kp_s_Minimum_overlap_must_be_at_least, __pyx_k_Minimum_overlap_must_be_at_least, sizeof(__pyx_k_Minimum_overlap_must_be_at_least), 0, 0, 1, 0}, {&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1}, {&__pyx_n_s_R, __pyx_k_R, sizeof(__pyx_k_R), 0, 0, 1, 1}, {&__pyx_kp_s_Representation_of_the_dynamic_p, __pyx_k_Representation_of_the_dynamic_p, sizeof(__pyx_k_Representation_of_the_dynamic_p), 0, 0, 1, 0}, {&__pyx_n_s_S, __pyx_k_S, sizeof(__pyx_k_S), 0, 0, 1, 1}, {&__pyx_n_s_START_WITHIN_QUERY, __pyx_k_START_WITHIN_QUERY, sizeof(__pyx_k_START_WITHIN_QUERY), 0, 0, 1, 1}, {&__pyx_n_s_START_WITHIN_REFERENCE, __pyx_k_START_WITHIN_REFERENCE, sizeof(__pyx_k_START_WITHIN_REFERENCE), 0, 0, 1, 1}, {&__pyx_n_s_STOP_WITHIN_QUERY, __pyx_k_STOP_WITHIN_QUERY, sizeof(__pyx_k_STOP_WITHIN_QUERY), 0, 0, 1, 1}, {&__pyx_n_s_STOP_WITHIN_REFERENCE, __pyx_k_STOP_WITHIN_REFERENCE, sizeof(__pyx_k_STOP_WITHIN_REFERENCE), 0, 0, 1, 1}, {&__pyx_n_s_T, __pyx_k_T, sizeof(__pyx_k_T), 0, 0, 1, 1}, {&__pyx_n_s_U, __pyx_k_U, sizeof(__pyx_k_U), 0, 0, 1, 1}, {&__pyx_n_s_V, __pyx_k_V, sizeof(__pyx_k_V), 0, 0, 1, 1}, {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, {&__pyx_n_s_W, __pyx_k_W, sizeof(__pyx_k_W), 0, 0, 1, 1}, {&__pyx_n_s_X, __pyx_k_X, sizeof(__pyx_k_X), 0, 0, 1, 1}, {&__pyx_n_s_Y, __pyx_k_Y, sizeof(__pyx_k_Y), 0, 0, 1, 1}, {&__pyx_n_s__19, __pyx_k__19, sizeof(__pyx_k__19), 0, 0, 1, 1}, {&__pyx_kp_s__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 0, 1, 0}, {&__pyx_kp_s__6, __pyx_k__6, sizeof(__pyx_k__6), 0, 0, 1, 0}, {&__pyx_kp_s__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 1, 0}, {&__pyx_kp_s__8, __pyx_k__8, sizeof(__pyx_k__8), 0, 0, 1, 0}, {&__pyx_n_s_acgt_table, __pyx_k_acgt_table, sizeof(__pyx_k_acgt_table), 0, 0, 1, 1}, {&__pyx_n_s_aligner, __pyx_k_aligner, sizeof(__pyx_k_aligner), 0, 0, 1, 1}, {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, {&__pyx_n_s_ascii, __pyx_k_ascii, sizeof(__pyx_k_ascii), 0, 0, 1, 1}, {&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1}, {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1}, {&__pyx_n_s_compare_ascii, __pyx_k_compare_ascii, sizeof(__pyx_k_compare_ascii), 0, 0, 1, 1}, {&__pyx_n_s_compare_prefixes, __pyx_k_compare_prefixes, sizeof(__pyx_k_compare_prefixes), 0, 0, 1, 1}, {&__pyx_n_s_cost, __pyx_k_cost, sizeof(__pyx_k_cost), 0, 0, 1, 1}, {&__pyx_n_s_cutadapt__align, __pyx_k_cutadapt__align, sizeof(__pyx_k_cutadapt__align), 0, 0, 1, 1}, {&__pyx_n_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 1}, {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1}, {&__pyx_n_s_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 0, 0, 1, 1}, {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, {&__pyx_n_s_genexpr, __pyx_k_genexpr, sizeof(__pyx_k_genexpr), 0, 0, 1, 1}, {&__pyx_kp_s_home_marcel_scm_cutadapt_cutada, __pyx_k_home_marcel_scm_cutadapt_cutada, sizeof(__pyx_k_home_marcel_scm_cutadapt_cutada), 0, 0, 1, 0}, {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1}, {&__pyx_n_s_iupac, __pyx_k_iupac, sizeof(__pyx_k_iupac), 0, 0, 1, 1}, {&__pyx_n_s_iupac_table, __pyx_k_iupac_table, sizeof(__pyx_k_iupac_table), 0, 0, 1, 1}, {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1}, {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1}, {&__pyx_n_s_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 0, 1, 1}, {&__pyx_n_s_locate, __pyx_k_locate, sizeof(__pyx_k_locate), 0, 0, 1, 1}, {&__pyx_n_s_lower, __pyx_k_lower, sizeof(__pyx_k_lower), 0, 0, 1, 1}, {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_matches, __pyx_k_matches, sizeof(__pyx_k_matches), 0, 0, 1, 1}, {&__pyx_n_s_max_error_rate, __pyx_k_max_error_rate, sizeof(__pyx_k_max_error_rate), 0, 0, 1, 1}, {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, {&__pyx_n_s_min_overlap, __pyx_k_min_overlap, sizeof(__pyx_k_min_overlap), 0, 0, 1, 1}, {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1}, {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, {&__pyx_n_s_q_ptr, __pyx_k_q_ptr, sizeof(__pyx_k_q_ptr), 0, 0, 1, 1}, {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, {&__pyx_n_s_query, __pyx_k_query, sizeof(__pyx_k_query), 0, 0, 1, 1}, {&__pyx_n_s_query_bytes, __pyx_k_query_bytes, sizeof(__pyx_k_query_bytes), 0, 0, 1, 1}, {&__pyx_n_s_r, __pyx_k_r, sizeof(__pyx_k_r), 0, 0, 1, 1}, {&__pyx_n_s_r_ptr, __pyx_k_r_ptr, sizeof(__pyx_k_r_ptr), 0, 0, 1, 1}, {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, {&__pyx_n_s_ref, __pyx_k_ref, sizeof(__pyx_k_ref), 0, 0, 1, 1}, {&__pyx_n_s_ref_bytes, __pyx_k_ref_bytes, sizeof(__pyx_k_ref_bytes), 0, 0, 1, 1}, {&__pyx_n_s_reference, __pyx_k_reference, sizeof(__pyx_k_reference), 0, 0, 1, 1}, {&__pyx_n_s_rjust, __pyx_k_rjust, sizeof(__pyx_k_rjust), 0, 0, 1, 1}, {&__pyx_n_s_row, __pyx_k_row, sizeof(__pyx_k_row), 0, 0, 1, 1}, {&__pyx_n_s_rows, __pyx_k_rows, sizeof(__pyx_k_rows), 0, 0, 1, 1}, {&__pyx_n_s_rows_2, __pyx_k_rows_2, sizeof(__pyx_k_rows_2), 0, 0, 1, 1}, {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1}, {&__pyx_n_s_set_entry, __pyx_k_set_entry, sizeof(__pyx_k_set_entry), 0, 0, 1, 1}, {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1}, {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1}, {&__pyx_n_s_translate, __pyx_k_translate, sizeof(__pyx_k_translate), 0, 0, 1, 1}, {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1}, {&__pyx_n_s_wildcard_query, __pyx_k_wildcard_query, sizeof(__pyx_k_wildcard_query), 0, 0, 1, 1}, {&__pyx_n_s_wildcard_ref, __pyx_k_wildcard_ref, sizeof(__pyx_k_wildcard_ref), 0, 0, 1, 1}, {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 98, __pyx_L1_error) __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 113, __pyx_L1_error) __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 219, __pyx_L1_error) __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(0, 240, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_b_); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_b_); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); __pyx_tuple__4 = PyTuple_Pack(1, __pyx_int_2); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_Minimum_overlap_must_be_at_least); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 219, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Insertion_deletion_cost_must_be); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); __pyx_tuple__11 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 280, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); __pyx_tuple__13 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13); __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_ascii); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14); __pyx_tuple__15 = PyTuple_Pack(4, __pyx_n_s_d, __pyx_n_s_t, __pyx_n_s_c, __pyx_n_s_v); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(0, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_marcel_scm_cutadapt_cutada, __pyx_n_s_acgt_table, 25, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 25, __pyx_L1_error) __pyx_tuple__17 = PyTuple_Pack(8, __pyx_n_s_A, __pyx_n_s_C, __pyx_n_s_G, __pyx_n_s_T, __pyx_n_s_iupac, __pyx_n_s_t, __pyx_n_s_c, __pyx_n_s_v); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(0, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_marcel_scm_cutadapt_cutada, __pyx_n_s_iupac_table, 41, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 41, __pyx_L1_error) __pyx_tuple__20 = PyTuple_Pack(6, __pyx_n_s_self, __pyx_n_s_reference, __pyx_n_s_query, __pyx_n_s_m, __pyx_n_s_n, __pyx_n_s__19); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__20); __Pyx_GIVEREF(__pyx_tuple__20); __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_marcel_scm_cutadapt_cutada, __pyx_n_s_init, 95, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 95, __pyx_L1_error) __pyx_tuple__22 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_cost); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22); __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_marcel_scm_cutadapt_cutada, __pyx_n_s_set_entry, 102, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 102, __pyx_L1_error) __pyx_tuple__24 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_rows_2, __pyx_n_s_c, __pyx_n_s_row, __pyx_n_s_r, __pyx_n_s_genexpr, __pyx_n_s_genexpr, __pyx_n_s_genexpr); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__24); __Pyx_GIVEREF(__pyx_tuple__24); __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(1, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_marcel_scm_cutadapt_cutada, __pyx_n_s_str, 108, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 108, __pyx_L1_error) __pyx_tuple__26 = PyTuple_Pack(8, __pyx_n_s_reference, __pyx_n_s_query, __pyx_n_s_max_error_rate, __pyx_n_s_flags, __pyx_n_s_wildcard_ref, __pyx_n_s_wildcard_query, __pyx_n_s_min_overlap, __pyx_n_s_aligner); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 489, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__26); __Pyx_GIVEREF(__pyx_tuple__26); __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(7, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_marcel_scm_cutadapt_cutada, __pyx_n_s_locate, 489, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 489, __pyx_L1_error) __pyx_tuple__28 = PyTuple_Pack(14, __pyx_n_s_ref, __pyx_n_s_query, __pyx_n_s_wildcard_ref, __pyx_n_s_wildcard_query, __pyx_n_s_m, __pyx_n_s_n, __pyx_n_s_query_bytes, __pyx_n_s_ref_bytes, __pyx_n_s_r_ptr, __pyx_n_s_q_ptr, __pyx_n_s_length, __pyx_n_s_i, __pyx_n_s_matches, __pyx_n_s_compare_ascii); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__28); __Pyx_GIVEREF(__pyx_tuple__28); __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(4, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_marcel_scm_cutadapt_cutada, __pyx_n_s_compare_prefixes, 495, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { __pyx_umethod_PyDict_Type_items.type = (PyObject*)&PyDict_Type; if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_8 = PyInt_FromLong(8); if (unlikely(!__pyx_int_8)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_256 = PyInt_FromLong(256); if (unlikely(!__pyx_int_256)) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC init_align(void); /*proto*/ PyMODINIT_FUNC init_align(void) #else PyMODINIT_FUNC PyInit__align(void); /*proto*/ PyMODINIT_FUNC PyInit__align(void) #endif { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__align(void)", 0); if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4("_align", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_d); __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif if (__pyx_module_is_main_cutadapt___align) { if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "cutadapt._align")) { if (unlikely(PyDict_SetItemString(modules, "cutadapt._align", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif /*--- Builtin init code ---*/ if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Global init code ---*/ __pyx_v_8cutadapt_6_align_ACGT_TABLE = ((PyObject*)Py_None); Py_INCREF(Py_None); __pyx_v_8cutadapt_6_align_IUPAC_TABLE = ((PyObject*)Py_None); Py_INCREF(Py_None); /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ if (PyType_Ready(&__pyx_type_8cutadapt_6_align_Aligner) < 0) __PYX_ERR(0, 119, __pyx_L1_error) __pyx_type_8cutadapt_6_align_Aligner.tp_print = 0; if (PyObject_SetAttrString(__pyx_m, "Aligner", (PyObject *)&__pyx_type_8cutadapt_6_align_Aligner) < 0) __PYX_ERR(0, 119, __pyx_L1_error) __pyx_ptype_8cutadapt_6_align_Aligner = &__pyx_type_8cutadapt_6_align_Aligner; if (PyType_Ready(&__pyx_type_8cutadapt_6_align___pyx_scope_struct____str__) < 0) __PYX_ERR(0, 108, __pyx_L1_error) __pyx_type_8cutadapt_6_align___pyx_scope_struct____str__.tp_print = 0; __pyx_ptype_8cutadapt_6_align___pyx_scope_struct____str__ = &__pyx_type_8cutadapt_6_align___pyx_scope_struct____str__; if (PyType_Ready(&__pyx_type_8cutadapt_6_align___pyx_scope_struct_1_genexpr) < 0) __PYX_ERR(0, 112, __pyx_L1_error) __pyx_type_8cutadapt_6_align___pyx_scope_struct_1_genexpr.tp_print = 0; __pyx_ptype_8cutadapt_6_align___pyx_scope_struct_1_genexpr = &__pyx_type_8cutadapt_6_align___pyx_scope_struct_1_genexpr; if (PyType_Ready(&__pyx_type_8cutadapt_6_align___pyx_scope_struct_2_genexpr) < 0) __PYX_ERR(0, 114, __pyx_L1_error) __pyx_type_8cutadapt_6_align___pyx_scope_struct_2_genexpr.tp_print = 0; __pyx_ptype_8cutadapt_6_align___pyx_scope_struct_2_genexpr = &__pyx_type_8cutadapt_6_align___pyx_scope_struct_2_genexpr; /*--- Type import code ---*/ /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8cutadapt_6_align_1_acgt_table, NULL, __pyx_n_s_cutadapt__align); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_acgt_table, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8cutadapt_6_align_3_iupac_table, NULL, __pyx_n_s_cutadapt__align); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_iupac_table, __pyx_t_1) < 0) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_acgt_table); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_XGOTREF(__pyx_v_8cutadapt_6_align_ACGT_TABLE); __Pyx_DECREF_SET(__pyx_v_8cutadapt_6_align_ACGT_TABLE, ((PyObject*)__pyx_t_1)); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_iupac_table); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 82, __pyx_L1_error) __Pyx_XGOTREF(__pyx_v_8cutadapt_6_align_IUPAC_TABLE); __Pyx_DECREF_SET(__pyx_v_8cutadapt_6_align_IUPAC_TABLE, ((PyObject*)__pyx_t_1)); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_DPMatrix, __pyx_n_s_DPMatrix, (PyObject *) NULL, __pyx_n_s_cutadapt__align, __pyx_kp_s_Representation_of_the_dynamic_p); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8cutadapt_6_align_8DPMatrix_1__init__, 0, __pyx_n_s_DPMatrix___init, NULL, __pyx_n_s_cutadapt__align, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8cutadapt_6_align_8DPMatrix_3set_entry, 0, __pyx_n_s_DPMatrix_set_entry, NULL, __pyx_n_s_cutadapt__align, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_set_entry, __pyx_t_2) < 0) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8cutadapt_6_align_8DPMatrix_5__str__, 0, __pyx_n_s_DPMatrix___str, NULL, __pyx_n_s_cutadapt__align, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_str, __pyx_t_2) < 0) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_DPMatrix, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_DPMatrix, __pyx_t_2) < 0) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem((PyObject *)__pyx_ptype_8cutadapt_6_align_Aligner->tp_dict, __pyx_n_s_START_WITHIN_REFERENCE, __pyx_int_1) < 0) __PYX_ERR(0, 195, __pyx_L1_error) PyType_Modified(__pyx_ptype_8cutadapt_6_align_Aligner); if (PyDict_SetItem((PyObject *)__pyx_ptype_8cutadapt_6_align_Aligner->tp_dict, __pyx_n_s_START_WITHIN_QUERY, __pyx_int_2) < 0) __PYX_ERR(0, 196, __pyx_L1_error) PyType_Modified(__pyx_ptype_8cutadapt_6_align_Aligner); if (PyDict_SetItem((PyObject *)__pyx_ptype_8cutadapt_6_align_Aligner->tp_dict, __pyx_n_s_STOP_WITHIN_REFERENCE, __pyx_int_4) < 0) __PYX_ERR(0, 197, __pyx_L1_error) PyType_Modified(__pyx_ptype_8cutadapt_6_align_Aligner); if (PyDict_SetItem((PyObject *)__pyx_ptype_8cutadapt_6_align_Aligner->tp_dict, __pyx_n_s_STOP_WITHIN_QUERY, __pyx_int_8) < 0) __PYX_ERR(0, 198, __pyx_L1_error) PyType_Modified(__pyx_ptype_8cutadapt_6_align_Aligner); __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8cutadapt_6_align_5locate, NULL, __pyx_n_s_cutadapt__align); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 489, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_locate, __pyx_t_1) < 0) __PYX_ERR(0, 489, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8cutadapt_6_align_7compare_prefixes, NULL, __pyx_n_s_cutadapt__align); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_compare_prefixes, __pyx_t_1) < 0) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { if (__pyx_d) { __Pyx_AddTraceback("init cutadapt._align", __pyx_clineno, __pyx_lineno, __pyx_filename); } Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init cutadapt._align"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* --- Runtime support code --- */ /* Refnanny */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); if (unlikely(!result)) { PyErr_Format(PyExc_NameError, #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); #else "name '%.200s' is not defined", PyString_AS_STRING(name)); #endif } return result; } /* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *result; ternaryfunc call = func->ob_type->tp_call; if (unlikely(!call)) return PyObject_Call(func, arg, kw); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) return NULL; result = (*call)(func, arg, kw); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* UnpackUnboundCMethod */ static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) { PyObject *method; method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name); if (unlikely(!method)) return -1; target->method = method; #if CYTHON_COMPILING_IN_CPYTHON #if PY_MAJOR_VERSION >= 3 if (likely(PyObject_TypeCheck(method, &PyMethodDescr_Type))) #endif { PyMethodDescrObject *descr = (PyMethodDescrObject*) method; target->func = descr->d_method->ml_meth; target->flag = descr->d_method->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_O | METH_NOARGS); } #endif return 0; } /* CallUnboundCMethod0 */ static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self) { PyObject *args, *result = NULL; if (unlikely(!cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL; #if CYTHON_COMPILING_IN_CPYTHON args = PyTuple_New(1); if (unlikely(!args)) goto bad; Py_INCREF(self); PyTuple_SET_ITEM(args, 0, self); #else args = PyTuple_Pack(1, self); if (unlikely(!args)) goto bad; #endif result = __Pyx_PyObject_Call(cfunc->method, args, NULL); Py_DECREF(args); bad: return result; } /* py_dict_items */ static CYTHON_INLINE PyObject* __Pyx_PyDict_Items(PyObject* d) { if (PY_MAJOR_VERSION >= 3) return __Pyx_CallUnboundCMethod0(&__pyx_umethod_PyDict_Type_items, d); else return PyDict_Items(d); } /* RaiseTooManyValuesToUnpack */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } /* RaiseNeedMoreValuesToUnpack */ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", index, (index == 1) ? "" : "s"); } /* IterFinish */ static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); PyObject* exc_type = tstate->curexc_type; if (unlikely(exc_type)) { if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { PyObject *exc_value, *exc_tb; exc_value = tstate->curexc_value; exc_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; Py_DECREF(exc_type); Py_XDECREF(exc_value); Py_XDECREF(exc_tb); return 0; } else { return -1; } } return 0; #else if (unlikely(PyErr_Occurred())) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { PyErr_Clear(); return 0; } else { return -1; } } return 0; #endif } /* UnpackItemEndCheck */ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; } else { return __Pyx_IterFinish(); } return 0; } /* UnicodeAsUCS4 */ static CYTHON_INLINE Py_UCS4 __Pyx_PyUnicode_AsPy_UCS4(PyObject* x) { Py_ssize_t length; #if CYTHON_PEP393_ENABLED length = PyUnicode_GET_LENGTH(x); if (likely(length == 1)) { return PyUnicode_READ_CHAR(x, 0); } #else length = PyUnicode_GET_SIZE(x); if (likely(length == 1)) { return PyUnicode_AS_UNICODE(x)[0]; } #if Py_UNICODE_SIZE == 2 else if (PyUnicode_GET_SIZE(x) == 2) { Py_UCS4 high_val = PyUnicode_AS_UNICODE(x)[0]; if (high_val >= 0xD800 && high_val <= 0xDBFF) { Py_UCS4 low_val = PyUnicode_AS_UNICODE(x)[1]; if (low_val >= 0xDC00 && low_val <= 0xDFFF) { return 0x10000 + (((high_val & ((1<<10)-1)) << 10) | (low_val & ((1<<10)-1))); } } } #endif #endif PyErr_Format(PyExc_ValueError, "only single character unicode strings can be converted to Py_UCS4, " "got length %" CYTHON_FORMAT_SSIZE_T "d", length); return (Py_UCS4)-1; } /* object_ord */ static long __Pyx__PyObject_Ord(PyObject* c) { Py_ssize_t size; if (PyBytes_Check(c)) { size = PyBytes_GET_SIZE(c); if (likely(size == 1)) { return (unsigned char) PyBytes_AS_STRING(c)[0]; } #if PY_MAJOR_VERSION < 3 } else if (PyUnicode_Check(c)) { return (long)__Pyx_PyUnicode_AsPy_UCS4(c); #endif #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) } else if (PyByteArray_Check(c)) { size = PyByteArray_GET_SIZE(c); if (likely(size == 1)) { return (unsigned char) PyByteArray_AS_STRING(c)[0]; } #endif } else { PyErr_Format(PyExc_TypeError, "ord() expected string of length 1, but %.200s found", c->ob_type->tp_name); return (long)(Py_UCS4)-1; } PyErr_Format(PyExc_TypeError, "ord() expected a character, but string of length %zd found", size); return (long)(Py_UCS4)-1; } /* SetItemIntByteArray */ static CYTHON_INLINE int __Pyx_SetItemInt_ByteArray_Fast(PyObject* string, Py_ssize_t i, unsigned char v, int wraparound, int boundscheck) { Py_ssize_t length; if (wraparound | boundscheck) { length = PyByteArray_GET_SIZE(string); if (wraparound & unlikely(i < 0)) i += length; if ((!boundscheck) || likely((0 <= i) & (i < length))) { PyByteArray_AS_STRING(string)[i] = (char) v; return 0; } else { PyErr_SetString(PyExc_IndexError, "bytearray index out of range"); return -1; } } else { PyByteArray_AS_STRING(string)[i] = (char) v; return 0; } } /* PyObjectCallMethO */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { PyObject *self, *result; PyCFunction cfunc; cfunc = PyCFunction_GET_FUNCTION(func); self = PyCFunction_GET_SELF(func); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) return NULL; result = cfunc(self, arg); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyObjectCallOneArg */ #if CYTHON_COMPILING_IN_CPYTHON static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *result; PyObject *args = PyTuple_New(1); if (unlikely(!args)) return NULL; Py_INCREF(arg); PyTuple_SET_ITEM(args, 0, arg); result = __Pyx_PyObject_Call(func, args, NULL); Py_DECREF(args); return result; } static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { #ifdef __Pyx_CyFunction_USED if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { #else if (likely(PyCFunction_Check(func))) { #endif if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { return __Pyx_PyObject_CallMethO(func, arg); } } return __Pyx__PyObject_CallOneArg(func, arg); } #else static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *result; PyObject *args = PyTuple_Pack(1, arg); if (unlikely(!args)) return NULL; result = __Pyx_PyObject_Call(func, args, NULL); Py_DECREF(args); return result; } #endif /* PyObjectCallNoArg */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { #ifdef __Pyx_CyFunction_USED if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { #else if (likely(PyCFunction_Check(func))) { #endif if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { return __Pyx_PyObject_CallMethO(func, NULL); } } return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); } #endif /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } /* RaiseDoubleKeywords */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AsString(kw_name)); #endif } /* ParseKeywords */ static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; continue; } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { if ((**argname == key) || ( (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) && _PyString_Eq(**argname, key))) { goto arg_passed_twice; } argname++; } } } else #endif if (likely(PyUnicode_Check(key))) { while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; argname++; } } } else goto invalid_keyword_type; if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%.200s() got an unexpected keyword argument '%.200s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } /* PyIntBinop */ #if CYTHON_COMPILING_IN_CPYTHON static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) { #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(op1))) { const long b = intval; long x; long a = PyInt_AS_LONG(op1); x = (long)((unsigned long)a + b); if (likely((x^a) >= 0 || (x^b) >= 0)) return PyInt_FromLong(x); return PyLong_Type.tp_as_number->nb_add(op1, op2); } #endif #if CYTHON_USE_PYLONG_INTERNALS && PY_MAJOR_VERSION >= 3 if (likely(PyLong_CheckExact(op1))) { const long b = intval; long a, x; const PY_LONG_LONG llb = intval; PY_LONG_LONG lla, llx; const digit* digits = ((PyLongObject*)op1)->ob_digit; const Py_ssize_t size = Py_SIZE(op1); if (likely(__Pyx_sst_abs(size) <= 1)) { a = likely(size) ? digits[0] : 0; if (size == -1) a = -a; } else { switch (size) { case -2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; } case 2: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; } case -3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; } case 3: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; } case -4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; } case 4: if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); goto long_long; } default: return PyLong_Type.tp_as_number->nb_add(op1, op2); } } x = a + b; return PyLong_FromLong(x); long_long: llx = lla + llb; return PyLong_FromLongLong(llx); } #endif if (PyFloat_CheckExact(op1)) { const long b = intval; double a = PyFloat_AS_DOUBLE(op1); double result; PyFPE_START_PROTECT("add", return NULL) result = ((double)a) + (double)b; PyFPE_END_PROTECT(result) return PyFloat_FromDouble(result); } return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2); } #endif /* GetItemInt */ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, i); Py_INCREF(r); return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else return PySequence_GetItem(o, i); #endif } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else return PySequence_GetItem(o, i); #endif } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (is_list || PyList_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { PyObject *r = PyList_GET_ITEM(o, n); Py_INCREF(r); return r; } } else if (PyTuple_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, n); Py_INCREF(r); return r; } } else { PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_item)) { if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { Py_ssize_t l = m->sq_length(o); if (likely(l >= 0)) { i += l; } else { if (!PyErr_ExceptionMatches(PyExc_OverflowError)) return NULL; PyErr_Clear(); } } return m->sq_item(o, i); } } #else if (is_list || PySequence_Check(o)) { return PySequence_GetItem(o, i); } #endif return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } /* SetItemInt */ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; if (!j) return -1; r = PyObject_SetItem(o, j, v); Py_DECREF(j); return r; } static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (is_list || PyList_CheckExact(o)) { Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { PyObject* old = PyList_GET_ITEM(o, n); Py_INCREF(v); PyList_SET_ITEM(o, n, v); Py_DECREF(old); return 1; } } else { PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_ass_item)) { if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { Py_ssize_t l = m->sq_length(o); if (likely(l >= 0)) { i += l; } else { if (!PyErr_ExceptionMatches(PyExc_OverflowError)) return -1; PyErr_Clear(); } } return m->sq_ass_item(o, i, v); } } #else #if CYTHON_COMPILING_IN_PYPY if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) { #else if (is_list || PySequence_Check(o)) { #endif return PySequence_SetItem(o, i, v); } #endif return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); } /* None */ static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) { PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname); } /* StringJoin */ #if !CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) { return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL); } #endif /* ArgTypeTest */ static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { PyErr_Format(PyExc_TypeError, "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", name, type->tp_name, Py_TYPE(obj)->tp_name); } static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (likely(Py_TYPE(obj) == type)) return 1; #if PY_MAJOR_VERSION == 2 else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; #endif } else { if (likely(PyObject_TypeCheck(obj, type))) return 1; } __Pyx_RaiseArgumentTypeInvalid(name, obj, type); return 0; } /* PyErrFetchRestore */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; } #endif /* RaiseException */ #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { __Pyx_PyThreadState_declare Py_XINCREF(type); if (!value || value == Py_None) value = NULL; else Py_INCREF(value); if (!tb || tb == Py_None) tb = NULL; else { Py_INCREF(tb); if (!PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } } if (PyType_Check(type)) { #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); value = Py_None; } #endif PyErr_NormalizeException(&type, &value, &tb); } else { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } value = type; type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } } __Pyx_PyThreadState_assign __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *instance_class = NULL; if (value && PyExceptionInstance_Check(value)) { instance_class = (PyObject*) Py_TYPE(value); if (instance_class != type) { int is_subclass = PyObject_IsSubclass(instance_class, type); if (!is_subclass) { instance_class = NULL; } else if (unlikely(is_subclass == -1)) { goto bad; } else { type = instance_class; } } } if (!instance_class) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyObject_Call(type, args, NULL); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } #if PY_VERSION_HEX >= 0x03030000 if (cause) { #else if (cause && cause != Py_None) { #endif PyObject *fixed_cause; if (cause == Py_None) { fixed_cause = NULL; } else if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { #if CYTHON_COMPILING_IN_PYPY PyObject *tmp_type, *tmp_value, *tmp_tb; PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); Py_INCREF(tb); PyErr_Restore(tmp_type, tmp_value, tb); Py_XDECREF(tmp_tb); #else PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } #endif } bad: Py_XDECREF(owned_instance); return; } #endif /* GetModuleGlobalName */ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { PyObject *result; #if CYTHON_COMPILING_IN_CPYTHON result = PyDict_GetItem(__pyx_d, name); if (likely(result)) { Py_INCREF(result); } else { #else result = PyObject_GetItem(__pyx_d, name); if (!result) { PyErr_Clear(); #endif result = __Pyx_GetBuiltinName(name); } return result; } /* FetchCommonType */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { PyObject* fake_module; PyTypeObject* cached_type = NULL; fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); if (!fake_module) return NULL; Py_INCREF(fake_module); cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); if (cached_type) { if (!PyType_Check((PyObject*)cached_type)) { PyErr_Format(PyExc_TypeError, "Shared Cython type %.200s is not a type object", type->tp_name); goto bad; } if (cached_type->tp_basicsize != type->tp_basicsize) { PyErr_Format(PyExc_TypeError, "Shared Cython type %.200s has the wrong size, try recompiling", type->tp_name); goto bad; } } else { if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; PyErr_Clear(); if (PyType_Ready(type) < 0) goto bad; if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) goto bad; Py_INCREF(type); cached_type = type; } done: Py_DECREF(fake_module); return cached_type; bad: Py_XDECREF(cached_type); cached_type = NULL; goto done; } /* CythonFunction */ static PyObject * __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) { if (unlikely(op->func_doc == NULL)) { if (op->func.m_ml->ml_doc) { #if PY_MAJOR_VERSION >= 3 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); #else op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); #endif if (unlikely(op->func_doc == NULL)) return NULL; } else { Py_INCREF(Py_None); return Py_None; } } Py_INCREF(op->func_doc); return op->func_doc; } static int __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp = op->func_doc; if (value == NULL) { value = Py_None; } Py_INCREF(value); op->func_doc = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) { if (unlikely(op->func_name == NULL)) { #if PY_MAJOR_VERSION >= 3 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); #else op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); #endif if (unlikely(op->func_name == NULL)) return NULL; } Py_INCREF(op->func_name); return op->func_name; } static int __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) { #else if (unlikely(value == NULL || !PyString_Check(value))) { #endif PyErr_SetString(PyExc_TypeError, "__name__ must be set to a string object"); return -1; } tmp = op->func_name; Py_INCREF(value); op->func_name = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op) { Py_INCREF(op->func_qualname); return op->func_qualname; } static int __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) { #else if (unlikely(value == NULL || !PyString_Check(value))) { #endif PyErr_SetString(PyExc_TypeError, "__qualname__ must be set to a string object"); return -1; } tmp = op->func_qualname; Py_INCREF(value); op->func_qualname = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) { PyObject *self; self = m->func_closure; if (self == NULL) self = Py_None; Py_INCREF(self); return self; } static PyObject * __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) { if (unlikely(op->func_dict == NULL)) { op->func_dict = PyDict_New(); if (unlikely(op->func_dict == NULL)) return NULL; } Py_INCREF(op->func_dict); return op->func_dict; } static int __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp; if (unlikely(value == NULL)) { PyErr_SetString(PyExc_TypeError, "function's dictionary may not be deleted"); return -1; } if (unlikely(!PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "setting function's dictionary to a non-dict"); return -1; } tmp = op->func_dict; Py_INCREF(value); op->func_dict = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op) { Py_INCREF(op->func_globals); return op->func_globals; } static PyObject * __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op) { Py_INCREF(Py_None); return Py_None; } static PyObject * __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) { PyObject* result = (op->func_code) ? op->func_code : Py_None; Py_INCREF(result); return result; } static int __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { int result = 0; PyObject *res = op->defaults_getter((PyObject *) op); if (unlikely(!res)) return -1; #if CYTHON_COMPILING_IN_CPYTHON op->defaults_tuple = PyTuple_GET_ITEM(res, 0); Py_INCREF(op->defaults_tuple); op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); Py_INCREF(op->defaults_kwdict); #else op->defaults_tuple = PySequence_ITEM(res, 0); if (unlikely(!op->defaults_tuple)) result = -1; else { op->defaults_kwdict = PySequence_ITEM(res, 1); if (unlikely(!op->defaults_kwdict)) result = -1; } #endif Py_DECREF(res); return result; } static int __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) { PyObject* tmp; if (!value) { value = Py_None; } else if (value != Py_None && !PyTuple_Check(value)) { PyErr_SetString(PyExc_TypeError, "__defaults__ must be set to a tuple object"); return -1; } Py_INCREF(value); tmp = op->defaults_tuple; op->defaults_tuple = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) { PyObject* result = op->defaults_tuple; if (unlikely(!result)) { if (op->defaults_getter) { if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; result = op->defaults_tuple; } else { result = Py_None; } } Py_INCREF(result); return result; } static int __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) { PyObject* tmp; if (!value) { value = Py_None; } else if (value != Py_None && !PyDict_Check(value)) { PyErr_SetString(PyExc_TypeError, "__kwdefaults__ must be set to a dict object"); return -1; } Py_INCREF(value); tmp = op->defaults_kwdict; op->defaults_kwdict = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) { PyObject* result = op->defaults_kwdict; if (unlikely(!result)) { if (op->defaults_getter) { if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; result = op->defaults_kwdict; } else { result = Py_None; } } Py_INCREF(result); return result; } static int __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) { PyObject* tmp; if (!value || value == Py_None) { value = NULL; } else if (!PyDict_Check(value)) { PyErr_SetString(PyExc_TypeError, "__annotations__ must be set to a dict object"); return -1; } Py_XINCREF(value); tmp = op->func_annotations; op->func_annotations = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) { PyObject* result = op->func_annotations; if (unlikely(!result)) { result = PyDict_New(); if (unlikely(!result)) return NULL; op->func_annotations = result; } Py_INCREF(result); return result; } static PyGetSetDef __pyx_CyFunction_getsets[] = { {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, {0, 0, 0, 0, 0} }; static PyMemberDef __pyx_CyFunction_members[] = { {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, {0, 0, 0, 0, 0} }; static PyObject * __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) { #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(m->func.m_ml->ml_name); #else return PyString_FromString(m->func.m_ml->ml_name); #endif } static PyMethodDef __pyx_CyFunction_methods[] = { {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, {0, 0, 0, 0} }; #if PY_VERSION_HEX < 0x030500A0 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) #else #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) #endif static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); if (op == NULL) return NULL; op->flags = flags; __Pyx_CyFunction_weakreflist(op) = NULL; op->func.m_ml = ml; op->func.m_self = (PyObject *) op; Py_XINCREF(closure); op->func_closure = closure; Py_XINCREF(module); op->func.m_module = module; op->func_dict = NULL; op->func_name = NULL; Py_INCREF(qualname); op->func_qualname = qualname; op->func_doc = NULL; op->func_classobj = NULL; op->func_globals = globals; Py_INCREF(op->func_globals); Py_XINCREF(code); op->func_code = code; op->defaults_pyobjects = 0; op->defaults = NULL; op->defaults_tuple = NULL; op->defaults_kwdict = NULL; op->defaults_getter = NULL; op->func_annotations = NULL; PyObject_GC_Track(op); return (PyObject *) op; } static int __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) { Py_CLEAR(m->func_closure); Py_CLEAR(m->func.m_module); Py_CLEAR(m->func_dict); Py_CLEAR(m->func_name); Py_CLEAR(m->func_qualname); Py_CLEAR(m->func_doc); Py_CLEAR(m->func_globals); Py_CLEAR(m->func_code); Py_CLEAR(m->func_classobj); Py_CLEAR(m->defaults_tuple); Py_CLEAR(m->defaults_kwdict); Py_CLEAR(m->func_annotations); if (m->defaults) { PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); int i; for (i = 0; i < m->defaults_pyobjects; i++) Py_XDECREF(pydefaults[i]); PyObject_Free(m->defaults); m->defaults = NULL; } return 0; } static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) { PyObject_GC_UnTrack(m); if (__Pyx_CyFunction_weakreflist(m) != NULL) PyObject_ClearWeakRefs((PyObject *) m); __Pyx_CyFunction_clear(m); PyObject_GC_Del(m); } static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) { Py_VISIT(m->func_closure); Py_VISIT(m->func.m_module); Py_VISIT(m->func_dict); Py_VISIT(m->func_name); Py_VISIT(m->func_qualname); Py_VISIT(m->func_doc); Py_VISIT(m->func_globals); Py_VISIT(m->func_code); Py_VISIT(m->func_classobj); Py_VISIT(m->defaults_tuple); Py_VISIT(m->defaults_kwdict); if (m->defaults) { PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); int i; for (i = 0; i < m->defaults_pyobjects; i++) Py_VISIT(pydefaults[i]); } return 0; } static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { Py_INCREF(func); return func; } if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { if (type == NULL) type = (PyObject *)(Py_TYPE(obj)); return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); } if (obj == Py_None) obj = NULL; return __Pyx_PyMethod_New(func, obj, type); } static PyObject* __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) { #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromFormat("", op->func_qualname, (void *)op); #else return PyString_FromFormat("", PyString_AsString(op->func_qualname), (void *)op); #endif } #if CYTHON_COMPILING_IN_PYPY static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyCFunctionObject* f = (PyCFunctionObject*)func; PyCFunction meth = f->m_ml->ml_meth; PyObject *self = f->m_self; Py_ssize_t size; switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { case METH_VARARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) return (*meth)(self, arg); break; case METH_VARARGS | METH_KEYWORDS: return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); case METH_NOARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { size = PyTuple_GET_SIZE(arg); if (likely(size == 0)) return (*meth)(self, NULL); PyErr_Format(PyExc_TypeError, "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", f->m_ml->ml_name, size); return NULL; } break; case METH_O: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { size = PyTuple_GET_SIZE(arg); if (likely(size == 1)) { PyObject *result, *arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; result = (*meth)(self, arg0); Py_DECREF(arg0); return result; } PyErr_Format(PyExc_TypeError, "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", f->m_ml->ml_name, size); return NULL; } break; default: PyErr_SetString(PyExc_SystemError, "Bad call flags in " "__Pyx_CyFunction_Call. METH_OLDARGS is no " "longer supported!"); return NULL; } PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", f->m_ml->ml_name); return NULL; } #else static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { return PyCFunction_Call(func, arg, kw); } #endif static PyTypeObject __pyx_CyFunctionType_type = { PyVarObject_HEAD_INIT(0, 0) "cython_function_or_method", sizeof(__pyx_CyFunctionObject), 0, (destructor) __Pyx_CyFunction_dealloc, 0, 0, 0, #if PY_MAJOR_VERSION < 3 0, #else 0, #endif (reprfunc) __Pyx_CyFunction_repr, 0, 0, 0, 0, __Pyx_CyFunction_Call, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, 0, (traverseproc) __Pyx_CyFunction_traverse, (inquiry) __Pyx_CyFunction_clear, 0, #if PY_VERSION_HEX < 0x030500A0 offsetof(__pyx_CyFunctionObject, func_weakreflist), #else offsetof(PyCFunctionObject, m_weakreflist), #endif 0, 0, __pyx_CyFunction_methods, __pyx_CyFunction_members, __pyx_CyFunction_getsets, 0, 0, __Pyx_CyFunction_descr_get, 0, offsetof(__pyx_CyFunctionObject, func_dict), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, #if PY_VERSION_HEX >= 0x030400a1 0, #endif }; static int __pyx_CyFunction_init(void) { #if !CYTHON_COMPILING_IN_PYPY __pyx_CyFunctionType_type.tp_call = PyCFunction_Call; #endif __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); if (__pyx_CyFunctionType == NULL) { return -1; } return 0; } static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults = PyObject_Malloc(size); if (!m->defaults) return PyErr_NoMemory(); memset(m->defaults, 0, size); m->defaults_pyobjects = pyobjects; return m->defaults; } static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults_tuple = tuple; Py_INCREF(tuple); } static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults_kwdict = dict; Py_INCREF(dict); } static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->func_annotations = dict; Py_INCREF(dict); } /* CalculateMetaclass */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); for (i=0; i < nbases; i++) { PyTypeObject *tmptype; PyObject *tmp = PyTuple_GET_ITEM(bases, i); tmptype = Py_TYPE(tmp); #if PY_MAJOR_VERSION < 3 if (tmptype == &PyClass_Type) continue; #endif if (!metaclass) { metaclass = tmptype; continue; } if (PyType_IsSubtype(metaclass, tmptype)) continue; if (PyType_IsSubtype(tmptype, metaclass)) { metaclass = tmptype; continue; } PyErr_SetString(PyExc_TypeError, "metaclass conflict: " "the metaclass of a derived class " "must be a (non-strict) subclass " "of the metaclasses of all its bases"); return NULL; } if (!metaclass) { #if PY_MAJOR_VERSION < 3 metaclass = &PyClass_Type; #else metaclass = &PyType_Type; #endif } Py_INCREF((PyObject*) metaclass); return (PyObject*) metaclass; } /* Py3ClassCreate */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { PyObject *ns; if (metaclass) { PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare); if (prep) { PyObject *pargs = PyTuple_Pack(2, name, bases); if (unlikely(!pargs)) { Py_DECREF(prep); return NULL; } ns = PyObject_Call(prep, pargs, mkw); Py_DECREF(prep); Py_DECREF(pargs); } else { if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) return NULL; PyErr_Clear(); ns = PyDict_New(); } } else { ns = PyDict_New(); } if (unlikely(!ns)) return NULL; if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad; if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad; if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad; return ns; bad: Py_DECREF(ns); return NULL; } static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass) { PyObject *result, *margs; PyObject *owned_metaclass = NULL; if (allow_py2_metaclass) { owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass); if (owned_metaclass) { metaclass = owned_metaclass; } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) { PyErr_Clear(); } else { return NULL; } } if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) { metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases); Py_XDECREF(owned_metaclass); if (unlikely(!metaclass)) return NULL; owned_metaclass = metaclass; } margs = PyTuple_Pack(3, name, bases, dict); if (unlikely(!margs)) { result = NULL; } else { result = PyObject_Call(metaclass, margs, mkw); Py_DECREF(margs); } Py_XDECREF(owned_metaclass); return result; } /* CodeObjectCache */ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; } while (start < end) { mid = start + (end - start) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { start = mid + 1; } else { return mid; } } if (code_line <= entries[mid].code_line) { return mid; } else { return mid + 1; } } static PyCodeObject *__pyx_find_code_object(int code_line) { PyCodeObject* code_object; int pos; if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { return NULL; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { return NULL; } code_object = __pyx_code_cache.entries[pos].code_object; Py_INCREF(code_object); return code_object; } static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = 64; __pyx_code_cache.count = 1; entries[0].code_line = code_line; entries[0].code_object = code_object; Py_INCREF(code_object); } return; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { PyCodeObject* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_DECREF(tmp); return; } if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = new_max; } for (i=__pyx_code_cache.count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; __pyx_code_cache.count++; Py_INCREF(code_object); } /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(filename); #else py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_code = __Pyx_PyCode_New( 0, 0, 0, 0, 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); Py_DECREF(py_funcname); return py_code; bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; py_code = __pyx_find_code_object(c_line ? c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; __pyx_insert_code_object(c_line ? c_line : py_line, py_code); } py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ __pyx_d, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ {\ func_type value = func_value;\ if (sizeof(target_type) < sizeof(func_type)) {\ if (unlikely(value != (func_type) (target_type) value)) {\ func_type zero = 0;\ if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ return (target_type) -1;\ if (is_unsigned && unlikely(value < zero))\ goto raise_neg_overflow;\ else\ goto raise_overflow;\ }\ }\ return (target_type) value;\ } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(long) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); } } else { if (sizeof(long) <= sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); } } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(int) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(int) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); } } else { if (sizeof(int) <= sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(int), little, !is_unsigned); } } /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(int) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (int) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) case 2: if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; case 3: if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; case 4: if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __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]))) } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (int) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(int) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) case -2: if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 2: if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -3: if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 3: if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -4: if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __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]))) } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 4: if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __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]))) } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; } #endif if (sizeof(int) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (int) -1; } } else { int val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (int) -1; val = __Pyx_PyInt_As_int(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); return (int) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to int"); return (int) -1; } /* CIntFromPy */ static CYTHON_INLINE unsigned char __Pyx_PyInt_As_unsigned_char(PyObject *x) { const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(unsigned char) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(unsigned char, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (unsigned char) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (unsigned char) 0; case 1: __PYX_VERIFY_RETURN_INT(unsigned char, digit, digits[0]) case 2: if (8 * sizeof(unsigned char) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned char) >= 2 * PyLong_SHIFT) { return (unsigned char) (((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])); } } break; case 3: if (8 * sizeof(unsigned char) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned char) >= 3 * PyLong_SHIFT) { return (unsigned char) (((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])); } } break; case 4: if (8 * sizeof(unsigned char) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned char) >= 4 * PyLong_SHIFT) { return (unsigned char) (((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (unsigned char) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(unsigned char) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned char, unsigned long, PyLong_AsUnsignedLong(x)) } else if (sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned char, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (unsigned char) 0; case -1: __PYX_VERIFY_RETURN_INT(unsigned char, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(unsigned char, digit, +digits[0]) case -2: if (8 * sizeof(unsigned char) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT) { return (unsigned char) (((unsigned char)-1)*(((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); } } break; case 2: if (8 * sizeof(unsigned char) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT) { return (unsigned char) ((((((unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); } } break; case -3: if (8 * sizeof(unsigned char) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT) { return (unsigned char) (((unsigned char)-1)*(((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); } } break; case 3: if (8 * sizeof(unsigned char) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT) { return (unsigned char) ((((((((unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); } } break; case -4: if (8 * sizeof(unsigned char) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned char, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned char) - 1 > 4 * PyLong_SHIFT) { return (unsigned char) (((unsigned char)-1)*(((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); } } break; case 4: if (8 * sizeof(unsigned char) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(unsigned char, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(unsigned char) - 1 > 4 * PyLong_SHIFT) { return (unsigned char) ((((((((((unsigned char)digits[3]) << PyLong_SHIFT) | (unsigned char)digits[2]) << PyLong_SHIFT) | (unsigned char)digits[1]) << PyLong_SHIFT) | (unsigned char)digits[0]))); } } break; } #endif if (sizeof(unsigned char) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned char, long, PyLong_AsLong(x)) } else if (sizeof(unsigned char) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(unsigned char, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else unsigned char val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (unsigned char) -1; } } else { unsigned char val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (unsigned char) -1; val = __Pyx_PyInt_As_unsigned_char(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned char"); return (unsigned char) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned char"); return (unsigned char) -1; } /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(long) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (long) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) case 2: if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 3: if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 4: if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __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]))) } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (long) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(long) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) case -2: if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 2: if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -3: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 3: if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -4: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __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]))) } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 4: if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __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]))) } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; } #endif if (sizeof(long) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (long) -1; } } else { long val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (long) -1; val = __Pyx_PyInt_As_long(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); return (long) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long) -1; } /* SwapException */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = *type; tstate->exc_value = *value; tstate->exc_traceback = *tb; *type = tmp_type; *value = tmp_value; *tb = tmp_tb; } #else static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); PyErr_SetExcInfo(*type, *value, *tb); *type = tmp_type; *value = tmp_value; *tb = tmp_tb; } #endif /* PyObjectCallMethod1 */ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { PyObject *method, *result = NULL; method = __Pyx_PyObject_GetAttrStr(obj, method_name); if (unlikely(!method)) goto bad; #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyMethod_Check(method))) { PyObject *self = PyMethod_GET_SELF(method); if (likely(self)) { PyObject *args; PyObject *function = PyMethod_GET_FUNCTION(method); args = PyTuple_New(2); if (unlikely(!args)) goto bad; Py_INCREF(self); PyTuple_SET_ITEM(args, 0, self); Py_INCREF(arg); PyTuple_SET_ITEM(args, 1, arg); Py_INCREF(function); Py_DECREF(method); method = NULL; result = __Pyx_PyObject_Call(function, args, NULL); Py_DECREF(args); Py_DECREF(function); return result; } } #endif result = __Pyx_PyObject_CallOneArg(method, arg); bad: Py_XDECREF(method); return result; } /* CoroutineBase */ #include #include static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); static PyObject *__Pyx_Coroutine_Close(PyObject *self); static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); #define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) #if 1 || PY_VERSION_HEX < 0x030300B0 static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) { PyObject *et, *ev, *tb; PyObject *value = NULL; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ErrFetch(&et, &ev, &tb); if (!et) { Py_XDECREF(tb); Py_XDECREF(ev); Py_INCREF(Py_None); *pvalue = Py_None; return 0; } if (likely(et == PyExc_StopIteration)) { #if PY_VERSION_HEX >= 0x030300A0 if (ev && Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) { value = ((PyStopIterationObject *)ev)->value; Py_INCREF(value); Py_DECREF(ev); Py_XDECREF(tb); Py_DECREF(et); *pvalue = value; return 0; } #endif if (!ev || !PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { if (!ev) { Py_INCREF(Py_None); ev = Py_None; } else if (PyTuple_Check(ev)) { if (PyTuple_GET_SIZE(ev) >= 1) { PyObject *value; #if CYTHON_COMPILING_IN_CPYTHON value = PySequence_ITEM(ev, 0); #else value = PyTuple_GET_ITEM(ev, 0); Py_INCREF(value); #endif Py_DECREF(ev); ev = value; } else { Py_INCREF(Py_None); Py_DECREF(ev); ev = Py_None; } } Py_XDECREF(tb); Py_DECREF(et); *pvalue = ev; return 0; } } else if (!PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) { __Pyx_ErrRestore(et, ev, tb); return -1; } PyErr_NormalizeException(&et, &ev, &tb); if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) { __Pyx_ErrRestore(et, ev, tb); return -1; } Py_XDECREF(tb); Py_DECREF(et); #if PY_VERSION_HEX >= 0x030300A0 value = ((PyStopIterationObject *)ev)->value; Py_INCREF(value); Py_DECREF(ev); #else { PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args); Py_DECREF(ev); if (likely(args)) { value = PySequence_GetItem(args, 0); Py_DECREF(args); } if (unlikely(!value)) { __Pyx_ErrRestore(NULL, NULL, NULL); Py_INCREF(Py_None); value = Py_None; } } #endif *pvalue = value; return 0; } #endif static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__pyx_CoroutineObject *self) { PyObject *exc_type = self->exc_type; PyObject *exc_value = self->exc_value; PyObject *exc_traceback = self->exc_traceback; self->exc_type = NULL; self->exc_value = NULL; self->exc_traceback = NULL; Py_XDECREF(exc_type); Py_XDECREF(exc_value); Py_XDECREF(exc_traceback); } static CYTHON_INLINE int __Pyx_Coroutine_CheckRunning(__pyx_CoroutineObject *gen) { if (unlikely(gen->is_running)) { PyErr_SetString(PyExc_ValueError, "generator already executing"); return 1; } return 0; } static CYTHON_INLINE PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value) { PyObject *retval; __Pyx_PyThreadState_declare assert(!self->is_running); if (unlikely(self->resume_label == 0)) { if (unlikely(value && value != Py_None)) { PyErr_SetString(PyExc_TypeError, "can't send non-None value to a " "just-started generator"); return NULL; } } if (unlikely(self->resume_label == -1)) { PyErr_SetNone(PyExc_StopIteration); return NULL; } __Pyx_PyThreadState_assign if (value) { #if CYTHON_COMPILING_IN_PYPY #else if (self->exc_traceback) { PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; PyFrameObject *f = tb->tb_frame; Py_XINCREF(__pyx_tstate->frame); assert(f->f_back == NULL); f->f_back = __pyx_tstate->frame; } #endif __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback); } else { __Pyx_Coroutine_ExceptionClear(self); } self->is_running = 1; retval = self->body((PyObject *) self, value); self->is_running = 0; if (retval) { __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback); #if CYTHON_COMPILING_IN_PYPY #else if (self->exc_traceback) { PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; PyFrameObject *f = tb->tb_frame; Py_CLEAR(f->f_back); } #endif } else { __Pyx_Coroutine_ExceptionClear(self); } return retval; } static CYTHON_INLINE PyObject *__Pyx_Coroutine_MethodReturn(PyObject *retval) { if (unlikely(!retval && !PyErr_Occurred())) { PyErr_SetNone(PyExc_StopIteration); } return retval; } static CYTHON_INLINE PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) { PyObject *ret; PyObject *val = NULL; __Pyx_Coroutine_Undelegate(gen); __Pyx_PyGen_FetchStopIterationValue(&val); ret = __Pyx_Coroutine_SendEx(gen, val); Py_XDECREF(val); return ret; } static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { PyObject *retval; __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; PyObject *yf = gen->yieldfrom; if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) return NULL; if (yf) { PyObject *ret; gen->is_running = 1; #ifdef __Pyx_Generator_USED if (__Pyx_Generator_CheckExact(yf)) { ret = __Pyx_Coroutine_Send(yf, value); } else #endif #ifdef __Pyx_Coroutine_USED if (__Pyx_Coroutine_CheckExact(yf)) { ret = __Pyx_Coroutine_Send(yf, value); } else #endif { if (value == Py_None) ret = Py_TYPE(yf)->tp_iternext(yf); else ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value); } gen->is_running = 0; if (likely(ret)) { return ret; } retval = __Pyx_Coroutine_FinishDelegation(gen); } else { retval = __Pyx_Coroutine_SendEx(gen, value); } return __Pyx_Coroutine_MethodReturn(retval); } static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { PyObject *retval = NULL; int err = 0; #ifdef __Pyx_Generator_USED if (__Pyx_Generator_CheckExact(yf)) { retval = __Pyx_Coroutine_Close(yf); if (!retval) return -1; } else #endif #ifdef __Pyx_Coroutine_USED if (__Pyx_Coroutine_CheckExact(yf)) { retval = __Pyx_Coroutine_Close(yf); if (!retval) return -1; } else #endif { PyObject *meth; gen->is_running = 1; meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close); if (unlikely(!meth)) { if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_WriteUnraisable(yf); } PyErr_Clear(); } else { retval = PyObject_CallFunction(meth, NULL); Py_DECREF(meth); if (!retval) err = -1; } gen->is_running = 0; } Py_XDECREF(retval); return err; } static PyObject *__Pyx_Generator_Next(PyObject *self) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; PyObject *yf = gen->yieldfrom; if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) return NULL; if (yf) { PyObject *ret; gen->is_running = 1; ret = Py_TYPE(yf)->tp_iternext(yf); gen->is_running = 0; if (likely(ret)) { return ret; } return __Pyx_Coroutine_FinishDelegation(gen); } return __Pyx_Coroutine_SendEx(gen, Py_None); } static PyObject *__Pyx_Coroutine_Close(PyObject *self) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; PyObject *retval, *raised_exception; PyObject *yf = gen->yieldfrom; int err = 0; if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) return NULL; if (yf) { Py_INCREF(yf); err = __Pyx_Coroutine_CloseIter(gen, yf); __Pyx_Coroutine_Undelegate(gen); Py_DECREF(yf); } if (err == 0) PyErr_SetNone(PyExc_GeneratorExit); retval = __Pyx_Coroutine_SendEx(gen, NULL); if (retval) { Py_DECREF(retval); PyErr_SetString(PyExc_RuntimeError, "generator ignored GeneratorExit"); return NULL; } raised_exception = PyErr_Occurred(); if (!raised_exception || raised_exception == PyExc_StopIteration || raised_exception == PyExc_GeneratorExit || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit) || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration)) { if (raised_exception) PyErr_Clear(); Py_INCREF(Py_None); return Py_None; } return NULL; } static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; PyObject *typ; PyObject *tb = NULL; PyObject *val = NULL; PyObject *yf = gen->yieldfrom; if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb)) return NULL; if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) return NULL; if (yf) { PyObject *ret; Py_INCREF(yf); if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) { int err = __Pyx_Coroutine_CloseIter(gen, yf); Py_DECREF(yf); __Pyx_Coroutine_Undelegate(gen); if (err < 0) return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL)); goto throw_here; } gen->is_running = 1; #ifdef __Pyx_Generator_USED if (__Pyx_Generator_CheckExact(yf)) { ret = __Pyx_Coroutine_Throw(yf, args); } else #endif #ifdef __Pyx_Coroutine_USED if (__Pyx_Coroutine_CheckExact(yf)) { ret = __Pyx_Coroutine_Throw(yf, args); } else #endif { PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw); if (unlikely(!meth)) { Py_DECREF(yf); if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { gen->is_running = 0; return NULL; } PyErr_Clear(); __Pyx_Coroutine_Undelegate(gen); gen->is_running = 0; goto throw_here; } ret = PyObject_CallObject(meth, args); Py_DECREF(meth); } gen->is_running = 0; Py_DECREF(yf); if (!ret) { ret = __Pyx_Coroutine_FinishDelegation(gen); } return __Pyx_Coroutine_MethodReturn(ret); } throw_here: __Pyx_Raise(typ, val, tb, NULL); return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL)); } static int __Pyx_Coroutine_traverse(PyObject *self, visitproc visit, void *arg) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; Py_VISIT(gen->closure); Py_VISIT(gen->classobj); Py_VISIT(gen->yieldfrom); Py_VISIT(gen->exc_type); Py_VISIT(gen->exc_value); Py_VISIT(gen->exc_traceback); return 0; } static int __Pyx_Coroutine_clear(PyObject *self) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; Py_CLEAR(gen->closure); Py_CLEAR(gen->classobj); Py_CLEAR(gen->yieldfrom); Py_CLEAR(gen->exc_type); Py_CLEAR(gen->exc_value); Py_CLEAR(gen->exc_traceback); Py_CLEAR(gen->gi_name); Py_CLEAR(gen->gi_qualname); return 0; } static void __Pyx_Coroutine_dealloc(PyObject *self) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; PyObject_GC_UnTrack(gen); if (gen->gi_weakreflist != NULL) PyObject_ClearWeakRefs(self); if (gen->resume_label > 0) { PyObject_GC_Track(self); #if PY_VERSION_HEX >= 0x030400a1 if (PyObject_CallFinalizerFromDealloc(self)) #else Py_TYPE(gen)->tp_del(self); if (self->ob_refcnt > 0) #endif { return; } PyObject_GC_UnTrack(self); } __Pyx_Coroutine_clear(self); PyObject_GC_Del(gen); } static void __Pyx_Coroutine_del(PyObject *self) { PyObject *res; PyObject *error_type, *error_value, *error_traceback; __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; __Pyx_PyThreadState_declare if (gen->resume_label <= 0) return ; #if PY_VERSION_HEX < 0x030400a1 assert(self->ob_refcnt == 0); self->ob_refcnt = 1; #endif __Pyx_PyThreadState_assign __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); res = __Pyx_Coroutine_Close(self); if (res == NULL) PyErr_WriteUnraisable(self); else Py_DECREF(res); __Pyx_ErrRestore(error_type, error_value, error_traceback); #if PY_VERSION_HEX < 0x030400a1 assert(self->ob_refcnt > 0); if (--self->ob_refcnt == 0) { return; } { Py_ssize_t refcnt = self->ob_refcnt; _Py_NewReference(self); self->ob_refcnt = refcnt; } #if CYTHON_COMPILING_IN_CPYTHON assert(PyType_IS_GC(self->ob_type) && _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); _Py_DEC_REFTOTAL; #endif #ifdef COUNT_ALLOCS --Py_TYPE(self)->tp_frees; --Py_TYPE(self)->tp_allocs; #endif #endif } static PyObject * __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self) { Py_INCREF(self->gi_name); return self->gi_name; } static int __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) { #else if (unlikely(value == NULL || !PyString_Check(value))) { #endif PyErr_SetString(PyExc_TypeError, "__name__ must be set to a string object"); return -1; } tmp = self->gi_name; Py_INCREF(value); self->gi_name = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self) { Py_INCREF(self->gi_qualname); return self->gi_qualname; } static int __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) { #else if (unlikely(value == NULL || !PyString_Check(value))) { #endif PyErr_SetString(PyExc_TypeError, "__qualname__ must be set to a string object"); return -1; } tmp = self->gi_qualname; Py_INCREF(value); self->gi_qualname = value; Py_XDECREF(tmp); return 0; } static __pyx_CoroutineObject *__Pyx__Coroutine_New(PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *closure, PyObject *name, PyObject *qualname) { __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); if (gen == NULL) return NULL; gen->body = body; gen->closure = closure; Py_XINCREF(closure); gen->is_running = 0; gen->resume_label = 0; gen->classobj = NULL; gen->yieldfrom = NULL; gen->exc_type = NULL; gen->exc_value = NULL; gen->exc_traceback = NULL; gen->gi_weakreflist = NULL; Py_XINCREF(qualname); gen->gi_qualname = qualname; Py_XINCREF(name); gen->gi_name = name; PyObject_GC_Track(gen); return gen; } /* PatchModuleWithCoroutine */ static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) { #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) int result; PyObject *globals, *result_obj; globals = PyDict_New(); if (unlikely(!globals)) goto ignore; result = PyDict_SetItemString(globals, "_cython_coroutine_type", #ifdef __Pyx_Coroutine_USED (PyObject*)__pyx_CoroutineType); #else Py_None); #endif if (unlikely(result < 0)) goto ignore; result = PyDict_SetItemString(globals, "_cython_generator_type", #ifdef __Pyx_Generator_USED (PyObject*)__pyx_GeneratorType); #else Py_None); #endif if (unlikely(result < 0)) goto ignore; if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore; if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore; result_obj = PyRun_String(py_code, Py_file_input, globals, globals); if (unlikely(!result_obj)) goto ignore; Py_DECREF(result_obj); Py_DECREF(globals); return module; ignore: Py_XDECREF(globals); PyErr_WriteUnraisable(module); if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) { Py_DECREF(module); module = NULL; } #else py_code++; #endif return module; } /* PatchGeneratorABC */ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) static PyObject* __Pyx_patch_abc_module(PyObject *module); static PyObject* __Pyx_patch_abc_module(PyObject *module) { module = __Pyx_Coroutine_patch_module( module, "" "if _cython_generator_type is not None:\n" " try: Generator = _module.Generator\n" " except AttributeError: pass\n" " else: Generator.register(_cython_generator_type)\n" "if _cython_coroutine_type is not None:\n" " try: Coroutine = _module.Coroutine\n" " except AttributeError: pass\n" " else: Coroutine.register(_cython_coroutine_type)\n" ); return module; } #endif static int __Pyx_patch_abc(void) { #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) static int abc_patched = 0; if (!abc_patched) { PyObject *module; module = PyImport_ImportModule((PY_VERSION_HEX >= 0x03030000) ? "collections.abc" : "collections"); if (!module) { PyErr_WriteUnraisable(NULL); if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, ((PY_VERSION_HEX >= 0x03030000) ? "Cython module failed to register with collections.abc module" : "Cython module failed to register with collections module"), 1) < 0)) { return -1; } } else { module = __Pyx_patch_abc_module(module); abc_patched = 1; if (unlikely(!module)) return -1; Py_DECREF(module); } module = PyImport_ImportModule("backports_abc"); if (module) { module = __Pyx_patch_abc_module(module); Py_XDECREF(module); } if (!module) { PyErr_Clear(); } } #else if (0) __Pyx_Coroutine_patch_module(NULL, NULL); #endif return 0; } /* Generator */ static PyMethodDef __pyx_Generator_methods[] = { {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")}, {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")}, {"close", (PyCFunction) __Pyx_Coroutine_Close, METH_NOARGS, (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")}, {0, 0, 0, 0} }; static PyMemberDef __pyx_Generator_memberlist[] = { {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL}, {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, (char*) PyDoc_STR("object being iterated by 'yield from', or None")}, {0, 0, 0, 0, 0} }; static PyGetSetDef __pyx_Generator_getsets[] = { {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, (char*) PyDoc_STR("name of the generator"), 0}, {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, (char*) PyDoc_STR("qualified name of the generator"), 0}, {0, 0, 0, 0, 0} }; static PyTypeObject __pyx_GeneratorType_type = { PyVarObject_HEAD_INIT(0, 0) "generator", sizeof(__pyx_CoroutineObject), 0, (destructor) __Pyx_Coroutine_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, 0, (traverseproc) __Pyx_Coroutine_traverse, 0, 0, offsetof(__pyx_CoroutineObject, gi_weakreflist), 0, (iternextfunc) __Pyx_Generator_Next, __pyx_Generator_methods, __pyx_Generator_memberlist, __pyx_Generator_getsets, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, #if PY_VERSION_HEX >= 0x030400a1 0, #else __Pyx_Coroutine_del, #endif 0, #if PY_VERSION_HEX >= 0x030400a1 __Pyx_Coroutine_del, #endif }; static int __pyx_Generator_init(void) { __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr; __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter; __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type); if (unlikely(!__pyx_GeneratorType)) { return -1; } return 0; } /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); } return 0; } /* InitStrings */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); } static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if ( #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII __Pyx_sys_getdefaultencoding_not_ascii && #endif PyUnicode_Check(o)) { #if PY_VERSION_HEX < 0x03030000 char* defenc_c; PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); if (!defenc) return NULL; defenc_c = PyBytes_AS_STRING(defenc); #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII { char* end = defenc_c + PyBytes_GET_SIZE(defenc); char* c; for (c = defenc_c; c < end; c++) { if ((unsigned char) (*c) >= 128) { PyUnicode_AsASCIIString(o); return NULL; } } } #endif *length = PyBytes_GET_SIZE(defenc); return defenc_c; #else if (__Pyx_PyUnicode_READY(o) == -1) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (PyUnicode_IS_ASCII(o)) { *length = PyUnicode_GET_LENGTH(o); return PyUnicode_AsUTF8(o); } else { PyUnicode_AsASCIIString(o); return NULL; } #else return PyUnicode_AsUTF8AndSize(o, length); #endif #endif } else #endif #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); } else #endif { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); if (unlikely(r < 0)) { return NULL; } else { return result; } } } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_MAJOR_VERSION < 3 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return __Pyx_NewRef(x); m = Py_TYPE(x)->tp_as_number; #if PY_MAJOR_VERSION < 3 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_MAJOR_VERSION < 3 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%.4s__ returned non-%.4s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject *x; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(b))) { if (sizeof(Py_ssize_t) >= sizeof(long)) return PyInt_AS_LONG(b); else return PyInt_AsSsize_t(x); } #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)b)->ob_digit; const Py_ssize_t size = Py_SIZE(b); if (likely(__Pyx_sst_abs(size) <= 1)) { ival = likely(size) ? digits[0] : 0; if (size == -1) ival = -ival; return ival; } else { switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case 3: if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -3: if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case 4: if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { 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])); } break; case -4: if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { 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])); } break; } } #endif return PyLong_AsSsize_t(b); } x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); } #endif /* Py_PYTHON_H */ cutadapt-1.15/src/cutadapt/__init__.py0000664000175000017500000000126613205526454020517 0ustar marcelmarcel00000000000000# coding: utf-8 from __future__ import print_function, division, absolute_import import sys from ._version import get_versions __version__ = get_versions()['version'] del get_versions def check_importability(): # pragma: no cover try: import cutadapt._align except ImportError as e: if 'undefined symbol' in str(e): print(""" ERROR: A required extension module could not be imported because it is incompatible with your system. A quick fix is to recompile the extension modules with the following command: {0} setup.py build_ext -i See the documentation for alternative ways of installing the program. The original error message follows. """.format(sys.executable)) raise cutadapt-1.15/src/cutadapt/_qualtrim.pyx0000664000175000017500000000416213205526454021143 0ustar marcelmarcel00000000000000# kate: syntax Python; # cython: profile=False, emit_code_comments=False """ Quality trimming. """ def quality_trim_index(str qualities, int cutoff_front, int cutoff_back, int base=33): """ Find the positions at which to trim low-quality ends from a nucleotide sequence. Return tuple (start, stop) that indicates the good-quality segment. Qualities are assumed to be ASCII-encoded as chr(qual + base). The algorithm is the same as the one used by BWA within the function 'bwa_trim_read': - Subtract the cutoff value from all qualities. - Compute partial sums from all indices to the end of the sequence. - Trim sequence at the index at which the sum is minimal. """ cdef int s cdef int max_qual cdef int stop = len(qualities) cdef int start = 0 cdef int i # find trim position for 5' end s = 0 max_qual = 0 for i in range(len(qualities)): s += cutoff_front - (ord(qualities[i]) - base) if s < 0: break if s > max_qual: max_qual = s start = i + 1 # same for 3' end max_qual = 0 s = 0 for i in reversed(xrange(len(qualities))): s += cutoff_back - (ord(qualities[i]) - base) if s < 0: break if s > max_qual: max_qual = s stop = i if start >= stop: start, stop = 0, 0 return (start, stop) def nextseq_trim_index(sequence, int cutoff, int base=33): """ Variant of the above quality trimming routine that works on NextSeq data. With Illumina NextSeq, bases are encoded with two colors. 'No color' (a dark cycle) usually means that a 'G' was sequenced, but that also occurs when sequencing falls off the end of the fragment. The read then contains a run of high-quality G bases in the end. This routine works as the one above, but counts qualities belonging to 'G' bases as being equal to cutoff - 1. """ bases = sequence.sequence qualities = sequence.qualities cdef: int s = 0 int max_qual = 0 int max_i = len(qualities) int i, q s = 0 max_qual = 0 max_i = len(qualities) for i in reversed(xrange(max_i)): q = ord(qualities[i]) - base if bases[i] == 'G': q = cutoff - 1 s += cutoff - q if s < 0: break if s > max_qual: max_qual = s max_i = i return max_i cutadapt-1.15/src/cutadapt/filters.py0000664000175000017500000002231413205526454020425 0ustar marcelmarcel00000000000000# coding: utf-8 """ Classes for writing and filtering of processed reads. A Filter is a callable that has the read as its only argument. If it is called, it returns True if the read should be filtered (discarded), and False if not. To be used, a filter needs to be wrapped in one of the redirector classes. They are called so because they can redirect filtered reads to a file if so desired. They also keep statistics. To determine what happens to a read, a list of redirectors with different filters is created and each redirector is called in turn until one returns True. The read is then assumed to have been "consumed", that is, either written somewhere or filtered (should be discarded). """ from __future__ import print_function, division, absolute_import from . import seqio # Constants used when returning from a Filter’s __call__ method to improve # readability (it is unintuitive that "return True" means "discard the read"). DISCARD = True KEEP = False class NoFilter(object): """ No filtering, just send each read to the given writer. """ def __init__(self, writer): self.filtered = 0 self.writer = writer self.written = 0 # no of written reads TODO move to writer self.written_bp = [0, 0] def __call__(self, read): self.writer.write(read) self.written += 1 self.written_bp[0] += len(read) return DISCARD class PairedNoFilter(object): """ No filtering, just send each paired-end read to the given writer. """ def __init__(self, writer): self.filtered = 0 self.writer = writer self.written = 0 # no of written reads or read pairs TODO move to writer self.written_bp = [0, 0] def __call__(self, read1, read2): self.writer.write(read1, read2) self.written += 1 self.written_bp[0] += len(read1) self.written_bp[1] += len(read2) return DISCARD class Redirector(object): """ Redirect discarded reads to the given writer. This is for single-end reads. """ def __init__(self, writer, filter): self.filtered = 0 self.writer = writer self.filter = filter self.written = 0 # no of written reads TODO move to writer self.written_bp = [0, 0] def __call__(self, read): if self.filter(read): self.filtered += 1 if self.writer is not None: self.writer.write(read) self.written += 1 self.written_bp[0] += len(read) return DISCARD return KEEP class PairedRedirector(object): """ Redirect paired-end reads matching a filtering criterion to a writer. Different filtering styles are supported, differing by which of the two reads in a pair have to fulfill the filtering criterion. """ def __init__(self, writer, filter, pair_filter_mode='any'): """ pair_filter_mode -- these values are allowed: 'any': The pair is discarded if any read matches. 'both': The pair is discarded if both reads match. 'first': The pair is discarded if the first read matches ('legacy' mode, backwards compatibility). With 'first', the second read is not inspected. """ if pair_filter_mode not in ('any', 'both', 'first'): raise ValueError("pair_filter_mode must be 'any', 'both' or 'first'") self.filtered = 0 self.writer = writer self.filter = filter self.written = 0 # no of written reads or read pairs TODO move to writer self.written_bp = [0, 0] if pair_filter_mode == 'any': self._is_filtered = lambda r1, r2: self.filter(r1) or self.filter(r2) elif pair_filter_mode == 'both': self._is_filtered = lambda r1, r2: self.filter(r1) and self.filter(r2) else: assert pair_filter_mode == 'first' self._is_filtered = lambda r1, r2: self.filter(r1) def __call__(self, read1, read2): if self._is_filtered(read1, read2): self.filtered += 1 # discard read if self.writer is not None: self.writer.write(read1, read2) self.written += 1 self.written_bp[0] += len(read1) self.written_bp[1] += len(read2) return DISCARD return KEEP class TooShortReadFilter(object): def __init__(self, minimum_length): self.minimum_length = minimum_length def __call__(self, read): return len(read) < self.minimum_length class TooLongReadFilter(object): def __init__(self, maximum_length): self.maximum_length = maximum_length def __call__(self, read): return len(read) > self.maximum_length class NContentFilter(object): """ Discards a reads that has a number of 'N's over a given threshold. It handles both raw counts of Ns as well as proportions. Note, for raw counts, it is a 'greater than' comparison, so a cutoff of '1' will keep reads with a single N in it. """ def __init__(self, count): """ Count -- if it is below 1.0, it will be considered a proportion, and above and equal to 1 will be considered as discarding reads with a number of N's greater than this cutoff. """ assert count >= 0 self.is_proportion = count < 1.0 self.cutoff = count def __call__(self, read): """Return True when the read should be discarded""" n_count = read.sequence.lower().count('n') if self.is_proportion: if len(read) == 0: return False return n_count / len(read) > self.cutoff else: return n_count > self.cutoff class DiscardUntrimmedFilter(object): """ Return True if read is untrimmed. """ def __call__(self, read): return read.match is None class DiscardTrimmedFilter(object): """ Return True if read is trimmed. """ def __call__(self, read): return read.match is not None class Demultiplexer(object): """ Demultiplex trimmed reads. Reads are written to different output files depending on which adapter matches. Files are created when the first read is written to them. """ def __init__(self, path_template, untrimmed_path, colorspace, qualities): """ path_template must contain the string '{name}', which will be replaced with the name of the adapter to form the final output path. Reads without an adapter match are written to the file named by untrimmed_path. """ assert '{name}' in path_template self.template = path_template self.untrimmed_path = untrimmed_path self.untrimmed_writer = None self.writers = dict() self.written = 0 self.written_bp = [0, 0] self.colorspace = colorspace self.qualities = qualities def write(self, read, match): """ Write the read to the proper output file according to the match """ if match is None: if self.untrimmed_writer is None and self.untrimmed_path is not None: self.untrimmed_writer = seqio.open(self.untrimmed_path, mode='w', colorspace=self.colorspace, qualities=self.qualities) if self.untrimmed_writer is not None: self.written += 1 self.written_bp[0] += len(read) self.untrimmed_writer.write(read) else: name = match.adapter.name if name not in self.writers: self.writers[name] = seqio.open(self.template.replace('{name}', name), mode='w', colorspace=self.colorspace, qualities=self.qualities) self.written += 1 self.written_bp[0] += len(read) self.writers[name].write(read) def __call__(self, read1, read2=None): assert read2 is None self.write(read1, read1.match) return DISCARD def close(self): for w in self.writers.values(): w.close() if self.untrimmed_writer is not None: self.untrimmed_writer.close() class PairedEndDemultiplexer(object): """ Demultiplex trimmed paired-end reads. Reads are written to different output files depending on which adapter (in read 1) matches. """ def __init__(self, path_template, path_paired_template, untrimmed_path, untrimmed_paired_path, colorspace, qualities): """ The path templates must contain the string '{name}', which will be replaced with the name of the adapter to form the final output path. Read pairs without an adapter match are written to the files named by untrimmed_path. """ self._demultiplexer1 = Demultiplexer(path_template, untrimmed_path, colorspace, qualities) self._demultiplexer2 = Demultiplexer(path_paired_template, untrimmed_paired_path, colorspace, qualities) @property def written(self): return self._demultiplexer1.written + self._demultiplexer2.written @property def written_bp(self): return [self._demultiplexer1.written_bp[0], self._demultiplexer2.written_bp[0]] def __call__(self, read1, read2): assert read2 is not None self._demultiplexer1.write(read1, read1.match) self._demultiplexer2.write(read2, read1.match) def close(self): self._demultiplexer1.close() self._demultiplexer1.close() class RestFileWriter(object): def __init__(self, file): self.file = file def __call__(self, read, read2=None): if read.match: rest = read.match.rest() if len(rest) > 0: print(rest, read.name, file=self.file) return KEEP class WildcardFileWriter(object): def __init__(self, file): self.file = file def __call__(self, read, read2=None): if read.match: print(read.match.wildcards(), read.name, file=self.file) return KEEP class InfoFileWriter(object): def __init__(self, file): self.file = file def __call__(self, read, read2=None): matches = [] r = read while r.match is not None: matches.append(r.match) r = r.match.read matches = matches[::-1] if matches: for match in matches: info_record = match.get_info_record() print(*info_record, sep='\t', file=self.file) else: seq = read.sequence qualities = read.qualities if read.qualities is not None else '' print(read.name, -1, seq, qualities, sep='\t', file=self.file) return KEEP cutadapt-1.15/src/cutadapt/_version.py0000664000175000017500000000072613205527004020574 0ustar marcelmarcel00000000000000 # This file was generated by 'versioneer.py' (0.16) from # revision-control system data, or from the parent directory name of an # unpacked source archive. Distribution tarballs contain a pre-generated copy # of this file. import json import sys version_json = ''' { "dirty": false, "error": null, "full-revisionid": "8d0b61222e77973592bd2fb9e2ce57445fccf8dd", "version": "1.15" } ''' # END VERSION_JSON def get_versions(): return json.loads(version_json) cutadapt-1.15/src/cutadapt/_seqio.c0000664000175000017500000150172313205526771020037 0ustar marcelmarcel00000000000000/* Generated by Cython 0.24 */ /* BEGIN: Cython Metadata { "distutils": {} } END: Cython Metadata */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) #error Cython requires Python 2.6+ or Python 3.2+. #else #define CYTHON_ABI "0_24" #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 #else #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif #if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000 #define CYTHON_USE_PYLONG_INTERNALS 1 #endif #if CYTHON_USE_PYLONG_INTERNALS #include "longintrepr.h" #undef SHIFT #undef BASE #undef MASK #endif #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) #define Py_OptimizeFlag 0 #endif #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyType_Type #endif #ifndef Py_TPFLAGS_CHECKTYPES #define Py_TPFLAGS_CHECKTYPES 0 #endif #ifndef Py_TPFLAGS_HAVE_INDEX #define Py_TPFLAGS_HAVE_INDEX 0 #endif #ifndef Py_TPFLAGS_HAVE_NEWBUFFER #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #ifndef Py_TPFLAGS_HAVE_FINALIZE #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u) #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) #else #define CYTHON_PEP393_ENABLED 0 #define __Pyx_PyUnicode_READY(op) (0) #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE)) #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u)) #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u)) #endif #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) #else #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains) #define PyUnicode_Contains(u, s) PySequence_Contains(u, s) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format) #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt) #endif #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc) #define PyObject_Malloc(s) PyMem_Malloc(s) #define PyObject_Free(p) PyMem_Free(p) #define PyObject_Realloc(p) PyMem_Realloc(p) #endif #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) #else #define __Pyx_PyString_Format(a, b) PyString_Format(a, b) #endif #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII) #define PyObject_ASCII(o) PyObject_Repr(o) #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) #else #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define PyNumber_Int PyNumber_Long #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY #ifndef PyUnicode_InternFromString #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) #endif #endif #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif #if PY_VERSION_HEX >= 0x030500B1 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async) #elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 typedef struct { unaryfunc am_await; unaryfunc am_aiter; unaryfunc am_anext; } __Pyx_PyAsyncMethodsStruct; #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved)) #else #define __Pyx_PyType_AsAsync(obj) NULL #endif #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict #else #define CYTHON_RESTRICT #endif #endif #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None) #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include #ifdef NAN #define __PYX_NAN() ((float) NAN) #else static CYTHON_INLINE float __PYX_NAN() { float value; memset(&value, 0xFF, sizeof(value)); return value; } #endif #define __PYX_ERR(f_index, lineno, Ln_error) \ { \ __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ } #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #define __PYX_HAVE__cutadapt___seqio #define __PYX_HAVE_API__cutadapt___seqio #ifdef _OPENMP #include #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif #ifndef CYTHON_NCP_UNUSED # if CYTHON_COMPILING_IN_CPYTHON # define CYTHON_NCP_UNUSED # else # define CYTHON_NCP_UNUSED CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 #define __PYX_DEFAULT_STRING_ENCODING "" #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #define __Pyx_uchar_cast(c) ((unsigned char)c) #define __Pyx_long_cast(x) ((long)x) #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\ (sizeof(type) < sizeof(Py_ssize_t)) ||\ (sizeof(type) > sizeof(Py_ssize_t) &&\ likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX) &&\ (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\ v == (type)PY_SSIZE_T_MIN))) ||\ (sizeof(type) == sizeof(Py_ssize_t) &&\ (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\ v == (type)PY_SSIZE_T_MAX))) ) #if defined (__cplusplus) && __cplusplus >= 201103L #include #define __Pyx_sst_abs(value) std::abs(value) #elif SIZEOF_INT >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) abs(value) #elif SIZEOF_LONG >= SIZEOF_SIZE_T #define __Pyx_sst_abs(value) labs(value) #elif defined (_MSC_VER) && defined (_M_X64) #define __Pyx_sst_abs(value) _abs64(value) #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define __Pyx_sst_abs(value) llabs(value) #elif defined (__GNUC__) #define __Pyx_sst_abs(value) __builtin_llabs(value) #else #define __Pyx_sst_abs(value) ((value<0) ? -value : value) #endif static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s)) #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l) #define __Pyx_PyBytes_FromString PyBytes_FromString #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*); #if PY_MAJOR_VERSION < 3 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize #else #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize #endif #define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s) #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s) #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s) #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s) #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s) #if PY_MAJOR_VERSION < 3 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) { const Py_UNICODE *u_end = u; while (*u_end++) ; return (size_t)(u_end - u - 1); } #else #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen #endif #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj) #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); #if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) #endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x)) #else #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x)) #endif #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x)) #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII static int __Pyx_sys_getdefaultencoding_not_ascii; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; PyObject* default_encoding = NULL; PyObject* ascii_chars_u = NULL; PyObject* ascii_chars_b = NULL; const char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; if (strcmp(default_encoding_c, "ascii") == 0) { __Pyx_sys_getdefaultencoding_not_ascii = 0; } else { char ascii_chars[128]; int c; for (c = 0; c < 128; c++) { ascii_chars[c] = c; } __Pyx_sys_getdefaultencoding_not_ascii = 1; ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); if (!ascii_chars_u) goto bad; ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { PyErr_Format( PyExc_ValueError, "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.", default_encoding_c); goto bad; } Py_DECREF(ascii_chars_u); Py_DECREF(ascii_chars_b); } Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(default_encoding); Py_XDECREF(ascii_chars_u); Py_XDECREF(ascii_chars_b); return -1; } #endif #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) #else #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT static char* __PYX_DEFAULT_STRING_ENCODING; static int __Pyx_init_sys_getdefaultencoding_params(void) { PyObject* sys; PyObject* default_encoding = NULL; char* default_encoding_c; sys = PyImport_ImportModule("sys"); if (!sys) goto bad; default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); Py_DECREF(sys); if (!default_encoding) goto bad; default_encoding_c = PyBytes_AsString(default_encoding); if (!default_encoding_c) goto bad; __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); if (!__PYX_DEFAULT_STRING_ENCODING) goto bad; strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); Py_DECREF(default_encoding); return 0; bad: Py_XDECREF(default_encoding); return -1; } #endif #endif /* Test for GCC > 2.95 */ #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* !__GNUC__ or GCC < 2.95 */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_d; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static PyObject *__pyx_empty_unicode; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; static const char *__pyx_f[] = { "src/cutadapt/_seqio.pyx", }; /*--- Type declarations ---*/ struct __pyx_obj_8cutadapt_6_seqio_Sequence; struct __pyx_obj_8cutadapt_6_seqio___pyx_scope_struct____iter__; struct __pyx_defaults; typedef struct __pyx_defaults __pyx_defaults; struct __pyx_defaults1; typedef struct __pyx_defaults1 __pyx_defaults1; struct __pyx_defaults2; typedef struct __pyx_defaults2 __pyx_defaults2; struct __pyx_defaults3; typedef struct __pyx_defaults3 __pyx_defaults3; struct __pyx_defaults4; typedef struct __pyx_defaults4 __pyx_defaults4; struct __pyx_defaults { Py_ssize_t __pyx_arg_end; }; struct __pyx_defaults1 { Py_ssize_t __pyx_arg_end; }; struct __pyx_defaults2 { Py_ssize_t __pyx_arg_end; }; struct __pyx_defaults3 { Py_ssize_t __pyx_arg_end; }; struct __pyx_defaults4 { PyObject *__pyx_arg_sequence_class; }; struct __pyx_obj_8cutadapt_6_seqio_Sequence { PyObject_HEAD PyObject *name; PyObject *sequence; PyObject *qualities; int second_header; PyObject *match; }; struct __pyx_obj_8cutadapt_6_seqio___pyx_scope_struct____iter__ { PyObject_HEAD int __pyx_v_i; PyObject *__pyx_v_it; PyObject *__pyx_v_line; PyObject *__pyx_v_name; PyObject *__pyx_v_name2; PyObject *__pyx_v_qualities; int __pyx_v_second_header; PyObject *__pyx_v_self; PyObject *__pyx_v_sequence; PyObject *__pyx_v_sequence_class; int __pyx_v_strip; PyObject *__pyx_t_0; Py_ssize_t __pyx_t_1; PyObject *(*__pyx_t_2)(PyObject *); }; /* --- Runtime support code (head) --- */ /* Refnanny.proto */ #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil)\ if (acquire_gil) {\ PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ PyGILState_Release(__pyx_gilstate_save);\ } else {\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\ } #else #define __Pyx_RefNannySetupContext(name, acquire_gil)\ __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #endif #define __Pyx_RefNannyFinishContext()\ __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif #define __Pyx_XDECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_XDECREF(tmp);\ } while (0) #define __Pyx_DECREF_SET(r, v) do {\ PyObject *tmp = (PyObject *) r;\ r = v; __Pyx_DECREF(tmp);\ } while (0) #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) /* PyObjectGetAttrStr.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_getattro)) return tp->tp_getattro(obj, attr_name); #if PY_MAJOR_VERSION < 3 if (likely(tp->tp_getattr)) return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); #endif return PyObject_GetAttr(obj, attr_name); } #else #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); /* RaiseArgTupleInvalid.proto */ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /* RaiseDoubleKeywords.proto */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /* ParseKeywords.proto */ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); /* GetItemInt.proto */ #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\ (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\ __Pyx_GetItemInt_Generic(o, to_py_func(i)))) #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\ (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL)) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int wraparound, int boundscheck); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); /* PyDictContains.proto */ static CYTHON_INLINE int __Pyx_PyDict_ContainsTF(PyObject* item, PyObject* dict, int eq) { int result = PyDict_Contains(dict, item); return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); } /* DictGetItem.proto */ #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { PyObject *value; value = PyDict_GetItemWithError(d, key); if (unlikely(!value)) { if (!PyErr_Occurred()) { PyObject* args = PyTuple_Pack(1, key); if (likely(args)) PyErr_SetObject(PyExc_KeyError, args); Py_XDECREF(args); } return NULL; } Py_INCREF(value); return value; } #else #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) #endif /* PyObjectCall.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); #else #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif /* PyThreadStateGet.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; #define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET(); #else #define __Pyx_PyThreadState_declare #define __Pyx_PyThreadState_assign #endif /* PyErrFetchRestore.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) #endif /* RaiseException.proto */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /* SetItemInt.proto */ #define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\ (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\ __Pyx_SetItemInt_Generic(o, to_py_func(i), v))) static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, int wraparound, int boundscheck); /* IterFinish.proto */ static CYTHON_INLINE int __Pyx_IterFinish(void); /* PyObjectCallMethO.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif /* PyObjectCallNoArg.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); #else #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) #endif /* PyObjectCallOneArg.proto */ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); /* PyObjectCallMethod0.proto */ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); /* RaiseNeedMoreValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); /* RaiseTooManyValuesToUnpack.proto */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); /* UnpackItemEndCheck.proto */ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /* RaiseNoneIterError.proto */ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); /* UnpackTupleError.proto */ static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /* UnpackTuple2.proto */ static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** value1, PyObject** value2, int is_tuple, int has_known_size, int decref_tuple); /* dict_iter.proto */ static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name, Py_ssize_t* p_orig_length, int* p_is_dict); static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos, PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict); /* ListAppend.proto */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { PyListObject* L = (PyListObject*) list; Py_ssize_t len = Py_SIZE(list); if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { Py_INCREF(x); PyList_SET_ITEM(list, len, x); Py_SIZE(list) = len+1; return 0; } return PyList_Append(list, x); } #else #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif /* ArgTypeTest.proto */ static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /* GetModuleGlobalName.proto */ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /* PyObjectSetAttrStr.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { PyTypeObject* tp = Py_TYPE(obj); if (likely(tp->tp_setattro)) return tp->tp_setattro(obj, attr_name, value); #if PY_MAJOR_VERSION < 3 if (likely(tp->tp_setattr)) return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); #endif return PyObject_SetAttr(obj, attr_name, value); } #else #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) #endif /* IterNext.proto */ #define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL) static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject *, PyObject *); /* IncludeStringH.proto */ #include /* BytesEquals.proto */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /* UnicodeEquals.proto */ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /* StrEquals.proto */ #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals #else #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals #endif /* bytes_tailmatch.proto */ static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize_t start, Py_ssize_t end, int direction); static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr, Py_ssize_t start, Py_ssize_t end, int direction); /* unicode_tailmatch.proto */ static int __Pyx_PyUnicode_Tailmatch(PyObject* s, PyObject* substr, Py_ssize_t start, Py_ssize_t end, int direction); /* str_tailmatch.proto */ static CYTHON_INLINE int __Pyx_PyStr_Tailmatch(PyObject* self, PyObject* arg, Py_ssize_t start, Py_ssize_t end, int direction); /* None.proto */ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); /* None.proto */ static CYTHON_INLINE long __Pyx_mod_long(long, long); /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /* FetchCommonType.proto */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); /* CythonFunction.proto */ #define __Pyx_CyFunction_USED 1 #include #define __Pyx_CYFUNCTION_STATICMETHOD 0x01 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02 #define __Pyx_CYFUNCTION_CCLASS 0x04 #define __Pyx_CyFunction_GetClosure(f)\ (((__pyx_CyFunctionObject *) (f))->func_closure) #define __Pyx_CyFunction_GetClassObj(f)\ (((__pyx_CyFunctionObject *) (f))->func_classobj) #define __Pyx_CyFunction_Defaults(type, f)\ ((type *)(((__pyx_CyFunctionObject *) (f))->defaults)) #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\ ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g) typedef struct { PyCFunctionObject func; #if PY_VERSION_HEX < 0x030500A0 PyObject *func_weakreflist; #endif PyObject *func_dict; PyObject *func_name; PyObject *func_qualname; PyObject *func_doc; PyObject *func_globals; PyObject *func_code; PyObject *func_closure; PyObject *func_classobj; void *defaults; int defaults_pyobjects; int flags; PyObject *defaults_tuple; PyObject *defaults_kwdict; PyObject *(*defaults_getter)(PyObject *); PyObject *func_annotations; } __pyx_CyFunctionObject; static PyTypeObject *__pyx_CyFunctionType = 0; #define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\ __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code) static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *self, PyObject *module, PyObject *globals, PyObject* code); static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m, size_t size, int pyobjects); static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m, PyObject *tuple); static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m, PyObject *dict); static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m, PyObject *dict); static int __pyx_CyFunction_init(void); /* FusedFunction.proto */ typedef struct { __pyx_CyFunctionObject func; PyObject *__signatures__; PyObject *type; PyObject *self; } __pyx_FusedFunctionObject; #define __pyx_FusedFunction_NewEx(ml, flags, qualname, self, module, globals, code)\ __pyx_FusedFunction_New(__pyx_FusedFunctionType, ml, flags, qualname, self, module, globals, code) static PyObject *__pyx_FusedFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject *qualname, PyObject *self, PyObject *module, PyObject *globals, PyObject *code); static int __pyx_FusedFunction_clear(__pyx_FusedFunctionObject *self); static PyTypeObject *__pyx_FusedFunctionType = NULL; static int __pyx_FusedFunction_init(void); #define __Pyx_FusedFunction_USED /* CalculateMetaclass.proto */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); /* Py3ClassCreate.proto */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc); static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); /* CodeObjectCache.proto */ typedef struct { PyCodeObject* code_object; int code_line; } __Pyx_CodeObjectCacheEntry; struct __Pyx_CodeObjectCache { int count; int max_count; __Pyx_CodeObjectCacheEntry* entries; }; static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); static PyCodeObject *__pyx_find_code_object(int code_line); static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); /* AddTraceback.proto */ static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); /* SwapException.proto */ #if CYTHON_COMPILING_IN_CPYTHON #define __Pyx_ExceptionSwap(type, value, tb) __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb) static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); #else static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); #endif /* PyObjectCallMethod1.proto */ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); /* CoroutineBase.proto */ typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyObject *); typedef struct { PyObject_HEAD __pyx_coroutine_body_t body; PyObject *closure; PyObject *exc_type; PyObject *exc_value; PyObject *exc_traceback; PyObject *gi_weakreflist; PyObject *classobj; PyObject *yieldfrom; PyObject *gi_name; PyObject *gi_qualname; int resume_label; char is_running; } __pyx_CoroutineObject; static __pyx_CoroutineObject *__Pyx__Coroutine_New(PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *closure, PyObject *name, PyObject *qualname); static int __Pyx_Coroutine_clear(PyObject *self); #if 1 || PY_VERSION_HEX < 0x030300B0 static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue); #else #define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue) #endif /* PatchModuleWithCoroutine.proto */ static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code); /* PatchGeneratorABC.proto */ static int __Pyx_patch_abc(void); /* Generator.proto */ #define __Pyx_Generator_USED static PyTypeObject *__pyx_GeneratorType = 0; #define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType) #define __Pyx_Generator_New(body, closure, name, qualname)\ __Pyx__Coroutine_New(__pyx_GeneratorType, body, closure, name, qualname) static PyObject *__Pyx_Generator_Next(PyObject *self); static int __pyx_Generator_init(void); /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); /* InitStrings.proto */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'cython' */ /* Module declarations from 'cutadapt._seqio' */ static PyTypeObject *__pyx_ptype_8cutadapt_6_seqio_Sequence = 0; static PyTypeObject *__pyx_ptype_8cutadapt_6_seqio___pyx_scope_struct____iter__ = 0; #define __Pyx_MODULE_NAME "cutadapt._seqio" int __pyx_module_is_main_cutadapt___seqio = 0; /* Implementation of 'cutadapt._seqio' */ static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_zip; static PyObject *__pyx_builtin_NotImplementedError; static PyObject *__pyx_builtin_super; static const char __pyx_k_[] = "()"; static const char __pyx_k_i[] = "i"; static const char __pyx_k__3[] = "|"; static const char __pyx_k_it[] = "it"; static const char __pyx_k__16[] = ""; static const char __pyx_k__17[] = "@"; static const char __pyx_k__18[] = "\r\n"; static const char __pyx_k__19[] = "+\n"; static const char __pyx_k__20[] = "+"; static const char __pyx_k_buf[] = "buf"; static const char __pyx_k_doc[] = "__doc__"; static const char __pyx_k_end[] = "end"; static const char __pyx_k_pos[] = "pos"; static const char __pyx_k_zip[] = "zip"; static const char __pyx_k_args[] = "args"; static const char __pyx_k_buf1[] = "buf1"; static const char __pyx_k_buf2[] = "buf2"; static const char __pyx_k_data[] = "data"; static const char __pyx_k_end1[] = "end1"; static const char __pyx_k_end2[] = "end2"; static const char __pyx_k_file[] = "file"; static const char __pyx_k_head[] = "head"; static const char __pyx_k_init[] = "__init__"; static const char __pyx_k_iter[] = "__iter__"; static const char __pyx_k_line[] = "line"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_name[] = "name"; static const char __pyx_k_pos1[] = "pos1"; static const char __pyx_k_pos2[] = "pos2"; static const char __pyx_k_self[] = "self"; static const char __pyx_k_send[] = "send"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_bytes[] = "bytes"; static const char __pyx_k_class[] = "__class__"; static const char __pyx_k_close[] = "close"; static const char __pyx_k_data1[] = "data1"; static const char __pyx_k_data2[] = "data2"; static const char __pyx_k_lines[] = "lines"; static const char __pyx_k_match[] = "match"; static const char __pyx_k_name2[] = "name2"; static const char __pyx_k_seqio[] = "seqio"; static const char __pyx_k_split[] = "split"; static const char __pyx_k_strip[] = "strip"; static const char __pyx_k_super[] = "super"; static const char __pyx_k_throw[] = "throw"; static const char __pyx_k_xopen[] = "xopen"; static const char __pyx_k_file_2[] = "_file"; static const char __pyx_k_format[] = "format"; static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_kwargs[] = "kwargs"; static const char __pyx_k_length[] = "length"; static const char __pyx_k_module[] = "__module__"; static const char __pyx_k_name_2[] = "__name__"; static const char __pyx_k_rstrip[] = "rstrip"; static const char __pyx_k_prepare[] = "__prepare__"; static const char __pyx_k_shorten[] = "_shorten"; static const char __pyx_k_defaults[] = "defaults"; static const char __pyx_k_qualname[] = "__qualname__"; static const char __pyx_k_sequence[] = "sequence"; static const char __pyx_k_TypeError[] = "TypeError"; static const char __pyx_k_bytearray[] = "bytearray"; static const char __pyx_k_metaclass[] = "__metaclass__"; static const char __pyx_k_qualities[] = "qualities"; static const char __pyx_k_fastq_head[] = "fastq_head"; static const char __pyx_k_linebreaks[] = "linebreaks"; static const char __pyx_k_signatures[] = "signatures"; static const char __pyx_k_FastqReader[] = "FastqReader"; static const char __pyx_k_FormatError[] = "FormatError"; static const char __pyx_k_record_start[] = "record_start"; static const char __pyx_k_qualities_0_r[] = ", qualities={0!r}"; static const char __pyx_k_record_start1[] = "record_start1"; static const char __pyx_k_record_start2[] = "record_start2"; static const char __pyx_k_second_header[] = "second_header"; static const char __pyx_k_SequenceReader[] = "SequenceReader"; static const char __pyx_k_sequence_class[] = "sequence_class"; static const char __pyx_k_cutadapt__seqio[] = "cutadapt._seqio"; static const char __pyx_k_linebreaks_seen[] = "linebreaks_seen"; static const char __pyx_k_two_fastq_heads[] = "two_fastq_heads"; static const char __pyx_k_FastqReader___init[] = "FastqReader.__init__"; static const char __pyx_k_FastqReader___iter[] = "FastqReader.__iter__"; static const char __pyx_k_delivers_qualities[] = "delivers_qualities"; static const char __pyx_k_NotImplementedError[] = "NotImplementedError"; static const char __pyx_k_No_matching_signature_found[] = "No matching signature found"; static const char __pyx_k_FASTQ_file_ended_prematurely[] = "FASTQ file ended prematurely"; static const char __pyx_k_Expected_at_least_d_arguments[] = "Expected at least %d arguments"; static const char __pyx_k_Sequence_name_0_r_sequence_1_r[] = ""; static const char __pyx_k_At_line_0_Sequence_descriptions[] = "At line {0}: Sequence descriptions in the FASTQ file don't match ({1!r} != {2!r}).\nThe second sequence description must be either empty or equal to the first description."; static const char __pyx_k_Reader_for_FASTQ_files_Does_not[] = "\n\tReader for FASTQ files. Does not support multi-line FASTQ files.\n\t"; static const char __pyx_k_home_marcel_scm_cutadapt_cutada[] = "/home/marcel/scm/cutadapt/cutadapt/src/cutadapt/_seqio.pyx"; static const char __pyx_k_Function_call_with_ambiguous_arg[] = "Function call with ambiguous argument types"; static const char __pyx_k_In_read_named_0_r_length_of_qual[] = "In read named {0!r}: length of quality sequence ({1}) and length of read ({2}) do not match"; static const char __pyx_k_Line_0_in_FASTQ_file_is_expected[] = "Line {0} in FASTQ file is expected to start with '@', but found {1!r}"; static const char __pyx_k_Line_0_in_FASTQ_file_is_expected_2[] = "Line {0} in FASTQ file is expected to start with '+', but found {1!r}"; static PyObject *__pyx_kp_s_; static PyObject *__pyx_kp_s_At_line_0_Sequence_descriptions; static PyObject *__pyx_kp_s_Expected_at_least_d_arguments; static PyObject *__pyx_kp_s_FASTQ_file_ended_prematurely; static PyObject *__pyx_n_s_FastqReader; static PyObject *__pyx_n_s_FastqReader___init; static PyObject *__pyx_n_s_FastqReader___iter; static PyObject *__pyx_n_s_FormatError; static PyObject *__pyx_kp_s_Function_call_with_ambiguous_arg; static PyObject *__pyx_kp_s_In_read_named_0_r_length_of_qual; static PyObject *__pyx_kp_s_Line_0_in_FASTQ_file_is_expected; static PyObject *__pyx_kp_s_Line_0_in_FASTQ_file_is_expected_2; static PyObject *__pyx_kp_s_No_matching_signature_found; static PyObject *__pyx_n_s_NotImplementedError; static PyObject *__pyx_kp_s_Reader_for_FASTQ_files_Does_not; static PyObject *__pyx_n_s_SequenceReader; static PyObject *__pyx_kp_s_Sequence_name_0_r_sequence_1_r; static PyObject *__pyx_n_s_TypeError; static PyObject *__pyx_kp_s__16; static PyObject *__pyx_kp_s__17; static PyObject *__pyx_kp_s__18; static PyObject *__pyx_kp_s__19; static PyObject *__pyx_kp_s__20; static PyObject *__pyx_kp_s__3; static PyObject *__pyx_n_s_args; static PyObject *__pyx_n_s_buf; static PyObject *__pyx_n_s_buf1; static PyObject *__pyx_n_s_buf2; static PyObject *__pyx_n_s_bytearray; static PyObject *__pyx_n_s_bytes; static PyObject *__pyx_n_s_class; static PyObject *__pyx_n_s_close; static PyObject *__pyx_n_s_cutadapt__seqio; static PyObject *__pyx_n_s_data; static PyObject *__pyx_n_s_data1; static PyObject *__pyx_n_s_data2; static PyObject *__pyx_n_s_defaults; static PyObject *__pyx_n_s_delivers_qualities; static PyObject *__pyx_n_s_doc; static PyObject *__pyx_n_s_end; static PyObject *__pyx_n_s_end1; static PyObject *__pyx_n_s_end2; static PyObject *__pyx_n_s_fastq_head; static PyObject *__pyx_n_s_file; static PyObject *__pyx_n_s_file_2; static PyObject *__pyx_n_s_format; static PyObject *__pyx_n_s_head; static PyObject *__pyx_kp_s_home_marcel_scm_cutadapt_cutada; static PyObject *__pyx_n_s_i; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_init; static PyObject *__pyx_n_s_it; static PyObject *__pyx_n_s_iter; static PyObject *__pyx_n_s_kwargs; static PyObject *__pyx_n_s_length; static PyObject *__pyx_n_s_line; static PyObject *__pyx_n_s_linebreaks; static PyObject *__pyx_n_s_linebreaks_seen; static PyObject *__pyx_n_s_lines; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_match; static PyObject *__pyx_n_s_metaclass; static PyObject *__pyx_n_s_module; static PyObject *__pyx_n_s_name; static PyObject *__pyx_n_s_name2; static PyObject *__pyx_n_s_name_2; static PyObject *__pyx_n_s_pos; static PyObject *__pyx_n_s_pos1; static PyObject *__pyx_n_s_pos2; static PyObject *__pyx_n_s_prepare; static PyObject *__pyx_n_s_qualities; static PyObject *__pyx_kp_s_qualities_0_r; static PyObject *__pyx_n_s_qualname; static PyObject *__pyx_n_s_record_start; static PyObject *__pyx_n_s_record_start1; static PyObject *__pyx_n_s_record_start2; static PyObject *__pyx_n_s_rstrip; static PyObject *__pyx_n_s_second_header; static PyObject *__pyx_n_s_self; static PyObject *__pyx_n_s_send; static PyObject *__pyx_n_s_seqio; static PyObject *__pyx_n_s_sequence; static PyObject *__pyx_n_s_sequence_class; static PyObject *__pyx_n_s_shorten; static PyObject *__pyx_n_s_signatures; static PyObject *__pyx_n_s_split; static PyObject *__pyx_n_s_strip; static PyObject *__pyx_n_s_super; static PyObject *__pyx_n_s_test; static PyObject *__pyx_n_s_throw; static PyObject *__pyx_n_s_two_fastq_heads; static PyObject *__pyx_n_s_xopen; static PyObject *__pyx_n_s_zip; static PyObject *__pyx_pf_8cutadapt_6_seqio_head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_6head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buf, Py_ssize_t __pyx_v_lines); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_8head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buf, Py_ssize_t __pyx_v_lines); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_2fastq_head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_28__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_12fastq_head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buf, Py_ssize_t __pyx_v_end); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_30__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_14fastq_head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buf, Py_ssize_t __pyx_v_end); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_4two_fastq_heads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_18two_fastq_heads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buf1, PyObject *__pyx_v_buf2, Py_ssize_t __pyx_v_end1, Py_ssize_t __pyx_v_end2); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_20two_fastq_heads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buf1, PyObject *__pyx_v_buf2, Py_ssize_t __pyx_v_end1, Py_ssize_t __pyx_v_end2); /* proto */ static int __pyx_pf_8cutadapt_6_seqio_8Sequence___init__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_sequence, PyObject *__pyx_v_qualities, int __pyx_v_second_header, PyObject *__pyx_v_match); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_8Sequence_2__getitem__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self, PyObject *__pyx_v_key); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_8Sequence_4__repr__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self); /* proto */ static Py_ssize_t __pyx_pf_8cutadapt_6_seqio_8Sequence_6__len__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_8Sequence_8__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_8Sequence_10__reduce__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_8Sequence_4name___get__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self); /* proto */ static int __pyx_pf_8cutadapt_6_seqio_8Sequence_4name_2__set__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ static int __pyx_pf_8cutadapt_6_seqio_8Sequence_4name_4__del__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_8Sequence_8sequence___get__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self); /* proto */ static int __pyx_pf_8cutadapt_6_seqio_8Sequence_8sequence_2__set__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ static int __pyx_pf_8cutadapt_6_seqio_8Sequence_8sequence_4__del__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_8Sequence_9qualities___get__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self); /* proto */ static int __pyx_pf_8cutadapt_6_seqio_8Sequence_9qualities_2__set__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ static int __pyx_pf_8cutadapt_6_seqio_8Sequence_9qualities_4__del__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_8Sequence_13second_header___get__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self); /* proto */ static int __pyx_pf_8cutadapt_6_seqio_8Sequence_13second_header_2__set__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_8Sequence_5match___get__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self); /* proto */ static int __pyx_pf_8cutadapt_6_seqio_8Sequence_5match_2__set__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self, PyObject *__pyx_v_value); /* proto */ static int __pyx_pf_8cutadapt_6_seqio_8Sequence_5match_4__del__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_11FastqReader_5__defaults__(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_11FastqReader___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_sequence_class); /* proto */ static PyObject *__pyx_pf_8cutadapt_6_seqio_11FastqReader_2__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_tp_new_8cutadapt_6_seqio_Sequence(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_tp_new_8cutadapt_6_seqio___pyx_scope_struct____iter__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_k__7; static PyObject *__pyx_tuple__2; static PyObject *__pyx_tuple__4; static PyObject *__pyx_tuple__5; static PyObject *__pyx_tuple__6; static PyObject *__pyx_tuple__8; static PyObject *__pyx_tuple__9; static PyObject *__pyx_tuple__10; static PyObject *__pyx_tuple__11; static PyObject *__pyx_tuple__12; static PyObject *__pyx_tuple__13; static PyObject *__pyx_tuple__14; static PyObject *__pyx_tuple__15; static PyObject *__pyx_tuple__21; static PyObject *__pyx_tuple__22; static PyObject *__pyx_tuple__23; static PyObject *__pyx_tuple__25; static PyObject *__pyx_tuple__27; static PyObject *__pyx_tuple__29; static PyObject *__pyx_tuple__31; static PyObject *__pyx_codeobj__24; static PyObject *__pyx_codeobj__26; static PyObject *__pyx_codeobj__28; static PyObject *__pyx_codeobj__30; static PyObject *__pyx_codeobj__32; /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_seqio_1head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_8cutadapt_6_seqio_head[] = "\n\tSkip forward by a number of lines in the given buffer and return\n\thow many bytes this corresponds to.\n\t"; static PyMethodDef __pyx_mdef_8cutadapt_6_seqio_1head = {"head", (PyCFunction)__pyx_pw_8cutadapt_6_seqio_1head, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8cutadapt_6_seqio_head}; static PyObject *__pyx_pw_8cutadapt_6_seqio_1head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_signatures = 0; PyObject *__pyx_v_args = 0; PyObject *__pyx_v_kwargs = 0; CYTHON_UNUSED PyObject *__pyx_v_defaults = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fused_cpdef (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_signatures,&__pyx_n_s_args,&__pyx_n_s_kwargs,&__pyx_n_s_defaults,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_signatures)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 1); __PYX_ERR(0, 20, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 2); __PYX_ERR(0, 20, __pyx_L3_error) } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_defaults)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 3); __PYX_ERR(0, 20, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fused_cpdef") < 0)) __PYX_ERR(0, 20, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_signatures = values[0]; __pyx_v_args = values[1]; __pyx_v_kwargs = values[2]; __pyx_v_defaults = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 20, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._seqio.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8cutadapt_6_seqio_head(__pyx_self, __pyx_v_signatures, __pyx_v_args, __pyx_v_kwargs, __pyx_v_defaults); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults) { PyObject *__pyx_v_dest_sig = NULL; PyObject *__pyx_v_arg = NULL; PyObject *__pyx_v_candidates = NULL; PyObject *__pyx_v_sig = NULL; int __pyx_v_match_found; PyObject *__pyx_v_src_type = NULL; PyObject *__pyx_v_dst_type = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; Py_ssize_t __pyx_t_4; PyObject *__pyx_t_5 = NULL; Py_ssize_t __pyx_t_6; int __pyx_t_7; int __pyx_t_8; PyObject *__pyx_t_9 = NULL; Py_ssize_t __pyx_t_10; PyObject *(*__pyx_t_11)(PyObject *); PyObject *__pyx_t_12 = NULL; PyObject *__pyx_t_13 = NULL; PyObject *__pyx_t_14 = NULL; PyObject *(*__pyx_t_15)(PyObject *); int __pyx_t_16; __Pyx_RefNannySetupContext("head", 0); __Pyx_INCREF(__pyx_v_kwargs); __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyList_SET_ITEM(__pyx_t_1, 0, Py_None); __pyx_v_dest_sig = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; __pyx_t_2 = (__pyx_v_kwargs == Py_None); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_kwargs, __pyx_t_1); __pyx_t_1 = 0; } if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(0, 20, __pyx_L1_error) } __pyx_t_4 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 20, __pyx_L1_error) __pyx_t_3 = ((0 < __pyx_t_4) != 0); if (__pyx_t_3) { if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 20, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject*)__pyx_v_args), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_arg = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L4; } if (unlikely(__pyx_v_kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 20, __pyx_L1_error) } __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_buf, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 20, __pyx_L1_error) __pyx_t_2 = (__pyx_t_3 != 0); if (__pyx_t_2) { if (unlikely(__pyx_v_kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 20, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_arg = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L4; } /*else*/ { if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(0, 20, __pyx_L1_error) } __pyx_t_4 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 20, __pyx_L1_error) __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Expected_at_least_d_arguments, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 20, __pyx_L1_error) } __pyx_L4:; while (1) { __pyx_t_2 = PyBytes_Check(__pyx_v_arg); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_bytes, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 20, __pyx_L1_error) goto __pyx_L6_break; } __pyx_t_3 = PyByteArray_Check(__pyx_v_arg); __pyx_t_2 = (__pyx_t_3 != 0); if (__pyx_t_2) { if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_bytearray, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 20, __pyx_L1_error) goto __pyx_L6_break; } if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, Py_None, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 20, __pyx_L1_error) goto __pyx_L6_break; } __pyx_L6_break:; __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_candidates = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = 0; if (unlikely(__pyx_v_signatures == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 20, __pyx_L1_error) } __pyx_t_1 = __Pyx_dict_iterator(((PyObject*)__pyx_v_signatures), 1, ((PyObject *)NULL), (&__pyx_t_6), (&__pyx_t_7)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = __pyx_t_1; __pyx_t_1 = 0; while (1) { __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_6, &__pyx_t_4, &__pyx_t_1, NULL, NULL, __pyx_t_7); if (unlikely(__pyx_t_8 == 0)) break; if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_sig, __pyx_t_1); __pyx_t_1 = 0; __pyx_v_match_found = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sig, __pyx_n_s_strip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_split); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); __Pyx_INCREF(__pyx_v_dest_sig); __Pyx_GIVEREF(__pyx_v_dest_sig); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_dest_sig); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (likely(PyList_CheckExact(__pyx_t_9)) || PyTuple_CheckExact(__pyx_t_9)) { __pyx_t_1 = __pyx_t_9; __Pyx_INCREF(__pyx_t_1); __pyx_t_10 = 0; __pyx_t_11 = NULL; } else { __pyx_t_10 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_11 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 20, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; for (;;) { if (likely(!__pyx_t_11)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_9 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 20, __pyx_L1_error) #else __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } else { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 20, __pyx_L1_error) #else __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } } else { __pyx_t_9 = __pyx_t_11(__pyx_t_1); if (unlikely(!__pyx_t_9)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 20, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_9); } if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) { PyObject* sequence = __pyx_t_9; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 20, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_12 = PyList_GET_ITEM(sequence, 0); __pyx_t_13 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(__pyx_t_13); #else __pyx_t_12 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); #endif __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { Py_ssize_t index = -1; __pyx_t_14 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_15 = Py_TYPE(__pyx_t_14)->tp_iternext; index = 0; __pyx_t_12 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_12)) goto __pyx_L13_unpacking_failed; __Pyx_GOTREF(__pyx_t_12); index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L13_unpacking_failed; __Pyx_GOTREF(__pyx_t_13); if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < 0) __PYX_ERR(0, 20, __pyx_L1_error) __pyx_t_15 = NULL; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; goto __pyx_L14_unpacking_done; __pyx_L13_unpacking_failed:; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_15 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 20, __pyx_L1_error) __pyx_L14_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_src_type, __pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF_SET(__pyx_v_dst_type, __pyx_t_13); __pyx_t_13 = 0; __pyx_t_2 = (__pyx_v_dst_type != Py_None); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { __pyx_t_9 = PyObject_RichCompare(__pyx_v_src_type, __pyx_v_dst_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 20, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (__pyx_t_3) { __pyx_v_match_found = 1; goto __pyx_L16; } /*else*/ { __pyx_v_match_found = 0; goto __pyx_L12_break; } __pyx_L16:; } } __pyx_L12_break:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_v_match_found != 0); if (__pyx_t_3) { __pyx_t_16 = __Pyx_PyList_Append(__pyx_v_candidates, __pyx_v_sig); if (unlikely(__pyx_t_16 == -1)) __PYX_ERR(0, 20, __pyx_L1_error) } } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = (__pyx_v_candidates != Py_None) && (PyList_GET_SIZE(__pyx_v_candidates) != 0); __pyx_t_2 = ((!__pyx_t_3) != 0); if (__pyx_t_2) { __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 20, __pyx_L1_error) } __pyx_t_6 = PyList_GET_SIZE(__pyx_v_candidates); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 20, __pyx_L1_error) __pyx_t_2 = ((__pyx_t_6 > 1) != 0); if (__pyx_t_2) { __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 20, __pyx_L1_error) } /*else*/ { __Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_signatures == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 20, __pyx_L1_error) } __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_candidates, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_signatures), __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; } /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); __Pyx_AddTraceback("cutadapt._seqio.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_dest_sig); __Pyx_XDECREF(__pyx_v_arg); __Pyx_XDECREF(__pyx_v_candidates); __Pyx_XDECREF(__pyx_v_sig); __Pyx_XDECREF(__pyx_v_src_type); __Pyx_XDECREF(__pyx_v_dst_type); __Pyx_XDECREF(__pyx_v_kwargs); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_fuse_0__pyx_pw_8cutadapt_6_seqio_7head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_fuse_0__pyx_mdef_8cutadapt_6_seqio_7head = {"__pyx_fuse_0head", (PyCFunction)__pyx_fuse_0__pyx_pw_8cutadapt_6_seqio_7head, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8cutadapt_6_seqio_head}; static PyObject *__pyx_fuse_0__pyx_pw_8cutadapt_6_seqio_7head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_buf = 0; Py_ssize_t __pyx_v_lines; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("head (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buf,&__pyx_n_s_lines,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lines)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("head", 1, 2, 2, 1); __PYX_ERR(0, 20, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "head") < 0)) __PYX_ERR(0, 20, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_buf = ((PyObject*)values[0]); __pyx_v_lines = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_lines == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 20, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("head", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 20, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._seqio.head", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buf), (&PyBytes_Type), 1, "buf", 1))) __PYX_ERR(0, 20, __pyx_L1_error) __pyx_r = __pyx_pf_8cutadapt_6_seqio_6head(__pyx_self, __pyx_v_buf, __pyx_v_lines); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_6head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buf, Py_ssize_t __pyx_v_lines) { Py_ssize_t __pyx_v_pos; Py_ssize_t __pyx_v_linebreaks_seen; Py_ssize_t __pyx_v_length; unsigned char *__pyx_v_data; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; unsigned char *__pyx_t_2; int __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("__pyx_fuse_0head", 0); __pyx_v_pos = 0; __pyx_v_linebreaks_seen = 0; if (unlikely(__pyx_v_buf == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(0, 28, __pyx_L1_error) } __pyx_t_1 = PyBytes_GET_SIZE(__pyx_v_buf); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 28, __pyx_L1_error) __pyx_v_length = __pyx_t_1; __pyx_t_2 = __Pyx_PyObject_AsUString(__pyx_v_buf); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 29, __pyx_L1_error) __pyx_v_data = __pyx_t_2; while (1) { __pyx_t_4 = ((__pyx_v_linebreaks_seen < __pyx_v_lines) != 0); if (__pyx_t_4) { } else { __pyx_t_3 = __pyx_t_4; goto __pyx_L5_bool_binop_done; } __pyx_t_4 = ((__pyx_v_pos < __pyx_v_length) != 0); __pyx_t_3 = __pyx_t_4; __pyx_L5_bool_binop_done:; if (!__pyx_t_3) break; __pyx_t_3 = (((__pyx_v_data[__pyx_v_pos]) == '\n') != 0); if (__pyx_t_3) { __pyx_v_linebreaks_seen = (__pyx_v_linebreaks_seen + 1); } __pyx_v_pos = (__pyx_v_pos + 1); } __Pyx_XDECREF(__pyx_r); __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_pos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("cutadapt._seqio.head", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_fuse_1__pyx_pw_8cutadapt_6_seqio_9head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_fuse_1__pyx_mdef_8cutadapt_6_seqio_9head = {"__pyx_fuse_1head", (PyCFunction)__pyx_fuse_1__pyx_pw_8cutadapt_6_seqio_9head, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8cutadapt_6_seqio_head}; static PyObject *__pyx_fuse_1__pyx_pw_8cutadapt_6_seqio_9head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_buf = 0; Py_ssize_t __pyx_v_lines; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("head (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buf,&__pyx_n_s_lines,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lines)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("head", 1, 2, 2, 1); __PYX_ERR(0, 20, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "head") < 0)) __PYX_ERR(0, 20, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_buf = ((PyObject*)values[0]); __pyx_v_lines = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_lines == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 20, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("head", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 20, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._seqio.head", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buf), (&PyByteArray_Type), 1, "buf", 1))) __PYX_ERR(0, 20, __pyx_L1_error) __pyx_r = __pyx_pf_8cutadapt_6_seqio_8head(__pyx_self, __pyx_v_buf, __pyx_v_lines); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_8head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buf, Py_ssize_t __pyx_v_lines) { Py_ssize_t __pyx_v_pos; Py_ssize_t __pyx_v_linebreaks_seen; Py_ssize_t __pyx_v_length; unsigned char *__pyx_v_data; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; unsigned char *__pyx_t_2; int __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("__pyx_fuse_1head", 0); __pyx_v_pos = 0; __pyx_v_linebreaks_seen = 0; __pyx_t_1 = PyObject_Length(__pyx_v_buf); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 28, __pyx_L1_error) __pyx_v_length = __pyx_t_1; __pyx_t_2 = __Pyx_PyObject_AsUString(__pyx_v_buf); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 29, __pyx_L1_error) __pyx_v_data = __pyx_t_2; while (1) { __pyx_t_4 = ((__pyx_v_linebreaks_seen < __pyx_v_lines) != 0); if (__pyx_t_4) { } else { __pyx_t_3 = __pyx_t_4; goto __pyx_L5_bool_binop_done; } __pyx_t_4 = ((__pyx_v_pos < __pyx_v_length) != 0); __pyx_t_3 = __pyx_t_4; __pyx_L5_bool_binop_done:; if (!__pyx_t_3) break; __pyx_t_3 = (((__pyx_v_data[__pyx_v_pos]) == '\n') != 0); if (__pyx_t_3) { __pyx_v_linebreaks_seen = (__pyx_v_linebreaks_seen + 1); } __pyx_v_pos = (__pyx_v_pos + 1); } __Pyx_XDECREF(__pyx_r); __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_pos); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("cutadapt._seqio.head", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_seqio_3fastq_head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_8cutadapt_6_seqio_2fastq_head[] = "\n\tReturn an integer length such that buf[:length] contains the highest\n\tpossible number of complete four-line records.\n\n\tIf end is -1, the full buffer is searched. Otherwise only buf[:end].\n\t"; static PyMethodDef __pyx_mdef_8cutadapt_6_seqio_3fastq_head = {"fastq_head", (PyCFunction)__pyx_pw_8cutadapt_6_seqio_3fastq_head, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8cutadapt_6_seqio_2fastq_head}; static PyObject *__pyx_pw_8cutadapt_6_seqio_3fastq_head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_signatures = 0; PyObject *__pyx_v_args = 0; PyObject *__pyx_v_kwargs = 0; CYTHON_UNUSED PyObject *__pyx_v_defaults = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fused_cpdef (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_signatures,&__pyx_n_s_args,&__pyx_n_s_kwargs,&__pyx_n_s_defaults,0}; PyObject* values[4] = {0,0,0,0}; values[1] = __pyx_k__7; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_signatures)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args); if (value) { values[1] = value; kw_args--; } } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 2); __PYX_ERR(0, 38, __pyx_L3_error) } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_defaults)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 3); __PYX_ERR(0, 38, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fused_cpdef") < 0)) __PYX_ERR(0, 38, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_signatures = values[0]; __pyx_v_args = values[1]; __pyx_v_kwargs = values[2]; __pyx_v_defaults = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 38, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._seqio.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8cutadapt_6_seqio_2fastq_head(__pyx_self, __pyx_v_signatures, __pyx_v_args, __pyx_v_kwargs, __pyx_v_defaults); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_2fastq_head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults) { PyObject *__pyx_v_dest_sig = NULL; PyObject *__pyx_v_arg = NULL; PyObject *__pyx_v_candidates = NULL; PyObject *__pyx_v_sig = NULL; int __pyx_v_match_found; PyObject *__pyx_v_src_type = NULL; PyObject *__pyx_v_dst_type = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; Py_ssize_t __pyx_t_4; PyObject *__pyx_t_5 = NULL; Py_ssize_t __pyx_t_6; int __pyx_t_7; int __pyx_t_8; PyObject *__pyx_t_9 = NULL; Py_ssize_t __pyx_t_10; PyObject *(*__pyx_t_11)(PyObject *); PyObject *__pyx_t_12 = NULL; PyObject *__pyx_t_13 = NULL; PyObject *__pyx_t_14 = NULL; PyObject *(*__pyx_t_15)(PyObject *); int __pyx_t_16; __Pyx_RefNannySetupContext("fastq_head", 0); __Pyx_INCREF(__pyx_v_kwargs); __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyList_SET_ITEM(__pyx_t_1, 0, Py_None); __pyx_v_dest_sig = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; __pyx_t_2 = (__pyx_v_kwargs == Py_None); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_kwargs, __pyx_t_1); __pyx_t_1 = 0; } if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(0, 38, __pyx_L1_error) } __pyx_t_4 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 38, __pyx_L1_error) __pyx_t_3 = ((0 < __pyx_t_4) != 0); if (__pyx_t_3) { if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 38, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject*)__pyx_v_args), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_arg = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L4; } if (unlikely(__pyx_v_kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 38, __pyx_L1_error) } __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_buf, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 38, __pyx_L1_error) __pyx_t_2 = (__pyx_t_3 != 0); if (__pyx_t_2) { if (unlikely(__pyx_v_kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 38, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_buf); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_arg = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L4; } /*else*/ { if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(0, 38, __pyx_L1_error) } __pyx_t_4 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 38, __pyx_L1_error) __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Expected_at_least_d_arguments, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 38, __pyx_L1_error) } __pyx_L4:; while (1) { __pyx_t_2 = PyBytes_Check(__pyx_v_arg); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_bytes, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 38, __pyx_L1_error) goto __pyx_L6_break; } __pyx_t_3 = PyByteArray_Check(__pyx_v_arg); __pyx_t_2 = (__pyx_t_3 != 0); if (__pyx_t_2) { if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_bytearray, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 38, __pyx_L1_error) goto __pyx_L6_break; } if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, Py_None, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 38, __pyx_L1_error) goto __pyx_L6_break; } __pyx_L6_break:; __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_candidates = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = 0; if (unlikely(__pyx_v_signatures == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 38, __pyx_L1_error) } __pyx_t_1 = __Pyx_dict_iterator(((PyObject*)__pyx_v_signatures), 1, ((PyObject *)NULL), (&__pyx_t_6), (&__pyx_t_7)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = __pyx_t_1; __pyx_t_1 = 0; while (1) { __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_6, &__pyx_t_4, &__pyx_t_1, NULL, NULL, __pyx_t_7); if (unlikely(__pyx_t_8 == 0)) break; if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_sig, __pyx_t_1); __pyx_t_1 = 0; __pyx_v_match_found = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sig, __pyx_n_s_strip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_split); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); __Pyx_INCREF(__pyx_v_dest_sig); __Pyx_GIVEREF(__pyx_v_dest_sig); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_dest_sig); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (likely(PyList_CheckExact(__pyx_t_9)) || PyTuple_CheckExact(__pyx_t_9)) { __pyx_t_1 = __pyx_t_9; __Pyx_INCREF(__pyx_t_1); __pyx_t_10 = 0; __pyx_t_11 = NULL; } else { __pyx_t_10 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_11 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 38, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; for (;;) { if (likely(!__pyx_t_11)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_9 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 38, __pyx_L1_error) #else __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } else { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 38, __pyx_L1_error) #else __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } } else { __pyx_t_9 = __pyx_t_11(__pyx_t_1); if (unlikely(!__pyx_t_9)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 38, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_9); } if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) { PyObject* sequence = __pyx_t_9; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 38, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_12 = PyList_GET_ITEM(sequence, 0); __pyx_t_13 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(__pyx_t_13); #else __pyx_t_12 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); #endif __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { Py_ssize_t index = -1; __pyx_t_14 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_15 = Py_TYPE(__pyx_t_14)->tp_iternext; index = 0; __pyx_t_12 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_12)) goto __pyx_L13_unpacking_failed; __Pyx_GOTREF(__pyx_t_12); index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L13_unpacking_failed; __Pyx_GOTREF(__pyx_t_13); if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < 0) __PYX_ERR(0, 38, __pyx_L1_error) __pyx_t_15 = NULL; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; goto __pyx_L14_unpacking_done; __pyx_L13_unpacking_failed:; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_15 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 38, __pyx_L1_error) __pyx_L14_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_src_type, __pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF_SET(__pyx_v_dst_type, __pyx_t_13); __pyx_t_13 = 0; __pyx_t_2 = (__pyx_v_dst_type != Py_None); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { __pyx_t_9 = PyObject_RichCompare(__pyx_v_src_type, __pyx_v_dst_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (__pyx_t_3) { __pyx_v_match_found = 1; goto __pyx_L16; } /*else*/ { __pyx_v_match_found = 0; goto __pyx_L12_break; } __pyx_L16:; } } __pyx_L12_break:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_v_match_found != 0); if (__pyx_t_3) { __pyx_t_16 = __Pyx_PyList_Append(__pyx_v_candidates, __pyx_v_sig); if (unlikely(__pyx_t_16 == -1)) __PYX_ERR(0, 38, __pyx_L1_error) } } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = (__pyx_v_candidates != Py_None) && (PyList_GET_SIZE(__pyx_v_candidates) != 0); __pyx_t_2 = ((!__pyx_t_3) != 0); if (__pyx_t_2) { __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 38, __pyx_L1_error) } __pyx_t_6 = PyList_GET_SIZE(__pyx_v_candidates); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 38, __pyx_L1_error) __pyx_t_2 = ((__pyx_t_6 > 1) != 0); if (__pyx_t_2) { __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 38, __pyx_L1_error) } /*else*/ { __Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_signatures == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 38, __pyx_L1_error) } __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_candidates, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_signatures), __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; } /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); __Pyx_AddTraceback("cutadapt._seqio.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_dest_sig); __Pyx_XDECREF(__pyx_v_arg); __Pyx_XDECREF(__pyx_v_candidates); __Pyx_XDECREF(__pyx_v_sig); __Pyx_XDECREF(__pyx_v_src_type); __Pyx_XDECREF(__pyx_v_dst_type); __Pyx_XDECREF(__pyx_v_kwargs); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_28__defaults__(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__defaults__", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyInt_FromSsize_t(__Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self)->__pyx_arg_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("cutadapt._seqio.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_fuse_0__pyx_pw_8cutadapt_6_seqio_13fastq_head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_fuse_0__pyx_mdef_8cutadapt_6_seqio_13fastq_head = {"__pyx_fuse_0fastq_head", (PyCFunction)__pyx_fuse_0__pyx_pw_8cutadapt_6_seqio_13fastq_head, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8cutadapt_6_seqio_2fastq_head}; static PyObject *__pyx_fuse_0__pyx_pw_8cutadapt_6_seqio_13fastq_head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_buf = 0; Py_ssize_t __pyx_v_end; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fastq_head (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buf,&__pyx_n_s_end,0}; PyObject* values[2] = {0,0}; __pyx_defaults2 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_self); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fastq_head") < 0)) __PYX_ERR(0, 38, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_buf = ((PyObject*)values[0]); if (values[1]) { __pyx_v_end = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_end == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L3_error) } else { __pyx_v_end = __pyx_dynamic_args->__pyx_arg_end; } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("fastq_head", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 38, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._seqio.fastq_head", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buf), (&PyBytes_Type), 1, "buf", 1))) __PYX_ERR(0, 38, __pyx_L1_error) __pyx_r = __pyx_pf_8cutadapt_6_seqio_12fastq_head(__pyx_self, __pyx_v_buf, __pyx_v_end); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_12fastq_head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buf, Py_ssize_t __pyx_v_end) { Py_ssize_t __pyx_v_pos; Py_ssize_t __pyx_v_linebreaks; Py_ssize_t __pyx_v_length; unsigned char *__pyx_v_data; Py_ssize_t __pyx_v_record_start; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; unsigned char *__pyx_t_2; int __pyx_t_3; Py_ssize_t __pyx_t_4; Py_ssize_t __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; __Pyx_RefNannySetupContext("__pyx_fuse_0fastq_head", 0); __pyx_v_pos = 0; __pyx_v_linebreaks = 0; if (unlikely(__pyx_v_buf == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(0, 48, __pyx_L1_error) } __pyx_t_1 = PyBytes_GET_SIZE(__pyx_v_buf); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 48, __pyx_L1_error) __pyx_v_length = __pyx_t_1; __pyx_t_2 = __Pyx_PyObject_AsUString(__pyx_v_buf); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 49, __pyx_L1_error) __pyx_v_data = __pyx_t_2; __pyx_v_record_start = 0; __pyx_t_3 = ((__pyx_v_end != -1L) != 0); if (__pyx_t_3) { __pyx_t_1 = __pyx_v_end; __pyx_t_4 = __pyx_v_length; if (((__pyx_t_1 < __pyx_t_4) != 0)) { __pyx_t_5 = __pyx_t_1; } else { __pyx_t_5 = __pyx_t_4; } __pyx_v_length = __pyx_t_5; } while (1) { while (1) { __pyx_t_6 = ((__pyx_v_pos < __pyx_v_length) != 0); if (__pyx_t_6) { } else { __pyx_t_3 = __pyx_t_6; goto __pyx_L8_bool_binop_done; } __pyx_t_6 = (((__pyx_v_data[__pyx_v_pos]) != '\n') != 0); __pyx_t_3 = __pyx_t_6; __pyx_L8_bool_binop_done:; if (!__pyx_t_3) break; __pyx_v_pos = (__pyx_v_pos + 1); } __pyx_t_3 = ((__pyx_v_pos == __pyx_v_length) != 0); if (__pyx_t_3) { goto __pyx_L5_break; } __pyx_v_pos = (__pyx_v_pos + 1); __pyx_v_linebreaks = (__pyx_v_linebreaks + 1); __pyx_t_3 = ((__pyx_v_linebreaks == 4) != 0); if (__pyx_t_3) { __pyx_v_linebreaks = 0; __pyx_v_record_start = __pyx_v_pos; } } __pyx_L5_break:; __Pyx_XDECREF(__pyx_r); __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_record_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_r = __pyx_t_7; __pyx_t_7 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("cutadapt._seqio.fastq_head", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_30__defaults__(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__defaults__", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyInt_FromSsize_t(__Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self)->__pyx_arg_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_1, 1, Py_None); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("cutadapt._seqio.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_fuse_1__pyx_pw_8cutadapt_6_seqio_15fastq_head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_fuse_1__pyx_mdef_8cutadapt_6_seqio_15fastq_head = {"__pyx_fuse_1fastq_head", (PyCFunction)__pyx_fuse_1__pyx_pw_8cutadapt_6_seqio_15fastq_head, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8cutadapt_6_seqio_2fastq_head}; static PyObject *__pyx_fuse_1__pyx_pw_8cutadapt_6_seqio_15fastq_head(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_buf = 0; Py_ssize_t __pyx_v_end; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fastq_head (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buf,&__pyx_n_s_end,0}; PyObject* values[2] = {0,0}; __pyx_defaults3 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_self); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_buf)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end); if (value) { values[1] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fastq_head") < 0)) __PYX_ERR(0, 38, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_buf = ((PyObject*)values[0]); if (values[1]) { __pyx_v_end = __Pyx_PyIndex_AsSsize_t(values[1]); if (unlikely((__pyx_v_end == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L3_error) } else { __pyx_v_end = __pyx_dynamic_args->__pyx_arg_end; } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("fastq_head", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 38, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._seqio.fastq_head", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buf), (&PyByteArray_Type), 1, "buf", 1))) __PYX_ERR(0, 38, __pyx_L1_error) __pyx_r = __pyx_pf_8cutadapt_6_seqio_14fastq_head(__pyx_self, __pyx_v_buf, __pyx_v_end); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_14fastq_head(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buf, Py_ssize_t __pyx_v_end) { Py_ssize_t __pyx_v_pos; Py_ssize_t __pyx_v_linebreaks; Py_ssize_t __pyx_v_length; unsigned char *__pyx_v_data; Py_ssize_t __pyx_v_record_start; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; unsigned char *__pyx_t_2; int __pyx_t_3; Py_ssize_t __pyx_t_4; Py_ssize_t __pyx_t_5; int __pyx_t_6; PyObject *__pyx_t_7 = NULL; __Pyx_RefNannySetupContext("__pyx_fuse_1fastq_head", 0); __pyx_v_pos = 0; __pyx_v_linebreaks = 0; __pyx_t_1 = PyObject_Length(__pyx_v_buf); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 48, __pyx_L1_error) __pyx_v_length = __pyx_t_1; __pyx_t_2 = __Pyx_PyObject_AsUString(__pyx_v_buf); if (unlikely((!__pyx_t_2) && PyErr_Occurred())) __PYX_ERR(0, 49, __pyx_L1_error) __pyx_v_data = __pyx_t_2; __pyx_v_record_start = 0; __pyx_t_3 = ((__pyx_v_end != -1L) != 0); if (__pyx_t_3) { __pyx_t_1 = __pyx_v_end; __pyx_t_4 = __pyx_v_length; if (((__pyx_t_1 < __pyx_t_4) != 0)) { __pyx_t_5 = __pyx_t_1; } else { __pyx_t_5 = __pyx_t_4; } __pyx_v_length = __pyx_t_5; } while (1) { while (1) { __pyx_t_6 = ((__pyx_v_pos < __pyx_v_length) != 0); if (__pyx_t_6) { } else { __pyx_t_3 = __pyx_t_6; goto __pyx_L8_bool_binop_done; } __pyx_t_6 = (((__pyx_v_data[__pyx_v_pos]) != '\n') != 0); __pyx_t_3 = __pyx_t_6; __pyx_L8_bool_binop_done:; if (!__pyx_t_3) break; __pyx_v_pos = (__pyx_v_pos + 1); } __pyx_t_3 = ((__pyx_v_pos == __pyx_v_length) != 0); if (__pyx_t_3) { goto __pyx_L5_break; } __pyx_v_pos = (__pyx_v_pos + 1); __pyx_v_linebreaks = (__pyx_v_linebreaks + 1); __pyx_t_3 = ((__pyx_v_linebreaks == 4) != 0); if (__pyx_t_3) { __pyx_v_linebreaks = 0; __pyx_v_record_start = __pyx_v_pos; } } __pyx_L5_break:; __Pyx_XDECREF(__pyx_r); __pyx_t_7 = PyInt_FromSsize_t(__pyx_v_record_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_r = __pyx_t_7; __pyx_t_7 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("cutadapt._seqio.fastq_head", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_seqio_5two_fastq_heads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_8cutadapt_6_seqio_4two_fastq_heads[] = "\n\tSkip forward in the two buffers by multiples of four lines.\n\n\tReturn a tuple (length1, length2) such that buf1[:length1] and\n\tbuf2[:length2] contain the same number of lines (where the\n\tline number is divisible by four).\n\t"; static PyMethodDef __pyx_mdef_8cutadapt_6_seqio_5two_fastq_heads = {"two_fastq_heads", (PyCFunction)__pyx_pw_8cutadapt_6_seqio_5two_fastq_heads, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8cutadapt_6_seqio_4two_fastq_heads}; static PyObject *__pyx_pw_8cutadapt_6_seqio_5two_fastq_heads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_signatures = 0; PyObject *__pyx_v_args = 0; PyObject *__pyx_v_kwargs = 0; CYTHON_UNUSED PyObject *__pyx_v_defaults = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_fused_cpdef (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_signatures,&__pyx_n_s_args,&__pyx_n_s_kwargs,&__pyx_n_s_defaults,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_signatures)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_args)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 1); __PYX_ERR(0, 69, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_kwargs)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 2); __PYX_ERR(0, 69, __pyx_L3_error) } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_defaults)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, 3); __PYX_ERR(0, 69, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_fused_cpdef") < 0)) __PYX_ERR(0, 69, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_signatures = values[0]; __pyx_v_args = values[1]; __pyx_v_kwargs = values[2]; __pyx_v_defaults = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__pyx_fused_cpdef", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 69, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._seqio.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8cutadapt_6_seqio_4two_fastq_heads(__pyx_self, __pyx_v_signatures, __pyx_v_args, __pyx_v_kwargs, __pyx_v_defaults); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_4two_fastq_heads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_signatures, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs, CYTHON_UNUSED PyObject *__pyx_v_defaults) { PyObject *__pyx_v_dest_sig = NULL; PyObject *__pyx_v_arg = NULL; PyObject *__pyx_v_candidates = NULL; PyObject *__pyx_v_sig = NULL; int __pyx_v_match_found; PyObject *__pyx_v_src_type = NULL; PyObject *__pyx_v_dst_type = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; Py_ssize_t __pyx_t_4; PyObject *__pyx_t_5 = NULL; Py_ssize_t __pyx_t_6; int __pyx_t_7; int __pyx_t_8; PyObject *__pyx_t_9 = NULL; Py_ssize_t __pyx_t_10; PyObject *(*__pyx_t_11)(PyObject *); PyObject *__pyx_t_12 = NULL; PyObject *__pyx_t_13 = NULL; PyObject *__pyx_t_14 = NULL; PyObject *(*__pyx_t_15)(PyObject *); int __pyx_t_16; __Pyx_RefNannySetupContext("two_fastq_heads", 0); __Pyx_INCREF(__pyx_v_kwargs); __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyList_SET_ITEM(__pyx_t_1, 0, Py_None); __pyx_v_dest_sig = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; __pyx_t_2 = (__pyx_v_kwargs == Py_None); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF_SET(__pyx_v_kwargs, __pyx_t_1); __pyx_t_1 = 0; } if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(0, 69, __pyx_L1_error) } __pyx_t_4 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 69, __pyx_L1_error) __pyx_t_3 = ((0 < __pyx_t_4) != 0); if (__pyx_t_3) { if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 69, __pyx_L1_error) } __pyx_t_1 = __Pyx_GetItemInt_Tuple(((PyObject*)__pyx_v_args), 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_arg = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L4; } if (unlikely(__pyx_v_kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 69, __pyx_L1_error) } __pyx_t_3 = (__Pyx_PyDict_ContainsTF(__pyx_n_s_buf1, ((PyObject*)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 69, __pyx_L1_error) __pyx_t_2 = (__pyx_t_3 != 0); if (__pyx_t_2) { if (unlikely(__pyx_v_kwargs == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 69, __pyx_L1_error) } __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_kwargs), __pyx_n_s_buf1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_arg = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L4; } /*else*/ { if (unlikely(__pyx_v_args == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(0, 69, __pyx_L1_error) } __pyx_t_4 = PyTuple_GET_SIZE(((PyObject*)__pyx_v_args)); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 69, __pyx_L1_error) __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Expected_at_least_d_arguments, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 69, __pyx_L1_error) } __pyx_L4:; while (1) { __pyx_t_2 = PyBytes_Check(__pyx_v_arg); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_bytes, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 69, __pyx_L1_error) goto __pyx_L6_break; } __pyx_t_3 = PyByteArray_Check(__pyx_v_arg); __pyx_t_2 = (__pyx_t_3 != 0); if (__pyx_t_2) { if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, __pyx_n_s_bytearray, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 69, __pyx_L1_error) goto __pyx_L6_break; } if (unlikely(__Pyx_SetItemInt(__pyx_v_dest_sig, 0, Py_None, long, 1, __Pyx_PyInt_From_long, 1, 0, 1) < 0)) __PYX_ERR(0, 69, __pyx_L1_error) goto __pyx_L6_break; } __pyx_L6_break:; __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_v_candidates = ((PyObject*)__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = 0; if (unlikely(__pyx_v_signatures == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); __PYX_ERR(0, 69, __pyx_L1_error) } __pyx_t_1 = __Pyx_dict_iterator(((PyObject*)__pyx_v_signatures), 1, ((PyObject *)NULL), (&__pyx_t_6), (&__pyx_t_7)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = __pyx_t_1; __pyx_t_1 = 0; while (1) { __pyx_t_8 = __Pyx_dict_iter_next(__pyx_t_5, __pyx_t_6, &__pyx_t_4, &__pyx_t_1, NULL, NULL, __pyx_t_7); if (unlikely(__pyx_t_8 == 0)) break; if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF_SET(__pyx_v_sig, __pyx_t_1); __pyx_t_1 = 0; __pyx_v_match_found = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sig, __pyx_n_s_strip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_split); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); __Pyx_INCREF(__pyx_v_dest_sig); __Pyx_GIVEREF(__pyx_v_dest_sig); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_dest_sig); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_1, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (likely(PyList_CheckExact(__pyx_t_9)) || PyTuple_CheckExact(__pyx_t_9)) { __pyx_t_1 = __pyx_t_9; __Pyx_INCREF(__pyx_t_1); __pyx_t_10 = 0; __pyx_t_11 = NULL; } else { __pyx_t_10 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_11 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 69, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; for (;;) { if (likely(!__pyx_t_11)) { if (likely(PyList_CheckExact(__pyx_t_1))) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_9 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 69, __pyx_L1_error) #else __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } else { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 69, __pyx_L1_error) #else __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } } else { __pyx_t_9 = __pyx_t_11(__pyx_t_1); if (unlikely(!__pyx_t_9)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 69, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_9); } if ((likely(PyTuple_CheckExact(__pyx_t_9))) || (PyList_CheckExact(__pyx_t_9))) { PyObject* sequence = __pyx_t_9; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 69, __pyx_L1_error) } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_12 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_13 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_12 = PyList_GET_ITEM(sequence, 0); __pyx_t_13 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(__pyx_t_13); #else __pyx_t_12 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_13 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); #endif __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { Py_ssize_t index = -1; __pyx_t_14 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_15 = Py_TYPE(__pyx_t_14)->tp_iternext; index = 0; __pyx_t_12 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_12)) goto __pyx_L13_unpacking_failed; __Pyx_GOTREF(__pyx_t_12); index = 1; __pyx_t_13 = __pyx_t_15(__pyx_t_14); if (unlikely(!__pyx_t_13)) goto __pyx_L13_unpacking_failed; __Pyx_GOTREF(__pyx_t_13); if (__Pyx_IternextUnpackEndCheck(__pyx_t_15(__pyx_t_14), 2) < 0) __PYX_ERR(0, 69, __pyx_L1_error) __pyx_t_15 = NULL; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; goto __pyx_L14_unpacking_done; __pyx_L13_unpacking_failed:; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_15 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 69, __pyx_L1_error) __pyx_L14_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_src_type, __pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF_SET(__pyx_v_dst_type, __pyx_t_13); __pyx_t_13 = 0; __pyx_t_2 = (__pyx_v_dst_type != Py_None); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { __pyx_t_9 = PyObject_RichCompare(__pyx_v_src_type, __pyx_v_dst_type, Py_EQ); __Pyx_XGOTREF(__pyx_t_9); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 69, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (__pyx_t_3) { __pyx_v_match_found = 1; goto __pyx_L16; } /*else*/ { __pyx_v_match_found = 0; goto __pyx_L12_break; } __pyx_L16:; } } __pyx_L12_break:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_v_match_found != 0); if (__pyx_t_3) { __pyx_t_16 = __Pyx_PyList_Append(__pyx_v_candidates, __pyx_v_sig); if (unlikely(__pyx_t_16 == -1)) __PYX_ERR(0, 69, __pyx_L1_error) } } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = (__pyx_v_candidates != Py_None) && (PyList_GET_SIZE(__pyx_v_candidates) != 0); __pyx_t_2 = ((!__pyx_t_3) != 0); if (__pyx_t_2) { __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 69, __pyx_L1_error) } __pyx_t_6 = PyList_GET_SIZE(__pyx_v_candidates); if (unlikely(__pyx_t_6 == -1)) __PYX_ERR(0, 69, __pyx_L1_error) __pyx_t_2 = ((__pyx_t_6 > 1) != 0); if (__pyx_t_2) { __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 69, __pyx_L1_error) } /*else*/ { __Pyx_XDECREF(__pyx_r); if (unlikely(__pyx_v_signatures == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 69, __pyx_L1_error) } __pyx_t_5 = __Pyx_GetItemInt_List(__pyx_v_candidates, 0, long, 1, __Pyx_PyInt_From_long, 1, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject*)__pyx_v_signatures), __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; } /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); __Pyx_AddTraceback("cutadapt._seqio.__pyx_fused_cpdef", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_dest_sig); __Pyx_XDECREF(__pyx_v_arg); __Pyx_XDECREF(__pyx_v_candidates); __Pyx_XDECREF(__pyx_v_sig); __Pyx_XDECREF(__pyx_v_src_type); __Pyx_XDECREF(__pyx_v_dst_type); __Pyx_XDECREF(__pyx_v_kwargs); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_fuse_0__pyx_pw_8cutadapt_6_seqio_19two_fastq_heads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_fuse_0__pyx_mdef_8cutadapt_6_seqio_19two_fastq_heads = {"__pyx_fuse_0two_fastq_heads", (PyCFunction)__pyx_fuse_0__pyx_pw_8cutadapt_6_seqio_19two_fastq_heads, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8cutadapt_6_seqio_4two_fastq_heads}; static PyObject *__pyx_fuse_0__pyx_pw_8cutadapt_6_seqio_19two_fastq_heads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_buf1 = 0; PyObject *__pyx_v_buf2 = 0; Py_ssize_t __pyx_v_end1; Py_ssize_t __pyx_v_end2; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("two_fastq_heads (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buf1,&__pyx_n_s_buf2,&__pyx_n_s_end1,&__pyx_n_s_end2,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_buf1)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_buf2)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("two_fastq_heads", 1, 4, 4, 1); __PYX_ERR(0, 69, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end1)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("two_fastq_heads", 1, 4, 4, 2); __PYX_ERR(0, 69, __pyx_L3_error) } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end2)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("two_fastq_heads", 1, 4, 4, 3); __PYX_ERR(0, 69, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "two_fastq_heads") < 0)) __PYX_ERR(0, 69, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_buf1 = ((PyObject*)values[0]); __pyx_v_buf2 = ((PyObject*)values[1]); __pyx_v_end1 = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_end1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L3_error) __pyx_v_end2 = __Pyx_PyIndex_AsSsize_t(values[3]); if (unlikely((__pyx_v_end2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("two_fastq_heads", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 69, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._seqio.two_fastq_heads", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buf1), (&PyBytes_Type), 1, "buf1", 1))) __PYX_ERR(0, 69, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buf2), (&PyBytes_Type), 1, "buf2", 1))) __PYX_ERR(0, 69, __pyx_L1_error) __pyx_r = __pyx_pf_8cutadapt_6_seqio_18two_fastq_heads(__pyx_self, __pyx_v_buf1, __pyx_v_buf2, __pyx_v_end1, __pyx_v_end2); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_18two_fastq_heads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buf1, PyObject *__pyx_v_buf2, Py_ssize_t __pyx_v_end1, Py_ssize_t __pyx_v_end2) { Py_ssize_t __pyx_v_pos1; Py_ssize_t __pyx_v_pos2; Py_ssize_t __pyx_v_linebreaks; unsigned char *__pyx_v_data1; unsigned char *__pyx_v_data2; Py_ssize_t __pyx_v_record_start1; Py_ssize_t __pyx_v_record_start2; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations unsigned char *__pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__pyx_fuse_0two_fastq_heads", 0); __pyx_v_pos1 = 0; __pyx_v_pos2 = 0; __pyx_v_linebreaks = 0; __pyx_t_1 = __Pyx_PyObject_AsUString(__pyx_v_buf1); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 80, __pyx_L1_error) __pyx_v_data1 = __pyx_t_1; __pyx_t_1 = __Pyx_PyObject_AsUString(__pyx_v_buf2); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error) __pyx_v_data2 = __pyx_t_1; __pyx_v_record_start1 = 0; __pyx_v_record_start2 = 0; while (1) { while (1) { __pyx_t_3 = ((__pyx_v_pos1 < __pyx_v_end1) != 0); if (__pyx_t_3) { } else { __pyx_t_2 = __pyx_t_3; goto __pyx_L7_bool_binop_done; } __pyx_t_3 = (((__pyx_v_data1[__pyx_v_pos1]) != '\n') != 0); __pyx_t_2 = __pyx_t_3; __pyx_L7_bool_binop_done:; if (!__pyx_t_2) break; __pyx_v_pos1 = (__pyx_v_pos1 + 1); } __pyx_t_2 = ((__pyx_v_pos1 == __pyx_v_end1) != 0); if (__pyx_t_2) { goto __pyx_L4_break; } __pyx_v_pos1 = (__pyx_v_pos1 + 1); while (1) { __pyx_t_3 = ((__pyx_v_pos2 < __pyx_v_end2) != 0); if (__pyx_t_3) { } else { __pyx_t_2 = __pyx_t_3; goto __pyx_L12_bool_binop_done; } __pyx_t_3 = (((__pyx_v_data2[__pyx_v_pos2]) != '\n') != 0); __pyx_t_2 = __pyx_t_3; __pyx_L12_bool_binop_done:; if (!__pyx_t_2) break; __pyx_v_pos2 = (__pyx_v_pos2 + 1); } __pyx_t_2 = ((__pyx_v_pos2 == __pyx_v_end2) != 0); if (__pyx_t_2) { goto __pyx_L4_break; } __pyx_v_pos2 = (__pyx_v_pos2 + 1); __pyx_v_linebreaks = (__pyx_v_linebreaks + 1); __pyx_t_2 = ((__pyx_v_linebreaks == 4) != 0); if (__pyx_t_2) { __pyx_v_linebreaks = 0; __pyx_v_record_start1 = __pyx_v_pos1; __pyx_v_record_start2 = __pyx_v_pos2; } } __pyx_L4_break:; __Pyx_XDECREF(__pyx_r); __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_record_start1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_record_start2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("cutadapt._seqio.two_fastq_heads", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_fuse_1__pyx_pw_8cutadapt_6_seqio_21two_fastq_heads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_fuse_1__pyx_mdef_8cutadapt_6_seqio_21two_fastq_heads = {"__pyx_fuse_1two_fastq_heads", (PyCFunction)__pyx_fuse_1__pyx_pw_8cutadapt_6_seqio_21two_fastq_heads, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8cutadapt_6_seqio_4two_fastq_heads}; static PyObject *__pyx_fuse_1__pyx_pw_8cutadapt_6_seqio_21two_fastq_heads(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_buf1 = 0; PyObject *__pyx_v_buf2 = 0; Py_ssize_t __pyx_v_end1; Py_ssize_t __pyx_v_end2; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("two_fastq_heads (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buf1,&__pyx_n_s_buf2,&__pyx_n_s_end1,&__pyx_n_s_end2,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_buf1)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_buf2)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("two_fastq_heads", 1, 4, 4, 1); __PYX_ERR(0, 69, __pyx_L3_error) } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end1)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("two_fastq_heads", 1, 4, 4, 2); __PYX_ERR(0, 69, __pyx_L3_error) } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_end2)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("two_fastq_heads", 1, 4, 4, 3); __PYX_ERR(0, 69, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "two_fastq_heads") < 0)) __PYX_ERR(0, 69, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_buf1 = ((PyObject*)values[0]); __pyx_v_buf2 = ((PyObject*)values[1]); __pyx_v_end1 = __Pyx_PyIndex_AsSsize_t(values[2]); if (unlikely((__pyx_v_end1 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L3_error) __pyx_v_end2 = __Pyx_PyIndex_AsSsize_t(values[3]); if (unlikely((__pyx_v_end2 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 69, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("two_fastq_heads", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 69, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._seqio.two_fastq_heads", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buf1), (&PyByteArray_Type), 1, "buf1", 1))) __PYX_ERR(0, 69, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_buf2), (&PyByteArray_Type), 1, "buf2", 1))) __PYX_ERR(0, 69, __pyx_L1_error) __pyx_r = __pyx_pf_8cutadapt_6_seqio_20two_fastq_heads(__pyx_self, __pyx_v_buf1, __pyx_v_buf2, __pyx_v_end1, __pyx_v_end2); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_20two_fastq_heads(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buf1, PyObject *__pyx_v_buf2, Py_ssize_t __pyx_v_end1, Py_ssize_t __pyx_v_end2) { Py_ssize_t __pyx_v_pos1; Py_ssize_t __pyx_v_pos2; Py_ssize_t __pyx_v_linebreaks; unsigned char *__pyx_v_data1; unsigned char *__pyx_v_data2; Py_ssize_t __pyx_v_record_start1; Py_ssize_t __pyx_v_record_start2; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations unsigned char *__pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__pyx_fuse_1two_fastq_heads", 0); __pyx_v_pos1 = 0; __pyx_v_pos2 = 0; __pyx_v_linebreaks = 0; __pyx_t_1 = __Pyx_PyObject_AsUString(__pyx_v_buf1); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 80, __pyx_L1_error) __pyx_v_data1 = __pyx_t_1; __pyx_t_1 = __Pyx_PyObject_AsUString(__pyx_v_buf2); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error) __pyx_v_data2 = __pyx_t_1; __pyx_v_record_start1 = 0; __pyx_v_record_start2 = 0; while (1) { while (1) { __pyx_t_3 = ((__pyx_v_pos1 < __pyx_v_end1) != 0); if (__pyx_t_3) { } else { __pyx_t_2 = __pyx_t_3; goto __pyx_L7_bool_binop_done; } __pyx_t_3 = (((__pyx_v_data1[__pyx_v_pos1]) != '\n') != 0); __pyx_t_2 = __pyx_t_3; __pyx_L7_bool_binop_done:; if (!__pyx_t_2) break; __pyx_v_pos1 = (__pyx_v_pos1 + 1); } __pyx_t_2 = ((__pyx_v_pos1 == __pyx_v_end1) != 0); if (__pyx_t_2) { goto __pyx_L4_break; } __pyx_v_pos1 = (__pyx_v_pos1 + 1); while (1) { __pyx_t_3 = ((__pyx_v_pos2 < __pyx_v_end2) != 0); if (__pyx_t_3) { } else { __pyx_t_2 = __pyx_t_3; goto __pyx_L12_bool_binop_done; } __pyx_t_3 = (((__pyx_v_data2[__pyx_v_pos2]) != '\n') != 0); __pyx_t_2 = __pyx_t_3; __pyx_L12_bool_binop_done:; if (!__pyx_t_2) break; __pyx_v_pos2 = (__pyx_v_pos2 + 1); } __pyx_t_2 = ((__pyx_v_pos2 == __pyx_v_end2) != 0); if (__pyx_t_2) { goto __pyx_L4_break; } __pyx_v_pos2 = (__pyx_v_pos2 + 1); __pyx_v_linebreaks = (__pyx_v_linebreaks + 1); __pyx_t_2 = ((__pyx_v_linebreaks == 4) != 0); if (__pyx_t_2) { __pyx_v_linebreaks = 0; __pyx_v_record_start1 = __pyx_v_pos1; __pyx_v_record_start2 = __pyx_v_pos2; } } __pyx_L4_break:; __Pyx_XDECREF(__pyx_r); __pyx_t_4 = PyInt_FromSsize_t(__pyx_v_record_start1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyInt_FromSsize_t(__pyx_v_record_start2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("cutadapt._seqio.two_fastq_heads", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_8cutadapt_6_seqio_8Sequence___init__[] = "Set qualities to None if there are no quality values"; #if CYTHON_COMPILING_IN_CPYTHON struct wrapperbase __pyx_wrapperbase_8cutadapt_6_seqio_8Sequence___init__; #endif static int __pyx_pw_8cutadapt_6_seqio_8Sequence_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_name = 0; PyObject *__pyx_v_sequence = 0; PyObject *__pyx_v_qualities = 0; int __pyx_v_second_header; PyObject *__pyx_v_match = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_sequence,&__pyx_n_s_qualities,&__pyx_n_s_second_header,&__pyx_n_s_match,0}; PyObject* values[5] = {0,0,0,0,0}; values[2] = ((PyObject*)Py_None); values[4] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sequence)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, 1); __PYX_ERR(0, 122, __pyx_L3_error) } case 2: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_qualities); if (value) { values[2] = value; kw_args--; } } case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_second_header); if (value) { values[3] = value; kw_args--; } } case 4: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_match); if (value) { values[4] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 122, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_name = ((PyObject*)values[0]); __pyx_v_sequence = ((PyObject*)values[1]); __pyx_v_qualities = ((PyObject*)values[2]); if (values[3]) { __pyx_v_second_header = __Pyx_PyObject_IsTrue(values[3]); if (unlikely((__pyx_v_second_header == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 122, __pyx_L3_error) } else { __pyx_v_second_header = ((int)0); } __pyx_v_match = values[4]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 122, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._seqio.Sequence.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_name), (&PyString_Type), 1, "name", 1))) __PYX_ERR(0, 122, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sequence), (&PyString_Type), 1, "sequence", 1))) __PYX_ERR(0, 122, __pyx_L1_error) if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_qualities), (&PyString_Type), 1, "qualities", 1))) __PYX_ERR(0, 122, __pyx_L1_error) __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence___init__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self), __pyx_v_name, __pyx_v_sequence, __pyx_v_qualities, __pyx_v_second_header, __pyx_v_match); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_8cutadapt_6_seqio_8Sequence___init__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_sequence, PyObject *__pyx_v_qualities, int __pyx_v_second_header, PyObject *__pyx_v_match) { PyObject *__pyx_v_rname = NULL; int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; Py_ssize_t __pyx_t_4; Py_ssize_t __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; PyObject *__pyx_t_13 = NULL; __Pyx_RefNannySetupContext("__init__", 0); __Pyx_INCREF(__pyx_v_name); __Pyx_GIVEREF(__pyx_v_name); __Pyx_GOTREF(__pyx_v_self->name); __Pyx_DECREF(__pyx_v_self->name); __pyx_v_self->name = __pyx_v_name; __Pyx_INCREF(__pyx_v_sequence); __Pyx_GIVEREF(__pyx_v_sequence); __Pyx_GOTREF(__pyx_v_self->sequence); __Pyx_DECREF(__pyx_v_self->sequence); __pyx_v_self->sequence = __pyx_v_sequence; __Pyx_INCREF(__pyx_v_qualities); __Pyx_GIVEREF(__pyx_v_qualities); __Pyx_GOTREF(__pyx_v_self->qualities); __Pyx_DECREF(__pyx_v_self->qualities); __pyx_v_self->qualities = __pyx_v_qualities; __pyx_v_self->second_header = __pyx_v_second_header; __Pyx_INCREF(__pyx_v_match); __Pyx_GIVEREF(__pyx_v_match); __Pyx_GOTREF(__pyx_v_self->match); __Pyx_DECREF(__pyx_v_self->match); __pyx_v_self->match = __pyx_v_match; __pyx_t_2 = (__pyx_v_qualities != ((PyObject*)Py_None)); __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { } else { __pyx_t_1 = __pyx_t_3; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = PyObject_Length(__pyx_v_qualities); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 130, __pyx_L1_error) __pyx_t_5 = PyObject_Length(__pyx_v_sequence); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 130, __pyx_L1_error) __pyx_t_3 = ((__pyx_t_4 != __pyx_t_5) != 0); __pyx_t_1 = __pyx_t_3; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_shorten); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); } } if (!__pyx_t_8) { __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); } else { __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; __Pyx_INCREF(__pyx_v_name); __Pyx_GIVEREF(__pyx_v_name); PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_name); __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_rname = __pyx_t_6; __pyx_t_6 = 0; __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_FormatError); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_In_read_named_0_r_length_of_qual, __pyx_n_s_format); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 133, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_5 = PyObject_Length(__pyx_v_qualities); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 134, __pyx_L1_error) __pyx_t_10 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_5 = PyObject_Length(__pyx_v_sequence); if (unlikely(__pyx_t_5 == -1)) __PYX_ERR(0, 134, __pyx_L1_error) __pyx_t_11 = PyInt_FromSsize_t(__pyx_t_5); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_12 = NULL; __pyx_t_5 = 0; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) { __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_8); if (likely(__pyx_t_12)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8); __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_8, function); __pyx_t_5 = 1; } } __pyx_t_13 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 133, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); if (__pyx_t_12) { __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL; } __Pyx_INCREF(__pyx_v_rname); __Pyx_GIVEREF(__pyx_v_rname); PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_5, __pyx_v_rname); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_5, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_5, __pyx_t_11); __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_13, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 133, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); } } if (!__pyx_t_8) { __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_9); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_6); } else { __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_8); __pyx_t_8 = NULL; __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_9); __pyx_t_9 = 0; __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_13, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __PYX_ERR(0, 132, __pyx_L1_error) } /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_AddTraceback("cutadapt._seqio.Sequence.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_XDECREF(__pyx_v_rname); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_seqio_8Sequence_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/ static char __pyx_doc_8cutadapt_6_seqio_8Sequence_2__getitem__[] = "slicing"; #if CYTHON_COMPILING_IN_CPYTHON struct wrapperbase __pyx_wrapperbase_8cutadapt_6_seqio_8Sequence_2__getitem__; #endif static PyObject *__pyx_pw_8cutadapt_6_seqio_8Sequence_3__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_2__getitem__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self), ((PyObject *)__pyx_v_key)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_8Sequence_2__getitem__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self, PyObject *__pyx_v_key) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; Py_ssize_t __pyx_t_8; PyObject *__pyx_t_9 = NULL; __Pyx_RefNannySetupContext("__getitem__", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_GetItem(__pyx_v_self->sequence, __pyx_v_key); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = (__pyx_v_self->qualities != ((PyObject*)Py_None)); if ((__pyx_t_5 != 0)) { __pyx_t_6 = PyObject_GetItem(__pyx_v_self->qualities, __pyx_v_key); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_4 = __pyx_t_6; __pyx_t_6 = 0; } else { __Pyx_INCREF(Py_None); __pyx_t_4 = Py_None; } __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_self->second_header); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 142, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; __pyx_t_8 = 0; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_8 = 1; } } __pyx_t_9 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_7) { __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; } __Pyx_INCREF(__pyx_v_self->name); __Pyx_GIVEREF(__pyx_v_self->name); PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_self->name); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6); __Pyx_INCREF(__pyx_v_self->match); __Pyx_GIVEREF(__pyx_v_self->match); PyTuple_SET_ITEM(__pyx_t_9, 4+__pyx_t_8, __pyx_v_self->match); __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("cutadapt._seqio.Sequence.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_seqio_8Sequence_5__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_8cutadapt_6_seqio_8Sequence_5__repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_4__repr__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_8Sequence_4__repr__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self) { PyObject *__pyx_v_qstr = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; Py_ssize_t __pyx_t_10; __Pyx_RefNannySetupContext("__repr__", 0); __Pyx_INCREF(__pyx_kp_s__16); __pyx_v_qstr = __pyx_kp_s__16; __pyx_t_1 = (__pyx_v_self->qualities != ((PyObject*)Py_None)); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_qualities_0_r, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_shorten); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); } } if (!__pyx_t_7) { __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_self->qualities); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } else { __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __pyx_t_7 = NULL; __Pyx_INCREF(__pyx_v_self->qualities); __Pyx_GIVEREF(__pyx_v_self->qualities); PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_self->qualities); __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } if (!__pyx_t_6) { __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_3); } else { __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_qstr, __pyx_t_3); __pyx_t_3 = 0; } __Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Sequence_name_0_r_sequence_1_r, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_shorten); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } if (!__pyx_t_6) { __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_self->name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); } else { __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL; __Pyx_INCREF(__pyx_v_self->name); __Pyx_GIVEREF(__pyx_v_self->name); PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_self->name); __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_shorten); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_7, function); } } if (!__pyx_t_6) { __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_self->sequence); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); } else { __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL; __Pyx_INCREF(__pyx_v_self->sequence); __Pyx_GIVEREF(__pyx_v_self->sequence); PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_self->sequence); __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; __pyx_t_10 = 0; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_10 = 1; } } __pyx_t_9 = PyTuple_New(3+__pyx_t_10); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_7) { __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; } __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_10, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_10, __pyx_t_5); __Pyx_INCREF(__pyx_v_qstr); __Pyx_GIVEREF(__pyx_v_qstr); PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_10, __pyx_v_qstr); __pyx_t_8 = 0; __pyx_t_5 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 149, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("cutadapt._seqio.Sequence.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_qstr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static Py_ssize_t __pyx_pw_8cutadapt_6_seqio_8Sequence_7__len__(PyObject *__pyx_v_self); /*proto*/ static Py_ssize_t __pyx_pw_8cutadapt_6_seqio_8Sequence_7__len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_6__len__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static Py_ssize_t __pyx_pf_8cutadapt_6_seqio_8Sequence_6__len__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; __Pyx_RefNannySetupContext("__len__", 0); __pyx_t_1 = __pyx_v_self->sequence; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("cutadapt._seqio.Sequence.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_seqio_8Sequence_9__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op); /*proto*/ static PyObject *__pyx_pw_8cutadapt_6_seqio_8Sequence_9__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_8__richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((int)__pyx_v_op)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_8Sequence_8__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_v_op) { PyObject *__pyx_v_eq = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; __Pyx_RefNannySetupContext("__richcmp__", 0); __pyx_t_1 = (2 <= __pyx_v_op); if (__pyx_t_1) { __pyx_t_1 = (__pyx_v_op <= 3); } __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_name); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 156, __pyx_L1_error) if (__pyx_t_2) { __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else { __Pyx_INCREF(__pyx_t_6); __pyx_t_3 = __pyx_t_6; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L4_bool_binop_done; } __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_sequence); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_sequence); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = PyObject_RichCompare(__pyx_t_6, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 157, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 157, __pyx_L1_error) if (__pyx_t_2) { __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = __pyx_t_4; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_qualities); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s_qualities); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_t_6); __pyx_t_3 = __pyx_t_6; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_L4_bool_binop_done:; __pyx_v_eq = __pyx_t_3; __pyx_t_3 = 0; __pyx_t_2 = ((__pyx_v_op == 2) != 0); if (__pyx_t_2) { __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_eq); __pyx_r = __pyx_v_eq; goto __pyx_L0; } /*else*/ { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_eq); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 162, __pyx_L1_error) __pyx_t_3 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; } } /*else*/ { __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_builtin_NotImplementedError); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 164, __pyx_L1_error) } /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("cutadapt._seqio.Sequence.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_eq); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_seqio_8Sequence_11__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_8cutadapt_6_seqio_8Sequence_11__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_10__reduce__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_8Sequence_10__reduce__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__reduce__", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->second_header); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_self->name); __Pyx_GIVEREF(__pyx_v_self->name); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_self->name); __Pyx_INCREF(__pyx_v_self->sequence); __Pyx_GIVEREF(__pyx_v_self->sequence); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_self->sequence); __Pyx_INCREF(__pyx_v_self->qualities); __Pyx_GIVEREF(__pyx_v_self->qualities); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_self->qualities); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_1); __Pyx_INCREF(__pyx_v_self->match); __Pyx_GIVEREF(__pyx_v_self->match); PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_v_self->match); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_ptype_8cutadapt_6_seqio_Sequence)); __Pyx_GIVEREF(((PyObject *)__pyx_ptype_8cutadapt_6_seqio_Sequence)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_ptype_8cutadapt_6_seqio_Sequence)); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("cutadapt._seqio.Sequence.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_seqio_8Sequence_4name_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_8cutadapt_6_seqio_8Sequence_4name_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_4name___get__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_8Sequence_4name___get__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->name); __pyx_r = __pyx_v_self->name; goto __pyx_L0; /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_4name_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_4name_2__set__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self), ((PyObject *)__pyx_v_value)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_8cutadapt_6_seqio_8Sequence_4name_2__set__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__set__", 0); if (!(likely(PyString_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(0, 116, __pyx_L1_error) __pyx_t_1 = __pyx_v_value; __Pyx_INCREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->name); __Pyx_DECREF(__pyx_v_self->name); __pyx_v_self->name = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("cutadapt._seqio.Sequence.name.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_4name_5__del__(PyObject *__pyx_v_self); /*proto*/ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_4name_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_4name_4__del__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_8cutadapt_6_seqio_8Sequence_4name_4__del__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->name); __Pyx_DECREF(__pyx_v_self->name); __pyx_v_self->name = ((PyObject*)Py_None); /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_seqio_8Sequence_8sequence_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_8cutadapt_6_seqio_8Sequence_8sequence_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_8sequence___get__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_8Sequence_8sequence___get__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->sequence); __pyx_r = __pyx_v_self->sequence; goto __pyx_L0; /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_8sequence_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_8sequence_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_8sequence_2__set__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self), ((PyObject *)__pyx_v_value)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_8cutadapt_6_seqio_8Sequence_8sequence_2__set__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__set__", 0); if (!(likely(PyString_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(0, 117, __pyx_L1_error) __pyx_t_1 = __pyx_v_value; __Pyx_INCREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->sequence); __Pyx_DECREF(__pyx_v_self->sequence); __pyx_v_self->sequence = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("cutadapt._seqio.Sequence.sequence.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_8sequence_5__del__(PyObject *__pyx_v_self); /*proto*/ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_8sequence_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_8sequence_4__del__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_8cutadapt_6_seqio_8Sequence_8sequence_4__del__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->sequence); __Pyx_DECREF(__pyx_v_self->sequence); __pyx_v_self->sequence = ((PyObject*)Py_None); /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_seqio_8Sequence_9qualities_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_8cutadapt_6_seqio_8Sequence_9qualities_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_9qualities___get__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_8Sequence_9qualities___get__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->qualities); __pyx_r = __pyx_v_self->qualities; goto __pyx_L0; /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_9qualities_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_9qualities_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_9qualities_2__set__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self), ((PyObject *)__pyx_v_value)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_8cutadapt_6_seqio_8Sequence_9qualities_2__set__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__set__", 0); if (!(likely(PyString_CheckExact(__pyx_v_value))||((__pyx_v_value) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_v_value)->tp_name), 0))) __PYX_ERR(0, 118, __pyx_L1_error) __pyx_t_1 = __pyx_v_value; __Pyx_INCREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->qualities); __Pyx_DECREF(__pyx_v_self->qualities); __pyx_v_self->qualities = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("cutadapt._seqio.Sequence.qualities.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_9qualities_5__del__(PyObject *__pyx_v_self); /*proto*/ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_9qualities_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_9qualities_4__del__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_8cutadapt_6_seqio_8Sequence_9qualities_4__del__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->qualities); __Pyx_DECREF(__pyx_v_self->qualities); __pyx_v_self->qualities = ((PyObject*)Py_None); /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_seqio_8Sequence_13second_header_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_8cutadapt_6_seqio_8Sequence_13second_header_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_13second_header___get__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_8Sequence_13second_header___get__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->second_header); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("cutadapt._seqio.Sequence.second_header.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_13second_header_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_13second_header_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_13second_header_2__set__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self), ((PyObject *)__pyx_v_value)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_8cutadapt_6_seqio_8Sequence_13second_header_2__set__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__set__", 0); __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L1_error) __pyx_v_self->second_header = __pyx_t_1; /* function exit code */ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_AddTraceback("cutadapt._seqio.Sequence.second_header.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_seqio_8Sequence_5match_1__get__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_8cutadapt_6_seqio_8Sequence_5match_1__get__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_5match___get__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_8Sequence_5match___get__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->match); __pyx_r = __pyx_v_self->match; goto __pyx_L0; /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_5match_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_5match_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_5match_2__set__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self), ((PyObject *)__pyx_v_value)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_8cutadapt_6_seqio_8Sequence_5match_2__set__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self, PyObject *__pyx_v_value) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__set__", 0); __Pyx_INCREF(__pyx_v_value); __Pyx_GIVEREF(__pyx_v_value); __Pyx_GOTREF(__pyx_v_self->match); __Pyx_DECREF(__pyx_v_self->match); __pyx_v_self->match = __pyx_v_value; /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_5match_5__del__(PyObject *__pyx_v_self); /*proto*/ static int __pyx_pw_8cutadapt_6_seqio_8Sequence_5match_5__del__(PyObject *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_8Sequence_5match_4__del__(((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_8cutadapt_6_seqio_8Sequence_5match_4__del__(struct __pyx_obj_8cutadapt_6_seqio_Sequence *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__del__", 0); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->match); __Pyx_DECREF(__pyx_v_self->match); __pyx_v_self->match = Py_None; /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_11FastqReader_5__defaults__(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; __Pyx_RefNannySetupContext("__defaults__", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__Pyx_CyFunction_Defaults(__pyx_defaults4, __pyx_self)->__pyx_arg_sequence_class); __Pyx_GIVEREF(__Pyx_CyFunction_Defaults(__pyx_defaults4, __pyx_self)->__pyx_arg_sequence_class); PyTuple_SET_ITEM(__pyx_t_1, 0, __Pyx_CyFunction_Defaults(__pyx_defaults4, __pyx_self)->__pyx_arg_sequence_class); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_2, 1, Py_None); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("cutadapt._seqio.FastqReader.__defaults__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_seqio_11FastqReader_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_8cutadapt_6_seqio_11FastqReader___init__[] = "\n\t\tfile is a filename or a file-like object.\n\t\tIf file is a filename, then .gz files are supported.\n\t\t"; static PyMethodDef __pyx_mdef_8cutadapt_6_seqio_11FastqReader_1__init__ = {"__init__", (PyCFunction)__pyx_pw_8cutadapt_6_seqio_11FastqReader_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8cutadapt_6_seqio_11FastqReader___init__}; static PyObject *__pyx_pw_8cutadapt_6_seqio_11FastqReader_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; PyObject *__pyx_v_file = 0; PyObject *__pyx_v_sequence_class = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_file,&__pyx_n_s_sequence_class,0}; PyObject* values[3] = {0,0,0}; __pyx_defaults4 *__pyx_dynamic_args = __Pyx_CyFunction_Defaults(__pyx_defaults4, __pyx_self); values[2] = __pyx_dynamic_args->__pyx_arg_sequence_class; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_file)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); __PYX_ERR(0, 175, __pyx_L3_error) } case 2: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sequence_class); if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 175, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_self = values[0]; __pyx_v_file = values[1]; __pyx_v_sequence_class = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 175, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("cutadapt._seqio.FastqReader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8cutadapt_6_seqio_11FastqReader___init__(__pyx_self, __pyx_v_self, __pyx_v_file, __pyx_v_sequence_class); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_11FastqReader___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_file, PyObject *__pyx_v_sequence_class) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("__init__", 0); __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_FastqReader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_INCREF(__pyx_v_self); __Pyx_GIVEREF(__pyx_v_self); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_2) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_file); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; __Pyx_INCREF(__pyx_v_file); __Pyx_GIVEREF(__pyx_v_file); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_file); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sequence_class, __pyx_v_sequence_class) < 0) __PYX_ERR(0, 181, __pyx_L1_error) if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_delivers_qualities, Py_True) < 0) __PYX_ERR(0, 182, __pyx_L1_error) /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("cutadapt._seqio.FastqReader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_8cutadapt_6_seqio_11FastqReader_4generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ static PyObject *__pyx_pw_8cutadapt_6_seqio_11FastqReader_3__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ static char __pyx_doc_8cutadapt_6_seqio_11FastqReader_2__iter__[] = "\n\t\tYield Sequence objects\n\t\t"; static PyMethodDef __pyx_mdef_8cutadapt_6_seqio_11FastqReader_3__iter__ = {"__iter__", (PyCFunction)__pyx_pw_8cutadapt_6_seqio_11FastqReader_3__iter__, METH_O, __pyx_doc_8cutadapt_6_seqio_11FastqReader_2__iter__}; static PyObject *__pyx_pw_8cutadapt_6_seqio_11FastqReader_3__iter__(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); __pyx_r = __pyx_pf_8cutadapt_6_seqio_11FastqReader_2__iter__(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8cutadapt_6_seqio_11FastqReader_2__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { struct __pyx_obj_8cutadapt_6_seqio___pyx_scope_struct____iter__ *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__", 0); __pyx_cur_scope = (struct __pyx_obj_8cutadapt_6_seqio___pyx_scope_struct____iter__ *)__pyx_tp_new_8cutadapt_6_seqio___pyx_scope_struct____iter__(__pyx_ptype_8cutadapt_6_seqio___pyx_scope_struct____iter__, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; } __Pyx_GOTREF(__pyx_cur_scope); __pyx_cur_scope->__pyx_v_self = __pyx_v_self; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self); { __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_8cutadapt_6_seqio_11FastqReader_4generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_iter, __pyx_n_s_FastqReader___iter); if (unlikely(!gen)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; } /* function exit code */ __pyx_L1_error:; __Pyx_AddTraceback("cutadapt._seqio.FastqReader.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_gb_8cutadapt_6_seqio_11FastqReader_4generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { struct __pyx_obj_8cutadapt_6_seqio___pyx_scope_struct____iter__ *__pyx_cur_scope = ((struct __pyx_obj_8cutadapt_6_seqio___pyx_scope_struct____iter__ *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; Py_ssize_t __pyx_t_10; PyObject *__pyx_t_11 = NULL; int __pyx_t_12; PyObject *(*__pyx_t_13)(PyObject *); Py_ssize_t __pyx_t_14; PyObject *__pyx_t_15 = NULL; Py_ssize_t __pyx_t_16; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("None", 0); switch (__pyx_generator->resume_label) { case 0: goto __pyx_L3_first_run; case 1: goto __pyx_L19_resume_from_yield; default: /* CPython raises the right error here */ __Pyx_RefNannyFinishContext(); return NULL; } __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 184, __pyx_L1_error) __pyx_cur_scope->__pyx_v_i = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_sequence_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_v_sequence_class = __pyx_t_1; __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_file_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_2); __pyx_cur_scope->__pyx_v_it = __pyx_t_2; __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyIter_Next(__pyx_cur_scope->__pyx_v_it); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (!(likely(PyString_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_2); __pyx_cur_scope->__pyx_v_line = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_line); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 195, __pyx_L1_error) if (__pyx_t_4) { } else { __pyx_t_3 = __pyx_t_4; goto __pyx_L5_bool_binop_done; } __pyx_t_2 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_line, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_2, __pyx_kp_s__17, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = __pyx_t_4; __pyx_L5_bool_binop_done:; __pyx_t_4 = ((!__pyx_t_3) != 0); if (__pyx_t_4) { __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_FormatError); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Line_0_in_FASTQ_file_is_expected, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyInt_From_long((__pyx_cur_scope->__pyx_v_i + 1)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (unlikely(__pyx_cur_scope->__pyx_v_line == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 196, __pyx_L1_error) } __pyx_t_8 = PySequence_GetSlice(__pyx_cur_scope->__pyx_v_line, 0, 10); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; __pyx_t_10 = 0; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_10 = 1; } } __pyx_t_11 = PyTuple_New(2+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); if (__pyx_t_9) { __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __pyx_t_9 = NULL; } __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_8); __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); } } if (!__pyx_t_6) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); } else { __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_6); __pyx_t_6 = NULL; __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 196, __pyx_L1_error) } if (unlikely(__pyx_cur_scope->__pyx_v_line == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "endswith"); __PYX_ERR(0, 197, __pyx_L1_error) } __pyx_t_4 = __Pyx_PyStr_Tailmatch(__pyx_cur_scope->__pyx_v_line, __pyx_kp_s__18, 0, PY_SSIZE_T_MAX, 1); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 197, __pyx_L1_error) if ((__pyx_t_4 != 0)) { __pyx_t_12 = -2; } else { __pyx_t_12 = -1; } __pyx_cur_scope->__pyx_v_strip = __pyx_t_12; if (unlikely(__pyx_cur_scope->__pyx_v_line == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 198, __pyx_L1_error) } __pyx_t_2 = PySequence_GetSlice(__pyx_cur_scope->__pyx_v_line, 1, __pyx_cur_scope->__pyx_v_strip); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_cur_scope->__pyx_v_name = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; __pyx_cur_scope->__pyx_v_i = 1; if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_it)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_it)) { __pyx_t_2 = __pyx_cur_scope->__pyx_v_it; __Pyx_INCREF(__pyx_t_2); __pyx_t_10 = 0; __pyx_t_13 = NULL; } else { __pyx_t_10 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_it); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_13 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 201, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_13)) { if (likely(PyList_CheckExact(__pyx_t_2))) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 201, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_10); __Pyx_INCREF(__pyx_t_1); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 201, __pyx_L1_error) #else __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } } else { __pyx_t_1 = __pyx_t_13(__pyx_t_2); if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 201, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_1); } if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_line); __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_line, ((PyObject*)__pyx_t_1)); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; switch (__pyx_cur_scope->__pyx_v_i) { case 0: __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_line); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 203, __pyx_L1_error) if (__pyx_t_3) { } else { __pyx_t_4 = __pyx_t_3; goto __pyx_L10_bool_binop_done; } __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_line, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s__17, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = __pyx_t_3; __pyx_L10_bool_binop_done:; __pyx_t_3 = ((!__pyx_t_4) != 0); if (__pyx_t_3) { __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_FormatError); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Line_0_in_FASTQ_file_is_expected, __pyx_n_s_format); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = __Pyx_PyInt_From_long((__pyx_cur_scope->__pyx_v_i + 1)); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (unlikely(__pyx_cur_scope->__pyx_v_line == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 204, __pyx_L1_error) } __pyx_t_7 = PySequence_GetSlice(__pyx_cur_scope->__pyx_v_line, 0, 10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_9 = NULL; __pyx_t_14 = 0; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_14 = 1; } } __pyx_t_15 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); if (__pyx_t_9) { __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_9); __pyx_t_9 = NULL; } __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_15, 0+__pyx_t_14, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_15, 1+__pyx_t_14, __pyx_t_7); __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_15, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_11))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_11); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_11, function); } } if (!__pyx_t_6) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_1); } else { __pyx_t_15 = PyTuple_New(1+1); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_6); __pyx_t_6 = NULL; __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_15, 0+1, __pyx_t_5); __pyx_t_5 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_15, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; } __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 204, __pyx_L1_error) } if (unlikely(__pyx_cur_scope->__pyx_v_line == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 205, __pyx_L1_error) } __pyx_t_1 = PySequence_GetSlice(__pyx_cur_scope->__pyx_v_line, 1, __pyx_cur_scope->__pyx_v_strip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_name); __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_name, ((PyObject*)__pyx_t_1)); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; break; case 1: if (unlikely(__pyx_cur_scope->__pyx_v_line == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 207, __pyx_L1_error) } __pyx_t_1 = PySequence_GetSlice(__pyx_cur_scope->__pyx_v_line, 0, __pyx_cur_scope->__pyx_v_strip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_sequence); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_sequence, ((PyObject*)__pyx_t_1)); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; break; case 2: __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_cur_scope->__pyx_v_line, __pyx_kp_s__19, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 209, __pyx_L1_error) __pyx_t_4 = (__pyx_t_3 != 0); if (__pyx_t_4) { __Pyx_INCREF(__pyx_kp_s__16); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_name2); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_name2, __pyx_kp_s__16); __Pyx_GIVEREF(__pyx_kp_s__16); goto __pyx_L12; } /*else*/ { if (unlikely(__pyx_cur_scope->__pyx_v_line == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 212, __pyx_L1_error) } __pyx_t_1 = PySequence_GetSlice(__pyx_cur_scope->__pyx_v_line, 0, __pyx_cur_scope->__pyx_v_strip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_line); __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_line, ((PyObject*)__pyx_t_1)); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_cur_scope->__pyx_v_line); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 213, __pyx_L1_error) if (__pyx_t_3) { } else { __pyx_t_4 = __pyx_t_3; goto __pyx_L14_bool_binop_done; } __pyx_t_1 = __Pyx_GetItemInt(__pyx_cur_scope->__pyx_v_line, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_kp_s__20, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = __pyx_t_3; __pyx_L14_bool_binop_done:; __pyx_t_3 = ((!__pyx_t_4) != 0); if (__pyx_t_3) { __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_FormatError); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_Line_0_in_FASTQ_file_is_expected_2, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyInt_From_long((__pyx_cur_scope->__pyx_v_i + 1)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PySequence_GetSlice(__pyx_cur_scope->__pyx_v_line, 0, 10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; __pyx_t_14 = 0; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_14 = 1; } } __pyx_t_9 = PyTuple_New(2+__pyx_t_14); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_8) { __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = NULL; } __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_14, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_14, __pyx_t_7); __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_11))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_11); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_11, function); } } if (!__pyx_t_5) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_15); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_GOTREF(__pyx_t_1); } else { __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_15); __pyx_t_15 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 214, __pyx_L1_error) } __pyx_t_14 = PyObject_Length(__pyx_cur_scope->__pyx_v_line); if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 215, __pyx_L1_error) __pyx_t_3 = ((__pyx_t_14 > 1) != 0); if (__pyx_t_3) { __pyx_t_1 = PySequence_GetSlice(__pyx_cur_scope->__pyx_v_line, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_cur_scope->__pyx_v_name, Py_EQ)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 216, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = ((!(__pyx_t_3 != 0)) != 0); if (__pyx_t_4) { __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_FormatError); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_At_line_0_Sequence_descriptions, __pyx_n_s_format); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); __pyx_t_5 = __Pyx_PyInt_From_long((__pyx_cur_scope->__pyx_v_i + 1)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PySequence_GetSlice(__pyx_cur_scope->__pyx_v_line, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 222, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = NULL; __pyx_t_14 = 0; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_15))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_15); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_15, function); __pyx_t_14 = 1; } } __pyx_t_8 = PyTuple_New(3+__pyx_t_14); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (__pyx_t_6) { __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; } __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_14, __pyx_t_5); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_name); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_name); PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_14, __pyx_cur_scope->__pyx_v_name); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_14, __pyx_t_7); __pyx_t_5 = 0; __pyx_t_7 = 0; __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_15 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_11))) { __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_11); if (likely(__pyx_t_15)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); __Pyx_INCREF(__pyx_t_15); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_11, function); } } if (!__pyx_t_15) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_1); } else { __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_15); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_15); __pyx_t_15 = NULL; __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_9); __pyx_t_9 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_Raise(__pyx_t_1, 0, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 217, __pyx_L1_error) } __pyx_cur_scope->__pyx_v_second_header = 1; goto __pyx_L16; } /*else*/ { __pyx_cur_scope->__pyx_v_second_header = 0; } __pyx_L16:; } __pyx_L12:; break; case 3: __pyx_t_14 = PyObject_Length(__pyx_cur_scope->__pyx_v_line); if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 227, __pyx_L1_error) if (unlikely(!__pyx_cur_scope->__pyx_v_sequence)) { __Pyx_RaiseUnboundLocalError("sequence"); __PYX_ERR(0, 227, __pyx_L1_error) } __pyx_t_16 = PyObject_Length(__pyx_cur_scope->__pyx_v_sequence); if (unlikely(__pyx_t_16 == -1)) __PYX_ERR(0, 227, __pyx_L1_error) __pyx_t_4 = ((__pyx_t_14 == (__pyx_t_16 - __pyx_cur_scope->__pyx_v_strip)) != 0); if (__pyx_t_4) { if (unlikely(__pyx_cur_scope->__pyx_v_line == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(0, 228, __pyx_L1_error) } __pyx_t_1 = PySequence_GetSlice(__pyx_cur_scope->__pyx_v_line, 0, __pyx_cur_scope->__pyx_v_strip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_qualities); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_qualities, ((PyObject*)__pyx_t_1)); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L18; } /*else*/ { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_line, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (!(likely(PyString_CheckExact(__pyx_t_11))||((__pyx_t_11) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "str", Py_TYPE(__pyx_t_11)->tp_name), 0))) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_qualities); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_qualities, ((PyObject*)__pyx_t_11)); __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = 0; } __pyx_L18:; if (unlikely(!__pyx_cur_scope->__pyx_v_sequence)) { __Pyx_RaiseUnboundLocalError("sequence"); __PYX_ERR(0, 231, __pyx_L1_error) } __pyx_t_11 = PyTuple_New(3); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_name); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_name); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_cur_scope->__pyx_v_name); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_sequence); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_sequence); PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_cur_scope->__pyx_v_sequence); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_qualities); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_qualities); PyTuple_SET_ITEM(__pyx_t_11, 2, __pyx_cur_scope->__pyx_v_qualities); __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_8 = __Pyx_PyBool_FromLong(__pyx_cur_scope->__pyx_v_second_header); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_second_header, __pyx_t_8) < 0) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyObject_Call(__pyx_cur_scope->__pyx_v_sequence_class, __pyx_t_11, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_8; __pyx_t_8 = 0; __Pyx_XGIVEREF(__pyx_t_2); __pyx_cur_scope->__pyx_t_0 = __pyx_t_2; __pyx_cur_scope->__pyx_t_1 = __pyx_t_10; __pyx_cur_scope->__pyx_t_2 = __pyx_t_13; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); /* return from generator, yielding value */ __pyx_generator->resume_label = 1; return __pyx_r; __pyx_L19_resume_from_yield:; __pyx_t_2 = __pyx_cur_scope->__pyx_t_0; __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_2); __pyx_t_10 = __pyx_cur_scope->__pyx_t_1; __pyx_t_13 = __pyx_cur_scope->__pyx_t_2; if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 231, __pyx_L1_error) break; default: break; } __pyx_cur_scope->__pyx_v_i = __Pyx_mod_long((__pyx_cur_scope->__pyx_v_i + 1), 4); } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = ((__pyx_cur_scope->__pyx_v_i != 0) != 0); if (__pyx_t_4) { __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_FormatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __PYX_ERR(0, 234, __pyx_L1_error) } /* function exit code */ PyErr_SetNone(PyExc_StopIteration); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_15); __Pyx_AddTraceback("__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_L0:; __Pyx_XDECREF(__pyx_r); __pyx_r = 0; __pyx_generator->resume_label = -1; __Pyx_Coroutine_clear((PyObject*)__pyx_generator); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_tp_new_8cutadapt_6_seqio_Sequence(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { struct __pyx_obj_8cutadapt_6_seqio_Sequence *p; PyObject *o; if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { o = (*t->tp_alloc)(t, 0); } else { o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); } if (unlikely(!o)) return 0; p = ((struct __pyx_obj_8cutadapt_6_seqio_Sequence *)o); p->name = ((PyObject*)Py_None); Py_INCREF(Py_None); p->sequence = ((PyObject*)Py_None); Py_INCREF(Py_None); p->qualities = ((PyObject*)Py_None); Py_INCREF(Py_None); p->match = Py_None; Py_INCREF(Py_None); return o; } static void __pyx_tp_dealloc_8cutadapt_6_seqio_Sequence(PyObject *o) { struct __pyx_obj_8cutadapt_6_seqio_Sequence *p = (struct __pyx_obj_8cutadapt_6_seqio_Sequence *)o; #if PY_VERSION_HEX >= 0x030400a1 if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { if (PyObject_CallFinalizerFromDealloc(o)) return; } #endif PyObject_GC_UnTrack(o); Py_CLEAR(p->name); Py_CLEAR(p->sequence); Py_CLEAR(p->qualities); Py_CLEAR(p->match); (*Py_TYPE(o)->tp_free)(o); } static int __pyx_tp_traverse_8cutadapt_6_seqio_Sequence(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_8cutadapt_6_seqio_Sequence *p = (struct __pyx_obj_8cutadapt_6_seqio_Sequence *)o; if (p->match) { e = (*v)(p->match, a); if (e) return e; } return 0; } static int __pyx_tp_clear_8cutadapt_6_seqio_Sequence(PyObject *o) { PyObject* tmp; struct __pyx_obj_8cutadapt_6_seqio_Sequence *p = (struct __pyx_obj_8cutadapt_6_seqio_Sequence *)o; tmp = ((PyObject*)p->match); p->match = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyObject *__pyx_sq_item_8cutadapt_6_seqio_Sequence(PyObject *o, Py_ssize_t i) { PyObject *r; PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); Py_DECREF(x); return r; } static PyObject *__pyx_getprop_8cutadapt_6_seqio_8Sequence_name(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_8cutadapt_6_seqio_8Sequence_4name_1__get__(o); } static int __pyx_setprop_8cutadapt_6_seqio_8Sequence_name(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { return __pyx_pw_8cutadapt_6_seqio_8Sequence_4name_3__set__(o, v); } else { return __pyx_pw_8cutadapt_6_seqio_8Sequence_4name_5__del__(o); } } static PyObject *__pyx_getprop_8cutadapt_6_seqio_8Sequence_sequence(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_8cutadapt_6_seqio_8Sequence_8sequence_1__get__(o); } static int __pyx_setprop_8cutadapt_6_seqio_8Sequence_sequence(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { return __pyx_pw_8cutadapt_6_seqio_8Sequence_8sequence_3__set__(o, v); } else { return __pyx_pw_8cutadapt_6_seqio_8Sequence_8sequence_5__del__(o); } } static PyObject *__pyx_getprop_8cutadapt_6_seqio_8Sequence_qualities(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_8cutadapt_6_seqio_8Sequence_9qualities_1__get__(o); } static int __pyx_setprop_8cutadapt_6_seqio_8Sequence_qualities(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { return __pyx_pw_8cutadapt_6_seqio_8Sequence_9qualities_3__set__(o, v); } else { return __pyx_pw_8cutadapt_6_seqio_8Sequence_9qualities_5__del__(o); } } static PyObject *__pyx_getprop_8cutadapt_6_seqio_8Sequence_second_header(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_8cutadapt_6_seqio_8Sequence_13second_header_1__get__(o); } static int __pyx_setprop_8cutadapt_6_seqio_8Sequence_second_header(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { return __pyx_pw_8cutadapt_6_seqio_8Sequence_13second_header_3__set__(o, v); } else { PyErr_SetString(PyExc_NotImplementedError, "__del__"); return -1; } } static PyObject *__pyx_getprop_8cutadapt_6_seqio_8Sequence_match(PyObject *o, CYTHON_UNUSED void *x) { return __pyx_pw_8cutadapt_6_seqio_8Sequence_5match_1__get__(o); } static int __pyx_setprop_8cutadapt_6_seqio_8Sequence_match(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) { if (v) { return __pyx_pw_8cutadapt_6_seqio_8Sequence_5match_3__set__(o, v); } else { return __pyx_pw_8cutadapt_6_seqio_8Sequence_5match_5__del__(o); } } static PyMethodDef __pyx_methods_8cutadapt_6_seqio_Sequence[] = { {"__reduce__", (PyCFunction)__pyx_pw_8cutadapt_6_seqio_8Sequence_11__reduce__, METH_NOARGS, 0}, {0, 0, 0, 0} }; static struct PyGetSetDef __pyx_getsets_8cutadapt_6_seqio_Sequence[] = { {(char *)"name", __pyx_getprop_8cutadapt_6_seqio_8Sequence_name, __pyx_setprop_8cutadapt_6_seqio_8Sequence_name, (char *)0, 0}, {(char *)"sequence", __pyx_getprop_8cutadapt_6_seqio_8Sequence_sequence, __pyx_setprop_8cutadapt_6_seqio_8Sequence_sequence, (char *)0, 0}, {(char *)"qualities", __pyx_getprop_8cutadapt_6_seqio_8Sequence_qualities, __pyx_setprop_8cutadapt_6_seqio_8Sequence_qualities, (char *)0, 0}, {(char *)"second_header", __pyx_getprop_8cutadapt_6_seqio_8Sequence_second_header, __pyx_setprop_8cutadapt_6_seqio_8Sequence_second_header, (char *)0, 0}, {(char *)"match", __pyx_getprop_8cutadapt_6_seqio_8Sequence_match, __pyx_setprop_8cutadapt_6_seqio_8Sequence_match, (char *)0, 0}, {0, 0, 0, 0, 0} }; static PySequenceMethods __pyx_tp_as_sequence_Sequence = { __pyx_pw_8cutadapt_6_seqio_8Sequence_7__len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ __pyx_sq_item_8cutadapt_6_seqio_Sequence, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ 0, /*sq_contains*/ 0, /*sq_inplace_concat*/ 0, /*sq_inplace_repeat*/ }; static PyMappingMethods __pyx_tp_as_mapping_Sequence = { __pyx_pw_8cutadapt_6_seqio_8Sequence_7__len__, /*mp_length*/ __pyx_pw_8cutadapt_6_seqio_8Sequence_3__getitem__, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; static PyTypeObject __pyx_type_8cutadapt_6_seqio_Sequence = { PyVarObject_HEAD_INIT(0, 0) "cutadapt._seqio.Sequence", /*tp_name*/ sizeof(struct __pyx_obj_8cutadapt_6_seqio_Sequence), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_8cutadapt_6_seqio_Sequence, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif __pyx_pw_8cutadapt_6_seqio_8Sequence_5__repr__, /*tp_repr*/ 0, /*tp_as_number*/ &__pyx_tp_as_sequence_Sequence, /*tp_as_sequence*/ &__pyx_tp_as_mapping_Sequence, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ "\n\tA record in a FASTQ file. Also used for FASTA (then the qualities attribute\n\tis None). qualities is a string and it contains the qualities encoded as\n\tascii(qual+33).\n\n\tIf an adapter has been matched to the sequence, the 'match' attribute is\n\tset to the corresponding Match instance.\n\t", /*tp_doc*/ __pyx_tp_traverse_8cutadapt_6_seqio_Sequence, /*tp_traverse*/ __pyx_tp_clear_8cutadapt_6_seqio_Sequence, /*tp_clear*/ __pyx_pw_8cutadapt_6_seqio_8Sequence_9__richcmp__, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ __pyx_methods_8cutadapt_6_seqio_Sequence, /*tp_methods*/ 0, /*tp_members*/ __pyx_getsets_8cutadapt_6_seqio_Sequence, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ __pyx_pw_8cutadapt_6_seqio_8Sequence_1__init__, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_8cutadapt_6_seqio_Sequence, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static struct __pyx_obj_8cutadapt_6_seqio___pyx_scope_struct____iter__ *__pyx_freelist_8cutadapt_6_seqio___pyx_scope_struct____iter__[8]; static int __pyx_freecount_8cutadapt_6_seqio___pyx_scope_struct____iter__ = 0; static PyObject *__pyx_tp_new_8cutadapt_6_seqio___pyx_scope_struct____iter__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { PyObject *o; if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_8cutadapt_6_seqio___pyx_scope_struct____iter__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_8cutadapt_6_seqio___pyx_scope_struct____iter__)))) { o = (PyObject*)__pyx_freelist_8cutadapt_6_seqio___pyx_scope_struct____iter__[--__pyx_freecount_8cutadapt_6_seqio___pyx_scope_struct____iter__]; memset(o, 0, sizeof(struct __pyx_obj_8cutadapt_6_seqio___pyx_scope_struct____iter__)); (void) PyObject_INIT(o, t); PyObject_GC_Track(o); } else { o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; } return o; } static void __pyx_tp_dealloc_8cutadapt_6_seqio___pyx_scope_struct____iter__(PyObject *o) { struct __pyx_obj_8cutadapt_6_seqio___pyx_scope_struct____iter__ *p = (struct __pyx_obj_8cutadapt_6_seqio___pyx_scope_struct____iter__ *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->__pyx_v_it); Py_CLEAR(p->__pyx_v_line); Py_CLEAR(p->__pyx_v_name); Py_CLEAR(p->__pyx_v_name2); Py_CLEAR(p->__pyx_v_qualities); Py_CLEAR(p->__pyx_v_self); Py_CLEAR(p->__pyx_v_sequence); Py_CLEAR(p->__pyx_v_sequence_class); Py_CLEAR(p->__pyx_t_0); if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_8cutadapt_6_seqio___pyx_scope_struct____iter__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_8cutadapt_6_seqio___pyx_scope_struct____iter__)))) { __pyx_freelist_8cutadapt_6_seqio___pyx_scope_struct____iter__[__pyx_freecount_8cutadapt_6_seqio___pyx_scope_struct____iter__++] = ((struct __pyx_obj_8cutadapt_6_seqio___pyx_scope_struct____iter__ *)o); } else { (*Py_TYPE(o)->tp_free)(o); } } static int __pyx_tp_traverse_8cutadapt_6_seqio___pyx_scope_struct____iter__(PyObject *o, visitproc v, void *a) { int e; struct __pyx_obj_8cutadapt_6_seqio___pyx_scope_struct____iter__ *p = (struct __pyx_obj_8cutadapt_6_seqio___pyx_scope_struct____iter__ *)o; if (p->__pyx_v_it) { e = (*v)(p->__pyx_v_it, a); if (e) return e; } if (p->__pyx_v_self) { e = (*v)(p->__pyx_v_self, a); if (e) return e; } if (p->__pyx_v_sequence_class) { e = (*v)(p->__pyx_v_sequence_class, a); if (e) return e; } if (p->__pyx_t_0) { e = (*v)(p->__pyx_t_0, a); if (e) return e; } return 0; } static int __pyx_tp_clear_8cutadapt_6_seqio___pyx_scope_struct____iter__(PyObject *o) { PyObject* tmp; struct __pyx_obj_8cutadapt_6_seqio___pyx_scope_struct____iter__ *p = (struct __pyx_obj_8cutadapt_6_seqio___pyx_scope_struct____iter__ *)o; tmp = ((PyObject*)p->__pyx_v_it); p->__pyx_v_it = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_self); p->__pyx_v_self = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_v_sequence_class); p->__pyx_v_sequence_class = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->__pyx_t_0); p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } static PyTypeObject __pyx_type_8cutadapt_6_seqio___pyx_scope_struct____iter__ = { PyVarObject_HEAD_INIT(0, 0) "cutadapt._seqio.__pyx_scope_struct____iter__", /*tp_name*/ sizeof(struct __pyx_obj_8cutadapt_6_seqio___pyx_scope_struct____iter__), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_8cutadapt_6_seqio___pyx_scope_struct____iter__, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 0, /*tp_compare*/ #endif #if PY_MAJOR_VERSION >= 3 0, /*tp_as_async*/ #endif 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ __pyx_tp_traverse_8cutadapt_6_seqio___pyx_scope_struct____iter__, /*tp_traverse*/ __pyx_tp_clear_8cutadapt_6_seqio___pyx_scope_struct____iter__, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ __pyx_tp_new_8cutadapt_6_seqio___pyx_scope_struct____iter__, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ 0, /*tp_version_tag*/ #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif }; static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { #if PY_VERSION_HEX < 0x03020000 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, #else PyModuleDef_HEAD_INIT, #endif "_seqio", 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_, __pyx_k_, sizeof(__pyx_k_), 0, 0, 1, 0}, {&__pyx_kp_s_At_line_0_Sequence_descriptions, __pyx_k_At_line_0_Sequence_descriptions, sizeof(__pyx_k_At_line_0_Sequence_descriptions), 0, 0, 1, 0}, {&__pyx_kp_s_Expected_at_least_d_arguments, __pyx_k_Expected_at_least_d_arguments, sizeof(__pyx_k_Expected_at_least_d_arguments), 0, 0, 1, 0}, {&__pyx_kp_s_FASTQ_file_ended_prematurely, __pyx_k_FASTQ_file_ended_prematurely, sizeof(__pyx_k_FASTQ_file_ended_prematurely), 0, 0, 1, 0}, {&__pyx_n_s_FastqReader, __pyx_k_FastqReader, sizeof(__pyx_k_FastqReader), 0, 0, 1, 1}, {&__pyx_n_s_FastqReader___init, __pyx_k_FastqReader___init, sizeof(__pyx_k_FastqReader___init), 0, 0, 1, 1}, {&__pyx_n_s_FastqReader___iter, __pyx_k_FastqReader___iter, sizeof(__pyx_k_FastqReader___iter), 0, 0, 1, 1}, {&__pyx_n_s_FormatError, __pyx_k_FormatError, sizeof(__pyx_k_FormatError), 0, 0, 1, 1}, {&__pyx_kp_s_Function_call_with_ambiguous_arg, __pyx_k_Function_call_with_ambiguous_arg, sizeof(__pyx_k_Function_call_with_ambiguous_arg), 0, 0, 1, 0}, {&__pyx_kp_s_In_read_named_0_r_length_of_qual, __pyx_k_In_read_named_0_r_length_of_qual, sizeof(__pyx_k_In_read_named_0_r_length_of_qual), 0, 0, 1, 0}, {&__pyx_kp_s_Line_0_in_FASTQ_file_is_expected, __pyx_k_Line_0_in_FASTQ_file_is_expected, sizeof(__pyx_k_Line_0_in_FASTQ_file_is_expected), 0, 0, 1, 0}, {&__pyx_kp_s_Line_0_in_FASTQ_file_is_expected_2, __pyx_k_Line_0_in_FASTQ_file_is_expected_2, sizeof(__pyx_k_Line_0_in_FASTQ_file_is_expected_2), 0, 0, 1, 0}, {&__pyx_kp_s_No_matching_signature_found, __pyx_k_No_matching_signature_found, sizeof(__pyx_k_No_matching_signature_found), 0, 0, 1, 0}, {&__pyx_n_s_NotImplementedError, __pyx_k_NotImplementedError, sizeof(__pyx_k_NotImplementedError), 0, 0, 1, 1}, {&__pyx_kp_s_Reader_for_FASTQ_files_Does_not, __pyx_k_Reader_for_FASTQ_files_Does_not, sizeof(__pyx_k_Reader_for_FASTQ_files_Does_not), 0, 0, 1, 0}, {&__pyx_n_s_SequenceReader, __pyx_k_SequenceReader, sizeof(__pyx_k_SequenceReader), 0, 0, 1, 1}, {&__pyx_kp_s_Sequence_name_0_r_sequence_1_r, __pyx_k_Sequence_name_0_r_sequence_1_r, sizeof(__pyx_k_Sequence_name_0_r_sequence_1_r), 0, 0, 1, 0}, {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, {&__pyx_kp_s__16, __pyx_k__16, sizeof(__pyx_k__16), 0, 0, 1, 0}, {&__pyx_kp_s__17, __pyx_k__17, sizeof(__pyx_k__17), 0, 0, 1, 0}, {&__pyx_kp_s__18, __pyx_k__18, sizeof(__pyx_k__18), 0, 0, 1, 0}, {&__pyx_kp_s__19, __pyx_k__19, sizeof(__pyx_k__19), 0, 0, 1, 0}, {&__pyx_kp_s__20, __pyx_k__20, sizeof(__pyx_k__20), 0, 0, 1, 0}, {&__pyx_kp_s__3, __pyx_k__3, sizeof(__pyx_k__3), 0, 0, 1, 0}, {&__pyx_n_s_args, __pyx_k_args, sizeof(__pyx_k_args), 0, 0, 1, 1}, {&__pyx_n_s_buf, __pyx_k_buf, sizeof(__pyx_k_buf), 0, 0, 1, 1}, {&__pyx_n_s_buf1, __pyx_k_buf1, sizeof(__pyx_k_buf1), 0, 0, 1, 1}, {&__pyx_n_s_buf2, __pyx_k_buf2, sizeof(__pyx_k_buf2), 0, 0, 1, 1}, {&__pyx_n_s_bytearray, __pyx_k_bytearray, sizeof(__pyx_k_bytearray), 0, 0, 1, 1}, {&__pyx_n_s_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 0, 1, 1}, {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1}, {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1}, {&__pyx_n_s_cutadapt__seqio, __pyx_k_cutadapt__seqio, sizeof(__pyx_k_cutadapt__seqio), 0, 0, 1, 1}, {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, {&__pyx_n_s_data1, __pyx_k_data1, sizeof(__pyx_k_data1), 0, 0, 1, 1}, {&__pyx_n_s_data2, __pyx_k_data2, sizeof(__pyx_k_data2), 0, 0, 1, 1}, {&__pyx_n_s_defaults, __pyx_k_defaults, sizeof(__pyx_k_defaults), 0, 0, 1, 1}, {&__pyx_n_s_delivers_qualities, __pyx_k_delivers_qualities, sizeof(__pyx_k_delivers_qualities), 0, 0, 1, 1}, {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1}, {&__pyx_n_s_end1, __pyx_k_end1, sizeof(__pyx_k_end1), 0, 0, 1, 1}, {&__pyx_n_s_end2, __pyx_k_end2, sizeof(__pyx_k_end2), 0, 0, 1, 1}, {&__pyx_n_s_fastq_head, __pyx_k_fastq_head, sizeof(__pyx_k_fastq_head), 0, 0, 1, 1}, {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1}, {&__pyx_n_s_file_2, __pyx_k_file_2, sizeof(__pyx_k_file_2), 0, 0, 1, 1}, {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1}, {&__pyx_n_s_head, __pyx_k_head, sizeof(__pyx_k_head), 0, 0, 1, 1}, {&__pyx_kp_s_home_marcel_scm_cutadapt_cutada, __pyx_k_home_marcel_scm_cutadapt_cutada, sizeof(__pyx_k_home_marcel_scm_cutadapt_cutada), 0, 0, 1, 0}, {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, {&__pyx_n_s_it, __pyx_k_it, sizeof(__pyx_k_it), 0, 0, 1, 1}, {&__pyx_n_s_iter, __pyx_k_iter, sizeof(__pyx_k_iter), 0, 0, 1, 1}, {&__pyx_n_s_kwargs, __pyx_k_kwargs, sizeof(__pyx_k_kwargs), 0, 0, 1, 1}, {&__pyx_n_s_length, __pyx_k_length, sizeof(__pyx_k_length), 0, 0, 1, 1}, {&__pyx_n_s_line, __pyx_k_line, sizeof(__pyx_k_line), 0, 0, 1, 1}, {&__pyx_n_s_linebreaks, __pyx_k_linebreaks, sizeof(__pyx_k_linebreaks), 0, 0, 1, 1}, {&__pyx_n_s_linebreaks_seen, __pyx_k_linebreaks_seen, sizeof(__pyx_k_linebreaks_seen), 0, 0, 1, 1}, {&__pyx_n_s_lines, __pyx_k_lines, sizeof(__pyx_k_lines), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_match, __pyx_k_match, sizeof(__pyx_k_match), 0, 0, 1, 1}, {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, {&__pyx_n_s_name2, __pyx_k_name2, sizeof(__pyx_k_name2), 0, 0, 1, 1}, {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, {&__pyx_n_s_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 1}, {&__pyx_n_s_pos1, __pyx_k_pos1, sizeof(__pyx_k_pos1), 0, 0, 1, 1}, {&__pyx_n_s_pos2, __pyx_k_pos2, sizeof(__pyx_k_pos2), 0, 0, 1, 1}, {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, {&__pyx_n_s_qualities, __pyx_k_qualities, sizeof(__pyx_k_qualities), 0, 0, 1, 1}, {&__pyx_kp_s_qualities_0_r, __pyx_k_qualities_0_r, sizeof(__pyx_k_qualities_0_r), 0, 0, 1, 0}, {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, {&__pyx_n_s_record_start, __pyx_k_record_start, sizeof(__pyx_k_record_start), 0, 0, 1, 1}, {&__pyx_n_s_record_start1, __pyx_k_record_start1, sizeof(__pyx_k_record_start1), 0, 0, 1, 1}, {&__pyx_n_s_record_start2, __pyx_k_record_start2, sizeof(__pyx_k_record_start2), 0, 0, 1, 1}, {&__pyx_n_s_rstrip, __pyx_k_rstrip, sizeof(__pyx_k_rstrip), 0, 0, 1, 1}, {&__pyx_n_s_second_header, __pyx_k_second_header, sizeof(__pyx_k_second_header), 0, 0, 1, 1}, {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, {&__pyx_n_s_send, __pyx_k_send, sizeof(__pyx_k_send), 0, 0, 1, 1}, {&__pyx_n_s_seqio, __pyx_k_seqio, sizeof(__pyx_k_seqio), 0, 0, 1, 1}, {&__pyx_n_s_sequence, __pyx_k_sequence, sizeof(__pyx_k_sequence), 0, 0, 1, 1}, {&__pyx_n_s_sequence_class, __pyx_k_sequence_class, sizeof(__pyx_k_sequence_class), 0, 0, 1, 1}, {&__pyx_n_s_shorten, __pyx_k_shorten, sizeof(__pyx_k_shorten), 0, 0, 1, 1}, {&__pyx_n_s_signatures, __pyx_k_signatures, sizeof(__pyx_k_signatures), 0, 0, 1, 1}, {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1}, {&__pyx_n_s_strip, __pyx_k_strip, sizeof(__pyx_k_strip), 0, 0, 1, 1}, {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_n_s_throw, __pyx_k_throw, sizeof(__pyx_k_throw), 0, 0, 1, 1}, {&__pyx_n_s_two_fastq_heads, __pyx_k_two_fastq_heads, sizeof(__pyx_k_two_fastq_heads), 0, 0, 1, 1}, {&__pyx_n_s_xopen, __pyx_k_xopen, sizeof(__pyx_k_xopen), 0, 0, 1, 1}, {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 20, __pyx_L1_error) __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 20, __pyx_L1_error) __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s_NotImplementedError); if (!__pyx_builtin_NotImplementedError) __PYX_ERR(0, 164, __pyx_L1_error) __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 180, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s__3); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_No_matching_signature_found); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_Function_call_with_ambiguous_arg); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s__3); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_No_matching_signature_found); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Function_call_with_ambiguous_arg); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s__3); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13); __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_No_matching_signature_found); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14); __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Function_call_with_ambiguous_arg); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s__18); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 230, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_FASTQ_file_ended_prematurely); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 234, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22); __pyx_tuple__23 = PyTuple_Pack(6, __pyx_n_s_buf, __pyx_n_s_lines, __pyx_n_s_pos, __pyx_n_s_linebreaks_seen, __pyx_n_s_length, __pyx_n_s_data); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__23); __Pyx_GIVEREF(__pyx_tuple__23); __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_marcel_scm_cutadapt_cutada, __pyx_n_s_head, 20, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 20, __pyx_L1_error) __pyx_tuple__25 = PyTuple_Pack(7, __pyx_n_s_buf, __pyx_n_s_end, __pyx_n_s_pos, __pyx_n_s_linebreaks, __pyx_n_s_length, __pyx_n_s_data, __pyx_n_s_record_start); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__25); __Pyx_GIVEREF(__pyx_tuple__25); __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(2, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_marcel_scm_cutadapt_cutada, __pyx_n_s_fastq_head, 38, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 38, __pyx_L1_error) __pyx_tuple__27 = PyTuple_Pack(11, __pyx_n_s_buf1, __pyx_n_s_buf2, __pyx_n_s_end1, __pyx_n_s_end2, __pyx_n_s_pos1, __pyx_n_s_pos2, __pyx_n_s_linebreaks, __pyx_n_s_data1, __pyx_n_s_data2, __pyx_n_s_record_start1, __pyx_n_s_record_start2); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__27); __Pyx_GIVEREF(__pyx_tuple__27); __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(4, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_marcel_scm_cutadapt_cutada, __pyx_n_s_two_fastq_heads, 69, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 69, __pyx_L1_error) __pyx_tuple__29 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_file, __pyx_n_s_sequence_class); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__29); __Pyx_GIVEREF(__pyx_tuple__29); __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_marcel_scm_cutadapt_cutada, __pyx_n_s_init, 175, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 175, __pyx_L1_error) __pyx_tuple__31 = PyTuple_Pack(11, __pyx_n_s_self, __pyx_n_s_i, __pyx_n_s_strip, __pyx_n_s_line, __pyx_n_s_name, __pyx_n_s_qualities, __pyx_n_s_sequence, __pyx_n_s_name2, __pyx_n_s_sequence_class, __pyx_n_s_it, __pyx_n_s_second_header); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__31); __Pyx_GIVEREF(__pyx_tuple__31); __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(1, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_marcel_scm_cutadapt_cutada, __pyx_n_s_iter, 184, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; __Pyx_RefNannyFinishContext(); return -1; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC init_seqio(void); /*proto*/ PyMODINIT_FUNC init_seqio(void) #else PyMODINIT_FUNC PyInit__seqio(void); /*proto*/ PyMODINIT_FUNC PyInit__seqio(void) #endif { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__seqio(void)", 0); if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) #ifdef __Pyx_CyFunction_USED if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_FusedFunction_USED if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Coroutine_USED if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_Generator_USED if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif #ifdef __Pyx_StopAsyncIteration_USED if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4("_seqio", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) Py_INCREF(__pyx_d); __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); /*--- Initialize various global constants etc. ---*/ if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif if (__pyx_module_is_main_cutadapt___seqio) { if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) } #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) if (!PyDict_GetItemString(modules, "cutadapt._seqio")) { if (unlikely(PyDict_SetItemString(modules, "cutadapt._seqio", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) } } #endif /*--- Builtin init code ---*/ if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ if (PyType_Ready(&__pyx_type_8cutadapt_6_seqio_Sequence) < 0) __PYX_ERR(0, 106, __pyx_L1_error) __pyx_type_8cutadapt_6_seqio_Sequence.tp_print = 0; #if CYTHON_COMPILING_IN_CPYTHON { PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8cutadapt_6_seqio_Sequence, "__init__"); if (unlikely(!wrapper)) __PYX_ERR(0, 106, __pyx_L1_error) if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_8cutadapt_6_seqio_8Sequence___init__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_8cutadapt_6_seqio_8Sequence___init__.doc = __pyx_doc_8cutadapt_6_seqio_8Sequence___init__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8cutadapt_6_seqio_8Sequence___init__; } } #endif #if CYTHON_COMPILING_IN_CPYTHON { PyObject *wrapper = PyObject_GetAttrString((PyObject *)&__pyx_type_8cutadapt_6_seqio_Sequence, "__getitem__"); if (unlikely(!wrapper)) __PYX_ERR(0, 106, __pyx_L1_error) if (Py_TYPE(wrapper) == &PyWrapperDescr_Type) { __pyx_wrapperbase_8cutadapt_6_seqio_8Sequence_2__getitem__ = *((PyWrapperDescrObject *)wrapper)->d_base; __pyx_wrapperbase_8cutadapt_6_seqio_8Sequence_2__getitem__.doc = __pyx_doc_8cutadapt_6_seqio_8Sequence_2__getitem__; ((PyWrapperDescrObject *)wrapper)->d_base = &__pyx_wrapperbase_8cutadapt_6_seqio_8Sequence_2__getitem__; } } #endif if (PyObject_SetAttrString(__pyx_m, "Sequence", (PyObject *)&__pyx_type_8cutadapt_6_seqio_Sequence) < 0) __PYX_ERR(0, 106, __pyx_L1_error) __pyx_ptype_8cutadapt_6_seqio_Sequence = &__pyx_type_8cutadapt_6_seqio_Sequence; if (PyType_Ready(&__pyx_type_8cutadapt_6_seqio___pyx_scope_struct____iter__) < 0) __PYX_ERR(0, 184, __pyx_L1_error) __pyx_type_8cutadapt_6_seqio___pyx_scope_struct____iter__.tp_print = 0; __pyx_ptype_8cutadapt_6_seqio___pyx_scope_struct____iter__ = &__pyx_type_8cutadapt_6_seqio___pyx_scope_struct____iter__; /*--- Type import code ---*/ /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_xopen); __Pyx_GIVEREF(__pyx_n_s_xopen); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_xopen); __pyx_t_2 = __Pyx_Import(__pyx_n_s_xopen, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_xopen); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_xopen, __pyx_t_1) < 0) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_shorten); __Pyx_GIVEREF(__pyx_n_s_shorten); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_shorten); __Pyx_INCREF(__pyx_n_s_FormatError); __Pyx_GIVEREF(__pyx_n_s_FormatError); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_FormatError); __Pyx_INCREF(__pyx_n_s_SequenceReader); __Pyx_GIVEREF(__pyx_n_s_SequenceReader); PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_SequenceReader); __pyx_t_1 = __Pyx_Import(__pyx_n_s_seqio, __pyx_t_2, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_shorten); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_shorten, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_FormatError); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_FormatError, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_SequenceReader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_SequenceReader, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0__pyx_mdef_8cutadapt_6_seqio_7head, 0, __pyx_n_s_head, NULL, __pyx_n_s_cutadapt__seqio, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_bytes, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1__pyx_mdef_8cutadapt_6_seqio_9head, 0, __pyx_n_s_head, NULL, __pyx_n_s_cutadapt__seqio, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple); if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_bytearray, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __pyx_FusedFunction_NewEx(&__pyx_mdef_8cutadapt_6_seqio_1head, 0, __pyx_n_s_head, NULL, __pyx_n_s_cutadapt__seqio, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_2, __pyx_empty_tuple); ((__pyx_FusedFunctionObject *) __pyx_t_2)->__signatures__ = __pyx_t_1; __Pyx_GIVEREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_head, __pyx_t_2) < 0) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = __Pyx_PyInt_From_long(-1L); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_From_long(-1L); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_k__7 = __pyx_t_3; __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0__pyx_mdef_8cutadapt_6_seqio_13fastq_head, 0, __pyx_n_s_fastq_head, NULL, __pyx_n_s_cutadapt__seqio, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (!__Pyx_CyFunction_InitDefaults(__pyx_t_5, sizeof(__pyx_defaults2), 0)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_CyFunction_Defaults(__pyx_defaults2, __pyx_t_5)->__pyx_arg_end = -1L; __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_t_4); __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_5, __pyx_pf_8cutadapt_6_seqio_28__defaults__); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_bytes, __pyx_t_5) < 0) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1__pyx_mdef_8cutadapt_6_seqio_15fastq_head, 0, __pyx_n_s_fastq_head, NULL, __pyx_n_s_cutadapt__seqio, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (!__Pyx_CyFunction_InitDefaults(__pyx_t_5, sizeof(__pyx_defaults3), 0)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_CyFunction_Defaults(__pyx_defaults3, __pyx_t_5)->__pyx_arg_end = -1L; __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_t_4); __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_5, __pyx_pf_8cutadapt_6_seqio_30__defaults__); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_bytearray, __pyx_t_5) < 0) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __pyx_FusedFunction_NewEx(&__pyx_mdef_8cutadapt_6_seqio_3fastq_head, 0, __pyx_n_s_fastq_head, NULL, __pyx_n_s_cutadapt__seqio, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_5, __pyx_t_4); __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_5, __pyx_pf_8cutadapt_6_seqio_28__defaults__); ((__pyx_FusedFunctionObject *) __pyx_t_5)->__signatures__ = __pyx_t_3; __Pyx_GIVEREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_fastq_head, __pyx_t_5) < 0) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __pyx_FusedFunction_NewEx(&__pyx_fuse_0__pyx_mdef_8cutadapt_6_seqio_19two_fastq_heads, 0, __pyx_n_s_two_fastq_heads, NULL, __pyx_n_s_cutadapt__seqio, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_empty_tuple); if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_bytes, __pyx_t_7) < 0) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __pyx_FusedFunction_NewEx(&__pyx_fuse_1__pyx_mdef_8cutadapt_6_seqio_21two_fastq_heads, 0, __pyx_n_s_two_fastq_heads, NULL, __pyx_n_s_cutadapt__seqio, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_empty_tuple); if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_bytearray, __pyx_t_7) < 0) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __pyx_FusedFunction_NewEx(&__pyx_mdef_8cutadapt_6_seqio_5two_fastq_heads, 0, __pyx_n_s_two_fastq_heads, NULL, __pyx_n_s_cutadapt__seqio, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_empty_tuple); ((__pyx_FusedFunctionObject *) __pyx_t_7)->__signatures__ = __pyx_t_6; __Pyx_GIVEREF(__pyx_t_6); if (PyDict_SetItem(__pyx_d, __pyx_n_s_two_fastq_heads, __pyx_t_7) < 0) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_SequenceReader); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_CalculateMetaclass(NULL, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_10 = __Pyx_Py3MetaclassPrepare(__pyx_t_8, __pyx_t_9, __pyx_n_s_FastqReader, __pyx_n_s_FastqReader, (PyObject *) NULL, __pyx_n_s_cutadapt__seqio, __pyx_kp_s_Reader_for_FASTQ_files_Does_not); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8cutadapt_6_seqio_11FastqReader_1__init__, 0, __pyx_n_s_FastqReader___init, NULL, __pyx_n_s_cutadapt__seqio, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); if (!__Pyx_CyFunction_InitDefaults(__pyx_t_11, sizeof(__pyx_defaults4), 1)) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_INCREF(((PyObject *)__pyx_ptype_8cutadapt_6_seqio_Sequence)); __Pyx_CyFunction_Defaults(__pyx_defaults4, __pyx_t_11)->__pyx_arg_sequence_class = ((PyObject *)__pyx_ptype_8cutadapt_6_seqio_Sequence); __Pyx_GIVEREF(__pyx_ptype_8cutadapt_6_seqio_Sequence); __Pyx_CyFunction_SetDefaultsGetter(__pyx_t_11, __pyx_pf_8cutadapt_6_seqio_11FastqReader_5__defaults__); if (PyObject_SetItem(__pyx_t_10, __pyx_n_s_init, __pyx_t_11) < 0) __PYX_ERR(0, 175, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8cutadapt_6_seqio_11FastqReader_3__iter__, 0, __pyx_n_s_FastqReader___iter, NULL, __pyx_n_s_cutadapt__seqio, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); if (PyObject_SetItem(__pyx_t_10, __pyx_n_s_iter, __pyx_t_11) < 0) __PYX_ERR(0, 184, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = __Pyx_Py3ClassCreate(__pyx_t_8, __pyx_n_s_FastqReader, __pyx_t_9, __pyx_t_10, NULL, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); if (PyDict_SetItem(__pyx_d, __pyx_n_s_FastqReader, __pyx_t_11) < 0) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_9) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; /*--- Wrapped vars code ---*/ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); if (__pyx_m) { if (__pyx_d) { __Pyx_AddTraceback("init cutadapt._seqio", __pyx_clineno, __pyx_lineno, __pyx_filename); } Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init cutadapt._seqio"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* --- Runtime support code --- */ /* Refnanny */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* GetBuiltinName */ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); if (unlikely(!result)) { PyErr_Format(PyExc_NameError, #if PY_MAJOR_VERSION >= 3 "name '%U' is not defined", name); #else "name '%.200s' is not defined", PyString_AS_STRING(name)); #endif } return result; } /* RaiseArgTupleInvalid */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } /* RaiseDoubleKeywords */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AsString(kw_name)); #endif } /* ParseKeywords */ static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; continue; } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { if ((**argname == key) || ( (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) && _PyString_Eq(**argname, key))) { goto arg_passed_twice; } argname++; } } } else #endif if (likely(PyUnicode_Check(key))) { while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) { values[name-argnames] = value; break; } name++; } if (*name) continue; else { PyObject*** argname = argnames; while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; if (cmp == 0) goto arg_passed_twice; argname++; } } } else goto invalid_keyword_type; if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%.200s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%.200s() got an unexpected keyword argument '%.200s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } /* GetItemInt */ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); Py_DECREF(j); return r; } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, i); Py_INCREF(r); return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else return PySequence_GetItem(o, i); #endif } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #else return PySequence_GetItem(o, i); #endif } static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (is_list || PyList_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { PyObject *r = PyList_GET_ITEM(o, n); Py_INCREF(r); return r; } } else if (PyTuple_CheckExact(o)) { Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, n); Py_INCREF(r); return r; } } else { PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_item)) { if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { Py_ssize_t l = m->sq_length(o); if (likely(l >= 0)) { i += l; } else { if (!PyErr_ExceptionMatches(PyExc_OverflowError)) return NULL; PyErr_Clear(); } } return m->sq_item(o, i); } } #else if (is_list || PySequence_Check(o)) { return PySequence_GetItem(o, i); } #endif return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } /* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *result; ternaryfunc call = func->ob_type->tp_call; if (unlikely(!call)) return PyObject_Call(func, arg, kw); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) return NULL; result = (*call)(func, arg, kw); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyErrFetchRestore */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; } #endif /* RaiseException */ #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { __Pyx_PyThreadState_declare Py_XINCREF(type); if (!value || value == Py_None) value = NULL; else Py_INCREF(value); if (!tb || tb == Py_None) tb = NULL; else { Py_INCREF(tb); if (!PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } } if (PyType_Check(type)) { #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); value = Py_None; } #endif PyErr_NormalizeException(&type, &value, &tb); } else { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } value = type; type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } } __Pyx_PyThreadState_assign __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (PyExceptionClass_Check(type)) { PyObject *instance_class = NULL; if (value && PyExceptionInstance_Check(value)) { instance_class = (PyObject*) Py_TYPE(value); if (instance_class != type) { int is_subclass = PyObject_IsSubclass(instance_class, type); if (!is_subclass) { instance_class = NULL; } else if (unlikely(is_subclass == -1)) { goto bad; } else { type = instance_class; } } } if (!instance_class) { PyObject *args; if (!value) args = PyTuple_New(0); else if (PyTuple_Check(value)) { Py_INCREF(value); args = value; } else args = PyTuple_Pack(1, value); if (!args) goto bad; owned_instance = PyObject_Call(type, args, NULL); Py_DECREF(args); if (!owned_instance) goto bad; value = owned_instance; if (!PyExceptionInstance_Check(value)) { PyErr_Format(PyExc_TypeError, "calling %R should have returned an instance of " "BaseException, not %R", type, Py_TYPE(value)); goto bad; } } } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } #if PY_VERSION_HEX >= 0x03030000 if (cause) { #else if (cause && cause != Py_None) { #endif PyObject *fixed_cause; if (cause == Py_None) { fixed_cause = NULL; } else if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { #if CYTHON_COMPILING_IN_PYPY PyObject *tmp_type, *tmp_value, *tmp_tb; PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); Py_INCREF(tb); PyErr_Restore(tmp_type, tmp_value, tb); Py_XDECREF(tmp_tb); #else PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } #endif } bad: Py_XDECREF(owned_instance); return; } #endif /* SetItemInt */ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; if (!j) return -1; r = PyObject_SetItem(o, j, v); Py_DECREF(j); return r; } static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int is_list, CYTHON_NCP_UNUSED int wraparound, CYTHON_NCP_UNUSED int boundscheck) { #if CYTHON_COMPILING_IN_CPYTHON if (is_list || PyList_CheckExact(o)) { Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { PyObject* old = PyList_GET_ITEM(o, n); Py_INCREF(v); PyList_SET_ITEM(o, n, v); Py_DECREF(old); return 1; } } else { PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_ass_item)) { if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { Py_ssize_t l = m->sq_length(o); if (likely(l >= 0)) { i += l; } else { if (!PyErr_ExceptionMatches(PyExc_OverflowError)) return -1; PyErr_Clear(); } } return m->sq_ass_item(o, i, v); } } #else #if CYTHON_COMPILING_IN_PYPY if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) { #else if (is_list || PySequence_Check(o)) { #endif return PySequence_SetItem(o, i, v); } #endif return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); } /* IterFinish */ static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); PyObject* exc_type = tstate->curexc_type; if (unlikely(exc_type)) { if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { PyObject *exc_value, *exc_tb; exc_value = tstate->curexc_value; exc_tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; Py_DECREF(exc_type); Py_XDECREF(exc_value); Py_XDECREF(exc_tb); return 0; } else { return -1; } } return 0; #else if (unlikely(PyErr_Occurred())) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { PyErr_Clear(); return 0; } else { return -1; } } return 0; #endif } /* PyObjectCallMethO */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { PyObject *self, *result; PyCFunction cfunc; cfunc = PyCFunction_GET_FUNCTION(func); self = PyCFunction_GET_SELF(func); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) return NULL; result = cfunc(self, arg); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } return result; } #endif /* PyObjectCallNoArg */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { #ifdef __Pyx_CyFunction_USED if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { #else if (likely(PyCFunction_Check(func))) { #endif if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { return __Pyx_PyObject_CallMethO(func, NULL); } } return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); } #endif /* PyObjectCallOneArg */ #if CYTHON_COMPILING_IN_CPYTHON static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *result; PyObject *args = PyTuple_New(1); if (unlikely(!args)) return NULL; Py_INCREF(arg); PyTuple_SET_ITEM(args, 0, arg); result = __Pyx_PyObject_Call(func, args, NULL); Py_DECREF(args); return result; } static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { #ifdef __Pyx_CyFunction_USED if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { #else if (likely(PyCFunction_Check(func))) { #endif if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { return __Pyx_PyObject_CallMethO(func, arg); } } return __Pyx__PyObject_CallOneArg(func, arg); } #else static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { PyObject *result; PyObject *args = PyTuple_Pack(1, arg); if (unlikely(!args)) return NULL; result = __Pyx_PyObject_Call(func, args, NULL); Py_DECREF(args); return result; } #endif /* PyObjectCallMethod0 */ static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { PyObject *method, *result = NULL; method = __Pyx_PyObject_GetAttrStr(obj, method_name); if (unlikely(!method)) goto bad; #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyMethod_Check(method))) { PyObject *self = PyMethod_GET_SELF(method); if (likely(self)) { PyObject *function = PyMethod_GET_FUNCTION(method); result = __Pyx_PyObject_CallOneArg(function, self); Py_DECREF(method); return result; } } #endif result = __Pyx_PyObject_CallNoArg(method); Py_DECREF(method); bad: return result; } /* RaiseNeedMoreValuesToUnpack */ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", index, (index == 1) ? "" : "s"); } /* RaiseTooManyValuesToUnpack */ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } /* UnpackItemEndCheck */ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; } else { return __Pyx_IterFinish(); } return 0; } /* RaiseNoneIterError */ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } /* UnpackTupleError */ static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { if (t == Py_None) { __Pyx_RaiseNoneNotIterableError(); } else if (PyTuple_GET_SIZE(t) < index) { __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); } else { __Pyx_RaiseTooManyValuesError(index); } } /* UnpackTuple2 */ static CYTHON_INLINE int __Pyx_unpack_tuple2(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int is_tuple, int has_known_size, int decref_tuple) { Py_ssize_t index; PyObject *value1 = NULL, *value2 = NULL, *iter = NULL; if (!is_tuple && unlikely(!PyTuple_Check(tuple))) { iternextfunc iternext; iter = PyObject_GetIter(tuple); if (unlikely(!iter)) goto bad; if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; } iternext = Py_TYPE(iter)->tp_iternext; value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; } value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; } if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad; Py_DECREF(iter); } else { if (!has_known_size && unlikely(PyTuple_GET_SIZE(tuple) != 2)) { __Pyx_UnpackTupleError(tuple, 2); goto bad; } #if CYTHON_COMPILING_IN_PYPY value1 = PySequence_ITEM(tuple, 0); if (unlikely(!value1)) goto bad; value2 = PySequence_ITEM(tuple, 1); if (unlikely(!value2)) goto bad; #else value1 = PyTuple_GET_ITEM(tuple, 0); value2 = PyTuple_GET_ITEM(tuple, 1); Py_INCREF(value1); Py_INCREF(value2); #endif if (decref_tuple) { Py_DECREF(tuple); } } *pvalue1 = value1; *pvalue2 = value2; return 0; unpacking_failed: if (!has_known_size && __Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); bad: Py_XDECREF(iter); Py_XDECREF(value1); Py_XDECREF(value2); if (decref_tuple) { Py_XDECREF(tuple); } return -1; } /* dict_iter */ static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name, Py_ssize_t* p_orig_length, int* p_source_is_dict) { is_dict = is_dict || likely(PyDict_CheckExact(iterable)); *p_source_is_dict = is_dict; #if !CYTHON_COMPILING_IN_PYPY if (is_dict) { *p_orig_length = PyDict_Size(iterable); Py_INCREF(iterable); return iterable; } #endif *p_orig_length = 0; if (method_name) { PyObject* iter; iterable = __Pyx_PyObject_CallMethod0(iterable, method_name); if (!iterable) return NULL; #if !CYTHON_COMPILING_IN_PYPY if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable)) return iterable; #endif iter = PyObject_GetIter(iterable); Py_DECREF(iterable); return iter; } return PyObject_GetIter(iterable); } static CYTHON_INLINE int __Pyx_dict_iter_next( PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos, PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) { PyObject* next_item; #if !CYTHON_COMPILING_IN_PYPY if (source_is_dict) { PyObject *key, *value; if (unlikely(orig_length != PyDict_Size(iter_obj))) { PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); return -1; } if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) { return 0; } if (pitem) { PyObject* tuple = PyTuple_New(2); if (unlikely(!tuple)) { return -1; } Py_INCREF(key); Py_INCREF(value); PyTuple_SET_ITEM(tuple, 0, key); PyTuple_SET_ITEM(tuple, 1, value); *pitem = tuple; } else { if (pkey) { Py_INCREF(key); *pkey = key; } if (pvalue) { Py_INCREF(value); *pvalue = value; } } return 1; } else if (PyTuple_CheckExact(iter_obj)) { Py_ssize_t pos = *ppos; if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0; *ppos = pos + 1; next_item = PyTuple_GET_ITEM(iter_obj, pos); Py_INCREF(next_item); } else if (PyList_CheckExact(iter_obj)) { Py_ssize_t pos = *ppos; if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0; *ppos = pos + 1; next_item = PyList_GET_ITEM(iter_obj, pos); Py_INCREF(next_item); } else #endif { next_item = PyIter_Next(iter_obj); if (unlikely(!next_item)) { return __Pyx_IterFinish(); } } if (pitem) { *pitem = next_item; } else if (pkey && pvalue) { if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1)) return -1; } else if (pkey) { *pkey = next_item; } else { *pvalue = next_item; } return 1; } /* ArgTypeTest */ static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) { PyErr_Format(PyExc_TypeError, "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", name, type->tp_name, Py_TYPE(obj)->tp_name); } static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { if (unlikely(!type)) { PyErr_SetString(PyExc_SystemError, "Missing type object"); return 0; } if (none_allowed && obj == Py_None) return 1; else if (exact) { if (likely(Py_TYPE(obj) == type)) return 1; #if PY_MAJOR_VERSION == 2 else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; #endif } else { if (likely(PyObject_TypeCheck(obj, type))) return 1; } __Pyx_RaiseArgumentTypeInvalid(name, obj, type); return 0; } /* GetModuleGlobalName */ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { PyObject *result; #if CYTHON_COMPILING_IN_CPYTHON result = PyDict_GetItem(__pyx_d, name); if (likely(result)) { Py_INCREF(result); } else { #else result = PyObject_GetItem(__pyx_d, name); if (!result) { PyErr_Clear(); #endif result = __Pyx_GetBuiltinName(name); } return result; } /* IterNext */ static CYTHON_INLINE PyObject *__Pyx_PyIter_Next2(PyObject* iterator, PyObject* defval) { PyObject* next; iternextfunc iternext = Py_TYPE(iterator)->tp_iternext; #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(!iternext)) { #else if (unlikely(!iternext) || unlikely(!PyIter_Check(iterator))) { #endif PyErr_Format(PyExc_TypeError, "%.200s object is not an iterator", Py_TYPE(iterator)->tp_name); return NULL; } next = iternext(iterator); if (likely(next)) return next; #if CYTHON_COMPILING_IN_CPYTHON #if PY_VERSION_HEX >= 0x02070000 if (unlikely(iternext == &_PyObject_NextNotImplemented)) return NULL; #endif #endif if (defval) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (unlikely(exc_type != PyExc_StopIteration) && !PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) return NULL; PyErr_Clear(); } Py_INCREF(defval); return defval; } if (!PyErr_Occurred()) PyErr_SetNone(PyExc_StopIteration); return NULL; } /* BytesEquals */ static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else if (s1 == s2) { return (equals == Py_EQ); } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { const char *ps1, *ps2; Py_ssize_t length = PyBytes_GET_SIZE(s1); if (length != PyBytes_GET_SIZE(s2)) return (equals == Py_NE); ps1 = PyBytes_AS_STRING(s1); ps2 = PyBytes_AS_STRING(s2); if (ps1[0] != ps2[0]) { return (equals == Py_NE); } else if (length == 1) { return (equals == Py_EQ); } else { int result = memcmp(ps1, ps2, (size_t)length); return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { return (equals == Py_NE); } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { return (equals == Py_NE); } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); Py_DECREF(py_result); return result; } #endif } /* UnicodeEquals */ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { #if CYTHON_COMPILING_IN_PYPY return PyObject_RichCompareBool(s1, s2, equals); #else #if PY_MAJOR_VERSION < 3 PyObject* owned_ref = NULL; #endif int s1_is_unicode, s2_is_unicode; if (s1 == s2) { goto return_eq; } s1_is_unicode = PyUnicode_CheckExact(s1); s2_is_unicode = PyUnicode_CheckExact(s2); #if PY_MAJOR_VERSION < 3 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) { owned_ref = PyUnicode_FromObject(s2); if (unlikely(!owned_ref)) return -1; s2 = owned_ref; s2_is_unicode = 1; } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) { owned_ref = PyUnicode_FromObject(s1); if (unlikely(!owned_ref)) return -1; s1 = owned_ref; s1_is_unicode = 1; } else if (((!s2_is_unicode) & (!s1_is_unicode))) { return __Pyx_PyBytes_Equals(s1, s2, equals); } #endif if (s1_is_unicode & s2_is_unicode) { Py_ssize_t length; int kind; void *data1, *data2; if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) return -1; length = __Pyx_PyUnicode_GET_LENGTH(s1); if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { goto return_ne; } kind = __Pyx_PyUnicode_KIND(s1); if (kind != __Pyx_PyUnicode_KIND(s2)) { goto return_ne; } data1 = __Pyx_PyUnicode_DATA(s1); data2 = __Pyx_PyUnicode_DATA(s2); if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) { goto return_ne; } else if (length == 1) { goto return_eq; } else { int result = memcmp(data1, data2, (size_t)(length * kind)); #if PY_MAJOR_VERSION < 3 Py_XDECREF(owned_ref); #endif return (equals == Py_EQ) ? (result == 0) : (result != 0); } } else if ((s1 == Py_None) & s2_is_unicode) { goto return_ne; } else if ((s2 == Py_None) & s1_is_unicode) { goto return_ne; } else { int result; PyObject* py_result = PyObject_RichCompare(s1, s2, equals); if (!py_result) return -1; result = __Pyx_PyObject_IsTrue(py_result); Py_DECREF(py_result); return result; } return_eq: #if PY_MAJOR_VERSION < 3 Py_XDECREF(owned_ref); #endif return (equals == Py_EQ); return_ne: #if PY_MAJOR_VERSION < 3 Py_XDECREF(owned_ref); #endif return (equals == Py_NE); #endif } /* bytes_tailmatch */ static int __Pyx_PyBytes_SingleTailmatch(PyObject* self, PyObject* arg, Py_ssize_t start, Py_ssize_t end, int direction) { const char* self_ptr = PyBytes_AS_STRING(self); Py_ssize_t self_len = PyBytes_GET_SIZE(self); const char* sub_ptr; Py_ssize_t sub_len; int retval; Py_buffer view; view.obj = NULL; if ( PyBytes_Check(arg) ) { sub_ptr = PyBytes_AS_STRING(arg); sub_len = PyBytes_GET_SIZE(arg); } #if PY_MAJOR_VERSION < 3 else if ( PyUnicode_Check(arg) ) { return (int) PyUnicode_Tailmatch(self, arg, start, end, direction); } #endif else { if (unlikely(PyObject_GetBuffer(self, &view, PyBUF_SIMPLE) == -1)) return -1; sub_ptr = (const char*) view.buf; sub_len = view.len; } if (end > self_len) end = self_len; else if (end < 0) end += self_len; if (end < 0) end = 0; if (start < 0) start += self_len; if (start < 0) start = 0; if (direction > 0) { if (end-sub_len > start) start = end - sub_len; } if (start + sub_len <= end) retval = !memcmp(self_ptr+start, sub_ptr, (size_t)sub_len); else retval = 0; if (view.obj) PyBuffer_Release(&view); return retval; } static int __Pyx_PyBytes_Tailmatch(PyObject* self, PyObject* substr, Py_ssize_t start, Py_ssize_t end, int direction) { if (unlikely(PyTuple_Check(substr))) { Py_ssize_t i, count = PyTuple_GET_SIZE(substr); for (i = 0; i < count; i++) { int result; #if CYTHON_COMPILING_IN_CPYTHON result = __Pyx_PyBytes_SingleTailmatch(self, PyTuple_GET_ITEM(substr, i), start, end, direction); #else PyObject* sub = PySequence_ITEM(substr, i); if (unlikely(!sub)) return -1; result = __Pyx_PyBytes_SingleTailmatch(self, sub, start, end, direction); Py_DECREF(sub); #endif if (result) { return result; } } return 0; } return __Pyx_PyBytes_SingleTailmatch(self, substr, start, end, direction); } /* unicode_tailmatch */ static int __Pyx_PyUnicode_Tailmatch(PyObject* s, PyObject* substr, Py_ssize_t start, Py_ssize_t end, int direction) { if (unlikely(PyTuple_Check(substr))) { Py_ssize_t i, count = PyTuple_GET_SIZE(substr); for (i = 0; i < count; i++) { Py_ssize_t result; #if CYTHON_COMPILING_IN_CPYTHON result = PyUnicode_Tailmatch(s, PyTuple_GET_ITEM(substr, i), start, end, direction); #else PyObject* sub = PySequence_ITEM(substr, i); if (unlikely(!sub)) return -1; result = PyUnicode_Tailmatch(s, sub, start, end, direction); Py_DECREF(sub); #endif if (result) { return (int) result; } } return 0; } return (int) PyUnicode_Tailmatch(s, substr, start, end, direction); } /* str_tailmatch */ static CYTHON_INLINE int __Pyx_PyStr_Tailmatch(PyObject* self, PyObject* arg, Py_ssize_t start, Py_ssize_t end, int direction) { if (PY_MAJOR_VERSION < 3) return __Pyx_PyBytes_Tailmatch(self, arg, start, end, direction); else return __Pyx_PyUnicode_Tailmatch(self, arg, start, end, direction); } /* None */ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); } /* None */ static CYTHON_INLINE long __Pyx_mod_long(long a, long b) { long r = a % b; r += ((r != 0) & ((r ^ b) < 0)) * b; return r; } /* Import */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; #if PY_VERSION_HEX < 0x03030000 PyObject *py_import; py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); if (!py_import) goto bad; #endif if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; { #if PY_MAJOR_VERSION >= 3 if (level == -1) { if (strchr(__Pyx_MODULE_NAME, '.')) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(1); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); #endif if (!module) { if (!PyErr_ExceptionMatches(PyExc_ImportError)) goto bad; PyErr_Clear(); } } level = 0; } #endif if (!module) { #if PY_VERSION_HEX < 0x03030000 PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); #else module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, level); #endif } } bad: #if PY_VERSION_HEX < 0x03030000 Py_XDECREF(py_import); #endif Py_XDECREF(empty_list); Py_XDECREF(empty_dict); return module; } /* ImportFrom */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Format(PyExc_ImportError, #if PY_MAJOR_VERSION < 3 "cannot import name %.230s", PyString_AS_STRING(name)); #else "cannot import name %S", name); #endif } return value; } /* FetchCommonType */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { PyObject* fake_module; PyTypeObject* cached_type = NULL; fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI); if (!fake_module) return NULL; Py_INCREF(fake_module); cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name); if (cached_type) { if (!PyType_Check((PyObject*)cached_type)) { PyErr_Format(PyExc_TypeError, "Shared Cython type %.200s is not a type object", type->tp_name); goto bad; } if (cached_type->tp_basicsize != type->tp_basicsize) { PyErr_Format(PyExc_TypeError, "Shared Cython type %.200s has the wrong size, try recompiling", type->tp_name); goto bad; } } else { if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad; PyErr_Clear(); if (PyType_Ready(type) < 0) goto bad; if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0) goto bad; Py_INCREF(type); cached_type = type; } done: Py_DECREF(fake_module); return cached_type; bad: Py_XDECREF(cached_type); cached_type = NULL; goto done; } /* CythonFunction */ static PyObject * __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure) { if (unlikely(op->func_doc == NULL)) { if (op->func.m_ml->ml_doc) { #if PY_MAJOR_VERSION >= 3 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc); #else op->func_doc = PyString_FromString(op->func.m_ml->ml_doc); #endif if (unlikely(op->func_doc == NULL)) return NULL; } else { Py_INCREF(Py_None); return Py_None; } } Py_INCREF(op->func_doc); return op->func_doc; } static int __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp = op->func_doc; if (value == NULL) { value = Py_None; } Py_INCREF(value); op->func_doc = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op) { if (unlikely(op->func_name == NULL)) { #if PY_MAJOR_VERSION >= 3 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name); #else op->func_name = PyString_InternFromString(op->func.m_ml->ml_name); #endif if (unlikely(op->func_name == NULL)) return NULL; } Py_INCREF(op->func_name); return op->func_name; } static int __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) { #else if (unlikely(value == NULL || !PyString_Check(value))) { #endif PyErr_SetString(PyExc_TypeError, "__name__ must be set to a string object"); return -1; } tmp = op->func_name; Py_INCREF(value); op->func_name = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op) { Py_INCREF(op->func_qualname); return op->func_qualname; } static int __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) { #else if (unlikely(value == NULL || !PyString_Check(value))) { #endif PyErr_SetString(PyExc_TypeError, "__qualname__ must be set to a string object"); return -1; } tmp = op->func_qualname; Py_INCREF(value); op->func_qualname = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure) { PyObject *self; self = m->func_closure; if (self == NULL) self = Py_None; Py_INCREF(self); return self; } static PyObject * __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op) { if (unlikely(op->func_dict == NULL)) { op->func_dict = PyDict_New(); if (unlikely(op->func_dict == NULL)) return NULL; } Py_INCREF(op->func_dict); return op->func_dict; } static int __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value) { PyObject *tmp; if (unlikely(value == NULL)) { PyErr_SetString(PyExc_TypeError, "function's dictionary may not be deleted"); return -1; } if (unlikely(!PyDict_Check(value))) { PyErr_SetString(PyExc_TypeError, "setting function's dictionary to a non-dict"); return -1; } tmp = op->func_dict; Py_INCREF(value); op->func_dict = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op) { Py_INCREF(op->func_globals); return op->func_globals; } static PyObject * __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op) { Py_INCREF(Py_None); return Py_None; } static PyObject * __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op) { PyObject* result = (op->func_code) ? op->func_code : Py_None; Py_INCREF(result); return result; } static int __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) { int result = 0; PyObject *res = op->defaults_getter((PyObject *) op); if (unlikely(!res)) return -1; #if CYTHON_COMPILING_IN_CPYTHON op->defaults_tuple = PyTuple_GET_ITEM(res, 0); Py_INCREF(op->defaults_tuple); op->defaults_kwdict = PyTuple_GET_ITEM(res, 1); Py_INCREF(op->defaults_kwdict); #else op->defaults_tuple = PySequence_ITEM(res, 0); if (unlikely(!op->defaults_tuple)) result = -1; else { op->defaults_kwdict = PySequence_ITEM(res, 1); if (unlikely(!op->defaults_kwdict)) result = -1; } #endif Py_DECREF(res); return result; } static int __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) { PyObject* tmp; if (!value) { value = Py_None; } else if (value != Py_None && !PyTuple_Check(value)) { PyErr_SetString(PyExc_TypeError, "__defaults__ must be set to a tuple object"); return -1; } Py_INCREF(value); tmp = op->defaults_tuple; op->defaults_tuple = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) { PyObject* result = op->defaults_tuple; if (unlikely(!result)) { if (op->defaults_getter) { if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; result = op->defaults_tuple; } else { result = Py_None; } } Py_INCREF(result); return result; } static int __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) { PyObject* tmp; if (!value) { value = Py_None; } else if (value != Py_None && !PyDict_Check(value)) { PyErr_SetString(PyExc_TypeError, "__kwdefaults__ must be set to a dict object"); return -1; } Py_INCREF(value); tmp = op->defaults_kwdict; op->defaults_kwdict = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) { PyObject* result = op->defaults_kwdict; if (unlikely(!result)) { if (op->defaults_getter) { if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL; result = op->defaults_kwdict; } else { result = Py_None; } } Py_INCREF(result); return result; } static int __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) { PyObject* tmp; if (!value || value == Py_None) { value = NULL; } else if (!PyDict_Check(value)) { PyErr_SetString(PyExc_TypeError, "__annotations__ must be set to a dict object"); return -1; } Py_XINCREF(value); tmp = op->func_annotations; op->func_annotations = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) { PyObject* result = op->func_annotations; if (unlikely(!result)) { result = PyDict_New(); if (unlikely(!result)) return NULL; op->func_annotations = result; } Py_INCREF(result); return result; } static PyGetSetDef __pyx_CyFunction_getsets[] = { {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0}, {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0}, {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0}, {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0}, {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0}, {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0}, {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0}, {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0}, {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0}, {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0}, {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0}, {0, 0, 0, 0, 0} }; static PyMemberDef __pyx_CyFunction_members[] = { {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0}, {0, 0, 0, 0, 0} }; static PyObject * __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) { #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(m->func.m_ml->ml_name); #else return PyString_FromString(m->func.m_ml->ml_name); #endif } static PyMethodDef __pyx_CyFunction_methods[] = { {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0}, {0, 0, 0, 0} }; #if PY_VERSION_HEX < 0x030500A0 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist) #else #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist) #endif static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname, PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type); if (op == NULL) return NULL; op->flags = flags; __Pyx_CyFunction_weakreflist(op) = NULL; op->func.m_ml = ml; op->func.m_self = (PyObject *) op; Py_XINCREF(closure); op->func_closure = closure; Py_XINCREF(module); op->func.m_module = module; op->func_dict = NULL; op->func_name = NULL; Py_INCREF(qualname); op->func_qualname = qualname; op->func_doc = NULL; op->func_classobj = NULL; op->func_globals = globals; Py_INCREF(op->func_globals); Py_XINCREF(code); op->func_code = code; op->defaults_pyobjects = 0; op->defaults = NULL; op->defaults_tuple = NULL; op->defaults_kwdict = NULL; op->defaults_getter = NULL; op->func_annotations = NULL; PyObject_GC_Track(op); return (PyObject *) op; } static int __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m) { Py_CLEAR(m->func_closure); Py_CLEAR(m->func.m_module); Py_CLEAR(m->func_dict); Py_CLEAR(m->func_name); Py_CLEAR(m->func_qualname); Py_CLEAR(m->func_doc); Py_CLEAR(m->func_globals); Py_CLEAR(m->func_code); Py_CLEAR(m->func_classobj); Py_CLEAR(m->defaults_tuple); Py_CLEAR(m->defaults_kwdict); Py_CLEAR(m->func_annotations); if (m->defaults) { PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); int i; for (i = 0; i < m->defaults_pyobjects; i++) Py_XDECREF(pydefaults[i]); PyObject_Free(m->defaults); m->defaults = NULL; } return 0; } static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m) { PyObject_GC_UnTrack(m); if (__Pyx_CyFunction_weakreflist(m) != NULL) PyObject_ClearWeakRefs((PyObject *) m); __Pyx_CyFunction_clear(m); PyObject_GC_Del(m); } static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg) { Py_VISIT(m->func_closure); Py_VISIT(m->func.m_module); Py_VISIT(m->func_dict); Py_VISIT(m->func_name); Py_VISIT(m->func_qualname); Py_VISIT(m->func_doc); Py_VISIT(m->func_globals); Py_VISIT(m->func_code); Py_VISIT(m->func_classobj); Py_VISIT(m->defaults_tuple); Py_VISIT(m->defaults_kwdict); if (m->defaults) { PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m); int i; for (i = 0; i < m->defaults_pyobjects; i++) Py_VISIT(pydefaults[i]); } return 0; } static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { Py_INCREF(func); return func; } if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { if (type == NULL) type = (PyObject *)(Py_TYPE(obj)); return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); } if (obj == Py_None) obj = NULL; return __Pyx_PyMethod_New(func, obj, type); } static PyObject* __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) { #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromFormat("", op->func_qualname, (void *)op); #else return PyString_FromFormat("", PyString_AsString(op->func_qualname), (void *)op); #endif } #if CYTHON_COMPILING_IN_PYPY static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyCFunctionObject* f = (PyCFunctionObject*)func; PyCFunction meth = f->m_ml->ml_meth; PyObject *self = f->m_self; Py_ssize_t size; switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { case METH_VARARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) return (*meth)(self, arg); break; case METH_VARARGS | METH_KEYWORDS: return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); case METH_NOARGS: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { size = PyTuple_GET_SIZE(arg); if (likely(size == 0)) return (*meth)(self, NULL); PyErr_Format(PyExc_TypeError, "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", f->m_ml->ml_name, size); return NULL; } break; case METH_O: if (likely(kw == NULL || PyDict_Size(kw) == 0)) { size = PyTuple_GET_SIZE(arg); if (likely(size == 1)) { PyObject *result, *arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; result = (*meth)(self, arg0); Py_DECREF(arg0); return result; } PyErr_Format(PyExc_TypeError, "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", f->m_ml->ml_name, size); return NULL; } break; default: PyErr_SetString(PyExc_SystemError, "Bad call flags in " "__Pyx_CyFunction_Call. METH_OLDARGS is no " "longer supported!"); return NULL; } PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", f->m_ml->ml_name); return NULL; } #else static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { return PyCFunction_Call(func, arg, kw); } #endif static PyTypeObject __pyx_CyFunctionType_type = { PyVarObject_HEAD_INIT(0, 0) "cython_function_or_method", sizeof(__pyx_CyFunctionObject), 0, (destructor) __Pyx_CyFunction_dealloc, 0, 0, 0, #if PY_MAJOR_VERSION < 3 0, #else 0, #endif (reprfunc) __Pyx_CyFunction_repr, 0, 0, 0, 0, __Pyx_CyFunction_Call, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, 0, (traverseproc) __Pyx_CyFunction_traverse, (inquiry) __Pyx_CyFunction_clear, 0, #if PY_VERSION_HEX < 0x030500A0 offsetof(__pyx_CyFunctionObject, func_weakreflist), #else offsetof(PyCFunctionObject, m_weakreflist), #endif 0, 0, __pyx_CyFunction_methods, __pyx_CyFunction_members, __pyx_CyFunction_getsets, 0, 0, __Pyx_CyFunction_descr_get, 0, offsetof(__pyx_CyFunctionObject, func_dict), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, #if PY_VERSION_HEX >= 0x030400a1 0, #endif }; static int __pyx_CyFunction_init(void) { #if !CYTHON_COMPILING_IN_PYPY __pyx_CyFunctionType_type.tp_call = PyCFunction_Call; #endif __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); if (__pyx_CyFunctionType == NULL) { return -1; } return 0; } static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults = PyObject_Malloc(size); if (!m->defaults) return PyErr_NoMemory(); memset(m->defaults, 0, size); m->defaults_pyobjects = pyobjects; return m->defaults; } static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults_tuple = tuple; Py_INCREF(tuple); } static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->defaults_kwdict = dict; Py_INCREF(dict); } static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; m->func_annotations = dict; Py_INCREF(dict); } /* FusedFunction */ static PyObject * __pyx_FusedFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject *qualname, PyObject *self, PyObject *module, PyObject *globals, PyObject *code) { __pyx_FusedFunctionObject *fusedfunc = (__pyx_FusedFunctionObject *) __Pyx_CyFunction_New(type, ml, flags, qualname, self, module, globals, code); if (!fusedfunc) return NULL; fusedfunc->__signatures__ = NULL; fusedfunc->type = NULL; fusedfunc->self = NULL; return (PyObject *) fusedfunc; } static void __pyx_FusedFunction_dealloc(__pyx_FusedFunctionObject *self) { __pyx_FusedFunction_clear(self); __pyx_FusedFunctionType->tp_free((PyObject *) self); } static int __pyx_FusedFunction_traverse(__pyx_FusedFunctionObject *self, visitproc visit, void *arg) { Py_VISIT(self->self); Py_VISIT(self->type); Py_VISIT(self->__signatures__); return __Pyx_CyFunction_traverse((__pyx_CyFunctionObject *) self, visit, arg); } static int __pyx_FusedFunction_clear(__pyx_FusedFunctionObject *self) { Py_CLEAR(self->self); Py_CLEAR(self->type); Py_CLEAR(self->__signatures__); return __Pyx_CyFunction_clear((__pyx_CyFunctionObject *) self); } static PyObject * __pyx_FusedFunction_descr_get(PyObject *self, PyObject *obj, PyObject *type) { __pyx_FusedFunctionObject *func, *meth; func = (__pyx_FusedFunctionObject *) self; if (func->self || func->func.flags & __Pyx_CYFUNCTION_STATICMETHOD) { Py_INCREF(self); return self; } if (obj == Py_None) obj = NULL; meth = (__pyx_FusedFunctionObject *) __pyx_FusedFunction_NewEx( ((PyCFunctionObject *) func)->m_ml, ((__pyx_CyFunctionObject *) func)->flags, ((__pyx_CyFunctionObject *) func)->func_qualname, ((__pyx_CyFunctionObject *) func)->func_closure, ((PyCFunctionObject *) func)->m_module, ((__pyx_CyFunctionObject *) func)->func_globals, ((__pyx_CyFunctionObject *) func)->func_code); if (!meth) return NULL; Py_XINCREF(func->func.func_classobj); meth->func.func_classobj = func->func.func_classobj; Py_XINCREF(func->__signatures__); meth->__signatures__ = func->__signatures__; Py_XINCREF(type); meth->type = type; Py_XINCREF(func->func.defaults_tuple); meth->func.defaults_tuple = func->func.defaults_tuple; if (func->func.flags & __Pyx_CYFUNCTION_CLASSMETHOD) obj = type; Py_XINCREF(obj); meth->self = obj; return (PyObject *) meth; } static PyObject * _obj_to_str(PyObject *obj) { if (PyType_Check(obj)) return PyObject_GetAttr(obj, __pyx_n_s_name_2); else return PyObject_Str(obj); } static PyObject * __pyx_FusedFunction_getitem(__pyx_FusedFunctionObject *self, PyObject *idx) { PyObject *signature = NULL; PyObject *unbound_result_func; PyObject *result_func = NULL; if (self->__signatures__ == NULL) { PyErr_SetString(PyExc_TypeError, "Function is not fused"); return NULL; } if (PyTuple_Check(idx)) { PyObject *list = PyList_New(0); Py_ssize_t n = PyTuple_GET_SIZE(idx); PyObject *string = NULL; PyObject *sep = NULL; int i; if (!list) return NULL; for (i = 0; i < n; i++) { #if CYTHON_COMPILING_IN_CPYTHON PyObject *item = PyTuple_GET_ITEM(idx, i); #else PyObject *item = PySequence_ITEM(idx, i); #endif string = _obj_to_str(item); #if !CYTHON_COMPILING_IN_CPYTHON Py_DECREF(item); #endif if (!string || PyList_Append(list, string) < 0) goto __pyx_err; Py_DECREF(string); } sep = PyUnicode_FromString("|"); if (sep) signature = PyUnicode_Join(sep, list); __pyx_err: ; Py_DECREF(list); Py_XDECREF(sep); } else { signature = _obj_to_str(idx); } if (!signature) return NULL; unbound_result_func = PyObject_GetItem(self->__signatures__, signature); if (unbound_result_func) { if (self->self || self->type) { __pyx_FusedFunctionObject *unbound = (__pyx_FusedFunctionObject *) unbound_result_func; Py_CLEAR(unbound->func.func_classobj); Py_XINCREF(self->func.func_classobj); unbound->func.func_classobj = self->func.func_classobj; result_func = __pyx_FusedFunction_descr_get(unbound_result_func, self->self, self->type); } else { result_func = unbound_result_func; Py_INCREF(result_func); } } Py_DECREF(signature); Py_XDECREF(unbound_result_func); return result_func; } static PyObject * __pyx_FusedFunction_callfunction(PyObject *func, PyObject *args, PyObject *kw) { __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; PyObject *result; int static_specialized = (cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD && !((__pyx_FusedFunctionObject *) func)->__signatures__); if (cyfunc->flags & __Pyx_CYFUNCTION_CCLASS && !static_specialized) { Py_ssize_t argc; PyObject *new_args; PyObject *self; PyObject *m_self; argc = PyTuple_GET_SIZE(args); new_args = PyTuple_GetSlice(args, 1, argc); if (!new_args) return NULL; self = PyTuple_GetItem(args, 0); if (!self) return NULL; m_self = cyfunc->func.m_self; cyfunc->func.m_self = self; result = __Pyx_CyFunction_Call(func, new_args, kw); cyfunc->func.m_self = m_self; Py_DECREF(new_args); } else { result = __Pyx_CyFunction_Call(func, args, kw); } return result; } static PyObject * __pyx_FusedFunction_call(PyObject *func, PyObject *args, PyObject *kw) { __pyx_FusedFunctionObject *binding_func = (__pyx_FusedFunctionObject *) func; Py_ssize_t argc = PyTuple_GET_SIZE(args); PyObject *new_args = NULL; __pyx_FusedFunctionObject *new_func = NULL; PyObject *result = NULL; PyObject *self = NULL; int is_staticmethod = binding_func->func.flags & __Pyx_CYFUNCTION_STATICMETHOD; int is_classmethod = binding_func->func.flags & __Pyx_CYFUNCTION_CLASSMETHOD; if (binding_func->self) { Py_ssize_t i; new_args = PyTuple_New(argc + 1); if (!new_args) return NULL; self = binding_func->self; #if !CYTHON_COMPILING_IN_CPYTHON Py_INCREF(self); #endif Py_INCREF(self); PyTuple_SET_ITEM(new_args, 0, self); for (i = 0; i < argc; i++) { #if CYTHON_COMPILING_IN_CPYTHON PyObject *item = PyTuple_GET_ITEM(args, i); Py_INCREF(item); #else PyObject *item = PySequence_ITEM(args, i); if (unlikely(!item)) goto bad; #endif PyTuple_SET_ITEM(new_args, i + 1, item); } args = new_args; } else if (binding_func->type) { if (argc < 1) { PyErr_SetString(PyExc_TypeError, "Need at least one argument, 0 given."); return NULL; } #if CYTHON_COMPILING_IN_CPYTHON self = PyTuple_GET_ITEM(args, 0); #else self = PySequence_ITEM(args, 0); if (unlikely(!self)) return NULL; #endif } if (self && !is_classmethod && !is_staticmethod) { int is_instance = PyObject_IsInstance(self, binding_func->type); if (unlikely(!is_instance)) { PyErr_Format(PyExc_TypeError, "First argument should be of type %.200s, got %.200s.", ((PyTypeObject *) binding_func->type)->tp_name, self->ob_type->tp_name); goto bad; } else if (unlikely(is_instance == -1)) { goto bad; } } #if !CYTHON_COMPILING_IN_CPYTHON Py_XDECREF(self); self = NULL; #endif if (binding_func->__signatures__) { PyObject *tup = PyTuple_Pack(4, binding_func->__signatures__, args, kw == NULL ? Py_None : kw, binding_func->func.defaults_tuple); if (!tup) goto bad; new_func = (__pyx_FusedFunctionObject *) __pyx_FusedFunction_callfunction(func, tup, NULL); Py_DECREF(tup); if (!new_func) goto bad; Py_XINCREF(binding_func->func.func_classobj); Py_CLEAR(new_func->func.func_classobj); new_func->func.func_classobj = binding_func->func.func_classobj; func = (PyObject *) new_func; } result = __pyx_FusedFunction_callfunction(func, args, kw); bad: #if !CYTHON_COMPILING_IN_CPYTHON Py_XDECREF(self); #endif Py_XDECREF(new_args); Py_XDECREF((PyObject *) new_func); return result; } static PyMemberDef __pyx_FusedFunction_members[] = { {(char *) "__signatures__", T_OBJECT, offsetof(__pyx_FusedFunctionObject, __signatures__), READONLY, 0}, {0, 0, 0, 0, 0}, }; static PyMappingMethods __pyx_FusedFunction_mapping_methods = { 0, (binaryfunc) __pyx_FusedFunction_getitem, 0, }; static PyTypeObject __pyx_FusedFunctionType_type = { PyVarObject_HEAD_INIT(0, 0) "fused_cython_function", sizeof(__pyx_FusedFunctionObject), 0, (destructor) __pyx_FusedFunction_dealloc, 0, 0, 0, #if PY_MAJOR_VERSION < 3 0, #else 0, #endif 0, 0, 0, &__pyx_FusedFunction_mapping_methods, 0, (ternaryfunc) __pyx_FusedFunction_call, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE, 0, (traverseproc) __pyx_FusedFunction_traverse, (inquiry) __pyx_FusedFunction_clear, 0, 0, 0, 0, 0, __pyx_FusedFunction_members, __pyx_CyFunction_getsets, &__pyx_CyFunctionType_type, 0, __pyx_FusedFunction_descr_get, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, #if PY_VERSION_HEX >= 0x030400a1 0, #endif }; static int __pyx_FusedFunction_init(void) { __pyx_FusedFunctionType = __Pyx_FetchCommonType(&__pyx_FusedFunctionType_type); if (__pyx_FusedFunctionType == NULL) { return -1; } return 0; } /* CalculateMetaclass */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); for (i=0; i < nbases; i++) { PyTypeObject *tmptype; PyObject *tmp = PyTuple_GET_ITEM(bases, i); tmptype = Py_TYPE(tmp); #if PY_MAJOR_VERSION < 3 if (tmptype == &PyClass_Type) continue; #endif if (!metaclass) { metaclass = tmptype; continue; } if (PyType_IsSubtype(metaclass, tmptype)) continue; if (PyType_IsSubtype(tmptype, metaclass)) { metaclass = tmptype; continue; } PyErr_SetString(PyExc_TypeError, "metaclass conflict: " "the metaclass of a derived class " "must be a (non-strict) subclass " "of the metaclasses of all its bases"); return NULL; } if (!metaclass) { #if PY_MAJOR_VERSION < 3 metaclass = &PyClass_Type; #else metaclass = &PyType_Type; #endif } Py_INCREF((PyObject*) metaclass); return (PyObject*) metaclass; } /* Py3ClassCreate */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { PyObject *ns; if (metaclass) { PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare); if (prep) { PyObject *pargs = PyTuple_Pack(2, name, bases); if (unlikely(!pargs)) { Py_DECREF(prep); return NULL; } ns = PyObject_Call(prep, pargs, mkw); Py_DECREF(prep); Py_DECREF(pargs); } else { if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) return NULL; PyErr_Clear(); ns = PyDict_New(); } } else { ns = PyDict_New(); } if (unlikely(!ns)) return NULL; if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad; if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad; if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad; return ns; bad: Py_DECREF(ns); return NULL; } static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass) { PyObject *result, *margs; PyObject *owned_metaclass = NULL; if (allow_py2_metaclass) { owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass); if (owned_metaclass) { metaclass = owned_metaclass; } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) { PyErr_Clear(); } else { return NULL; } } if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) { metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases); Py_XDECREF(owned_metaclass); if (unlikely(!metaclass)) return NULL; owned_metaclass = metaclass; } margs = PyTuple_Pack(3, name, bases, dict); if (unlikely(!margs)) { result = NULL; } else { result = PyObject_Call(metaclass, margs, mkw); Py_DECREF(margs); } Py_XDECREF(owned_metaclass); return result; } /* CodeObjectCache */ static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { return count; } while (start < end) { mid = start + (end - start) / 2; if (code_line < entries[mid].code_line) { end = mid; } else if (code_line > entries[mid].code_line) { start = mid + 1; } else { return mid; } } if (code_line <= entries[mid].code_line) { return mid; } else { return mid + 1; } } static PyCodeObject *__pyx_find_code_object(int code_line) { PyCodeObject* code_object; int pos; if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { return NULL; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { return NULL; } code_object = __pyx_code_cache.entries[pos].code_object; Py_INCREF(code_object); return code_object; } static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { int pos, i; __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; if (unlikely(!code_line)) { return; } if (unlikely(!entries)) { entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); if (likely(entries)) { __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = 64; __pyx_code_cache.count = 1; entries[0].code_line = code_line; entries[0].code_object = code_object; Py_INCREF(code_object); } return; } pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { PyCodeObject* tmp = entries[pos].code_object; entries[pos].code_object = code_object; Py_DECREF(tmp); return; } if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } __pyx_code_cache.entries = entries; __pyx_code_cache.max_count = new_max; } for (i=__pyx_code_cache.count; i>pos; i--) { entries[i] = entries[i-1]; } entries[pos].code_line = code_line; entries[pos].code_object = code_object; __pyx_code_cache.count++; Py_INCREF(code_object); } /* AddTraceback */ #include "compile.h" #include "frameobject.h" #include "traceback.h" static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(filename); #else py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_code = __Pyx_PyCode_New( 0, 0, 0, 0, 0, __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); Py_DECREF(py_funcname); return py_code; bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename) { PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; py_code = __pyx_find_code_object(c_line ? c_line : py_line); if (!py_code) { py_code = __Pyx_CreateCodeObjectForTraceback( funcname, c_line, py_line, filename); if (!py_code) goto bad; __pyx_insert_code_object(c_line ? c_line : py_line, py_code); } py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ __pyx_d, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_code); Py_XDECREF(py_frame); } /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; if (is_unsigned) { if (sizeof(long) < sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(long) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); } } else { if (sizeof(long) <= sizeof(long)) { return PyInt_FromLong((long) value); } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); } } { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; return _PyLong_FromByteArray(bytes, sizeof(long), little, !is_unsigned); } } /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ {\ func_type value = func_value;\ if (sizeof(target_type) < sizeof(func_type)) {\ if (unlikely(value != (func_type) (target_type) value)) {\ func_type zero = 0;\ if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ return (target_type) -1;\ if (is_unsigned && unlikely(value < zero))\ goto raise_neg_overflow;\ else\ goto raise_overflow;\ }\ }\ return (target_type) value;\ } /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) -1, const_zero = (int) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(int) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (int) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) case 2: if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; case 3: if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; case 4: if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __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]))) } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (int) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(int) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (int) 0; case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) case -2: if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 2: if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -3: if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 3: if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case -4: if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __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]))) } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 4: if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __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]))) } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; } #endif if (sizeof(int) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (int) -1; } } else { int val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (int) -1; val = __Pyx_PyInt_As_int(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); return (int) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to int"); return (int) -1; } /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const long neg_one = (long) -1, const_zero = (long) 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(long) < sizeof(long)) { __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } return (long) val; } } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0]) case 2: if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) { return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 3: if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) { return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; case 4: if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __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]))) } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) { return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])); } } break; } #endif #if CYTHON_COMPILING_IN_CPYTHON if (unlikely(Py_SIZE(x) < 0)) { goto raise_neg_overflow; } #else { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) return (long) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif if (sizeof(long) <= sizeof(unsigned long)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x)) } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { case 0: return (long) 0; case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0])) case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0]) case -2: if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 2: if (8 * sizeof(long) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -3: if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 3: if (8 * sizeof(long) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case -4: if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __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]))) } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; case 4: if (8 * sizeof(long) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { __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]))) } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]))); } } break; } #endif if (sizeof(long) <= sizeof(long)) { __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x)) } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x)) } } { #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else long val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { PyObject *tmp = v; v = PyNumber_Long(tmp); Py_DECREF(tmp); } #endif if (likely(v)) { int one = 1; int is_little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; int ret = _PyLong_AsByteArray((PyLongObject *)v, bytes, sizeof(val), is_little, !is_unsigned); Py_DECREF(v); if (likely(!ret)) return val; } #endif return (long) -1; } } else { long val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); if (!tmp) return (long) -1; val = __Pyx_PyInt_As_long(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); return (long) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long) -1; } /* SwapException */ #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; tmp_type = tstate->exc_type; tmp_value = tstate->exc_value; tmp_tb = tstate->exc_traceback; tstate->exc_type = *type; tstate->exc_value = *value; tstate->exc_traceback = *tb; *type = tmp_type; *value = tmp_value; *tb = tmp_tb; } #else static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); PyErr_SetExcInfo(*type, *value, *tb); *type = tmp_type; *value = tmp_value; *tb = tmp_tb; } #endif /* PyObjectCallMethod1 */ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { PyObject *method, *result = NULL; method = __Pyx_PyObject_GetAttrStr(obj, method_name); if (unlikely(!method)) goto bad; #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyMethod_Check(method))) { PyObject *self = PyMethod_GET_SELF(method); if (likely(self)) { PyObject *args; PyObject *function = PyMethod_GET_FUNCTION(method); args = PyTuple_New(2); if (unlikely(!args)) goto bad; Py_INCREF(self); PyTuple_SET_ITEM(args, 0, self); Py_INCREF(arg); PyTuple_SET_ITEM(args, 1, arg); Py_INCREF(function); Py_DECREF(method); method = NULL; result = __Pyx_PyObject_Call(function, args, NULL); Py_DECREF(args); Py_DECREF(function); return result; } } #endif result = __Pyx_PyObject_CallOneArg(method, arg); bad: Py_XDECREF(method); return result; } /* CoroutineBase */ #include #include static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value); static PyObject *__Pyx_Coroutine_Close(PyObject *self); static PyObject *__Pyx_Coroutine_Throw(PyObject *gen, PyObject *args); #define __Pyx_Coroutine_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) #if 1 || PY_VERSION_HEX < 0x030300B0 static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) { PyObject *et, *ev, *tb; PyObject *value = NULL; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ErrFetch(&et, &ev, &tb); if (!et) { Py_XDECREF(tb); Py_XDECREF(ev); Py_INCREF(Py_None); *pvalue = Py_None; return 0; } if (likely(et == PyExc_StopIteration)) { #if PY_VERSION_HEX >= 0x030300A0 if (ev && Py_TYPE(ev) == (PyTypeObject*)PyExc_StopIteration) { value = ((PyStopIterationObject *)ev)->value; Py_INCREF(value); Py_DECREF(ev); Py_XDECREF(tb); Py_DECREF(et); *pvalue = value; return 0; } #endif if (!ev || !PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration)) { if (!ev) { Py_INCREF(Py_None); ev = Py_None; } else if (PyTuple_Check(ev)) { if (PyTuple_GET_SIZE(ev) >= 1) { PyObject *value; #if CYTHON_COMPILING_IN_CPYTHON value = PySequence_ITEM(ev, 0); #else value = PyTuple_GET_ITEM(ev, 0); Py_INCREF(value); #endif Py_DECREF(ev); ev = value; } else { Py_INCREF(Py_None); Py_DECREF(ev); ev = Py_None; } } Py_XDECREF(tb); Py_DECREF(et); *pvalue = ev; return 0; } } else if (!PyErr_GivenExceptionMatches(et, PyExc_StopIteration)) { __Pyx_ErrRestore(et, ev, tb); return -1; } PyErr_NormalizeException(&et, &ev, &tb); if (unlikely(!PyObject_TypeCheck(ev, (PyTypeObject*)PyExc_StopIteration))) { __Pyx_ErrRestore(et, ev, tb); return -1; } Py_XDECREF(tb); Py_DECREF(et); #if PY_VERSION_HEX >= 0x030300A0 value = ((PyStopIterationObject *)ev)->value; Py_INCREF(value); Py_DECREF(ev); #else { PyObject* args = __Pyx_PyObject_GetAttrStr(ev, __pyx_n_s_args); Py_DECREF(ev); if (likely(args)) { value = PySequence_GetItem(args, 0); Py_DECREF(args); } if (unlikely(!value)) { __Pyx_ErrRestore(NULL, NULL, NULL); Py_INCREF(Py_None); value = Py_None; } } #endif *pvalue = value; return 0; } #endif static CYTHON_INLINE void __Pyx_Coroutine_ExceptionClear(__pyx_CoroutineObject *self) { PyObject *exc_type = self->exc_type; PyObject *exc_value = self->exc_value; PyObject *exc_traceback = self->exc_traceback; self->exc_type = NULL; self->exc_value = NULL; self->exc_traceback = NULL; Py_XDECREF(exc_type); Py_XDECREF(exc_value); Py_XDECREF(exc_traceback); } static CYTHON_INLINE int __Pyx_Coroutine_CheckRunning(__pyx_CoroutineObject *gen) { if (unlikely(gen->is_running)) { PyErr_SetString(PyExc_ValueError, "generator already executing"); return 1; } return 0; } static CYTHON_INLINE PyObject *__Pyx_Coroutine_SendEx(__pyx_CoroutineObject *self, PyObject *value) { PyObject *retval; __Pyx_PyThreadState_declare assert(!self->is_running); if (unlikely(self->resume_label == 0)) { if (unlikely(value && value != Py_None)) { PyErr_SetString(PyExc_TypeError, "can't send non-None value to a " "just-started generator"); return NULL; } } if (unlikely(self->resume_label == -1)) { PyErr_SetNone(PyExc_StopIteration); return NULL; } __Pyx_PyThreadState_assign if (value) { #if CYTHON_COMPILING_IN_PYPY #else if (self->exc_traceback) { PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; PyFrameObject *f = tb->tb_frame; Py_XINCREF(__pyx_tstate->frame); assert(f->f_back == NULL); f->f_back = __pyx_tstate->frame; } #endif __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback); } else { __Pyx_Coroutine_ExceptionClear(self); } self->is_running = 1; retval = self->body((PyObject *) self, value); self->is_running = 0; if (retval) { __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, &self->exc_traceback); #if CYTHON_COMPILING_IN_PYPY #else if (self->exc_traceback) { PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; PyFrameObject *f = tb->tb_frame; Py_CLEAR(f->f_back); } #endif } else { __Pyx_Coroutine_ExceptionClear(self); } return retval; } static CYTHON_INLINE PyObject *__Pyx_Coroutine_MethodReturn(PyObject *retval) { if (unlikely(!retval && !PyErr_Occurred())) { PyErr_SetNone(PyExc_StopIteration); } return retval; } static CYTHON_INLINE PyObject *__Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen) { PyObject *ret; PyObject *val = NULL; __Pyx_Coroutine_Undelegate(gen); __Pyx_PyGen_FetchStopIterationValue(&val); ret = __Pyx_Coroutine_SendEx(gen, val); Py_XDECREF(val); return ret; } static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) { PyObject *retval; __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; PyObject *yf = gen->yieldfrom; if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) return NULL; if (yf) { PyObject *ret; gen->is_running = 1; #ifdef __Pyx_Generator_USED if (__Pyx_Generator_CheckExact(yf)) { ret = __Pyx_Coroutine_Send(yf, value); } else #endif #ifdef __Pyx_Coroutine_USED if (__Pyx_Coroutine_CheckExact(yf)) { ret = __Pyx_Coroutine_Send(yf, value); } else #endif { if (value == Py_None) ret = Py_TYPE(yf)->tp_iternext(yf); else ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s_send, value); } gen->is_running = 0; if (likely(ret)) { return ret; } retval = __Pyx_Coroutine_FinishDelegation(gen); } else { retval = __Pyx_Coroutine_SendEx(gen, value); } return __Pyx_Coroutine_MethodReturn(retval); } static int __Pyx_Coroutine_CloseIter(__pyx_CoroutineObject *gen, PyObject *yf) { PyObject *retval = NULL; int err = 0; #ifdef __Pyx_Generator_USED if (__Pyx_Generator_CheckExact(yf)) { retval = __Pyx_Coroutine_Close(yf); if (!retval) return -1; } else #endif #ifdef __Pyx_Coroutine_USED if (__Pyx_Coroutine_CheckExact(yf)) { retval = __Pyx_Coroutine_Close(yf); if (!retval) return -1; } else #endif { PyObject *meth; gen->is_running = 1; meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_close); if (unlikely(!meth)) { if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_WriteUnraisable(yf); } PyErr_Clear(); } else { retval = PyObject_CallFunction(meth, NULL); Py_DECREF(meth); if (!retval) err = -1; } gen->is_running = 0; } Py_XDECREF(retval); return err; } static PyObject *__Pyx_Generator_Next(PyObject *self) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject*) self; PyObject *yf = gen->yieldfrom; if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) return NULL; if (yf) { PyObject *ret; gen->is_running = 1; ret = Py_TYPE(yf)->tp_iternext(yf); gen->is_running = 0; if (likely(ret)) { return ret; } return __Pyx_Coroutine_FinishDelegation(gen); } return __Pyx_Coroutine_SendEx(gen, Py_None); } static PyObject *__Pyx_Coroutine_Close(PyObject *self) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; PyObject *retval, *raised_exception; PyObject *yf = gen->yieldfrom; int err = 0; if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) return NULL; if (yf) { Py_INCREF(yf); err = __Pyx_Coroutine_CloseIter(gen, yf); __Pyx_Coroutine_Undelegate(gen); Py_DECREF(yf); } if (err == 0) PyErr_SetNone(PyExc_GeneratorExit); retval = __Pyx_Coroutine_SendEx(gen, NULL); if (retval) { Py_DECREF(retval); PyErr_SetString(PyExc_RuntimeError, "generator ignored GeneratorExit"); return NULL; } raised_exception = PyErr_Occurred(); if (!raised_exception || raised_exception == PyExc_StopIteration || raised_exception == PyExc_GeneratorExit || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit) || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration)) { if (raised_exception) PyErr_Clear(); Py_INCREF(Py_None); return Py_None; } return NULL; } static PyObject *__Pyx_Coroutine_Throw(PyObject *self, PyObject *args) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; PyObject *typ; PyObject *tb = NULL; PyObject *val = NULL; PyObject *yf = gen->yieldfrom; if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb)) return NULL; if (unlikely(__Pyx_Coroutine_CheckRunning(gen))) return NULL; if (yf) { PyObject *ret; Py_INCREF(yf); if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) { int err = __Pyx_Coroutine_CloseIter(gen, yf); Py_DECREF(yf); __Pyx_Coroutine_Undelegate(gen); if (err < 0) return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL)); goto throw_here; } gen->is_running = 1; #ifdef __Pyx_Generator_USED if (__Pyx_Generator_CheckExact(yf)) { ret = __Pyx_Coroutine_Throw(yf, args); } else #endif #ifdef __Pyx_Coroutine_USED if (__Pyx_Coroutine_CheckExact(yf)) { ret = __Pyx_Coroutine_Throw(yf, args); } else #endif { PyObject *meth = __Pyx_PyObject_GetAttrStr(yf, __pyx_n_s_throw); if (unlikely(!meth)) { Py_DECREF(yf); if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { gen->is_running = 0; return NULL; } PyErr_Clear(); __Pyx_Coroutine_Undelegate(gen); gen->is_running = 0; goto throw_here; } ret = PyObject_CallObject(meth, args); Py_DECREF(meth); } gen->is_running = 0; Py_DECREF(yf); if (!ret) { ret = __Pyx_Coroutine_FinishDelegation(gen); } return __Pyx_Coroutine_MethodReturn(ret); } throw_here: __Pyx_Raise(typ, val, tb, NULL); return __Pyx_Coroutine_MethodReturn(__Pyx_Coroutine_SendEx(gen, NULL)); } static int __Pyx_Coroutine_traverse(PyObject *self, visitproc visit, void *arg) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; Py_VISIT(gen->closure); Py_VISIT(gen->classobj); Py_VISIT(gen->yieldfrom); Py_VISIT(gen->exc_type); Py_VISIT(gen->exc_value); Py_VISIT(gen->exc_traceback); return 0; } static int __Pyx_Coroutine_clear(PyObject *self) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; Py_CLEAR(gen->closure); Py_CLEAR(gen->classobj); Py_CLEAR(gen->yieldfrom); Py_CLEAR(gen->exc_type); Py_CLEAR(gen->exc_value); Py_CLEAR(gen->exc_traceback); Py_CLEAR(gen->gi_name); Py_CLEAR(gen->gi_qualname); return 0; } static void __Pyx_Coroutine_dealloc(PyObject *self) { __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; PyObject_GC_UnTrack(gen); if (gen->gi_weakreflist != NULL) PyObject_ClearWeakRefs(self); if (gen->resume_label > 0) { PyObject_GC_Track(self); #if PY_VERSION_HEX >= 0x030400a1 if (PyObject_CallFinalizerFromDealloc(self)) #else Py_TYPE(gen)->tp_del(self); if (self->ob_refcnt > 0) #endif { return; } PyObject_GC_UnTrack(self); } __Pyx_Coroutine_clear(self); PyObject_GC_Del(gen); } static void __Pyx_Coroutine_del(PyObject *self) { PyObject *res; PyObject *error_type, *error_value, *error_traceback; __pyx_CoroutineObject *gen = (__pyx_CoroutineObject *) self; __Pyx_PyThreadState_declare if (gen->resume_label <= 0) return ; #if PY_VERSION_HEX < 0x030400a1 assert(self->ob_refcnt == 0); self->ob_refcnt = 1; #endif __Pyx_PyThreadState_assign __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); res = __Pyx_Coroutine_Close(self); if (res == NULL) PyErr_WriteUnraisable(self); else Py_DECREF(res); __Pyx_ErrRestore(error_type, error_value, error_traceback); #if PY_VERSION_HEX < 0x030400a1 assert(self->ob_refcnt > 0); if (--self->ob_refcnt == 0) { return; } { Py_ssize_t refcnt = self->ob_refcnt; _Py_NewReference(self); self->ob_refcnt = refcnt; } #if CYTHON_COMPILING_IN_CPYTHON assert(PyType_IS_GC(self->ob_type) && _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); _Py_DEC_REFTOTAL; #endif #ifdef COUNT_ALLOCS --Py_TYPE(self)->tp_frees; --Py_TYPE(self)->tp_allocs; #endif #endif } static PyObject * __Pyx_Coroutine_get_name(__pyx_CoroutineObject *self) { Py_INCREF(self->gi_name); return self->gi_name; } static int __Pyx_Coroutine_set_name(__pyx_CoroutineObject *self, PyObject *value) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) { #else if (unlikely(value == NULL || !PyString_Check(value))) { #endif PyErr_SetString(PyExc_TypeError, "__name__ must be set to a string object"); return -1; } tmp = self->gi_name; Py_INCREF(value); self->gi_name = value; Py_XDECREF(tmp); return 0; } static PyObject * __Pyx_Coroutine_get_qualname(__pyx_CoroutineObject *self) { Py_INCREF(self->gi_qualname); return self->gi_qualname; } static int __Pyx_Coroutine_set_qualname(__pyx_CoroutineObject *self, PyObject *value) { PyObject *tmp; #if PY_MAJOR_VERSION >= 3 if (unlikely(value == NULL || !PyUnicode_Check(value))) { #else if (unlikely(value == NULL || !PyString_Check(value))) { #endif PyErr_SetString(PyExc_TypeError, "__qualname__ must be set to a string object"); return -1; } tmp = self->gi_qualname; Py_INCREF(value); self->gi_qualname = value; Py_XDECREF(tmp); return 0; } static __pyx_CoroutineObject *__Pyx__Coroutine_New(PyTypeObject* type, __pyx_coroutine_body_t body, PyObject *closure, PyObject *name, PyObject *qualname) { __pyx_CoroutineObject *gen = PyObject_GC_New(__pyx_CoroutineObject, type); if (gen == NULL) return NULL; gen->body = body; gen->closure = closure; Py_XINCREF(closure); gen->is_running = 0; gen->resume_label = 0; gen->classobj = NULL; gen->yieldfrom = NULL; gen->exc_type = NULL; gen->exc_value = NULL; gen->exc_traceback = NULL; gen->gi_weakreflist = NULL; Py_XINCREF(qualname); gen->gi_qualname = qualname; Py_XINCREF(name); gen->gi_name = name; PyObject_GC_Track(gen); return gen; } /* PatchModuleWithCoroutine */ static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code) { #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) int result; PyObject *globals, *result_obj; globals = PyDict_New(); if (unlikely(!globals)) goto ignore; result = PyDict_SetItemString(globals, "_cython_coroutine_type", #ifdef __Pyx_Coroutine_USED (PyObject*)__pyx_CoroutineType); #else Py_None); #endif if (unlikely(result < 0)) goto ignore; result = PyDict_SetItemString(globals, "_cython_generator_type", #ifdef __Pyx_Generator_USED (PyObject*)__pyx_GeneratorType); #else Py_None); #endif if (unlikely(result < 0)) goto ignore; if (unlikely(PyDict_SetItemString(globals, "_module", module) < 0)) goto ignore; if (unlikely(PyDict_SetItemString(globals, "__builtins__", __pyx_b) < 0)) goto ignore; result_obj = PyRun_String(py_code, Py_file_input, globals, globals); if (unlikely(!result_obj)) goto ignore; Py_DECREF(result_obj); Py_DECREF(globals); return module; ignore: Py_XDECREF(globals); PyErr_WriteUnraisable(module); if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, "Cython module failed to patch module with custom type", 1) < 0)) { Py_DECREF(module); module = NULL; } #else py_code++; #endif return module; } /* PatchGeneratorABC */ #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) static PyObject* __Pyx_patch_abc_module(PyObject *module); static PyObject* __Pyx_patch_abc_module(PyObject *module) { module = __Pyx_Coroutine_patch_module( module, "" "if _cython_generator_type is not None:\n" " try: Generator = _module.Generator\n" " except AttributeError: pass\n" " else: Generator.register(_cython_generator_type)\n" "if _cython_coroutine_type is not None:\n" " try: Coroutine = _module.Coroutine\n" " except AttributeError: pass\n" " else: Coroutine.register(_cython_coroutine_type)\n" ); return module; } #endif static int __Pyx_patch_abc(void) { #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) static int abc_patched = 0; if (!abc_patched) { PyObject *module; module = PyImport_ImportModule((PY_VERSION_HEX >= 0x03030000) ? "collections.abc" : "collections"); if (!module) { PyErr_WriteUnraisable(NULL); if (unlikely(PyErr_WarnEx(PyExc_RuntimeWarning, ((PY_VERSION_HEX >= 0x03030000) ? "Cython module failed to register with collections.abc module" : "Cython module failed to register with collections module"), 1) < 0)) { return -1; } } else { module = __Pyx_patch_abc_module(module); abc_patched = 1; if (unlikely(!module)) return -1; Py_DECREF(module); } module = PyImport_ImportModule("backports_abc"); if (module) { module = __Pyx_patch_abc_module(module); Py_XDECREF(module); } if (!module) { PyErr_Clear(); } } #else if (0) __Pyx_Coroutine_patch_module(NULL, NULL); #endif return 0; } /* Generator */ static PyMethodDef __pyx_Generator_methods[] = { {"send", (PyCFunction) __Pyx_Coroutine_Send, METH_O, (char*) PyDoc_STR("send(arg) -> send 'arg' into generator,\nreturn next yielded value or raise StopIteration.")}, {"throw", (PyCFunction) __Pyx_Coroutine_Throw, METH_VARARGS, (char*) PyDoc_STR("throw(typ[,val[,tb]]) -> raise exception in generator,\nreturn next yielded value or raise StopIteration.")}, {"close", (PyCFunction) __Pyx_Coroutine_Close, METH_NOARGS, (char*) PyDoc_STR("close() -> raise GeneratorExit inside generator.")}, {0, 0, 0, 0} }; static PyMemberDef __pyx_Generator_memberlist[] = { {(char *) "gi_running", T_BOOL, offsetof(__pyx_CoroutineObject, is_running), READONLY, NULL}, {(char*) "gi_yieldfrom", T_OBJECT, offsetof(__pyx_CoroutineObject, yieldfrom), READONLY, (char*) PyDoc_STR("object being iterated by 'yield from', or None")}, {0, 0, 0, 0, 0} }; static PyGetSetDef __pyx_Generator_getsets[] = { {(char *) "__name__", (getter)__Pyx_Coroutine_get_name, (setter)__Pyx_Coroutine_set_name, (char*) PyDoc_STR("name of the generator"), 0}, {(char *) "__qualname__", (getter)__Pyx_Coroutine_get_qualname, (setter)__Pyx_Coroutine_set_qualname, (char*) PyDoc_STR("qualified name of the generator"), 0}, {0, 0, 0, 0, 0} }; static PyTypeObject __pyx_GeneratorType_type = { PyVarObject_HEAD_INIT(0, 0) "generator", sizeof(__pyx_CoroutineObject), 0, (destructor) __Pyx_Coroutine_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_FINALIZE, 0, (traverseproc) __Pyx_Coroutine_traverse, 0, 0, offsetof(__pyx_CoroutineObject, gi_weakreflist), 0, (iternextfunc) __Pyx_Generator_Next, __pyx_Generator_methods, __pyx_Generator_memberlist, __pyx_Generator_getsets, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, #if PY_VERSION_HEX >= 0x030400a1 0, #else __Pyx_Coroutine_del, #endif 0, #if PY_VERSION_HEX >= 0x030400a1 __Pyx_Coroutine_del, #endif }; static int __pyx_Generator_init(void) { __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr; __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter; __pyx_GeneratorType = __Pyx_FetchCommonType(&__pyx_GeneratorType_type); if (unlikely(!__pyx_GeneratorType)) { return -1; } return 0; } /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); return PyErr_WarnEx(NULL, message, 1); } return 0; } /* InitStrings */ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) { return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str)); } static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { Py_ssize_t ignore; return __Pyx_PyObject_AsStringAndSize(o, &ignore); } static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if ( #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII __Pyx_sys_getdefaultencoding_not_ascii && #endif PyUnicode_Check(o)) { #if PY_VERSION_HEX < 0x03030000 char* defenc_c; PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); if (!defenc) return NULL; defenc_c = PyBytes_AS_STRING(defenc); #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII { char* end = defenc_c + PyBytes_GET_SIZE(defenc); char* c; for (c = defenc_c; c < end; c++) { if ((unsigned char) (*c) >= 128) { PyUnicode_AsASCIIString(o); return NULL; } } } #endif *length = PyBytes_GET_SIZE(defenc); return defenc_c; #else if (__Pyx_PyUnicode_READY(o) == -1) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (PyUnicode_IS_ASCII(o)) { *length = PyUnicode_GET_LENGTH(o); return PyUnicode_AsUTF8(o); } else { PyUnicode_AsASCIIString(o); return NULL; } #else return PyUnicode_AsUTF8AndSize(o, length); #endif #endif } else #endif #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE)) if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); } else #endif { char* result; int r = PyBytes_AsStringAndSize(o, &result, length); if (unlikely(r < 0)) { return NULL; } else { return result; } } } static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_MAJOR_VERSION < 3 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return __Pyx_NewRef(x); m = Py_TYPE(x)->tp_as_number; #if PY_MAJOR_VERSION < 3 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_MAJOR_VERSION < 3 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%.4s__ returned non-%.4s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject *x; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_CheckExact(b))) { if (sizeof(Py_ssize_t) >= sizeof(long)) return PyInt_AS_LONG(b); else return PyInt_AsSsize_t(x); } #endif if (likely(PyLong_CheckExact(b))) { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)b)->ob_digit; const Py_ssize_t size = Py_SIZE(b); if (likely(__Pyx_sst_abs(size) <= 1)) { ival = likely(size) ? digits[0] : 0; if (size == -1) ival = -ival; return ival; } else { switch (size) { case 2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -2: if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) { return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case 3: if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case -3: if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) { return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); } break; case 4: if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { 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])); } break; case -4: if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) { 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])); } break; } } #endif return PyLong_AsSsize_t(b); } x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { return PyInt_FromSize_t(ival); } #endif /* Py_PYTHON_H */ cutadapt-1.15/src/cutadapt/colorspace.py0000664000175000017500000000312113205526454021102 0ustar marcelmarcel00000000000000# coding: utf-8 """ Colorspace conversion routines. Inspired by agapython/util/Dibase.py from Corona lite, but reimplemented to avoid licensing issues. Encoding Table A C G T A 0 1 2 3 C 1 0 3 2 G 2 3 0 1 T 3 2 1 0 """ from __future__ import print_function, division, absolute_import __author__ = 'Marcel Martin' def _initialize_dicts(): """ Create the colorspace encoding and decoding dictionaries. """ enc = {} for i, c1 in enumerate("ACGT"): enc['N' + c1] = '4' enc[c1 + 'N'] = '4' enc['.' + c1] = '4' enc[c1 + '.'] = '4' for j, c2 in enumerate("ACGT"): # XOR of nucleotides gives color enc[c1 + c2] = chr(ord('0') + (i ^ j)) enc.update({ 'NN': '4', 'N.': '4', '.N': '4', '..': '4'}) dec = {} for i, c1 in enumerate("ACGT"): dec['.' + str(i)] = 'N' dec['N' + str(i)] = 'N' dec[c1 + '4'] = 'N' dec[c1 + '.'] = 'N' for j, c2 in enumerate("ACGT"): # XOR of nucleotides gives color dec[c1 + chr(ord('0') + (i ^ j))] = c2 dec['N4'] = 'N' return (enc, dec) def encode(s): """ Given a sequence of nucleotides, convert them to colorspace. Only uppercase characters are allowed. >>> encode("ACGGTC") "A13012" """ if not s: return s r = s[0:1] for i in range(len(s) - 1): r += ENCODE[s[i:i+2]] return r def decode(s): """ Decode a sequence of colors to nucleotide space. The first character in s must be a nucleotide. Only uppercase characters are allowed. >>> decode("A13012") "ACGGTC" """ if len(s) < 2: return s x = s[0] result = x for c in s[1:]: x = DECODE[x + c] result += x return result (ENCODE, DECODE) = _initialize_dicts() cutadapt-1.15/src/cutadapt/_align.pyx0000664000175000017500000003706613205526454020410 0ustar marcelmarcel00000000000000# cython: profile=False, emit_code_comments=False from cpython.mem cimport PyMem_Malloc, PyMem_Free, PyMem_Realloc DEF START_WITHIN_SEQ1 = 1 DEF START_WITHIN_SEQ2 = 2 DEF STOP_WITHIN_SEQ1 = 4 DEF STOP_WITHIN_SEQ2 = 8 DEF SEMIGLOBAL = 15 # structure for a DP matrix entry ctypedef struct _Entry: int cost int matches # no. of matches in this alignment int origin # where the alignment originated: negative for positions within seq1, positive for pos. within seq2 ctypedef struct _Match: int origin int cost int matches int ref_stop int query_stop def _acgt_table(): """ Return a translation table that maps A, C, G, T characters to the lower four bits of a byte. Other characters (including possibly IUPAC characters) are mapped to zero. Lowercase versions are also translated, and U is treated the same as T. """ d = dict(A=1, C=2, G=4, T=8, U=8) t = bytearray(b'\0') * 256 for c, v in d.items(): t[ord(c)] = v t[ord(c.lower())] = v return bytes(t) def _iupac_table(): """ Return a translation table for IUPAC characters. The table maps ASCII-encoded IUPAC nucleotide characters to bytes in which the four least significant bits are used to represent one nucleotide each. Whether two characters x and y match can then be checked with the expression "x & y != 0". """ A = 1 C = 2 G = 4 T = 8 iupac = dict( X=0, A=A, C=C, G=G, T=T, U=T, R=A|G, Y=C|T, S=G|C, W=A|T, K=G|T, M=A|C, B=C|G|T, D=A|G|T, H=A|C|T, V=A|C|G, N=A|C|G|T ) t = bytearray(b'\0') * 256 for c, v in iupac.items(): t[ord(c)] = v t[ord(c.lower())] = v return bytes(t) cdef bytes ACGT_TABLE = _acgt_table() cdef bytes IUPAC_TABLE = _iupac_table() class DPMatrix: """ Representation of the dynamic-programming matrix. This used only when debugging is enabled in the Aligner class since the matrix is normally not stored in full. Entries in the matrix may be None, in which case that value was not computed. """ def __init__(self, reference, query): m = len(reference) n = len(query) self._rows = [ [None] * (n+1) for _ in range(m + 1) ] self.reference = reference self.query = query def set_entry(self, int i, int j, cost): """ Set an entry in the dynamic programming matrix. """ self._rows[i][j] = cost def __str__(self): """ Return a representation of the matrix as a string. """ rows = [' ' + ' '.join(c.rjust(2) for c in self.query)] for c, row in zip(' ' + self.reference, self._rows): r = c + ' ' + ' '.join(' ' if v is None else '{0:2d}'.format(v) for v in row) rows.append(r) return '\n'.join(rows) cdef class Aligner: """ TODO documentation still uses s1 (reference) and s2 (query). Locate one string within another by computing an optimal semiglobal alignment between string1 and string2. The alignment uses unit costs, which means that mismatches, insertions and deletions are counted as one error. flags is a bitwise 'or' of the allowed flags. To allow skipping of a prefix of string1 at no cost, set the START_WITHIN_SEQ1 flag. To allow skipping of a prefix of string2 at no cost, set the START_WITHIN_SEQ2 flag. If both are set, a prefix of string1 or of string1 is skipped, never both. Similarly, set STOP_WITHIN_SEQ1 and STOP_WITHIN_SEQ2 to allow skipping of suffixes of string1 or string2. Again, when both flags are set, never suffixes in both strings are skipped. If all flags are set, this results in standard semiglobal alignment. The skipped parts are described with two intervals (start1, stop1), (start2, stop2). For example, an optimal semiglobal alignment of SISSI and MISSISSIPPI looks like this: ---SISSI--- MISSISSIPPI start1, stop1 = 0, 5 start2, stop2 = 3, 8 (with zero errors) The aligned parts are string1[start1:stop1] and string2[start2:stop2]. The error rate is: errors / length where length is (stop1 - start1). An optimal alignment fulfills all of these criteria: - its error_rate is at most max_error_rate - Among those alignments with error_rate <= max_error_rate, the alignment contains a maximal number of matches (there is no alignment with more matches). - If there are multiple alignments with the same no. of matches, then one that has minimal no. of errors is chosen. - If there are still multiple candidates, choose the alignment that starts at the leftmost position within the read. The alignment itself is not returned, only the tuple (start1, stop1, start2, stop2, matches, errors), where the first four fields have the meaning as described, matches is the number of matches and errors is the number of errors in the alignment. It is always the case that at least one of start1 and start2 is zero. IUPAC wildcard characters can be allowed in the reference and the query by setting the appropriate flags. If neither flag is set, the full ASCII alphabet is used for comparison. If any of the flags is set, all non-IUPAC characters in the sequences compare as 'not equal'. """ cdef int m cdef _Entry* column # one column of the DP matrix cdef double max_error_rate cdef int flags cdef int _insertion_cost cdef int _deletion_cost cdef int _min_overlap cdef bint wildcard_ref cdef bint wildcard_query cdef bint debug cdef object _dpmatrix cdef bytes _reference # TODO rename to translated_reference or so cdef str str_reference START_WITHIN_REFERENCE = 1 START_WITHIN_QUERY = 2 STOP_WITHIN_REFERENCE = 4 STOP_WITHIN_QUERY = 8 def __cinit__(self, str reference, double max_error_rate, int flags=SEMIGLOBAL, bint wildcard_ref=False, bint wildcard_query=False): self.max_error_rate = max_error_rate self.flags = flags self.wildcard_ref = wildcard_ref self.wildcard_query = wildcard_query self.str_reference = reference self.reference = reference self._min_overlap = 1 self.debug = False self._dpmatrix = None self._insertion_cost = 1 self._deletion_cost = 1 property min_overlap: def __get__(self): return self._min_overlap def __set__(self, int value): if value < 1: raise ValueError('Minimum overlap must be at least 1') self._min_overlap = value property indel_cost: """ Matches cost 0, mismatches cost 1. Only insertion/deletion costs can be changed. """ def __set__(self, value): if value < 1: raise ValueError('Insertion/deletion cost must be at leat 1') self._insertion_cost = value self._deletion_cost = value property reference: def __get__(self): return self._reference def __set__(self, str reference): mem = <_Entry*> PyMem_Realloc(self.column, (len(reference) + 1) * sizeof(_Entry)) if not mem: raise MemoryError() self.column = mem self._reference = reference.encode('ascii') self.m = len(reference) if self.wildcard_ref: self._reference = self._reference.translate(IUPAC_TABLE) elif self.wildcard_query: self._reference = self._reference.translate(ACGT_TABLE) self.str_reference = reference property dpmatrix: """ The dynamic programming matrix as a DPMatrix object. This attribute is usually None, unless debugging has been enabled with enable_debug(). """ def __get__(self): return self._dpmatrix def enable_debug(self): """ Store the dynamic programming matrix while running the locate() method and make it available in the .dpmatrix attribute. """ self.debug = True def locate(self, str query): """ locate(query) -> (refstart, refstop, querystart, querystop, matches, errors) Find the query within the reference associated with this aligner. The intervals (querystart, querystop) and (refstart, refstop) give the location of the match. That is, the substrings query[querystart:querystop] and self.reference[refstart:refstop] were found to align best to each other, with the given number of matches and the given number of errors. The alignment itself is not returned. """ cdef char* s1 = self._reference cdef bytes query_bytes = query.encode('ascii') cdef char* s2 = query_bytes cdef int m = self.m cdef int n = len(query) cdef _Entry* column = self.column cdef double max_error_rate = self.max_error_rate cdef bint start_in_ref = self.flags & START_WITHIN_SEQ1 cdef bint start_in_query = self.flags & START_WITHIN_SEQ2 cdef bint stop_in_ref = self.flags & STOP_WITHIN_SEQ1 cdef bint stop_in_query = self.flags & STOP_WITHIN_SEQ2 if self.wildcard_query: query_bytes = query_bytes.translate(IUPAC_TABLE) s2 = query_bytes elif self.wildcard_ref: query_bytes = query_bytes.translate(ACGT_TABLE) s2 = query_bytes cdef bint compare_ascii = not (self.wildcard_query or self.wildcard_ref) """ DP Matrix: query (j) ----------> n | ref (i) | | V m """ cdef int i, j # maximum no. of errors cdef int k = (max_error_rate * m) # Determine largest and smallest column we need to compute cdef int max_n = n cdef int min_n = 0 if not start_in_query: # costs can only get worse after column m max_n = min(n, m + k) if not stop_in_query: min_n = max(0, n - m - k) # Fill column min_n. # # Four cases: # not startin1, not startin2: c(i,j) = max(i,j); origin(i, j) = 0 # startin1, not startin2: c(i,j) = j ; origin(i, j) = min(0, j - i) # not startin1, startin2: c(i,j) = i ; origin(i, j) = # startin1, startin2: c(i,j) = min(i,j) # TODO (later) # fill out columns only until 'last' if not start_in_ref and not start_in_query: for i in range(m + 1): column[i].matches = 0 column[i].cost = max(i, min_n) * self._insertion_cost column[i].origin = 0 elif start_in_ref and not start_in_query: for i in range(m + 1): column[i].matches = 0 column[i].cost = min_n * self._insertion_cost column[i].origin = min(0, min_n - i) elif not start_in_ref and start_in_query: for i in range(m + 1): column[i].matches = 0 column[i].cost = i * self._insertion_cost column[i].origin = max(0, min_n - i) else: for i in range(m + 1): column[i].matches = 0 column[i].cost = min(i, min_n) * self._insertion_cost column[i].origin = min_n - i if self.debug: self._dpmatrix = DPMatrix(self.str_reference, query) for i in range(m + 1): self._dpmatrix.set_entry(i, min_n, column[i].cost) cdef _Match best best.ref_stop = m best.query_stop = n best.cost = m + n best.origin = 0 best.matches = 0 # Ukkonen's trick: index of the last cell that is less than k. cdef int last = min(m, k + 1) if start_in_ref: last = m cdef int cost_diag cdef int cost_deletion cdef int cost_insertion cdef int origin, cost, matches cdef int length cdef bint characters_equal cdef _Entry tmp_entry with nogil: # iterate over columns for j in range(min_n + 1, max_n + 1): # remember first entry tmp_entry = column[0] # fill in first entry in this column if start_in_query: column[0].origin = j else: column[0].cost = j * self._insertion_cost for i in range(1, last + 1): if compare_ascii: characters_equal = (s1[i-1] == s2[j-1]) else: characters_equal = (s1[i-1] & s2[j-1]) != 0 if characters_equal: # Characters match: This cannot be an indel. cost = tmp_entry.cost origin = tmp_entry.origin matches = tmp_entry.matches + 1 else: # Characters do not match. cost_diag = tmp_entry.cost + 1 cost_deletion = column[i].cost + self._deletion_cost cost_insertion = column[i-1].cost + self._insertion_cost if cost_diag <= cost_deletion and cost_diag <= cost_insertion: # MISMATCH cost = cost_diag origin = tmp_entry.origin matches = tmp_entry.matches elif cost_insertion <= cost_deletion: # INSERTION cost = cost_insertion origin = column[i-1].origin matches = column[i-1].matches else: # DELETION cost = cost_deletion origin = column[i].origin matches = column[i].matches # remember current cell for next iteration tmp_entry = column[i] column[i].cost = cost column[i].origin = origin column[i].matches = matches if self.debug: with gil: for i in range(last + 1): self._dpmatrix.set_entry(i, j, column[i].cost) while last >= 0 and column[last].cost > k: last -= 1 # last can be -1 here, but will be incremented next. # TODO if last is -1, can we stop searching? if last < m: last += 1 elif stop_in_query: # Found a match. If requested, find best match in last row. # length of the aligned part of the reference length = m + min(column[m].origin, 0) cost = column[m].cost matches = column[m].matches if length >= self._min_overlap and cost <= length * max_error_rate and (matches > best.matches or (matches == best.matches and cost < best.cost)): # update best.matches = matches best.cost = cost best.origin = column[m].origin best.ref_stop = m best.query_stop = j if cost == 0 and matches == m: # exact match, stop early break # column finished if max_n == n: first_i = 0 if stop_in_ref else m # search in last column # TODO last? for i in range(first_i, m+1): length = i + min(column[i].origin, 0) cost = column[i].cost matches = column[i].matches if length >= self._min_overlap and cost <= length * max_error_rate and (matches > best.matches or (matches == best.matches and cost < best.cost)): # update best best.matches = matches best.cost = cost best.origin = column[i].origin best.ref_stop = i best.query_stop = n if best.cost == m + n: # best.cost was initialized with this value. # If it is unchanged, no alignment was found that has # an error rate within the allowed range. return None cdef int start1, start2 if best.origin >= 0: start1 = 0 start2 = best.origin else: start1 = -best.origin start2 = 0 assert best.ref_stop - start1 > 0 # Do not return empty alignments. return (start1, best.ref_stop, start2, best.query_stop, best.matches, best.cost) def __dealloc__(self): PyMem_Free(self.column) def locate(str reference, str query, double max_error_rate, int flags=SEMIGLOBAL, bint wildcard_ref=False, bint wildcard_query=False, int min_overlap=1): aligner = Aligner(reference, max_error_rate, flags, wildcard_ref, wildcard_query) aligner.min_overlap = min_overlap return aligner.locate(query) def compare_prefixes(str ref, str query, bint wildcard_ref=False, bint wildcard_query=False): """ Find out whether one string is the prefix of the other one, allowing IUPAC wildcards in ref and/or query if the appropriate flag is set. This is used to find an anchored 5' adapter (type 'FRONT') in the 'no indels' mode. This is very simple as only the number of errors needs to be counted. This function returns a tuple compatible with what Aligner.locate outputs. """ cdef int m = len(ref) cdef int n = len(query) cdef bytes query_bytes = query.encode('ascii') cdef bytes ref_bytes = ref.encode('ascii') cdef char* r_ptr cdef char* q_ptr cdef int length = min(m, n) cdef int i, matches = 0 cdef bint compare_ascii = False if wildcard_ref: ref_bytes = ref_bytes.translate(IUPAC_TABLE) elif wildcard_query: ref_bytes = ref_bytes.translate(ACGT_TABLE) else: compare_ascii = True if wildcard_query: query_bytes = query_bytes.translate(IUPAC_TABLE) elif wildcard_ref: query_bytes = query_bytes.translate(ACGT_TABLE) if compare_ascii: for i in range(length): if ref[i] == query[i]: matches += 1 else: r_ptr = ref_bytes q_ptr = query_bytes for i in range(length): if (r_ptr[i] & q_ptr[i]) != 0: matches += 1 # length - matches = no. of errors return (0, length, 0, length, matches, length - matches) cutadapt-1.15/src/cutadapt/qualtrim.py0000664000175000017500000000204213205526454020607 0ustar marcelmarcel00000000000000# coding: utf-8 """ Quality trimming. """ from __future__ import print_function, division, absolute_import import sys if sys.version > '3': xrange = range def nextseq_trim_index(sequence, cutoff, base=33): """ Variant of the above quality trimming routine that works on NextSeq data. With Illumina NextSeq, bases are encoded with two colors. 'No color' (a dark cycle) usually means that a 'G' was sequenced, but that also occurs when sequencing falls off the end of the fragment. The read then contains a run of high-quality G bases in the end. This routine works as the one above, but counts qualities belonging to 'G' bases as being equal to cutoff - 1. """ bases = sequence.sequence qualities = sequence.qualities s = 0 max_qual = 0 max_i = len(qualities) for i in reversed(xrange(max_i)): q = ord(qualities[i]) - base if bases[i] == 'G': q = cutoff - 1 s += cutoff - q if s < 0: break if s > max_qual: max_qual = s max_i = i return max_i from cutadapt._qualtrim import quality_trim_index, nextseq_trim_index cutadapt-1.15/src/cutadapt/report.py0000664000175000017500000003136713205526454020300 0ustar marcelmarcel00000000000000# coding: utf-8 """ Routines for printing a report. """ from __future__ import print_function, division, absolute_import import sys from contextlib import contextmanager import textwrap from .adapters import BACK, FRONT, PREFIX, SUFFIX, ANYWHERE, LINKED from .modifiers import QualityTrimmer, AdapterCutter from .filters import (NoFilter, PairedNoFilter, TooShortReadFilter, TooLongReadFilter, DiscardTrimmedFilter, DiscardUntrimmedFilter, PairedEndDemultiplexer, Demultiplexer, NContentFilter, InfoFileWriter, WildcardFileWriter, RestFileWriter) def safe_divide(numerator, denominator): if numerator is None or not denominator: return 0.0 else: return numerator / denominator class Statistics: def __init__(self): """ """ self.paired = None self.too_short = None self.too_long = None self.too_many_n = None self.did_quality_trimming = None self.n = 0 self.written = 0 self.total_bp = [0, 0] self.written_bp = [0, 0] self.with_adapters = [0, 0] self.quality_trimmed_bp = [0, 0] self.adapter_stats = [[], []] def __iadd__(self, other): self.n += other.n self.written += other.written if self.paired is None: self.paired = other.paired elif self.paired != other.paired: raise ValueError('Incompatible Statistics: paired is not equal') if self.did_quality_trimming is None: self.did_quality_trimming = other.did_quality_trimming elif self.did_quality_trimming != other.did_quality_trimming: raise ValueError('Incompatible Statistics: did_quality_trimming is not equal') def add_if_not_none(a, b): if a is None: return b if b is None: return a return a + b self.too_short = add_if_not_none(self.too_short, other.too_short) self.too_long = add_if_not_none(self.too_long, other.too_long) self.too_many_n = add_if_not_none(self.too_many_n, other.too_many_n) for i in (0, 1): self.total_bp[i] += other.total_bp[i] self.written_bp[i] += other.written_bp[i] self.with_adapters[i] += other.with_adapters[i] self.quality_trimmed_bp[i] += other.quality_trimmed_bp[i] if self.adapter_stats[i] and other.adapter_stats[i]: if len(self.adapter_stats[i]) != len(other.adapter_stats[i]): raise ValueError('Incompatible Statistics objects (adapter_stats length)') for j in range(len(self.adapter_stats[i])): self.adapter_stats[i][j] += other.adapter_stats[i][j] elif other.adapter_stats[i]: assert self.adapter_stats[i] == [] self.adapter_stats[i] = other.adapter_stats[i] return self def collect(self, n, total_bp1, total_bp2, modifiers, modifiers2, writers): """ n -- total number of reads total_bp1 -- number of bases in first reads total_bp2 -- number of bases in second reads. None for single-end data. """ self.n = n self.total_bp[0] = total_bp1 if total_bp2 is None: self.paired = False else: self.paired = True self.total_bp[1] = total_bp2 # Collect statistics from writers/filters for w in writers: if isinstance(w, (InfoFileWriter, RestFileWriter, WildcardFileWriter)): pass elif isinstance(w, (NoFilter, PairedNoFilter, PairedEndDemultiplexer, Demultiplexer)) or \ isinstance(w.filter, (DiscardTrimmedFilter, DiscardUntrimmedFilter)): self.written += w.written self.written_bp[0] += w.written_bp[0] self.written_bp[1] += w.written_bp[1] elif isinstance(w.filter, TooShortReadFilter): self.too_short = w.filtered elif isinstance(w.filter, TooLongReadFilter): self.too_long = w.filtered elif isinstance(w.filter, NContentFilter): self.too_many_n = w.filtered assert self.written is not None # Collect statistics from modifiers for i, modifiers_list in [(0, modifiers), (1, modifiers2)]: for modifier in modifiers_list: if isinstance(modifier, QualityTrimmer): self.quality_trimmed_bp[i] = modifier.trimmed_bases self.did_quality_trimming = True elif isinstance(modifier, AdapterCutter): self.with_adapters[i] += modifier.with_adapters self.adapter_stats[i] = list(modifier.adapter_statistics.values()) @property def total(self): return sum(self.total_bp) @property def quality_trimmed(self): return sum(self.quality_trimmed_bp) @property def total_written_bp(self): return sum(self.written_bp) @property def written_fraction(self): return safe_divide(self.written, self.n) @property def with_adapters_fraction(self): return [safe_divide(v, self.n) for v in self.with_adapters] @property def quality_trimmed_fraction(self): return safe_divide(self.quality_trimmed, self.total) @property def total_written_bp_fraction(self): return safe_divide(self.total_written_bp, self.total) @property def too_short_fraction(self): return safe_divide(self.too_short, self.n) @property def too_long_fraction(self): return safe_divide(self.too_long, self.n) @property def too_many_n_fraction(self): return safe_divide(self.too_many_n, self.n) ADAPTER_TYPES = { BACK: "regular 3'", FRONT: "regular 5'", PREFIX: "anchored 5'", SUFFIX: "anchored 3'", ANYWHERE: "variable 5'/3'", LINKED: "linked", } def print_error_ranges(adapter_length, error_rate): print("No. of allowed errors:") prev = 0 for errors in range(1, int(error_rate * adapter_length) + 1): r = int(errors / error_rate) print("{0}-{1} bp: {2};".format(prev, r - 1, errors - 1), end=' ') prev = r if prev == adapter_length: print("{0} bp: {1}".format(adapter_length, int(error_rate * adapter_length))) else: print("{0}-{1} bp: {2}".format(prev, adapter_length, int(error_rate * adapter_length))) print() def print_histogram(end_statistics, n, gc_content): """ Print a histogram. Also, print the no. of reads expected to be trimmed by chance (assuming a uniform distribution of nucleotides in the reads). adapter_statistics -- EndStatistics object adapter_length -- adapter length n -- total no. of reads. """ d = end_statistics.lengths errors = end_statistics.errors match_probabilities = end_statistics.random_match_probabilities(gc_content=gc_content) print("length", "count", "expect", "max.err", "error counts", sep="\t") for length in sorted(d): # when length surpasses adapter_length, the # probability does not increase anymore expect = n * match_probabilities[min(len(end_statistics.sequence), length)] count = d[length] max_errors = max(errors[length].keys()) errs = ' '.join(str(errors[length][e]) for e in range(max_errors+1)) print( length, count, "{0:.1F}".format(expect), int(end_statistics.max_error_rate*min(length, len(end_statistics.sequence))), errs, sep="\t") print() def print_adjacent_bases(bases): """ Print a summary of the bases preceding removed adapter sequences. Print a warning if one of the bases is overrepresented and there are at least 20 preceding bases available. Return whether a warning was printed. """ total = sum(bases.values()) if total == 0: return False print('Bases preceding removed adapters:') warnbase = None for base in ['A', 'C', 'G', 'T', '']: b = base if base != '' else 'none/other' fraction = 1.0 * bases[base] / total print(' {0}: {1:.1%}'.format(b, fraction)) if fraction > 0.8 and base != '': warnbase = b if total >= 20 and warnbase is not None: print('WARNING:') print(' The adapter is preceded by "{0}" extremely often.'.format(warnbase)) print(' The provided adapter sequence may be incomplete.') print(' To fix the problem, add "{0}" to the beginning of the adapter sequence.'.format(warnbase)) print() return True print() return False @contextmanager def redirect_standard_output(file): if file is None: yield return old_stdout = sys.stdout sys.stdout = file yield sys.stdout = old_stdout def print_report(stats, time, gc_content): """Print report to standard output.""" if stats.n == 0: print("No reads processed! Either your input file is empty or you used the wrong -f/--format parameter.") return print("Finished in {0:.2F} s ({1:.0F} us/read; {2:.2F} M reads/minute).".format( time, 1E6 * time / stats.n, stats.n / time * 60 / 1E6)) report = "\n=== Summary ===\n\n" if stats.paired: report += textwrap.dedent("""\ Total read pairs processed: {o.n:13,d} Read 1 with adapter: {o.with_adapters[0]:13,d} ({o.with_adapters_fraction[0]:.1%}) Read 2 with adapter: {o.with_adapters[1]:13,d} ({o.with_adapters_fraction[1]:.1%}) """) else: report += textwrap.dedent("""\ Total reads processed: {o.n:13,d} Reads with adapters: {o.with_adapters[0]:13,d} ({o.with_adapters_fraction[0]:.1%}) """) if stats.too_short is not None: report += "{pairs_or_reads} that were too short: {o.too_short:13,d} ({o.too_short_fraction:.1%})\n" if stats.too_long is not None: report += "{pairs_or_reads} that were too long: {o.too_long:13,d} ({o.too_long_fraction:.1%})\n" if stats.too_many_n is not None: report += "{pairs_or_reads} with too many N: {o.too_many_n:13,d} ({o.too_many_n_fraction:.1%})\n" report += textwrap.dedent("""\ {pairs_or_reads} written (passing filters): {o.written:13,d} ({o.written_fraction:.1%}) Total basepairs processed: {o.total:13,d} bp """) if stats.paired: report += " Read 1: {o.total_bp[0]:13,d} bp\n" report += " Read 2: {o.total_bp[1]:13,d} bp\n" if stats.did_quality_trimming: report += "Quality-trimmed: {o.quality_trimmed:13,d} bp ({o.quality_trimmed_fraction:.1%})\n" if stats.paired: report += " Read 1: {o.quality_trimmed_bp[0]:13,d} bp\n" report += " Read 2: {o.quality_trimmed_bp[1]:13,d} bp\n" report += "Total written (filtered): {o.total_written_bp:13,d} bp ({o.total_written_bp_fraction:.1%})\n" if stats.paired: report += " Read 1: {o.written_bp[0]:13,d} bp\n" report += " Read 2: {o.written_bp[1]:13,d} bp\n" pairs_or_reads = "Pairs" if stats.paired else "Reads" report = report.format(o=stats, pairs_or_reads=pairs_or_reads) print(report) warning = False for which_in_pair in (0, 1): for adapter_statistics in stats.adapter_stats[which_in_pair]: total_front = sum(adapter_statistics.front.lengths.values()) total_back = sum(adapter_statistics.back.lengths.values()) total = total_front + total_back where = adapter_statistics.where assert where in (ANYWHERE, LINKED) or (where in (BACK, SUFFIX) and total_front == 0) or (where in (FRONT, PREFIX) and total_back == 0) if stats.paired: extra = 'First read: ' if which_in_pair == 0 else 'Second read: ' else: extra = '' print("=" * 3, extra + "Adapter", adapter_statistics.name, "=" * 3) print() if where == LINKED: print("Sequence: {0}...{1}; Type: linked; Length: {2}+{3}; " "5' trimmed: {4} times; 3' trimmed: {5} times".format( adapter_statistics.front.sequence, adapter_statistics.back.sequence, len(adapter_statistics.front.sequence), len(adapter_statistics.back.sequence), total_front, total_back)) else: print("Sequence: {0}; Type: {1}; Length: {2}; Trimmed: {3} times.". format(adapter_statistics.front.sequence, ADAPTER_TYPES[adapter_statistics.where], len(adapter_statistics.front.sequence), total)) if total == 0: print() continue if where == ANYWHERE: print(total_front, "times, it overlapped the 5' end of a read") print(total_back, "times, it overlapped the 3' end or was within the read") print() print_error_ranges(len(adapter_statistics.front.sequence), adapter_statistics.front.max_error_rate) print("Overview of removed sequences (5')") print_histogram(adapter_statistics.front, stats.n, gc_content) print() print("Overview of removed sequences (3' or within)") print_histogram(adapter_statistics.back, stats.n, gc_content) elif where == LINKED: print() print_error_ranges(len(adapter_statistics.front.sequence), adapter_statistics.front.max_error_rate) print_error_ranges(len(adapter_statistics.back.sequence), adapter_statistics.back.max_error_rate) print("Overview of removed sequences at 5' end") print_histogram(adapter_statistics.front, stats.n, gc_content) print() print("Overview of removed sequences at 3' end") print_histogram(adapter_statistics.back, stats.n, gc_content) elif where in (FRONT, PREFIX): print() print_error_ranges(len(adapter_statistics.front.sequence), adapter_statistics.front.max_error_rate) print("Overview of removed sequences") print_histogram(adapter_statistics.front, stats.n, gc_content) else: assert where in (BACK, SUFFIX) print() print_error_ranges(len(adapter_statistics.back.sequence), adapter_statistics.back.max_error_rate) warning = warning or print_adjacent_bases(adapter_statistics.back.adjacent_bases) print("Overview of removed sequences") print_histogram(adapter_statistics.back, stats.n, gc_content) if warning: print('WARNING:') print(' One or more of your adapter sequences may be incomplete.') print(' Please see the detailed output above.') cutadapt-1.15/src/cutadapt/adapters.py0000664000175000017500000006033613205526454020566 0ustar marcelmarcel00000000000000# coding: utf-8 """ Adapter finding and trimming classes The ...Adapter classes are responsible for finding adapters. The ...Match classes trim the reads. """ from __future__ import print_function, division, absolute_import import re from collections import defaultdict from cutadapt import align, colorspace from cutadapt.seqio import FastaReader # Constants for the find_best_alignment function. # The function is called with SEQ1 as the adapter, SEQ2 as the read. # TODO get rid of those constants, use strings instead BACK = align.START_WITHIN_SEQ2 | align.STOP_WITHIN_SEQ2 | align.STOP_WITHIN_SEQ1 FRONT = align.START_WITHIN_SEQ2 | align.STOP_WITHIN_SEQ2 | align.START_WITHIN_SEQ1 PREFIX = align.STOP_WITHIN_SEQ2 SUFFIX = align.START_WITHIN_SEQ2 ANYWHERE = align.SEMIGLOBAL LINKED = 'linked' def parse_braces(sequence): """ Replace all occurrences of ``x{n}`` (where x is any character) with n occurrences of x. Raise ValueError if the expression cannot be parsed. >>> parse_braces('TGA{5}CT') TGAAAAACT """ # Simple DFA with four states, encoded in prev result = '' prev = None for s in re.split('([{}])', sequence): if s == '': continue if prev is None: if s == '{': raise ValueError('"{" must be used after a character') if s == '}': raise ValueError('"}" cannot be used here') prev = s result += s elif prev == '{': prev = int(s) if not 0 <= prev <= 10000: raise ValueError('Value {} invalid'.format(prev)) elif isinstance(prev, int): if s != '}': raise ValueError('"}" expected') result = result[:-1] + result[-1] * prev prev = None else: if s != '{': raise ValueError('Expected "{"') prev = '{' # Check if we are in a non-terminating state if isinstance(prev, int) or prev == '{': raise ValueError("Unterminated expression") return result class AdapterParser(object): """ Factory for Adapter classes that all use the same parameters (error rate, indels etc.). The given **kwargs will be passed to the Adapter constructors. """ def __init__(self, colorspace=False, **kwargs): self.colorspace = colorspace self.constructor_args = kwargs self.adapter_class = ColorspaceAdapter if colorspace else Adapter def _parse_no_file(self, spec, name=None, cmdline_type='back'): """ Parse an adapter specification not using ``file:`` notation and return an object of an appropriate Adapter class. The notation for anchored 5' and 3' adapters is supported. If the name parameter is None, then an attempt is made to extract the name from the specification (If spec is 'name=ADAPTER', name will be 'name'.) cmdline_type -- describes which commandline parameter was used (``-a`` is 'back', ``-b`` is 'anywhere', and ``-g`` is 'front'). """ if name is None: name, spec = self._extract_name(spec) orig_spec = spec types = dict(back=BACK, front=FRONT, anywhere=ANYWHERE) if cmdline_type not in types: raise ValueError('cmdline_type cannot be {0!r}'.format(cmdline_type)) where = types[cmdline_type] front_anchored, back_anchored = False, False if spec.startswith('^'): spec = spec[1:] front_anchored = True if spec.endswith('$'): spec = spec[:-1] back_anchored = True sequence1, middle, sequence2 = spec.partition('...') if where == ANYWHERE: if front_anchored or back_anchored: raise ValueError("'anywhere' (-b) adapters may not be anchored") if middle == '...': raise ValueError("'anywhere' (-b) adapters may not be linked") return self.adapter_class(sequence=spec, where=where, name=name, **self.constructor_args) assert where == FRONT or where == BACK if middle == '...': if not sequence1: if where == BACK: # -a ...ADAPTER spec = sequence2 else: # -g ...ADAPTER raise ValueError('Invalid adapter specification') elif not sequence2: if where == BACK: # -a ADAPTER... spec = sequence1 where = FRONT front_anchored = True else: # -g ADAPTER... spec = sequence1 else: # linked adapter if self.colorspace: raise NotImplementedError( 'Using linked adapters in colorspace is not supported') # automatically anchor 5' adapter if -a is used if where == BACK: front_anchored = True require_both = True if not front_anchored and not back_anchored else None return LinkedAdapter(sequence1, sequence2, name=name, front_anchored=front_anchored, back_anchored=back_anchored, require_both=require_both, **self.constructor_args) if front_anchored and back_anchored: raise ValueError('Trying to use both "^" and "$" in adapter specification {!r}'.format(orig_spec)) if front_anchored: if where == BACK: raise ValueError("Cannot anchor the 3' adapter at its 5' end") where = PREFIX elif back_anchored: if where == FRONT: raise ValueError("Cannot anchor 5' adapter at 3' end") where = SUFFIX return self.adapter_class(sequence=spec, where=where, name=name, **self.constructor_args) def parse(self, spec, cmdline_type='back'): """ Parse an adapter specification and yield appropriate Adapter classes. This works like the _parse_no_file() function above, but also supports the ``file:`` notation for reading adapters from an external FASTA file. Since a file can contain multiple adapters, this function is a generator. """ if spec.startswith('file:'): # read adapter sequences from a file with FastaReader(spec[5:]) as fasta: for record in fasta: name = record.name.split(None, 1)[0] yield self._parse_no_file(record.sequence, name, cmdline_type) else: name, spec = self._extract_name(spec) yield self._parse_no_file(spec, name, cmdline_type) def _extract_name(self, spec): """ Parse an adapter specification given as 'name=adapt' into 'name' and 'adapt'. """ fields = spec.split('=', 1) if len(fields) > 1: name, spec = fields name = name.strip() else: name = None spec = spec.strip() return name, spec def parse_multi(self, back, anywhere, front): """ Parse all three types of commandline options that can be used to specify adapters. back, anywhere and front are lists of strings, corresponding to the respective commandline types (-a, -b, -g). Return a list of appropriate Adapter classes. """ adapters = [] for specs, cmdline_type in (back, 'back'), (anywhere, 'anywhere'), (front, 'front'): for spec in specs: adapters.extend(self.parse(spec, cmdline_type)) return adapters def returns_defaultdict_int(): # We need this function to make EndStatistics picklable. # Even a @staticmethod of EndStatistics is not sufficient # as that is not picklable before Python 3.5. return defaultdict(int) class EndStatistics(object): """Statistics about the 5' or 3' end""" def __init__(self, adapter): self.where = adapter.where self.max_error_rate = adapter.max_error_rate self.sequence = adapter.sequence self.has_wildcards = adapter.adapter_wildcards # self.errors[l][e] == n iff n times a sequence of length l matching at e errors was removed self.errors = defaultdict(returns_defaultdict_int) self._remove_before = adapter.remove_before self.adjacent_bases = {'A': 0, 'C': 0, 'G': 0, 'T': 0, '': 0} def __iadd__(self, other): if self.where != other.where or self.max_error_rate != other.max_error_rate or self.sequence != other.sequence: raise RuntimeError('Incompatible EndStatistics, cannot be added') for base in ('A', 'C', 'G', 'T', ''): self.adjacent_bases[base] += other.adjacent_bases[base] for length, error_dict in other.errors.items(): for errors in error_dict: self.errors[length][errors] += other.errors[length][errors] return self @property def lengths(self): # Python 2.6 has no dict comprehension d = dict((length, sum(errors.values())) for length, errors in self.errors.items()) return d def random_match_probabilities(self, gc_content): """ Estimate probabilities that this adapter end matches a random sequence. Indels are not taken into account. Returns a list p, where p[i] is the probability that i bases of this adapter match a random sequence with GC content gc_content. The where parameter is necessary for linked adapters to specify which (front or back) of the two adapters is meant. """ seq = self.sequence if self._remove_before: seq = seq[::-1] allowed_bases = 'CGRYSKMBDHVN' if self.has_wildcards else 'GC' p = 1 probabilities = [p] for i, c in enumerate(seq): if c in allowed_bases: p *= gc_content / 2. else: p *= (1 - gc_content) / 2 probabilities.append(p) return probabilities class AdapterStatistics(object): """ Statistics about an adapter. An adapter can work on the 5' end (front) or 3' end (back) of a read, and statistics for that are captured separately. """ def __init__(self, adapter, adapter2=None, where=None): self.name = adapter.name self.where = where if where is not None else adapter.where self.front = EndStatistics(adapter) if adapter2 is None: self.back = EndStatistics(adapter) else: self.back = EndStatistics(adapter2) def __iadd__(self, other): if self.where != other.where: # TODO self.name != other.name or raise ValueError('incompatible objects') self.front += other.front self.back += other.back return self class Match(object): """ Representation of a single adapter matched to a single read. TODO creating instances of this class is relatively slow and responsible for quite some runtime. """ __slots__ = ['astart', 'astop', 'rstart', 'rstop', 'matches', 'errors', 'remove_before', 'adapter', 'read', 'length', '_trimmed_read', 'adjacent_base'] def __init__(self, astart, astop, rstart, rstop, matches, errors, remove_before, adapter, read): """ remove_before -- True: remove bases before adapter. False: remove after """ self.astart = astart self.astop = astop self.rstart = rstart self.rstop = rstop self.matches = matches self.errors = errors self.adapter = adapter self.read = read if remove_before: self._trim_front() else: self._trim_back() self.remove_before = remove_before # Number of aligned characters in the adapter. If there are # indels, this may be different from the number of characters # in the read. self.length = self.astop - self.astart assert self.length > 0 assert self.errors / self.length <= self.adapter.max_error_rate assert self.length - self.errors > 0 def __repr__(self): return 'Match(astart={0}, astop={1}, rstart={2}, rstop={3}, matches={4}, errors={5})'.format( self.astart, self.astop, self.rstart, self.rstop, self.matches, self.errors) def wildcards(self, wildcard_char='N'): """ Return a string that contains, for each wildcard character, the character that it matches. For example, if the adapter ATNGNA matches ATCGTA, then the string 'CT' is returned. If there are indels, this is not reliable as the full alignment is not available. """ wildcards = [ self.read.sequence[self.rstart + i] for i in range(self.length) if self.adapter.sequence[self.astart + i] == wildcard_char and self.rstart + i < len(self.read.sequence) ] return ''.join(wildcards) def rest(self): """ Return the part of the read before this match if this is a 'front' (5') adapter, return the part after the match if this is not a 'front' adapter (3'). This can be an empty string. """ if self.remove_before: return self.read.sequence[:self.rstart] else: return self.read.sequence[self.rstop:] def get_info_record(self): seq = self.read.sequence qualities = self.read.qualities info = ( self.read.name, self.errors, self.rstart, self.rstop, seq[0:self.rstart], seq[self.rstart:self.rstop], seq[self.rstop:], self.adapter.name ) if qualities: info += ( qualities[0:self.rstart], qualities[self.rstart:self.rstop], qualities[self.rstop:] ) else: info += ('', '', '') return info def trimmed(self): return self._trimmed_read def _trim_front(self): """Compute the trimmed read, assuming it’s a 'front' adapter""" self._trimmed_read = self.read[self.rstop:] self.adjacent_base = '' def _trim_back(self): """Compute the trimmed read, assuming it’s a 'back' adapter""" adjacent_base = self.read.sequence[self.rstart-1:self.rstart] if adjacent_base not in 'ACGT': adjacent_base = '' self.adjacent_base = adjacent_base self._trimmed_read = self.read[:self.rstart] def update_statistics(self, statistics): """Update AdapterStatistics in place""" if self.remove_before: statistics.front.errors[self.rstop][self.errors] += 1 else: statistics.back.errors[len(self.read) - len(self._trimmed_read)][self.errors] += 1 statistics.back.adjacent_bases[self.adjacent_base] += 1 class ColorspaceMatch(Match): adjacent_base = '' def _trim_front(self): """Return a trimmed read""" read = self.read # to remove a front adapter, we need to re-encode the first color following the adapter match color_after_adapter = read.sequence[self.rstop:self.rstop + 1] if not color_after_adapter: # the read is empty new_read = read[self.rstop:] else: base_after_adapter = colorspace.DECODE[self.adapter.nucleotide_sequence[-1:] + color_after_adapter] new_first_color = colorspace.ENCODE[read.primer + base_after_adapter] new_read = read[:] new_read.sequence = new_first_color + read.sequence[(self.rstop + 1):] new_read.qualities = read.qualities[self.rstop:] if read.qualities else None self._trimmed_read = new_read def _trim_back(self): """Return a trimmed read""" # trim one more color if long enough adjusted_rstart = max(self.rstart - 1, 0) self._trimmed_read = self.read[:adjusted_rstart] def update_statistics(self, statistics): """Update AdapterStatistics in place""" if self.remove_before: statistics.front.errors[self.rstop][self.errors] += 1 else: statistics.back.errors[len(self.read) - len(self._trimmed_read)][self.errors] += 1 def _generate_adapter_name(_start=[1]): name = str(_start[0]) _start[0] += 1 return name class Adapter(object): """ This class can find a single adapter characterized by sequence, error rate, type etc. within reads. where -- One of the BACK, FRONT, PREFIX, SUFFIX or ANYWHERE constants. This influences where the adapter is allowed to appear within in the read and also which part of the read is removed. sequence -- The adapter sequence as string. Will be converted to uppercase. Also, Us will be converted to Ts. max_error_rate -- Maximum allowed error rate. The error rate is the number of errors in the alignment divided by the length of the part of the alignment that matches the adapter. minimum_overlap -- Minimum length of the part of the alignment that matches the adapter. read_wildcards -- Whether IUPAC wildcards in the read are allowed. adapter_wildcards -- Whether IUPAC wildcards in the adapter are allowed. name -- optional name of the adapter. If not provided, the name is set to a unique number. """ def __init__(self, sequence, where, max_error_rate=0.1, min_overlap=3, read_wildcards=False, adapter_wildcards=True, name=None, indels=True): self.debug = False self.name = _generate_adapter_name() if name is None else name self.sequence = parse_braces(sequence.upper().replace('U', 'T')) # TODO move away if not self.sequence: raise ValueError('Sequence is empty') self.where = where self.max_error_rate = max_error_rate self.min_overlap = min(min_overlap, len(self.sequence)) self.indels = indels iupac = frozenset('XACGTURYSWKMBDHVN') if adapter_wildcards and not set(self.sequence) <= iupac: for c in self.sequence: if c not in iupac: raise ValueError('Character {!r} in adapter sequence {!r} is ' 'not a valid IUPAC code. Use only characters ' 'XACGTURYSWKMBDHVN.'.format(c, self.sequence)) # Optimization: Use non-wildcard matching if only ACGT is used self.adapter_wildcards = adapter_wildcards and not set(self.sequence) <= set('ACGT') self.read_wildcards = read_wildcards self.remove_before = where not in (BACK, SUFFIX) self.aligner = align.Aligner(self.sequence, self.max_error_rate, flags=self.where, wildcard_ref=self.adapter_wildcards, wildcard_query=self.read_wildcards) self.aligner.min_overlap = self.min_overlap if not self.indels: # TODO # When indels are disallowed, an entirely different algorithm # should be used. self.aligner.indel_cost = 100000 def __repr__(self): return ''.format(**vars(self)) def enable_debug(self): """ Print out the dynamic programming matrix after matching a read to an adapter. """ self.debug = True self.aligner.enable_debug() def match_to(self, read, match_class=Match): """ Attempt to match this adapter to the given read. Return a Match instance if a match was found; return None if no match was found given the matching criteria (minimum overlap length, maximum error rate). """ read_seq = read.sequence.upper() # temporary copy remove_before = self.remove_before pos = -1 # try to find an exact match first unless wildcards are allowed if not self.adapter_wildcards: if self.where == PREFIX: pos = 0 if read_seq.startswith(self.sequence) else -1 elif self.where == SUFFIX: pos = (len(read_seq) - len(self.sequence)) if read_seq.endswith(self.sequence) else -1 else: pos = read_seq.find(self.sequence) if pos >= 0: if self.where == ANYWHERE: # guess: if alignment starts at pos 0, it’s a 5' adapter remove_before = pos == 0 match = match_class( 0, len(self.sequence), pos, pos + len(self.sequence), len(self.sequence), 0, remove_before, self, read) else: # try approximate matching if not self.indels and self.where in (PREFIX, SUFFIX): if self.where == PREFIX: alignment = align.compare_prefixes(self.sequence, read_seq, wildcard_ref=self.adapter_wildcards, wildcard_query=self.read_wildcards) else: alignment = align.compare_suffixes(self.sequence, read_seq, wildcard_ref=self.adapter_wildcards, wildcard_query=self.read_wildcards) astart, astop, rstart, rstop, matches, errors = alignment if astop - astart >= self.min_overlap and errors / (astop - astart) <= self.max_error_rate: match = match_class(*(alignment + (remove_before, self, read))) else: match = None else: alignment = self.aligner.locate(read_seq) if self.debug: print(self.aligner.dpmatrix) # pragma: no cover if alignment is None: match = None else: astart, astop, rstart, rstop, matches, errors = alignment if self.where == ANYWHERE: # guess: if alignment starts at pos 0, it’s a 5' adapter remove_before = rstart == 0 match = match_class(astart, astop, rstart, rstop, matches, errors, remove_before, self, read) if match is None: return None assert match.length > 0 and match.errors / match.length <= self.max_error_rate, match assert match.length >= self.min_overlap return match def __len__(self): return len(self.sequence) def create_statistics(self): return AdapterStatistics(self) class ColorspaceAdapter(Adapter): """ An Adapter, but in color space. It does not support all adapter types (see the 'where' parameter). """ def __init__(self, *args, **kwargs): """ sequence -- the adapter sequence as a str, can be given in nucleotide space or in color space where -- PREFIX, FRONT, BACK """ if kwargs.get('adapter_wildcards', False): raise ValueError('Wildcards not supported for colorspace adapters') kwargs['adapter_wildcards'] = False super(ColorspaceAdapter, self).__init__(*args, **kwargs) has_nucleotide_seq = False if set(self.sequence) <= set('ACGT'): # adapter was given in basespace self.nucleotide_sequence = self.sequence has_nucleotide_seq = True self.sequence = colorspace.encode(self.sequence)[1:] if self.where in (PREFIX, FRONT) and not has_nucleotide_seq: raise ValueError("A 5' colorspace adapter needs to be given in nucleotide space") self.aligner.reference = self.sequence def __repr__(self): return ''.format(self.sequence, self.where) def match_to(self, read, match_class=ColorspaceMatch): """ Match the adapter to the given read Return a ColorspaceMatch instance or None if the adapter was not found """ if self.where != PREFIX: return super(ColorspaceAdapter, self).match_to(read, match_class=match_class) # create artificial adapter that includes a first color that encodes the # transition from primer base into adapter asequence = colorspace.ENCODE[read.primer + self.nucleotide_sequence[0:1]] + self.sequence pos = 0 if read.sequence.startswith(asequence) else -1 if pos >= 0: match = ColorspaceMatch( 0, len(asequence), pos, pos + len(asequence), len(asequence), 0, self.remove_before, self, read) else: # try approximate matching self.aligner.reference = asequence alignment = self.aligner.locate(read.sequence) if self.debug: print(self.aligner.dpmatrix) # pragma: no cover if alignment is not None: match = ColorspaceMatch(*(alignment + (self.remove_before, self, read))) else: match = None if match is None: return None assert match.length > 0 and match.errors / match.length <= self.max_error_rate assert match.length >= self.min_overlap return match class LinkedMatch(object): """ Represent a match of a LinkedAdapter """ def __init__(self, front_match, back_match, adapter): """ One of front_match and back_match must be not None! """ self.front_match = front_match self.back_match = back_match self.adapter = adapter def __repr__(self): return ''.format( self.front_match, self.back_match, self.adapter) @property def matches(self): """Number of matching bases""" m = getattr(self.front_match, 'matches', 0) if self.back_match is not None: m += self.back_match.matches return m def trimmed(self): if self.back_match: # back match is relative to front match, so even if a front match exists, # this is correct return self.back_match.trimmed() else: assert self.front_match return self.front_match.trimmed() @property def adjacent_base(self): return self.back_match.adjacent_base def update_statistics(self, statistics): """Update AdapterStatistics in place""" if self.front_match: statistics.front.errors[self.front_match.rstop][self.front_match.errors] += 1 if self.back_match: statistics.back.errors[len(self.back_match.read) - self.back_match.rstart][self.back_match.errors] += 1 class LinkedAdapter(object): """ """ def __init__(self, front_sequence, back_sequence, front_anchored=True, back_anchored=False, require_both=None, name=None, **kwargs): """ require_both -- require both adapters to match. If not specified, the default is to require only anchored adapters to match. kwargs are passed on to individual Adapter constructors """ where1 = PREFIX if front_anchored else FRONT where2 = SUFFIX if back_anchored else BACK if require_both: self._require_back_match = True self._require_front_match = True else: self._require_front_match = front_anchored self._require_back_match = back_anchored # The following attributes are needed for the report self.where = LINKED self.name = _generate_adapter_name() if name is None else name self.front_adapter = Adapter(front_sequence, where=where1, name=None, **kwargs) self.back_adapter = Adapter(back_sequence, where=where2, name=None, **kwargs) def enable_debug(self): self.front_adapter.enable_debug() self.back_adapter.enable_debug() def match_to(self, read): """ Match the linked adapters against the given read. Any anchored adapters are required to exist for a successful match. If both adapters are unanchored, both need to match. """ front_match = self.front_adapter.match_to(read) if self._require_front_match and front_match is None: return None if front_match is not None: # TODO statistics read = front_match.trimmed() back_match = self.back_adapter.match_to(read) if back_match is None and (self._require_back_match or front_match is None): return None return LinkedMatch(front_match, back_match, self) def create_statistics(self): return AdapterStatistics(self.front_adapter, self.back_adapter, where=LINKED) cutadapt-1.15/src/cutadapt/__main__.py0000775000175000017500000010006213205526454020475 0ustar marcelmarcel00000000000000#!/usr/bin/env python # -*- coding: utf-8 -*- # kate: word-wrap off; remove-trailing-spaces all; # # Copyright (c) 2010-2017 Marcel Martin # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. """ cutadapt version %version Copyright (C) 2010-2017 Marcel Martin cutadapt removes adapter sequences from high-throughput sequencing reads. Usage: cutadapt -a ADAPTER [options] [-o output.fastq] input.fastq For paired-end reads: cutadapt -a ADAPT1 -A ADAPT2 [options] -o out1.fastq -p out2.fastq in1.fastq in2.fastq Replace "ADAPTER" with the actual sequence of your 3' adapter. IUPAC wildcard characters are supported. The reverse complement is *not* automatically searched. All reads from input.fastq will be written to output.fastq with the adapter sequence removed. Adapter matching is error-tolerant. Multiple adapter sequences can be given (use further -a options), but only the best-matching adapter will be removed. Input may also be in FASTA format. Compressed input and output is supported and auto-detected from the file name (.gz, .xz, .bz2). Use the file name '-' for standard input/output. Without the -o option, output is sent to standard output. Citation: Marcel Martin. Cutadapt removes adapter sequences from high-throughput sequencing reads. EMBnet.Journal, 17(1):10-12, May 2011. http://dx.doi.org/10.14806/ej.17.1.200 Use "cutadapt --help" to see all command-line options. See http://cutadapt.readthedocs.io/ for full documentation. """ from __future__ import print_function, division, absolute_import # Print a helpful error message if the extension modules cannot be imported. from cutadapt import check_importability check_importability() import sys import errno import time from optparse import OptionParser, OptionGroup, SUPPRESS_HELP import logging import platform import textwrap from xopen import xopen from cutadapt import seqio, __version__ from cutadapt.adapters import AdapterParser from cutadapt.modifiers import (LengthTagModifier, SuffixRemover, PrefixSuffixAdder, DoubleEncoder, ZeroCapper, PrimerTrimmer, QualityTrimmer, UnconditionalCutter, NEndTrimmer, AdapterCutter, NextseqQualityTrimmer, Shortener) from cutadapt.report import Statistics, print_report, redirect_standard_output from cutadapt.pipeline import SingleEndPipeline, PairedEndPipeline, OutputFiles, ParallelPipelineRunner, available_cpu_count from cutadapt.compat import PY3 logger = logging.getLogger() class CutadaptOptionParser(OptionParser): def get_usage(self): return self.usage.lstrip().replace('%version', __version__) class CommandlineError(Exception): pass class NiceFormatter(logging.Formatter): """ Do not prefix "INFO:" to info-level log messages (but do it for all other levels). Based on http://stackoverflow.com/a/9218261/715090 . """ def format(self, record): if record.levelno != logging.INFO: record.msg = '{}: {}'.format(record.levelname, record.msg) return super(NiceFormatter, self).format(record) def setup_logging(stdout=False, quiet=False): """ Attach handler to the global logger object """ # Due to backwards compatibility, logging output is sent to standard output # instead of standard error if the -o option is used. stream_handler = logging.StreamHandler(sys.stdout if stdout else sys.stderr) stream_handler.setFormatter(NiceFormatter()) stream_handler.setLevel(logging.ERROR if quiet else logging.INFO) logger.setLevel(logging.INFO) logger.addHandler(stream_handler) def get_option_parser(): parser = CutadaptOptionParser(usage=__doc__, version=__version__) parser.add_option("--debug", action='store_true', default=False, help="Print debugging information.") parser.add_option("-f", "--format", help="Input file format; can be either 'fasta', 'fastq' or 'sra-fastq'. " "Ignored when reading csfasta/qual files. Default: auto-detect " "from file name extension.") parser.add_option('-j', '--cores', type=int, default=1, help='Number of CPU cores to use. Default: %default') # Hidden options parser.add_option("--gc-content", type=float, default=50, # it's a percentage help=SUPPRESS_HELP) parser.add_option("--buffer-size", type=int, default=4000000, help=SUPPRESS_HELP) # buffer size for the reader process when running in parallel group = OptionGroup(parser, "Finding adapters", description="Parameters -a, -g, -b specify adapters to be removed from " "each read (or from the first read in a pair if data is paired). " "If specified multiple times, only the best matching adapter is " "trimmed (but see the --times option). When the special notation " "'file:FILE' is used, adapter sequences are read from the given " "FASTA file.") group.add_option("-a", "--adapter", action="append", default=[], metavar="ADAPTER", dest="adapters", help="Sequence of an adapter ligated to the 3' end (paired data: of the " "first read). The adapter and subsequent bases are trimmed. If a " "'$' character is appended ('anchoring'), the adapter is only " "found if it is a suffix of the read.") group.add_option("-g", "--front", action="append", default=[], metavar="ADAPTER", help="Sequence of an adapter ligated to the 5' end (paired data: of the " "first read). The adapter and any preceding bases are trimmed. " "Partial matches at the 5' end are allowed. If a '^' character is " "prepended ('anchoring'), the adapter is only found if it is a " "prefix of the read.") group.add_option("-b", "--anywhere", action="append", default=[], metavar="ADAPTER", help="Sequence of an adapter that may be ligated to the 5' or 3' end " "(paired data: of the first read). Both types of matches as " "described under -a und -g are allowed. If the first base of the " "read is part of the match, the behavior is as with -g, otherwise " "as with -a. This option is mostly for rescuing failed library " "preparations - do not use if you know which end your adapter was " "ligated to!") group.add_option("-e", "--error-rate", type=float, default=0.1, help="Maximum allowed error rate (no. of errors divided by the length " "of the matching region). Default: %default") group.add_option("--no-indels", action='store_false', dest='indels', default=True, help="Allow only mismatches in alignments. " "Default: allow both mismatches and indels") group.add_option("-n", "--times", type=int, metavar="COUNT", default=1, help="Remove up to COUNT adapters from each read. Default: %default") group.add_option("-O", "--overlap", type=int, metavar="MINLENGTH", default=3, help="Require MINLENGTH overlap between read and adapter for an adapter " "to be found. Default: %default") group.add_option("--match-read-wildcards", action="store_true", default=False, help="Interpret IUPAC wildcards in reads. Default: %default") group.add_option("-N", "--no-match-adapter-wildcards", action="store_false", default=True, dest='match_adapter_wildcards', help="Do not interpret IUPAC wildcards in adapters.") group.add_option("--no-trim", dest='action', action='store_const', const=None, help="Match and redirect reads to output/untrimmed-output as usual, " "but do not remove adapters.") group.add_option("--mask-adapter", dest='action', action='store_const', const='mask', help="Mask adapters with 'N' characters instead of trimming them.") parser.add_option_group(group) group = OptionGroup(parser, "Additional read modifications") group.add_option("-u", "--cut", action='append', default=[], type=int, metavar="LENGTH", help="Remove bases from each read (first read only if paired). " "If LENGTH is positive, remove bases from the beginning. " "If LENGTH is negative, remove bases from the end. " "Can be used twice if LENGTHs have different signs. " "This is applied *before* adapter trimming.") group.add_option("--nextseq-trim", type=int, default=None, metavar="3'CUTOFF", help="NextSeq-specific quality trimming (each read). Trims also dark " "cycles appearing as high-quality G bases.") group.add_option("-q", "--quality-cutoff", default=None, metavar="[5'CUTOFF,]3'CUTOFF", help="Trim low-quality bases from 5' and/or 3' ends of each read before " "adapter removal. Applied to both reads if data is paired. If one " "value is given, only the 3' end is trimmed. If two " "comma-separated cutoffs are given, the 5' end is trimmed with " "the first cutoff, the 3' end with the second.") group.add_option("--quality-base", type=int, default=33, help="Assume that quality values in FASTQ are encoded as ascii(quality " "+ QUALITY_BASE). This needs to be set to 64 for some old Illumina " "FASTQ files. Default: %default") group.add_option("--length", "-l", type=int, default=None, metavar="LENGTH", help="Shorten reads to LENGTH. This and the following modifications " "are applied after adapter trimming.") group.add_option("--trim-n", action='store_true', default=False, help="Trim N's on ends of reads.") group.add_option("--length-tag", metavar="TAG", help="Search for TAG followed by a decimal number in the description " "field of the read. Replace the decimal number with the correct " "length of the trimmed read. For example, use --length-tag 'length=' " "to correct fields like 'length=123'.") group.add_option("--strip-suffix", action='append', default=[], help="Remove this suffix from read names if present. Can be given multiple times.") group.add_option("-x", "--prefix", default='', help="Add this prefix to read names. Use {name} to insert the name of the matching adapter.") group.add_option("-y", "--suffix", default='', help="Add this suffix to read names; can also include {name}") parser.add_option_group(group) group = OptionGroup(parser, "Filtering of processed reads", description="Filters are applied after above read modifications. " "Paired-end reads are always discarded pairwise (see also " "--pair-filter).") group.add_option("-m", "--minimum-length", type=int, default=0, metavar="LENGTH", help="Discard reads shorter than LENGTH. Default: 0") group.add_option("-M", "--maximum-length", type=int, default=sys.maxsize, metavar="LENGTH", help="Discard reads longer than LENGTH. Default: no limit") group.add_option("--max-n", type=float, default=-1.0, metavar="COUNT", help="Discard reads with more than COUNT 'N' bases. If COUNT is a number " "between 0 and 1, it is interpreted as a fraction of the read length.") group.add_option("--discard-trimmed", "--discard", action='store_true', default=False, help="Discard reads that contain an adapter. Also use -O to avoid " "discarding too many randomly matching reads!") group.add_option("--discard-untrimmed", "--trimmed-only", action='store_true', default=False, help="Discard reads that do not contain an adapter.") parser.add_option_group(group) group = OptionGroup(parser, "Output") group.add_option("--quiet", default=False, action='store_true', help="Print only error messages.") group.add_option("-o", "--output", metavar="FILE", help="Write trimmed reads to FILE. FASTQ or FASTA format is chosen " "depending on input. The summary report is sent to standard output. " "Use '{name}' in FILE to demultiplex reads into multiple " "files. Default: write to standard output") group.add_option("--info-file", metavar="FILE", help="Write information about each read and its adapter matches into FILE. " "See the documentation for the file format.") group.add_option("-r", "--rest-file", metavar="FILE", help="When the adapter matches in the middle of a read, write the " "rest (after the adapter) to FILE.") group.add_option("--wildcard-file", metavar="FILE", help="When the adapter has N wildcard bases, write adapter bases " "matching wildcard positions to FILE. (Inaccurate with indels.)") group.add_option("--too-short-output", metavar="FILE", help="Write reads that are too short (according to length specified by " "-m) to FILE. Default: discard reads") group.add_option("--too-long-output", metavar="FILE", help="Write reads that are too long (according to length specified by " "-M) to FILE. Default: discard reads") group.add_option("--untrimmed-output", default=None, metavar="FILE", help="Write reads that do not contain any adapter to FILE. Default: " "output to same file as trimmed reads") parser.add_option_group(group) group = OptionGroup(parser, "Colorspace options") group.add_option("-c", "--colorspace", action='store_true', default=False, help="Enable colorspace mode") group.add_option("-d", "--double-encode", action='store_true', default=False, help="Double-encode colors (map 0,1,2,3,4 to A,C,G,T,N).") group.add_option("-t", "--trim-primer", action='store_true', default=False, help="Trim primer base and the first color") group.add_option("--strip-f3", action='store_true', default=False, help="Strip the _F3 suffix of read names") group.add_option("--maq", "--bwa", action='store_true', default=False, help="MAQ- and BWA-compatible colorspace output. This enables -c, -d, " "-t, --strip-f3 and -y '/1'.") group.add_option("--zero-cap", "-z", action='store_true', help="Change negative quality values to zero. Enabled by default " "in colorspace mode since many tools have problems with " "negative qualities") group.add_option("--no-zero-cap", dest='zero_cap', action='store_false', help="Disable zero capping") parser.set_defaults(zero_cap=None, action='trim') parser.add_option_group(group) group = OptionGroup(parser, "Paired-end options", description="The " "-A/-G/-B/-U options work like their -a/-b/-g/-u counterparts, but " "are applied to the second read in each pair.") group.add_option("-A", dest='adapters2', action='append', default=[], metavar='ADAPTER', help="3' adapter to be removed from second read in a pair.") group.add_option("-G", dest='front2', action='append', default=[], metavar='ADAPTER', help="5' adapter to be removed from second read in a pair.") group.add_option("-B", dest='anywhere2', action='append', default=[], metavar='ADAPTER', help="5'/3 adapter to be removed from second read in a pair.") group.add_option("-U", dest='cut2', action='append', default=[], type=int, metavar="LENGTH", help="Remove LENGTH bases from second read in a pair (see --cut).") group.add_option("-p", "--paired-output", metavar="FILE", help="Write second read in a pair to FILE.") # Setting the default for pair_filter to None allows us to find out whether # the option was used at all. group.add_option("--pair-filter", metavar='(any|both)', default=None, choices=("any", "both"), help="Which of the reads in a paired-end read have to match the " "filtering criterion in order for the pair to be filtered. " "Default: any") group.add_option("--interleaved", action='store_true', default=False, help="Read and write interleaved paired-end reads.") group.add_option("--untrimmed-paired-output", metavar="FILE", help="Write second read in a pair to this FILE when no adapter " "was found in the first read. Use this option together with " "--untrimmed-output when trimming paired-end reads. Default: output " "to same file as trimmed reads") group.add_option("--too-short-paired-output", metavar="FILE", default=None, help="Write second read in a pair to this file if pair is too short. " "Use together with --too-short-output.") group.add_option("--too-long-paired-output", metavar="FILE", default=None, help="Write second read in a pair to this file if pair is too long. " "Use together with --too-long-output.") parser.add_option_group(group) return parser def parse_cutoffs(s): """Parse a string INT[,INT] into a two-element list of integers""" cutoffs = s.split(',') if len(cutoffs) == 1: try: cutoffs = [0, int(cutoffs[0])] except ValueError as e: raise CommandlineError("Quality cutoff value not recognized: {0}".format(e)) elif len(cutoffs) == 2: try: cutoffs = [int(cutoffs[0]), int(cutoffs[1])] except ValueError as e: raise CommandlineError("Quality cutoff value not recognized: {0}".format(e)) else: raise CommandlineError("Expected one value or two values separated by comma for " "the quality cutoff") return cutoffs def open_output_files(options, default_outfile, interleaved): """ Return an OutputFiles instance. If demultiplex is True, the untrimmed, untrimmed2, out and out2 attributes are not opened files, but paths (out and out2 with the '{name}' template). """ rest_file = info_file = wildcard = None if options.rest_file is not None: rest_file = xopen(options.rest_file, 'w') if options.info_file is not None: info_file = xopen(options.info_file, 'w') if options.wildcard_file is not None: wildcard = xopen(options.wildcard_file, 'w') def open2(path1, path2): file1 = file2 = None if path1 is not None: file1 = xopen(path1, 'w') if path2 is not None: file2 = xopen(path2, 'w') return file1, file2 too_short = too_short2 = None if options.minimum_length > 0: too_short, too_short2 = open2(options.too_short_output, options.too_short_paired_output) too_long = too_long2 = None if options.maximum_length < sys.maxsize: too_long, too_long2 = open2(options.too_long_output, options.too_long_paired_output) if int(options.discard_trimmed) + int(options.discard_untrimmed) + int( options.untrimmed_output is not None) > 1: raise CommandlineError("Only one of the --discard-trimmed, --discard-untrimmed " "and --untrimmed-output options can be used at the same time.") demultiplex = options.output is not None and '{name}' in options.output if options.paired_output is not None and (demultiplex != ('{name}' in options.paired_output)): raise CommandlineError('When demultiplexing paired-end data, "{name}" must appear in ' 'both output file names (-o and -p)') if demultiplex: if options.discard_trimmed: raise CommandlineError("Do not use --discard-trimmed when demultiplexing.") out = options.output untrimmed = options.output.replace('{name}', 'unknown') if options.untrimmed_output: untrimmed = options.untrimmed_output if options.discard_untrimmed: untrimmed = None if options.paired_output is not None: out2 = options.paired_output untrimmed2 = options.paired_output.replace('{name}', 'unknown') if options.untrimmed_paired_output: untrimmed2 = options.untrimmed_paired_output if options.discard_untrimmed: untrimmed2 = None else: untrimmed2 = out2 = None else: untrimmed, untrimmed2 = open2(options.untrimmed_output, options.untrimmed_paired_output) out, out2 = open2(options.output, options.paired_output) if out is None: out = default_outfile if demultiplex: assert out is not None and '{name}' in out and (out2 is None or '{name}' in out2) return OutputFiles( rest=rest_file, info=info_file, wildcard=wildcard, too_short=too_short, too_short2=too_short2, too_long=too_long, too_long2=too_long2, untrimmed=untrimmed, untrimmed2=untrimmed2, out=out, out2=out2, demultiplex=demultiplex, interleaved=interleaved, ) def determine_paired_mode(options): """ Determine the paired-end mode: single-end, paired-end or legacy paired-end. Return False, 'first' or 'both'. False -- single-end 'first' -- Backwards-compatible "legacy" mode in which read modifications apply only to read 1 'both' -- normal paired-end mode in which read modifications apply to read 1 and 2 Legacy mode is deactivated as soon as any option is used that exists only in cutadapt 1.8 or later, such as -A/-G/-B/-U/--interleaved/--nextseq-trim. """ paired = False if options.paired_output: paired = 'first' # Switch off legacy mode if certain options given if paired and options.nextseq_trim: paired = 'both' if (options.adapters2 or options.front2 or options.anywhere2 or options.cut2 or options.interleaved or options.pair_filter or options.too_short_paired_output or options.too_long_paired_output): paired = 'both' return paired def determine_interleaved(options, args): is_interleaved_input = False is_interleaved_output = False if options.interleaved: is_interleaved_input = len(args) == 1 is_interleaved_output = not options.paired_output if not is_interleaved_input and not is_interleaved_output: raise CommandlineError("When --interleaved is used, you cannot provide both two " "input files and two output files") return is_interleaved_input, is_interleaved_output def input_files_from_parsed_args(args, paired, interleaved): """ Return tuple (input_filename, input_paired_filename, quality_filename) """ if len(args) == 0: raise CommandlineError("At least one parameter needed: name of a FASTA or FASTQ file.") elif len(args) > 2: raise CommandlineError("Too many parameters.") input_filename = args[0] if input_filename.endswith('.qual'): raise CommandlineError("If a .qual file is given, it must be the second argument.") if paired and len(args) == 1 and not interleaved: raise CommandlineError("When paired-end trimming is enabled via -A/-G/-B/-U/" "--interleaved or -p, two input files are required.") input_paired_filename = None quality_filename = None if paired: if not interleaved: input_paired_filename = args[1] elif len(args) == 2: quality_filename = args[1] return input_filename, input_paired_filename, quality_filename def pipeline_from_parsed_args(options, paired, pair_filter_mode, quality_filename, is_interleaved_output): """ Setup a processing pipeline from parsed command-line options. If there are any problems parsing the arguments, a CommandlineError is thrown. Return an instance of Pipeline (SingleEndPipeline or PairedEndPipeline) """ if not paired: if options.untrimmed_paired_output: raise CommandlineError("Option --untrimmed-paired-output can only be used when " "trimming paired-end reads (with option -p).") if paired: if not is_interleaved_output: if not options.paired_output: raise CommandlineError("When paired-end trimming is enabled via -A/-G/-B/-U, " "a second output file needs to be specified via -p (--paired-output).") if not options.output: raise CommandlineError("When you use -p or --paired-output, you must also " "use the -o option.") if bool(options.untrimmed_output) != bool(options.untrimmed_paired_output): raise CommandlineError("When trimming paired-end reads, you must use either none " "or both of the --untrimmed-output/--untrimmed-paired-output options.") if options.too_short_output and not options.too_short_paired_output: raise CommandlineError("When using --too-short-output with paired-end " "reads, you also need to use --too-short-paired-output") if options.too_long_output and not options.too_long_paired_output: raise CommandlineError("When using --too-long-output with paired-end " "reads, you also need to use --too-long-paired-output") elif quality_filename is not None: if options.format is not None: raise CommandlineError('If a pair of .fasta and .qual files is given, the -f/--format ' 'parameter cannot be used.') if options.format is not None and options.format.lower() not in ['fasta', 'fastq', 'sra-fastq']: raise CommandlineError("The input file format must be either 'fasta', 'fastq' or " "'sra-fastq' (not '{0}').".format(options.format)) if options.maq: options.colorspace = True options.double_encode = True options.trim_primer = True options.strip_suffix.append('_F3') options.suffix = "/1" if options.zero_cap is None: options.zero_cap = options.colorspace if options.trim_primer and not options.colorspace: raise CommandlineError("Trimming the primer makes only sense in colorspace.") if options.double_encode and not options.colorspace: raise CommandlineError("Double-encoding makes only sense in colorspace.") if options.anywhere and options.colorspace: raise CommandlineError("Using --anywhere with colorspace reads is currently not supported " "(if you think this may be useful, contact the author).") if not (0 <= options.error_rate <= 1.): raise CommandlineError("The maximum error rate must be between 0 and 1.") if options.overlap < 1: raise CommandlineError("The overlap must be at least 1.") if not (0 <= options.gc_content <= 100): raise CommandlineError("GC content must be given as percentage between 0 and 100") if options.colorspace: if options.match_read_wildcards: raise CommandlineError('IUPAC wildcards not supported in colorspace') options.match_adapter_wildcards = False adapter_parser = AdapterParser( colorspace=options.colorspace, max_error_rate=options.error_rate, min_overlap=options.overlap, read_wildcards=options.match_read_wildcards, adapter_wildcards=options.match_adapter_wildcards, indels=options.indels) try: adapters = adapter_parser.parse_multi(options.adapters, options.anywhere, options.front) adapters2 = adapter_parser.parse_multi(options.adapters2, options.anywhere2, options.front2) except IOError as e: if e.errno == errno.ENOENT: raise CommandlineError(e) raise except ValueError as e: raise CommandlineError(e) if options.debug: for adapter in adapters + adapters2: adapter.enable_debug() # Create the processing pipeline. # If no second-read adapters were given (via -A/-G/-B/-U), we need to # be backwards compatible and *no modifications* are done to the second read. if paired: pipeline = PairedEndPipeline(pair_filter_mode, modify_first_read_only=paired == 'first') else: pipeline = SingleEndPipeline() if options.cut: if len(options.cut) > 2: raise CommandlineError("You cannot remove bases from more than two ends.") if len(options.cut) == 2 and options.cut[0] * options.cut[1] > 0: raise CommandlineError("You cannot remove bases from the same end twice.") for cut in options.cut: if cut != 0: pipeline.add1(UnconditionalCutter(cut)) if options.cut2: if len(options.cut2) > 2: raise CommandlineError("You cannot remove bases from more than two ends.") if len(options.cut2) == 2 and options.cut2[0] * options.cut2[1] > 0: raise CommandlineError("You cannot remove bases from the same end twice.") for cut in options.cut2: if cut != 0: pipeline.add2(UnconditionalCutter(cut)) if options.nextseq_trim is not None: pipeline.add(NextseqQualityTrimmer(options.nextseq_trim, options.quality_base)) if options.quality_cutoff is not None: cutoffs = parse_cutoffs(options.quality_cutoff) pipeline.add(QualityTrimmer(cutoffs[0], cutoffs[1], options.quality_base)) if adapters: adapter_cutter = AdapterCutter(adapters, options.times, options.action) pipeline.add1(adapter_cutter) pipeline.n_adapters += len(adapters) if adapters2: adapter_cutter2 = AdapterCutter(adapters2, options.times, options.action) pipeline.add2(adapter_cutter2) pipeline.n_adapters += len(adapters2) # Modifiers that apply to both reads of paired-end reads unless in legacy mode if options.length is not None: pipeline.add(Shortener(options.length)) if options.trim_n: pipeline.add(NEndTrimmer()) if options.length_tag: pipeline.add(LengthTagModifier(options.length_tag)) if options.strip_f3: options.strip_suffix.append('_F3') for suffix in options.strip_suffix: pipeline.add(SuffixRemover(suffix)) if options.prefix or options.suffix: pipeline.add(PrefixSuffixAdder(options.prefix, options.suffix)) if options.double_encode: pipeline.add(DoubleEncoder()) if options.zero_cap: pipeline.add(ZeroCapper(quality_base=options.quality_base)) if options.trim_primer: pipeline.add(PrimerTrimmer) return pipeline def main(cmdlineargs=None, default_outfile=sys.stdout): """ Main function that sets up a processing pipeline and runs it. default_outfile is the file to which trimmed reads are sent if the ``-o`` parameter is not used. """ start_time = time.time() parser = get_option_parser() if cmdlineargs is None: cmdlineargs = sys.argv[1:] options, args = parser.parse_args(args=cmdlineargs) # Setup logging only if there are not already any handlers (can happen when # this function is being called externally such as from unit tests) if not logging.root.handlers: setup_logging(stdout=bool(options.output), quiet=options.quiet) paired = determine_paired_mode(options) assert paired in (False, 'first', 'both') if paired == 'first': # legacy mode assert options.pair_filter is None pair_filter_mode = 'first' elif options.pair_filter is None: # default pair_filter_mode = 'any' else: # user-provided behavior pair_filter_mode = options.pair_filter try: is_interleaved_input, is_interleaved_output = determine_interleaved(options, args) input_filename, input_paired_filename, quality_filename = input_files_from_parsed_args(args, paired, is_interleaved_input) pipeline = pipeline_from_parsed_args(options, paired, pair_filter_mode, quality_filename, is_interleaved_output) outfiles = open_output_files(options, default_outfile, is_interleaved_output) except CommandlineError as e: parser.error(e) return # avoid IDE warnings below cores = max(1, options.cores) if cores > 1: if ( PY3 and ParallelPipelineRunner.can_output_to(outfiles) and quality_filename is None and not options.colorspace and options.format is None and cores > 1 ): runner = ParallelPipelineRunner(pipeline, cores, options.buffer_size) else: if not PY3: logger.error('Running in parallel is not supported on Python 2') else: logger.error('Running in parallel is currently not supported for ' 'the given combination of command-line parameters.') sys.exit(1) else: runner = pipeline try: runner.set_input(input_filename, file2=input_paired_filename, qualfile=quality_filename, colorspace=options.colorspace, fileformat=options.format, interleaved=is_interleaved_input) runner.set_output(outfiles, options.minimum_length, options.maximum_length, options.max_n, options.discard_trimmed, options.discard_untrimmed) except (seqio.UnknownFileType, IOError) as e: parser.error(e) implementation = platform.python_implementation() opt = ' (' + implementation + ')' if implementation != 'CPython' else '' logger.info("This is cutadapt %s with Python %s%s", __version__, platform.python_version(), opt) logger.info("Command line parameters: %s", " ".join(cmdlineargs)) logger.info('Running on %d core%s', cores, 's' if cores > 1 else '') logger.info("Trimming %s adapter%s with at most %.1f%% errors in %s mode ...", pipeline.n_adapters, 's' if pipeline.n_adapters != 1 else '', options.error_rate * 100, {False: 'single-end', 'first': 'paired-end legacy', 'both': 'paired-end'}[pipeline.paired]) if pipeline.should_warn_legacy: logger.warning('\n'.join(textwrap.wrap('Legacy mode is ' 'enabled. Read modification and filtering options *ignore* ' 'the second read. To switch to regular paired-end mode, ' 'provide the --pair-filter=any option or use any of the ' '-A/-B/-G/-U/--interleaved options.'))) try: stats = runner.run() # cProfile.runctx('stats=runner.run()', globals(), locals(), 'profile_main.prof') runner.close() except KeyboardInterrupt: print("Interrupted", file=sys.stderr) sys.exit(130) except IOError as e: if e.errno == errno.EPIPE: sys.exit(1) raise except (seqio.FormatError, seqio.UnknownFileType, EOFError) as e: sys.exit("cutadapt: error: {0}".format(e)) elapsed = time.time() - start_time if not options.quiet: # send statistics to stderr if result was sent to stdout stat_file = sys.stderr if options.output is None else None with redirect_standard_output(stat_file): print_report(stats, elapsed, options.gc_content / 100) if __name__ == '__main__': main() cutadapt-1.15/src/cutadapt/modifiers.py0000664000175000017500000001571413205526454020744 0ustar marcelmarcel00000000000000# coding: utf-8 """ This module implements all the read modifications that cutadapt supports. A modifier must be callable. It is implemented as a function if no parameters need to be stored, and as a class with a __call__ method if there are parameters (or statistics). """ from __future__ import print_function, division, absolute_import import re from collections import OrderedDict from cutadapt.qualtrim import quality_trim_index, nextseq_trim_index from cutadapt.compat import maketrans class AdapterCutter(object): """ Repeatedly find one of multiple adapters in reads. The number of times the search is repeated is specified by the times parameter. """ def __init__(self, adapters, times=1, action='trim'): """ adapters -- list of Adapter objects action -- What to do with a found adapter: None, 'trim', or 'mask' """ self.adapters = adapters self.times = times self.action = action self.with_adapters = 0 self.adapter_statistics = OrderedDict((a, a.create_statistics()) for a in adapters) def _best_match(self, read): """ Find the best matching adapter in the given read. Return either a Match instance or None if there are no matches. """ # TODO # try to sort adapters by length, longest first, break when current best # match is longer than length of next adapter to try best = None for adapter in self.adapters: match = adapter.match_to(read) if match is None: continue # the no. of matches determines which adapter fits best if best is None or match.matches > best.matches: best = match return best def __call__(self, read): """ Cut found adapters from a single read. Return modified read. Determine the adapter that best matches the given read. Since the best adapter is searched repeatedly, a list of Match instances is returned, which need to be applied consecutively to the read. The list is empty if there are no adapter matches. The read is converted to uppercase before it is compared to the adapter sequences. """ matches = [] # try at most self.times times to remove an adapter trimmed_read = read for t in range(self.times): match = self._best_match(trimmed_read) if match is None: # nothing found break matches.append(match) trimmed_read = match.trimmed() trimmed_read.match = match match.update_statistics(self.adapter_statistics[match.adapter]) if not matches: trimmed_read.match = None return trimmed_read if __debug__: assert len(trimmed_read) < len(read), "Trimmed read isn't shorter than original" if self.action == 'trim': # read is already trimmed, nothing to do pass elif self.action == 'mask': # add N from last modification masked_sequence = trimmed_read.sequence for match in sorted(matches, reverse=True, key=lambda m: m.astart): ns = 'N' * (len(match.read.sequence) - len(match.trimmed().sequence)) # add N depending on match position if match.remove_before: masked_sequence = ns + masked_sequence else: masked_sequence += ns # set masked sequence as sequence with original quality trimmed_read.sequence = masked_sequence trimmed_read.qualities = matches[0].read.qualities assert len(trimmed_read.sequence) == len(read) elif self.action is None: trimmed_read = read trimmed_read.match = matches[-1] self.with_adapters += 1 return trimmed_read class UnconditionalCutter(object): """ A modifier that unconditionally removes the first n or the last n bases from a read. If the length is positive, the bases are removed from the beginning of the read. If the length is negative, the bases are removed from the end of the read. """ def __init__(self, length): self.length = length def __call__(self, read): if self.length > 0: return read[self.length:] elif self.length < 0: return read[:self.length] class LengthTagModifier(object): """ Replace "length=..." strings in read names. """ def __init__(self, length_tag): self.regex = re.compile(r"\b" + length_tag + r"[0-9]*\b") self.length_tag = length_tag def __call__(self, read): read = read[:] if read.name.find(self.length_tag) >= 0: read.name = self.regex.sub(self.length_tag + str(len(read.sequence)), read.name) return read class SuffixRemover(object): """ Remove a given suffix from read names. """ def __init__(self, suffix): self.suffix = suffix def __call__(self, read): read = read[:] if read.name.endswith(self.suffix): read.name = read.name[:-len(self.suffix)] return read class PrefixSuffixAdder(object): """ Add a suffix and a prefix to read names """ def __init__(self, prefix, suffix): self.prefix = prefix self.suffix = suffix def __call__(self, read): read = read[:] adapter_name = 'no_adapter' if read.match is None else read.match.adapter.name read.name = self.prefix.replace('{name}', adapter_name) + read.name + \ self.suffix.replace('{name}', adapter_name) return read class DoubleEncoder(object): """ Double-encode colorspace reads, using characters ACGTN to represent colors. """ def __init__(self): self.double_encode_trans = maketrans('0123.', 'ACGTN') def __call__(self, read): read = read[:] read.sequence = read.sequence.translate(self.double_encode_trans) return read class ZeroCapper(object): """ Change negative quality values of a read to zero """ def __init__(self, quality_base=33): qb = quality_base self.zero_cap_trans = maketrans(''.join(map(chr, range(qb))), chr(qb) * qb) def __call__(self, read): read = read[:] read.qualities = read.qualities.translate(self.zero_cap_trans) return read def PrimerTrimmer(read): """Trim primer base from colorspace reads""" read = read[1:] read.primer = '' return read class NextseqQualityTrimmer(object): def __init__(self, cutoff, base): self.cutoff = cutoff self.base = base self.trimmed_bases = 0 def __call__(self, read): stop = nextseq_trim_index(read, self.cutoff, self.base) self.trimmed_bases += len(read) - stop return read[:stop] class QualityTrimmer(object): def __init__(self, cutoff_front, cutoff_back, base): self.cutoff_front = cutoff_front self.cutoff_back = cutoff_back self.base = base self.trimmed_bases = 0 def __call__(self, read): start, stop = quality_trim_index(read.qualities, self.cutoff_front, self.cutoff_back, self.base) self.trimmed_bases += len(read) - (stop - start) return read[start:stop] class Shortener(object): """Unconditionally shorten a read to the given length""" def __init__(self, length): self.length = length def __call__(self, read): return read[:self.length] class NEndTrimmer(object): """Trims Ns from the 3' and 5' end of reads""" def __init__(self): self.start_trim = re.compile(r'^N+') self.end_trim = re.compile(r'N+$') def __call__(self, read): sequence = read.sequence start_cut = self.start_trim.match(sequence) end_cut = self.end_trim.search(sequence) start_cut = start_cut.end() if start_cut else 0 end_cut = end_cut.start() if end_cut else len(read) return read[start_cut:end_cut] cutadapt-1.15/src/cutadapt/pipeline.py0000664000175000017500000005076713205526454020577 0ustar marcelmarcel00000000000000from __future__ import print_function, division, absolute_import import io import os import re import sys import logging import functools from multiprocessing import Process, Pipe, Queue import multiprocessing.connection import traceback from xopen import xopen from . import seqio from .modifiers import ZeroCapper from .report import Statistics from .filters import (Redirector, PairedRedirector, NoFilter, PairedNoFilter, InfoFileWriter, RestFileWriter, WildcardFileWriter, TooShortReadFilter, TooLongReadFilter, NContentFilter, DiscardTrimmedFilter, DiscardUntrimmedFilter, Demultiplexer, PairedEndDemultiplexer) from .seqio import read_chunks_from_file, read_paired_chunks logger = logging.getLogger() class OutputFiles(object): """ The attributes are open file-like objects except when demultiplex is True. In that case, untrimmed, untrimmed2 are file names, and out and out2 are file name templates containing '{name}'. If interleaved is True, then out is written interleaved. Files may also be None. """ # TODO interleaving for the other file pairs (too_short, too_long, untrimmed)? def __init__(self, out=None, out2=None, untrimmed=None, untrimmed2=None, too_short=None, too_short2=None, too_long=None, too_long2=None, info=None, rest=None, wildcard=None, demultiplex=False, interleaved=False, ): self.out = out self.out2 = out2 self.untrimmed = untrimmed self.untrimmed2 = untrimmed2 self.too_short = too_short self.too_short2 = too_short2 self.too_long = too_long self.too_long2 = too_long2 self.info = info self.rest = rest self.wildcard = wildcard self.demultiplex = demultiplex self.interleaved = interleaved def __iter__(self): yield self.out yield self.out2 yield self.untrimmed yield self.untrimmed2 yield self.too_short yield self.too_short2 yield self.too_long yield self.too_long2 yield self.info yield self.rest yield self.wildcard class Pipeline(object): """ Processing pipeline that loops over reads and applies modifiers and filters """ should_warn_legacy = False n_adapters = 0 def __init__(self, ): self._close_files = [] self._reader = None self._filters = [] self._modifiers = [] self._colorspace = None self._outfiles = None self._demultiplexer = None def set_input(self, file1, file2=None, qualfile=None, colorspace=False, fileformat=None, interleaved=False): self._reader = seqio.open(file1, file2, qualfile, colorspace, fileformat, interleaved, mode='r') self._colorspace = colorspace # Special treatment: Disable zero-capping if no qualities are available if not self._reader.delivers_qualities: self._modifiers = [m for m in self._modifiers if not isinstance(m, ZeroCapper)] def _open_writer(self, file, file2, **kwargs): # TODO backwards-incompatible change (?) would be to use outfiles.interleaved # for all outputs return seqio.open(file, file2, mode='w', qualities=self.uses_qualities, colorspace=self._colorspace, **kwargs) # TODO set max_n default to None def set_output(self, outfiles, minimum_length=0, maximum_length=sys.maxsize, max_n=-1, discard_trimmed=False, discard_untrimmed=False): self._filters = [] self._outfiles = outfiles filter_wrapper = self._filter_wrapper() if outfiles.rest: self._filters.append(RestFileWriter(outfiles.rest)) if outfiles.info: self._filters.append(InfoFileWriter(outfiles.info)) if outfiles.wildcard: self._filters.append(WildcardFileWriter(outfiles.wildcard)) too_short_writer = None if minimum_length > 0: if outfiles.too_short: too_short_writer = self._open_writer(outfiles.too_short, outfiles.too_short2) self._filters.append( filter_wrapper(too_short_writer, TooShortReadFilter(minimum_length))) too_long_writer = None if maximum_length < sys.maxsize: if outfiles.too_long: too_long_writer = self._open_writer(outfiles.too_long, outfiles.too_long2) self._filters.append( filter_wrapper(too_long_writer, TooLongReadFilter(maximum_length))) if max_n != -1: self._filters.append(filter_wrapper(None, NContentFilter(max_n))) if int(discard_trimmed) + int(discard_untrimmed) + int(outfiles.untrimmed is not None) > 1: raise ValueError('discard_trimmed, discard_untrimmed and outfiles.untrimmed must not ' 'be set simultaneously') if outfiles.demultiplex: self._demultiplexer = self._create_demultiplexer(outfiles) self._filters.append(self._demultiplexer) else: # Set up the remaining filters to deal with --discard-trimmed, # --discard-untrimmed and --untrimmed-output. These options # are mutually exclusive in order to avoid brain damage. if discard_trimmed: self._filters.append(filter_wrapper(None, DiscardTrimmedFilter())) elif discard_untrimmed: self._filters.append(filter_wrapper(None, DiscardUntrimmedFilter())) elif outfiles.untrimmed: untrimmed_writer = self._open_writer(outfiles.untrimmed, outfiles.untrimmed2) self._filters.append(filter_wrapper(untrimmed_writer, DiscardUntrimmedFilter())) self._filters.append(self._final_filter(outfiles)) def close(self): for f in self._outfiles: # TODO do not use hasattr if f is not None and f is not sys.stdin and f is not sys.stdout and hasattr(f, 'close'): f.close() if self._demultiplexer is not None: self._demultiplexer.close() @property def uses_qualities(self): return self._reader.delivers_qualities def run(self): (n, total1_bp, total2_bp) = self.process_reads() # TODO m = self._modifiers m2 = getattr(self, '_modifiers2', []) stats = Statistics() stats.collect(n, total1_bp, total2_bp, m, m2, self._filters) return stats def process_reads(self): raise NotImplementedError() def _filter_wrapper(self): raise NotImplementedError() def _final_filter(self, outfiles): raise NotImplementedError() def _create_demultiplexer(self, outfiles): raise NotImplementedError() class SingleEndPipeline(Pipeline): """ Processing pipeline for single-end reads """ paired = False def __init__(self): super(SingleEndPipeline, self).__init__() self._modifiers = [] def add(self, modifier): self._modifiers.append(modifier) def add1(self, modifier): """An alias for the add() function. Makes the interface similar to PairedEndPipeline""" self.add(modifier) def process_reads(self): """Run the pipeline. Return statistics""" n = 0 # no. of processed reads # TODO turn into attribute total_bp = 0 for read in self._reader: n += 1 total_bp += len(read.sequence) for modifier in self._modifiers: read = modifier(read) for filter in self._filters: if filter(read): break return (n, total_bp, None) def _filter_wrapper(self): return Redirector def _final_filter(self, outfiles): writer = self._open_writer(outfiles.out, outfiles.out2) return NoFilter(writer) def _create_demultiplexer(self, outfiles): return Demultiplexer(outfiles.out, outfiles.untrimmed, qualities=self.uses_qualities, colorspace=self._colorspace) class PairedEndPipeline(Pipeline): """ Processing pipeline for paired-end reads. """ def __init__(self, pair_filter_mode, modify_first_read_only=False): """Setting modify_first_read_only to True enables "legacy mode" """ super(PairedEndPipeline, self).__init__() self._modifiers2 = [] self._pair_filter_mode = pair_filter_mode self._modify_first_read_only = modify_first_read_only self._add_both_called = False self._should_warn_legacy = False self._reader = None def set_input(self, *args, **kwargs): super(PairedEndPipeline, self).set_input(*args, **kwargs) if not self._reader.delivers_qualities: self._modifiers2 = [m for m in self._modifiers2 if not isinstance(m, ZeroCapper)] def add(self, modifier): """ Add a modifier for R1 and R2. If modify_first_read_only is True, the modifier is *not* added for R2. """ self._modifiers.append(modifier) if not self._modify_first_read_only: self._modifiers2.append(modifier) else: self._should_warn_legacy = True def add1(self, modifier): """Add a modifier for R1 only""" self._modifiers.append(modifier) def add2(self, modifier): """Add a modifier for R2 only""" assert not self._modify_first_read_only self._modifiers2.append(modifier) def process_reads(self): n = 0 # no. of processed reads total1_bp = 0 total2_bp = 0 for read1, read2 in self._reader: n += 1 total1_bp += len(read1.sequence) total2_bp += len(read2.sequence) for modifier in self._modifiers: read1 = modifier(read1) for modifier in self._modifiers2: read2 = modifier(read2) for filter in self._filters: # Stop writing as soon as one of the filters was successful. if filter(read1, read2): break return (n, total1_bp, total2_bp) @property def should_warn_legacy(self): return self._should_warn_legacy @should_warn_legacy.setter def should_warn_legacy(self, value): self._should_warn_legacy = bool(value) @property def paired(self): return 'first' if self._modify_first_read_only else 'both' def _filter_wrapper(self): return functools.partial(PairedRedirector, pair_filter_mode=self._pair_filter_mode) def _final_filter(self, outfiles): writer = self._open_writer(outfiles.out, outfiles.out2, interleaved=outfiles.interleaved) return PairedNoFilter(writer) def _create_demultiplexer(self, outfiles): return PairedEndDemultiplexer(outfiles.out, outfiles.out2, outfiles.untrimmed, outfiles.untrimmed2, qualities=self.uses_qualities, colorspace=self._colorspace) def available_cpu_count(): """ Return the number of available virtual or physical CPUs on this system. The number of available CPUs can be smaller than the total number of CPUs when the cpuset(7) mechanism is in use, as is the case on some cluster systems. Adapted from http://stackoverflow.com/a/1006301/715090 """ try: with open('/proc/self/status') as f: status = f.read() m = re.search(r'(?m)^Cpus_allowed:\s*(.*)$', status) if m: res = bin(int(m.group(1).replace(',', ''), 16)).count('1') if res > 0: return min(res, multiprocessing.cpu_count()) except IOError: pass return multiprocessing.cpu_count() def reader_process(file, file2, connections, queue, buffer_size, stdin_fd): """ Read chunks of FASTA or FASTQ data from *file* and send to a worker. queue -- a Queue of worker indices. A worker writes its own index into this queue to notify the reader that it is ready to receive more data. connections -- a list of Connection objects, one for each worker. The function repeatedly - reads a chunk from the file - reads a worker index from the Queue - sends the chunk to connections[index] and finally sends "poison pills" (the value -1) to all connections. """ if stdin_fd != -1: sys.stdin = os.fdopen(stdin_fd) try: with xopen(file, 'rb') as f: if file2: with xopen(file2, 'rb') as f2: for chunk_index, (chunk1, chunk2) in enumerate(read_paired_chunks(f, f2, buffer_size)): # Determine the worker that should get this chunk worker_index = queue.get() pipe = connections[worker_index] pipe.send(chunk_index) pipe.send_bytes(chunk1) pipe.send_bytes(chunk2) else: for chunk_index, chunk in enumerate(read_chunks_from_file(f, buffer_size)): # Determine the worker that should get this chunk worker_index = queue.get() pipe = connections[worker_index] pipe.send(chunk_index) pipe.send_bytes(chunk) # Send poison pills to all workers for _ in range(len(connections)): worker_index = queue.get() connections[worker_index].send(-1) except Exception as e: # TODO better send this to a common "something went wrong" Queue for worker_index in range(len(connections)): connections[worker_index].send(-2) connections[worker_index].send((e, traceback.format_exc())) class WorkerProcess(Process): """ The worker repeatedly reads chunks of data from the read_pipe, runs the pipeline on it and sends the processed chunks to the write_pipe. To notify the reader process that it wants data, it puts its own identifier into the need_work_queue before attempting to read data from the read_pipe. """ def __init__(self, id_, pipeline, filtering_options, input_path1, input_path2, interleaved_input, orig_outfiles, read_pipe, write_pipe, need_work_queue): super(WorkerProcess, self).__init__() self._id = id_ self._pipeline = pipeline self._filtering_options = filtering_options self._input_path1 = input_path1 self._input_path2 = input_path2 self._interleaved_input = interleaved_input self._orig_outfiles = orig_outfiles self._read_pipe = read_pipe self._write_pipe = write_pipe self._need_work_queue = need_work_queue def run(self): try: stats = Statistics() while True: # Notify reader that we need data self._need_work_queue.put(self._id) chunk_index = self._read_pipe.recv() if chunk_index == -1: # reader is done break elif chunk_index == -2: # An exception has occurred in the reader e, tb_str = self._read_pipe.recv() logger.error('%s', tb_str) raise e # Setting the .buffer.name attributess below is necessary because # file format detection uses the file name data = self._read_pipe.recv_bytes() input = io.TextIOWrapper(io.BytesIO(data), encoding='ascii') input.buffer.name = self._input_path1 if self._input_path2: data = self._read_pipe.recv_bytes() input2 = io.TextIOWrapper(io.BytesIO(data), encoding='ascii') input2.buffer.name = self._input_path2 else: input2 = None output = io.TextIOWrapper(io.BytesIO(), encoding='ascii') output.buffer.name = self._orig_outfiles.out.name if self._orig_outfiles.out2 is not None: output2 = io.TextIOWrapper(io.BytesIO(), encoding='ascii') output2.buffer.name = self._orig_outfiles.out2.name else: output2 = None outfiles = OutputFiles(out=output, out2=output2, interleaved=self._orig_outfiles.interleaved) self._pipeline.set_input(input, input2, interleaved=self._interleaved_input) self._pipeline.set_output(outfiles, *self._filtering_options[0], **self._filtering_options[1]) (n, bp1, bp2) = self._pipeline.process_reads() cur_stats = Statistics() cur_stats.collect(n, bp1, bp2, [], [], self._pipeline._filters) stats += cur_stats output.flush() processed_chunk = output.buffer.getvalue() self._write_pipe.send(chunk_index) self._write_pipe.send_bytes(processed_chunk) if self._orig_outfiles.out2 is not None: output2.flush() processed_chunk2 = output2.buffer.getvalue() self._write_pipe.send_bytes(processed_chunk2) m = self._pipeline._modifiers m2 = getattr(self._pipeline, '_modifiers2', []) modifier_stats = Statistics() modifier_stats.collect(0, 0, 0 if self._pipeline.paired else None, m, m2, []) stats += modifier_stats self._write_pipe.send(-1) self._write_pipe.send(stats) except Exception as e: self._write_pipe.send(-2) self._write_pipe.send((e, traceback.format_exc())) class OrderedChunkWriter(object): """ We may receive chunks of processed data from worker processes in any order. This class writes them to an output file in the correct order. """ def __init__(self, outfile): self._chunks = dict() self._current_index = 0 self._outfile = outfile def write(self, data, chunk_index): """ """ self._chunks[chunk_index] = data while self._current_index in self._chunks: # TODO 1) do not decode 2) use .buffer.write self._outfile.write(self._chunks[self._current_index].decode('utf-8')) del self._chunks[self._current_index] self._current_index += 1 def wrote_everything(self): return not self._chunks class ParallelPipelineRunner(object): """ Wrap a SingleEndPipeline, running it in parallel - When set_input() is called, a reader process is spawned. - When run() is called, as many worker processes as requested are spawned. - In the main process, results are written to the output files in the correct order, and statistics are aggregated. If a worker needs work, it puts its own index into a Queue() (_need_work_queue). The reader process listens on this queue and sends the raw data to the worker that has requested work. For sending the data from reader to worker, a Connection() is used. There is one such connection for each worker (self._pipes). For sending the processed data from the worker to the main process, there is a second set of connections, again one for each worker. When the reader is finished, it sends 'poison pills' to all workers. When a worker receives this, it sends a poison pill to the main process, followed by a Statistics object that contains statistics about all the reads processed by that worker. """ def __init__(self, pipeline, n_workers, buffer_size=4*1024**2): self._pipeline = pipeline self._pipes = [] # the workers read from these self._reader_process = None self._filtering_options = None self._outfiles = None self._input_path1 = None self._input_path2 = None self._interleaved_input = None self._n_workers = n_workers self._need_work_queue = Queue() self._buffer_size = buffer_size def set_input(self, file1, file2=None, qualfile=None, colorspace=False, fileformat=None, interleaved=False): if self._reader_process is not None: raise RuntimeError('Do not call set_input more than once') assert qualfile is None and colorspace is False and fileformat is None self._input_path1 = file1 if type(file1) is str else file1.name self._input_path2 = file2 if type(file2) is str or file2 is None else file2.name self._interleaved_input = interleaved connections = [Pipe(duplex=False) for _ in range(self._n_workers)] self._pipes, connw = zip(*connections) try: fileno = sys.stdin.fileno() except io.UnsupportedOperation: # This happens during tests: pytest sets sys.stdin to an object # that does not have a file descriptor. fileno = -1 self._reader_process = Process(target=reader_process, args=(file1, file2, connw, self._need_work_queue, self._buffer_size, fileno)) self._reader_process.daemon = True self._reader_process.start() @staticmethod def can_output_to(outfiles): return ( outfiles.out is not None and outfiles.rest is None and outfiles.info is None and outfiles.wildcard is None and outfiles.too_short is None and outfiles.too_short2 is None and outfiles.too_long is None and outfiles.too_long2 is None and outfiles.untrimmed is None and outfiles.untrimmed2 is None and not outfiles.demultiplex ) def set_output(self, outfiles, *args, **kwargs): if not self.can_output_to(outfiles): raise ValueError() self._filtering_options = args, kwargs self._outfiles = outfiles def _start_workers(self): workers = [] connections = [] for index in range(self._n_workers): conn_r, conn_w = Pipe(duplex=False) connections.append(conn_r) worker = WorkerProcess(index, self._pipeline, self._filtering_options, self._input_path1, self._input_path2, self._interleaved_input, self._outfiles, self._pipes[index], conn_w, self._need_work_queue) worker.daemon = True worker.start() workers.append(worker) return workers, connections def run(self): workers, connections = self._start_workers() writers = [] for outfile in [self._outfiles.out, self._outfiles.out2]: if outfile is None: continue writers.append(OrderedChunkWriter(outfile)) stats = None while connections: ready_connections = multiprocessing.connection.wait(connections) for connection in ready_connections: chunk_index = connection.recv() if chunk_index == -1: # the worker is done cur_stats = connection.recv() if stats == -2: # An exception has occurred in the worker (see below, # this happens only when there is an exception sending # the statistics) e, tb_str = connection.recv() # TODO traceback should only be printed in development logger.error('%s', tb_str) raise e if stats is None: stats = cur_stats else: stats += cur_stats connections.remove(connection) continue elif chunk_index == -2: # An exception has occurred in the worker e, tb_str = connection.recv() logger.error('%s', tb_str) # We should use the worker's actual traceback object # here, but traceback objects are not picklable. raise e for writer in writers: data = connection.recv_bytes() writer.write(data, chunk_index) for writer in writers: assert writer.wrote_everything() for w in workers: w.join() self._reader_process.join() return stats def close(self): for f in self._outfiles: # TODO do not use hasattr if f is not None and f is not sys.stdin and f is not sys.stdout and hasattr(f, 'close'): f.close() cutadapt-1.15/src/cutadapt.egg-info/0000775000175000017500000000000013205527004020063 5ustar marcelmarcel00000000000000cutadapt-1.15/src/cutadapt.egg-info/PKG-INFO0000664000175000017500000000542513205527004021166 0ustar marcelmarcel00000000000000Metadata-Version: 1.1 Name: cutadapt Version: 1.15 Summary: trim adapters from high-throughput sequencing reads Home-page: https://cutadapt.readthedocs.io/ Author: Marcel Martin Author-email: marcel.martin@scilifelab.se License: MIT Description: .. image:: https://travis-ci.org/marcelm/cutadapt.svg?branch=master :target: https://travis-ci.org/marcelm/cutadapt .. image:: https://img.shields.io/pypi/v/cutadapt.svg?branch=master :target: https://pypi.python.org/pypi/cutadapt ======== cutadapt ======== Cutadapt finds and removes adapter sequences, primers, poly-A tails and other types of unwanted sequence from your high-throughput sequencing reads. Cleaning your data in this way is often required: Reads from small-RNA sequencing contain the 3’ sequencing adapter because the read is longer than the molecule that is sequenced. Amplicon reads start with a primer sequence. Poly-A tails are useful for pulling out RNA from your sample, but often you don’t want them to be in your reads. Cutadapt helps with these trimming tasks by finding the adapter or primer sequences in an error-tolerant way. It can also modify and filter reads in various ways. Adapter sequences can contain IUPAC wildcard characters. Also, paired-end reads and even colorspace data is supported. If you want, you can also just demultiplex your input data, without removing adapter sequences at all. Cutadapt comes with an extensive suite of automated tests and is available under the terms of the MIT license. If you use cutadapt, please cite `DOI:10.14806/ej.17.1.200 `_ . Links ----- * `Documentation `_ * `Source code `_ * `Report an issue `_ * `Project page on PyPI (Python package index) `_ * `Follow @marcelm_ on Twitter `_ * `Wrapper for the Galaxy platform `_ Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Console Classifier: Intended Audience :: Science/Research Classifier: License :: OSI Approved :: MIT License Classifier: Natural Language :: English Classifier: Programming Language :: Cython Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Topic :: Scientific/Engineering :: Bio-Informatics cutadapt-1.15/src/cutadapt.egg-info/entry_points.txt0000664000175000017500000000006513205527004023362 0ustar marcelmarcel00000000000000[console_scripts] cutadapt = cutadapt.__main__:main cutadapt-1.15/src/cutadapt.egg-info/dependency_links.txt0000664000175000017500000000000113205527004024131 0ustar marcelmarcel00000000000000 cutadapt-1.15/src/cutadapt.egg-info/SOURCES.txt0000664000175000017500000001320713205527004021752 0ustar marcelmarcel00000000000000CHANGES.rst CITATION LICENSE MANIFEST.in README.rst setup.cfg setup.py versioneer.py doc/Makefile doc/changes.rst doc/colorspace.rst doc/conf.py doc/develop.rst doc/guide.rst doc/ideas.rst doc/index.rst doc/installation.rst doc/recipes.rst src/cutadapt/__init__.py src/cutadapt/__main__.py src/cutadapt/_align.c src/cutadapt/_align.pyx src/cutadapt/_qualtrim.c src/cutadapt/_qualtrim.pyx src/cutadapt/_seqio.c src/cutadapt/_seqio.pyx src/cutadapt/_version.py src/cutadapt/adapters.py src/cutadapt/align.py src/cutadapt/colorspace.py src/cutadapt/compat.py src/cutadapt/filters.py src/cutadapt/modifiers.py src/cutadapt/pipeline.py src/cutadapt/qualtrim.py src/cutadapt/report.py src/cutadapt/seqio.py src/cutadapt.egg-info/PKG-INFO src/cutadapt.egg-info/SOURCES.txt src/cutadapt.egg-info/dependency_links.txt src/cutadapt.egg-info/entry_points.txt src/cutadapt.egg-info/requires.txt src/cutadapt.egg-info/top_level.txt tests/test_adapters.py tests/test_align.py tests/test_colorspace.py tests/test_commandline.py tests/test_filters.py tests/test_modifiers.py tests/test_paired.py tests/test_qualtrim.py tests/test_seqio.py tests/test_trim.py tests/utils.py tests/cut/454.fa tests/cut/SRR2040271_1.fastq tests/cut/anchored-back.fasta tests/cut/anchored.fasta tests/cut/anchored_no_indels.fasta tests/cut/anchored_no_indels_wildcard.fasta tests/cut/anywhere_repeat.fastq tests/cut/demultiplexed.first.1.fastq tests/cut/demultiplexed.first.2.fastq tests/cut/demultiplexed.second.1.fastq tests/cut/demultiplexed.second.2.fastq tests/cut/demultiplexed.unknown.1.fastq tests/cut/demultiplexed.unknown.2.fastq tests/cut/discard-untrimmed.fastq tests/cut/discard.fastq tests/cut/dos.fastq tests/cut/empty.fastq tests/cut/example.fa tests/cut/examplefront.fa tests/cut/illumina.fastq tests/cut/illumina.info.txt tests/cut/illumina5.fastq tests/cut/illumina5.info.txt tests/cut/illumina64.fastq tests/cut/interleaved.fastq tests/cut/issue46.fasta tests/cut/linked-anchored.fasta tests/cut/linked-discard-g.fasta tests/cut/linked-discard.fasta tests/cut/linked-not-anchored.fasta tests/cut/linked.fasta tests/cut/lowercase.fastq tests/cut/lowqual.fastq tests/cut/maxlen.fa tests/cut/maxn0.2.fasta tests/cut/maxn0.4.fasta tests/cut/maxn0.fasta tests/cut/maxn1.fasta tests/cut/maxn2.fasta tests/cut/minlen.fa tests/cut/minlen.noprimer.fa tests/cut/nextseq.fastq tests/cut/no-trim.fastq tests/cut/no_indels.fasta tests/cut/overlapa.fa tests/cut/overlapb.fa tests/cut/paired-filterboth.1.fastq tests/cut/paired-filterboth.2.fastq tests/cut/paired-m27.1.fastq tests/cut/paired-m27.2.fastq tests/cut/paired-onlyA.1.fastq tests/cut/paired-onlyA.2.fastq tests/cut/paired-separate.1.fastq tests/cut/paired-separate.2.fastq tests/cut/paired-too-short.1.fastq tests/cut/paired-too-short.2.fastq tests/cut/paired-trimmed.1.fastq tests/cut/paired-trimmed.2.fastq tests/cut/paired-untrimmed.1.fastq tests/cut/paired-untrimmed.2.fastq tests/cut/paired.1.fastq tests/cut/paired.2.fastq tests/cut/paired.m14.1.fastq tests/cut/paired.m14.2.fastq tests/cut/pairedq.1.fastq tests/cut/pairedq.2.fastq tests/cut/pairedu.1.fastq tests/cut/pairedu.2.fastq tests/cut/plus.fastq tests/cut/polya.fasta tests/cut/rest.fa tests/cut/restfront.fa tests/cut/s_1_sequence.txt tests/cut/shortened.fastq tests/cut/small-no-trim.fasta tests/cut/small.fasta tests/cut/small.fastq tests/cut/small.trimmed.fastq tests/cut/small.untrimmed.fastq tests/cut/solid-no-zerocap.fastq tests/cut/solid.fasta tests/cut/solid.fastq tests/cut/solid5p-anchored.fasta tests/cut/solid5p-anchored.fastq tests/cut/solid5p-anchored.notrim.fasta tests/cut/solid5p-anchored.notrim.fastq tests/cut/solid5p.fasta tests/cut/solid5p.fastq tests/cut/solidbfast.fastq tests/cut/solidmaq.fastq tests/cut/solidqual.fastq tests/cut/sra.fastq tests/cut/stripped.fasta tests/cut/suffix.fastq tests/cut/trimN3.fasta tests/cut/trimN5.fasta tests/cut/twoadapters.fasta tests/cut/twoadapters.first.fasta tests/cut/twoadapters.second.fasta tests/cut/twoadapters.unknown.fasta tests/cut/unconditional-back.fastq tests/cut/unconditional-both.fastq tests/cut/unconditional-front.fastq tests/cut/wildcard.fa tests/cut/wildcardN.fa tests/cut/wildcard_adapter.fa tests/cut/wildcard_adapter_anywhere.fa tests/data/454.fa tests/data/E3M.fasta tests/data/E3M.qual tests/data/SRR2040271_1.fastq tests/data/adapter.fasta tests/data/anchored-back.fasta tests/data/anchored.fasta tests/data/anchored_no_indels.fasta tests/data/anywhere_repeat.fastq tests/data/dos.fastq tests/data/empty.fastq tests/data/example.fa tests/data/illumina.fastq.gz tests/data/illumina5.fastq tests/data/illumina64.fastq tests/data/interleaved.fastq tests/data/issue46.fasta tests/data/lengths.fa tests/data/linked.fasta tests/data/lowqual.fastq tests/data/maxn.fasta tests/data/multiblock.fastq.bz2 tests/data/multiblock.fastq.gz tests/data/nextseq.fastq tests/data/no_indels.fasta tests/data/overlapa.fa tests/data/overlapb.fa tests/data/paired.1.fastq tests/data/paired.2.fastq tests/data/plus.fastq tests/data/polya.fasta tests/data/prefix-adapter.fasta tests/data/rest.fa tests/data/rest.txt tests/data/restfront.txt tests/data/s_1_sequence.txt.gz tests/data/simple.fasta tests/data/simple.fastq tests/data/small.fastq tests/data/small.fastq.bz2 tests/data/small.fastq.gz tests/data/small.fastq.xz tests/data/small.myownextension tests/data/solid.csfasta tests/data/solid.fasta tests/data/solid.fastq tests/data/solid.qual tests/data/solid5p.fasta tests/data/solid5p.fastq tests/data/sra.fastq tests/data/suffix-adapter.fasta tests/data/toolong.fa tests/data/tooshort.fa tests/data/tooshort.noprimer.fa tests/data/trimN3.fasta tests/data/trimN5.fasta tests/data/twoadapters.fasta tests/data/wildcard.fa tests/data/wildcardN.fa tests/data/wildcard_adapter.fa tests/data/withplus.fastqcutadapt-1.15/src/cutadapt.egg-info/top_level.txt0000664000175000017500000000001113205527004022605 0ustar marcelmarcel00000000000000cutadapt cutadapt-1.15/src/cutadapt.egg-info/requires.txt0000664000175000017500000000001513205527004022457 0ustar marcelmarcel00000000000000xopen>=0.3.2 cutadapt-1.15/tests/0000775000175000017500000000000013205527004015137 5ustar marcelmarcel00000000000000cutadapt-1.15/tests/test_commandline.py0000664000175000017500000003431213205526454021051 0ustar marcelmarcel00000000000000# coding: utf-8 # TODO # test with the --output option # test reading from standard input from __future__ import print_function, division, absolute_import import os import shutil import subprocess import sys import tempfile from nose.tools import raises from cutadapt.__main__ import main from cutadapt.compat import StringIO from utils import run, assert_files_equal, datapath, cutpath, redirect_stderr, temporary_path def test_example(): run('-N -b ADAPTER', 'example.fa', 'example.fa') def test_small(): run('-b TTAGACATATCTCCGTCG', 'small.fastq', 'small.fastq') def test_empty(): """empty input""" run('-a TTAGACATATCTCCGTCG', 'empty.fastq', 'empty.fastq') def test_newlines(): """DOS/Windows newlines""" run('-e 0.12 -b TTAGACATATCTCCGTCG', 'dos.fastq', 'dos.fastq') def test_lowercase(): """lowercase adapter""" run('-b ttagacatatctccgtcg', 'lowercase.fastq', 'small.fastq') def test_rest(): """-r/--rest-file""" with temporary_path('rest.tmp') as rest_tmp: run(['-b', 'ADAPTER', '-N', '-r', rest_tmp], "rest.fa", "rest.fa") assert_files_equal(datapath('rest.txt'), rest_tmp) def test_restfront(): with temporary_path("rest.txt") as path: run(['-g', 'ADAPTER', '-N', '-r', path], "restfront.fa", "rest.fa") assert_files_equal(datapath('restfront.txt'), path) def test_discard(): """--discard""" run("-b TTAGACATATCTCCGTCG --discard", "discard.fastq", "small.fastq") def test_discard_untrimmed(): """--discard-untrimmed""" run('-b CAAGAT --discard-untrimmed', 'discard-untrimmed.fastq', 'small.fastq') def test_plus(): """test if sequence name after the "+" is retained""" run("-e 0.12 -b TTAGACATATCTCCGTCG", "plus.fastq", "plus.fastq") def test_extensiontxtgz(): """automatic recognition of "_sequence.txt.gz" extension""" run("-b TTAGACATATCTCCGTCG", "s_1_sequence.txt", "s_1_sequence.txt.gz") def test_format(): """the -f/--format parameter""" run("-f fastq -b TTAGACATATCTCCGTCG", "small.fastq", "small.myownextension") def test_minimum_length(): """-m/--minimum-length""" run("-c -m 5 -a 330201030313112312", "minlen.fa", "lengths.fa") def test_too_short(): """--too-short-output""" run("-c -m 5 -a 330201030313112312 --too-short-output tooshort.tmp.fa", "minlen.fa", "lengths.fa") assert_files_equal(datapath('tooshort.fa'), "tooshort.tmp.fa") os.remove('tooshort.tmp.fa') def test_too_short_no_primer(): """--too-short-output and --trim-primer""" run("-c -m 5 -a 330201030313112312 --trim-primer --too-short-output tooshort.tmp.fa", "minlen.noprimer.fa", "lengths.fa") assert_files_equal(datapath('tooshort.noprimer.fa'), "tooshort.tmp.fa") os.remove('tooshort.tmp.fa') def test_maximum_length(): """-M/--maximum-length""" run("-c -M 5 -a 330201030313112312", "maxlen.fa", "lengths.fa") def test_too_long(): """--too-long-output""" run("-c -M 5 --too-long-output toolong.tmp.fa -a 330201030313112312", "maxlen.fa", "lengths.fa") assert_files_equal(datapath('toolong.fa'), "toolong.tmp.fa") os.remove('toolong.tmp.fa') def test_length_tag(): """454 data; -n and --length-tag""" run("-n 3 -e 0.1 --length-tag length= " "-b TGAGACACGCAACAGGGGAAAGGCAAGGCACACAGGGGATAGG " "-b TCCATCTCATCCCTGCGTGTCCCATCTGTTCCCTCCCTGTCTCA", '454.fa', '454.fa') def test_overlap_a(): """-O/--overlap with -a (-c omitted on purpose)""" run("-O 10 -a 330201030313112312 -e 0.0 -N", "overlapa.fa", "overlapa.fa") def test_overlap_b(): """-O/--overlap with -b""" run("-O 10 -b TTAGACATATCTCCGTCG -N", "overlapb.fa", "overlapb.fa") def test_qualtrim(): """-q with low qualities""" run("-q 10 -a XXXXXX", "lowqual.fastq", "lowqual.fastq") def test_qualbase(): """-q with low qualities, using ascii(quality+64) encoding""" run("-q 10 --quality-base 64 -a XXXXXX", "illumina64.fastq", "illumina64.fastq") def test_quality_trim_only(): """only trim qualities, do not remove adapters""" run("-q 10 --quality-base 64", "illumina64.fastq", "illumina64.fastq") def test_twoadapters(): """two adapters""" run("-a AATTTCAGGAATT -a GTTCTCTAGTTCT", "twoadapters.fasta", "twoadapters.fasta") def test_polya(): """poly-A tails""" run("-m 24 -O 10 -a AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "polya.fasta", "polya.fasta") def test_polya_brace_notation(): """poly-A tails""" run("-m 24 -O 10 -a A{35}", "polya.fasta", "polya.fasta") def test_mask_adapter(): """mask adapter with N (reads maintain the same length)""" run("-b CAAG -n 3 --mask-adapter", "anywhere_repeat.fastq", "anywhere_repeat.fastq") def test_gz_multiblock(): """compressed gz file with multiple blocks (created by concatenating two .gz files)""" run("-b TTAGACATATCTCCGTCG", "small.fastq", "multiblock.fastq.gz") def test_suffix(): """-y/--suffix parameter, combined with _F3""" run("-c -e 0.12 -a 1=330201030313112312 -y _my_suffix_{name} --strip-f3", "suffix.fastq", "solid.csfasta", 'solid.qual') def test_read_wildcard(): """test wildcards in reads""" run("--match-read-wildcards -b ACGTACGT", "wildcard.fa", "wildcard.fa") def test_adapter_wildcard(): """wildcards in adapter""" for adapter_type, expected in ( ("-a", "wildcard_adapter.fa"), ("-b", "wildcard_adapter_anywhere.fa")): with temporary_path("wildcardtmp.txt") as wildcardtmp: run("--wildcard-file {0} {1} ACGTNNNACGT".format(wildcardtmp, adapter_type), expected, "wildcard_adapter.fa") with open(wildcardtmp) as wct: lines = wct.readlines() lines = [ line.strip() for line in lines ] assert lines == ['AAA 1', 'GGG 2', 'CCC 3b', 'TTT 4b'] def test_wildcard_N(): """test 'N' wildcard matching with no allowed errors""" run("-e 0 -a GGGGGGG --match-read-wildcards", "wildcardN.fa", "wildcardN.fa") def test_illumina_adapter_wildcard(): run("-a VCCGAMCYUCKHRKDCUBBCNUWNSGHCGU", "illumina.fastq", "illumina.fastq.gz") def test_adapter_front(): """test adapter in front""" run("--front ADAPTER -N", "examplefront.fa", "example.fa") def test_literal_N(): """test matching literal 'N's""" run("-N -e 0.2 -a NNNNNNNNNNNNNN", "trimN3.fasta", "trimN3.fasta") def test_literal_N2(): run("-N -O 1 -g NNNNNNNNNNNNNN", "trimN5.fasta", "trimN5.fasta") def test_literal_N_brace_notation(): """test matching literal 'N's""" run("-N -e 0.2 -a N{14}", "trimN3.fasta", "trimN3.fasta") def test_literal_N2_brace_notation(): run("-N -O 1 -g N{14}", "trimN5.fasta", "trimN5.fasta") def test_anchored_front(): run("-g ^FRONTADAPT -N", "anchored.fasta", "anchored.fasta") def test_anchored_front_ellipsis_notation(): run("-a FRONTADAPT... -N", "anchored.fasta", "anchored.fasta") def test_anchored_back(): run("-a BACKADAPTER$ -N", "anchored-back.fasta", "anchored-back.fasta") def test_anchored_back_ellipsis_notation(): run("-a ...BACKADAPTER$ -N", "anchored-back.fasta", "anchored-back.fasta") def test_anchored_back_no_indels(): run("-a BACKADAPTER$ -N --no-indels", "anchored-back.fasta", "anchored-back.fasta") def test_no_indels(): run('-a TTAGACATAT -g GAGATTGCCA --no-indels', 'no_indels.fasta', 'no_indels.fasta') def test_ellipsis_notation(): run('-a ...TTAGACATAT -g GAGATTGCCA --no-indels', 'no_indels.fasta', 'no_indels.fasta') def test_issue_46(): """issue 46 - IndexError with --wildcard-file""" with temporary_path("wildcardtmp.txt") as wildcardtmp: run("--anywhere=AACGTN --wildcard-file={0}".format(wildcardtmp), "issue46.fasta", "issue46.fasta") def test_strip_suffix(): run("--strip-suffix _sequence -a XXXXXXX", "stripped.fasta", "simple.fasta") def test_info_file(): # The true adapter sequence in the illumina.fastq.gz data set is # GCCTAACTTCTTAGACTGCCTTAAGGACGT (fourth base is different) # with temporary_path("infotmp.txt") as infotmp: run(["--info-file", infotmp, '-a', 'adapt=GCCGAACTTCTTAGACTGCCTTAAGGACGT'], "illumina.fastq", "illumina.fastq.gz") assert_files_equal(cutpath('illumina.info.txt'), infotmp) def test_info_file_times(): with temporary_path("infotmp.txt") as infotmp: run(["--info-file", infotmp, '--times', '2', '-a', 'adapt=GCCGAACTTCTTA', '-a', 'adapt2=GACTGCCTTAAGGACGT'], "illumina5.fastq", "illumina5.fastq") assert_files_equal(cutpath('illumina5.info.txt'), infotmp) def test_info_file_fasta(): with temporary_path("infotmp.txt") as infotmp: # Just make sure that it runs run(['--info-file', infotmp, '-a', 'TTAGACATAT', '-g', 'GAGATTGCCA', '--no-indels'], 'no_indels.fasta', 'no_indels.fasta') def test_named_adapter(): run("-a MY_ADAPTER=GCCGAACTTCTTAGACTGCCTTAAGGACGT", "illumina.fastq", "illumina.fastq.gz") def test_adapter_with_u(): run("-a GCCGAACUUCUUAGACUGCCUUAAGGACGU", "illumina.fastq", "illumina.fastq.gz") def test_no_trim(): run("--no-trim --discard-untrimmed -a CCCTAGTTAAAC", 'no-trim.fastq', 'small.fastq') def test_bzip2(): run('-b TTAGACATATCTCCGTCG', 'small.fastq', 'small.fastq.bz2') if sys.version_info[:2] >= (3, 3): def test_bzip2_multiblock(): run('-b TTAGACATATCTCCGTCG', 'small.fastq', 'multiblock.fastq.bz2') try: import lzma def test_xz(): run('-b TTAGACATATCTCCGTCG', 'small.fastq', 'small.fastq.xz') except ImportError: pass @raises(SystemExit) def test_qualfile_only(): with redirect_stderr(): main(['file.qual']) @raises(SystemExit) def test_no_args(): with redirect_stderr(): main([]) @raises(SystemExit) def test_two_fastqs(): with redirect_stderr(): main([datapath('paired.1.fastq'), datapath('paired.2.fastq')]) def test_anchored_no_indels(): """anchored 5' adapter, mismatches only (no indels)""" run('-g ^TTAGACATAT --no-indels -e 0.1', 'anchored_no_indels.fasta', 'anchored_no_indels.fasta') def test_anchored_no_indels_wildcard_read(): """anchored 5' adapter, mismatches only (no indels), but wildcards in the read count as matches""" run('-g ^TTAGACATAT --match-read-wildcards --no-indels -e 0.1', 'anchored_no_indels_wildcard.fasta', 'anchored_no_indels.fasta') def test_anchored_no_indels_wildcard_adapt(): """anchored 5' adapter, mismatches only (no indels), but wildcards in the adapter count as matches""" run('-g ^TTAGACANAT --no-indels -e 0.1', 'anchored_no_indels.fasta', 'anchored_no_indels.fasta') @raises(SystemExit) def test_non_iupac_characters(): with redirect_stderr(): main(['-a', 'ZACGT', datapath('small.fastq')]) def test_unconditional_cut_front(): run('-u 5', 'unconditional-front.fastq', 'small.fastq') def test_unconditional_cut_back(): run('-u -5', 'unconditional-back.fastq', 'small.fastq') def test_unconditional_cut_both(): run('-u -5 -u 5', 'unconditional-both.fastq', 'small.fastq') def test_untrimmed_output(): with temporary_path('untrimmed.tmp.fastq') as tmp: run(['-a', 'TTAGACATATCTCCGTCG', '--untrimmed-output', tmp], 'small.trimmed.fastq', 'small.fastq') assert_files_equal(cutpath('small.untrimmed.fastq'), tmp) def test_adapter_file(): run('-a file:' + datapath('adapter.fasta'), 'illumina.fastq', 'illumina.fastq.gz') def test_adapter_file_5p_anchored(): run('-N -g file:' + datapath('prefix-adapter.fasta'), 'anchored.fasta', 'anchored.fasta') def test_adapter_file_3p_anchored(): run('-N -a file:' + datapath('suffix-adapter.fasta'), 'anchored-back.fasta', 'anchored-back.fasta') def test_adapter_file_5p_anchored_no_indels(): run('-N --no-indels -g file:' + datapath('prefix-adapter.fasta'), 'anchored.fasta', 'anchored.fasta') def test_adapter_file_3p_anchored_no_indels(): run('-N --no-indels -a file:' + datapath('suffix-adapter.fasta'), 'anchored-back.fasta', 'anchored-back.fasta') def test_demultiplex(): tempdir = tempfile.mkdtemp(prefix='cutadapt-tests.') multiout = os.path.join(tempdir, 'tmp-demulti.{name}.fasta') params = ['-a', 'first=AATTTCAGGAATT', '-a', 'second=GTTCTCTAGTTCT', '-o', multiout, datapath('twoadapters.fasta')] assert main(params) is None assert_files_equal(cutpath('twoadapters.first.fasta'), multiout.format(name='first')) assert_files_equal(cutpath('twoadapters.second.fasta'), multiout.format(name='second')) assert_files_equal(cutpath('twoadapters.unknown.fasta'), multiout.format(name='unknown')) shutil.rmtree(tempdir) def test_max_n(): run('--max-n 0', 'maxn0.fasta', 'maxn.fasta') run('--max-n 1', 'maxn1.fasta', 'maxn.fasta') run('--max-n 2', 'maxn2.fasta', 'maxn.fasta') run('--max-n 0.2', 'maxn0.2.fasta', 'maxn.fasta') run('--max-n 0.4', 'maxn0.4.fasta', 'maxn.fasta') def test_quiet_is_quiet(): captured_standard_output = StringIO() captured_standard_error = StringIO() old_stdout = sys.stdout old_stderr = sys.stderr try: sys.stdout = captured_standard_output sys.stderr = captured_standard_error main(['-o', '/dev/null', '--quiet', '-a', 'XXXX', datapath('illumina.fastq.gz')]) finally: sys.stdout = old_stdout sys.stderr = old_stderr assert captured_standard_output.getvalue() == '' assert captured_standard_error.getvalue() == '' def test_nextseq(): run('--nextseq-trim 22', 'nextseq.fastq', 'nextseq.fastq') def test_linked(): run('-a AAAAAAAAAA...TTTTTTTTTT', 'linked.fasta', 'linked.fasta') def test_linked_explicitly_anchored(): run('-a ^AAAAAAAAAA...TTTTTTTTTT', 'linked.fasta', 'linked.fasta') def test_linked_multiple(): run('-a AAAAAAAAAA...TTTTTTTTTT -a AAAAAAAAAA...GCGCGCGCGC', 'linked.fasta', 'linked.fasta') def test_linked_both_anchored(): run('-a AAAAAAAAAA...TTTTT$', 'linked-anchored.fasta', 'linked.fasta') def test_linked_5p_not_anchored(): run('-g AAAAAAAAAA...TTTTTTTTTT', 'linked-not-anchored.fasta', 'linked.fasta') def test_linked_discard_untrimmed(): run('-a AAAAAAAAAA...TTTTTTTTTT --discard-untrimmed', 'linked-discard.fasta', 'linked.fasta') def test_linked_discard_untrimmed_g(): run('-g AAAAAAAAAA...TTTTTTTTTT --discard-untrimmed', 'linked-discard-g.fasta', 'linked.fasta') @raises(SystemExit) def test_linked_anywhere(): with redirect_stderr(): main(['-b', 'AAA...TTT', datapath('linked.fasta')]) @raises(SystemExit) def test_anywhere_anchored_5p(): with redirect_stderr(): main(['-b', '^AAA', datapath('small.fastq')]) @raises(SystemExit) def test_anywhere_anchored_3p(): with redirect_stderr(): main(['-b', 'TTT$', datapath('small.fastq')]) def test_fasta(): run('-a TTAGACATATCTCCGTCG', 'small.fasta', 'small.fastq') def test_fasta_no_trim(): run([], 'small-no-trim.fasta', 'small.fastq') def test_issue_202(): """Ensure --length-tag= also modifies the second header line""" run('-a GGCTTC --length-tag=length=', 'SRR2040271_1.fastq', 'SRR2040271_1.fastq') def test_length(): run('--length 5', 'shortened.fastq', 'small.fastq') def test_run_cutadapt_process(): subprocess.check_call(['cutadapt', '--version']) cutadapt-1.15/tests/cut/0000775000175000017500000000000013205527004015732 5ustar marcelmarcel00000000000000cutadapt-1.15/tests/cut/demultiplexed.first.1.fastq0000664000175000017500000000005513205526454023134 0ustar marcelmarcel00000000000000@read3/1 CCAACTTGATATTAAT + HHHHHHHHHHHHHHHH cutadapt-1.15/tests/cut/illumina5.info.txt0000664000175000017500000000347013205526454021340 0ustar marcelmarcel00000000000000SEQ:1:1101:9010:3891#0/1 adapter start: 51 0 64 81 ATAACCGGAGTAGTTGAAATGGTAATAAGACGACCAATCTGACCAGCAAGGGCCTAACTTCTTA GACTGCCTTAAGGACGT AAGCCAAGATGGGAAAGGTC adapt2 FFFFFEDBE@79@@>@CBCBFDBDFDDDDD<@C>ADD@B;5:978@CBDDFFDB4B?DB21;84 ?DDBC9DEBAB;=@<@@ B@@@@B>CCBBDE98>>0@7 SEQ:1:1101:9010:3891#0/1 adapter start: 51 1 51 64 ATAACCGGAGTAGTTGAAATGGTAATAAGACGACCAATCTGACCAGCAAGG GCCTAACTTCTTA adapt FFFFFEDBE@79@@>@CBCBFDBDFDDDDD<@C>ADD@B;5:978@CBDDF FDB4B?DB21;84 SEQ:1:1101:9240:3898#0/1 -1 CCAGCAAGGAAGCCAAGATGGGAAAGGTCATGCGGCATACGCTCGGCGCCAGTTTGAATATTAGACATAATTTATCCTCAAGTAAGGGGCCGAAGCCCCTG GHGHGHHHHGGGDHHGDCGFEEFHHGDFGEHHGFHHHHHGHEAFDHHGFHHEEFHGHFHHFHGEHFBHHFHHHH@GGGDGDFEEFC@=D?GBGFGF:FB6D SEQ:1:1101:9207:3899#0/1 adapter start: 64 0 77 94 TTAACTTCTCAGTAACAGATACAAACTCATCACGAACGTCAGAAGCAGCCTTATGGCCGTCAACGCCTAACTTCTTA GACTGCCTTAAGGACGT ATACATA adapt2 HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFHHHHHHCFHHFHHFHFFFFFBHHG HHHFFHHFHGGHHDEBF G70<,=: @1_14_177_F3 T31330222020233321121323302013303311 + :8957;;54)'98924905;;)6:7;1:3<88(9: @1_14_238_F3 T01331031200310022122230330201030313 + ?><5=;<<<12>=<;1;;=5);.;14:0>2;:3;7 @1_15_1098_F3 T + @1_16_404_F3 T03310320002130202331112133020103031 + 78;:;;><>9=9;<<2=><<1;58;9<<;>(<;<; @1_16_904_F3 T21230102331022312232132021122111212 + 9>=::6;;99=+/'$+#.#&%$&'(($1*$($.#. @1_16_1315_F3 T0323123111221033301031032330201000 + <9<8A?>?::;6&,%;6/)8<<#/;79(448&*. @1_16_1595_F3 T22323211312111230022210011213302012 + >,<=<>@6<;?<=>:/=.>&;;8;)17:=&,>1=+ @1_17_1379_F3 T32011212111223230232132311321200123 + /-1179<1;>>8:':7-%/::0&+=<29,7<8(,2 @1_18_1692_F3 T12322233031100211233323300112200210 + .#(###5%)%2)',2&:+#+&5,($/1#&4&))$6 @1_19_171_F3 T10101101220213201111011320201230 + )6:65/=3*:(8%)%2>&8&%;%0&#;$3$&: @1_22_72_F3 T133030323232212123013222333202 + 3/#678<:.=9::6:(<538295;9+;&*; @1_22_1377_F3 T22221333311222312201132312022322300 + )##0%.$.1*%,)95+%%14%$#8-###9-()#9+ @1_23_585_F3 T30010310310130312122123302013303131 + >55;8><96/18?)<3<58<5:;96=7:1=8=:-< @1_23_809_F3 T131301011010212110132203022233021 + :7<59@;<<5;/9;=<;7::.)&&&827(+221 @1_24_138_F3 T3321113010012032300203302012303131 + 6)68/;906#,25/&;<$0+250#2,<)5,9/+7 @1_24_206_F3 T33330332002223002020303331321221000 + ))4(&)9592)#)694(,)292:(=7$.18,()65 @1_25_143_F3 T2320200303120022030130330201220313 + :4;/#&<9;&*;95-7;85&;587#16>%&,9<2 @1_25_1866_F3 T03201321022131101112012330221130311 + =<>9;<@7?(=6,<&?=6=(=<641:?'<1=;':4 @1_27_584_F3 T10010330110103213112323303012103101 + 82'('*.-8+%#2)(-&3.,.2,),+.':&,'(&/ @1_27_1227_F3 T0200302212300100320100203130330201 + 492:;>A:<;34<<=);:<<;9=7<3::<::3=> @1_27_1350_F3 T1313010110102121101322022222130123 + 95,)<(4./;<938=64=+2/,.4),3':97#33 @1_29_477_F3 T13130101101021211013300302223 + 94=55:75=+:/7><968;;#&+$#3&6, @1_30_882_F3 T20102033000233133320103031311233200 + 2(+-:-3<;5##/;:(%&84'#:,?3&&8>-();5 @1_31_221_F3 T03301311201100030300100233220102031 + 89>9>5<139/,&:7969972.274&%:78&&746 @1_31_1313_F3 T01331131300330122321000101010330201 + ;3<7=7::)5*4=&;<7>4;795065;9';896'= @1_529_129_F3 T132222301020322102101322221322302.3302 + >>%/((B6-&5A0:6)>;'1)B*38/?(5=%B+!&<-9 cutadapt-1.15/tests/cut/linked-anchored.fasta0000664000175000017500000000062513205526454022014 0ustar marcelmarcel00000000000000>r1 5' adapter and 3' adapter AAAAAAAAAACCCCCCCCCCTTTTTTTTTTGGGGGGG >r2 without any adapter GGGGGGGGGGGGGGGGGGG >r3 5' adapter, partial 3' adapter CCCGGCCCCC >r4 only 3' adapter GGGGGGGGGGCCCCCCCCCCTTTTTTTTTTGGGGGGG >r5 only 5' adapter AAAAAAAAAACCCCCCCCCCGGGGGGG >r6 partial 5' adapter AAAAAACCCCCCCCCCTTTTTTTTTTGGGGGGG >r7 5' adapter plus preceding bases AACCGGTTTTAAAAAAAAAACCCCCCCCCCTTTTTTTTTTGGGGGGG cutadapt-1.15/tests/cut/twoadapters.first.fasta0000664000175000017500000000006713205526454022450 0ustar marcelmarcel00000000000000>read1 GATCCTCCTGGAGCTGGCTGATACCAGTATACCAGTGCTGATTGTTG cutadapt-1.15/tests/cut/paired.1.fastq0000664000175000017500000000026313205526454020406 0ustar marcelmarcel00000000000000@read1/1 some text TTATTTGTCTCCAGC + ##HHHHHHHHHHHHH @read3/1 CCAACTTGATATTAATAACA + HHHHHHHHHHHHHHHHHHHH @read4/1 GACAGGCCGTTTGAATGTTGACGGGATGTT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH cutadapt-1.15/tests/cut/lowercase.fastq0000664000175000017500000000034713205526454020772 0ustar marcelmarcel00000000000000@prefix:1_13_573/1 CGTCCGAANTAGCTACCACCCTGA + )3%)&&&&!.1&(6:<'67..*,: @prefix:1_13_1259/1 AGCCGCTANGACGGGTTGGCCC + ;<:&:A;A!9<<<,7:<=3=;: @prefix:1_13_1440/1 CAAGATCTNCCCTGCCACATTGCCCTAGTTAAAC + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=: cutadapt-1.15/tests/cut/paired-filterboth.1.fastq0000664000175000017500000000033013205526454022541 0ustar marcelmarcel00000000000000@read1/1 some text TTATTTGTCTCCAGC + ##HHHHHHHHHHHHH @read2/1 CAACAGGCCACA + HHHHHHHHHHHH @read3/1 CCAACTTGATATTAATAACA + HHHHHHHHHHHHHHHHHHHH @read4/1 GACAGGCCGTTTGAATGTTGACGGGATGTT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH cutadapt-1.15/tests/cut/small.trimmed.fastq0000664000175000017500000000021313205526454021546 0ustar marcelmarcel00000000000000@prefix:1_13_573/1 CGTCCGAANTAGCTACCACCCTGA + )3%)&&&&!.1&(6:<'67..*,: @prefix:1_13_1259/1 AGCCGCTANGACGGGTTGGCCC + ;<:&:A;A!9<<<,7:<=3=;: cutadapt-1.15/tests/cut/anchored_no_indels_wildcard.fasta0000664000175000017500000000030213205526454024443 0ustar marcelmarcel00000000000000>no_mismatch (adapter: TTAGACATAT) GAGGTCAG >one_mismatch GAGGTCAG >two_mismatches TAAGACGTATGAGGTCAG >insertion ATTAGACATATGAGGTCAG >deletion TAGACATATGAGGTCAG >mismatch_plus_wildcard GAGGTCAG cutadapt-1.15/tests/cut/paired.m14.2.fastq0000664000175000017500000000033413205526454021006 0ustar marcelmarcel00000000000000@read1/2 other text GCTGGAGACAAATAACAGTGGAGTAGTTTT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH @read3/2 TGTTATTAATATCAAGTTGGCAGTG + #HHHHHHHHHHHHHHHHHHHHHHHH @read4/2 CATCCCGTCAACATTCAAACGGCCTGTCCA + HH############################ cutadapt-1.15/tests/cut/no-trim.fastq0000664000175000017500000000013413205526454020365 0ustar marcelmarcel00000000000000@prefix:1_13_1440/1 CAAGATCTNCCCTGCCACATTGCCCTAGTTAAAC + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=: cutadapt-1.15/tests/cut/rest.fa0000664000175000017500000000020713205526454017226 0ustar marcelmarcel00000000000000>read1 TESTING >read2 TESTING >read3 TESTING >read4 TESTING >read5 TESTING >read6 SOMETHING >read7 SOMETHING >read8 REST >read9 NOREST cutadapt-1.15/tests/cut/demultiplexed.unknown.1.fastq0000664000175000017500000000023413205526454023503 0ustar marcelmarcel00000000000000@read1/1 some text TTATTTGTCTCCAGCTTAGACATATCGCCT + ##HHHHHHHHHHHHHHHHHHHHHHHHHHHH @read4/1 GACAGGCCGTTTGAATGTTGACGGGATGTT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH cutadapt-1.15/tests/cut/solid5p-anchored.notrim.fasta0000664000175000017500000000121713205526454023432 0ustar marcelmarcel00000000000000>read1 T1212322332333012001112122203233202221000211 >read2 T201212322332333200121311212133113001311002032 >read3 T02201212322332333211133003002232323010012320300 >read4 T302010102312033021011121312131 >read5 T121313210102120020302022233110 >read6 T331203203013323021010020301321 >read7 T21301020302201212322332333203020130202120211322010013211 >read8 T2310321030130120302201212322332333232202123123111113113003200330 >read9 T0002132103320302201212322332333020123133023120320131020333011 >read10 T00322031320033220302201212322332333201130233321321011303133231200 >read11 T402010102312033021011121312131 >read12 T11 >read13 T1 >read14 T >read15 T >read16 T cutadapt-1.15/tests/cut/wildcard_adapter_anywhere.fa0000664000175000017500000000006413205526454023445 0ustar marcelmarcel00000000000000>1 TGCATGCA >2 TGCATGCA >3b TGGCTGGCC >4b TGGCTGGCC cutadapt-1.15/tests/cut/pairedu.1.fastq0000664000175000017500000000041013205526454020565 0ustar marcelmarcel00000000000000@read1/1 some text TTTGTCTCCAGCTTAGACATATCGCC + HHHHHHHHHHHHHHHHHHHHHHHHHH @read2/1 CAGGCCACATTAGACATATCGGATGG + HHHHHHHHHHHHHHHHHHHHHHHHHH @read3/1 ACTTGATATTAATAACATTAGAC + HHHHHHHHHHHHHHHHHHHHHHH @read4/1 AGGCCGTTTGAATGTTGACGGGATGT + HHHHHHHHHHHHHHHHHHHHHHHHHH cutadapt-1.15/tests/cut/solid.fastq0000664000175000017500000000461713205526454020124 0ustar marcelmarcel00000000000000@1_13_85_F3 T110020300.0113010210002110102330021 + 7&9<&77)&!<7))%4'657-1+9;9,.<8);.;8 @1_13_573_F3 T312311200.30213011011132 + 6)3%)&&&&!.1&(6:<'67..*, @1_13_1259_F3 T002112130.201222332211 + =;<:&:A;A!9<<<,7:<=3=; @1_13_1440_F3 T110020313.1113211010332111302330001 + =<=A:A=57!7<';<6?5;;6:+:=)71>70<,=: @1_14_177_F3 T31330222020233321121323302013303311 + :8957;;54)'98924905;;)6:7;1:3<88(9: @1_14_238_F3 T0133103120031002212223 + ?><5=;<<<12>=<;1;;=5); @1_15_1098_F3 T32333033222233020223032312232220332 + #,##(#5##*#($$'#.##)$&#%)$1##-$&##% @1_16_404_F3 T03310320002130202331112 + 78;:;;><>9=9;<<2=><<1;5 @1_16_904_F3 T21230102331022312232132021122111212 + 9>=::6;;99=+/'$+#.#&%$&'(($1*$($.#. @1_16_1315_F3 T032312311122103330103103 + <9<8A?>?::;6&,%;6/)8<<#/ @1_16_1595_F3 T22323211312111230022210011213302012 + >,<=<>@6<;?<=>:/=.>&;;8;)17:=&,>1=+ @1_17_1379_F3 T32011212111223230232132311321200123 + /-1179<1;>>8:':7-%/::0&+=<29,7<8(,2 @1_18_1692_F3 T12322233031100211233323300112200210 + .#(###5%)%2)',2&:+#+&5,($/1#&4&))$6 @1_19_171_F3 T10101101220213201111011320201230032 + )6:65/=3*:(8%)%2>&8&%;%0&#;$3$&:$#& @1_22_72_F3 T13303032323221212301322233320210233 + 3/#678<:.=9::6:(<538295;9+;&*;)+',& @1_22_1377_F3 T22221333311222312201132312022322300 + )##0%.$.1*%,)95+%%14%$#8-###9-()#9+ @1_23_585_F3 T300103103101303121221 + >55;8><96/18?)<3<58<5 @1_23_809_F3 T13130101101021211013220302223302112 + :7<59@;<<5;/9;=<;7::.)&&&827(+221%( @1_24_138_F3 T33211130100120323002 + 6)68/;906#,25/&;<$0+ @1_24_206_F3 T33330332002223002020303331321221000 + ))4(&)9592)#)694(,)292:(=7$.18,()65 @1_25_143_F3 T23202003031200220301303302012203132 + :4;/#&<9;&*;95-7;85&;587#16>%&,9<2& @1_25_1866_F3 T03201321022131101112012330221130311 + =<>9;<@7?(=6,<&?=6=(=<641:?'<1=;':4 @1_27_584_F3 T10010330110103213112323303012103101 + 82'('*.-8+%#2)(-&3.,.2,),+.':&,'(&/ @1_27_1227_F3 T02003022123001003201002031303302011 + 492:;>A:<;34<<=);:<<;9=7<3::<::3=>' @1_27_1350_F3 T13130101101021211013220222221301231 + 95,)<(4./;<938=64=+2/,.4),3':97#33& @1_29_477_F3 T13130101101021211013300302223003030 + 94=55:75=+:/7><968;;#&+$#3&6,#1#4#' @1_30_882_F3 T20102033000233 + 2(+-:-3<;5##/; @1_31_221_F3 T03301311201100030300100233220102031 + 89>9>5<139/,&:7969972.274&%:78&&746 @1_31_1313_F3 T0133113130033012232100010101 + ;3<7=7::)5*4=&;<7>4;795065;9 @1_529_129_F3 T132222301020322102101322221322302.3302.3.3..221..3 + >>%/((B6-&5A0:6)>;'1)B*38/?(5=%B+!&<-9!%!@!!)%)!!( cutadapt-1.15/tests/cut/unconditional-front.fastq0000664000175000017500000000036513205526454023002 0ustar marcelmarcel00000000000000@prefix:1_13_573/1 GAANTAGCTACCACCCTGATTAGACAAAT + &&&!.1&(6:<'67..*,:75)'77&&&5 @prefix:1_13_1259/1 CTANGACGGGTTGGCCCTTAGACGTATCT + A;A!9<<<,7:<=3=;:<&70<,=: cutadapt-1.15/tests/cut/lowqual.fastq0000664000175000017500000000005113205526454020462 0ustar marcelmarcel00000000000000@first_sequence + @second_sequence + cutadapt-1.15/tests/cut/maxlen.fa0000664000175000017500000000020113205526454017527 0ustar marcelmarcel00000000000000>read_length0a T >read_length0b T >read_length1 T2 >read_length2 T02 >read_length3 T302 >read_length4 T3302 >read_length5 T23302 cutadapt-1.15/tests/cut/paired.m14.1.fastq0000664000175000017500000000026313205526454021006 0ustar marcelmarcel00000000000000@read1/1 some text TTATTTGTCTCCAGC + ##HHHHHHHHHHHHH @read3/1 CCAACTTGATATTAATAACA + HHHHHHHHHHHHHHHHHHHH @read4/1 GACAGGCCGTTTGAATGTTGACGGGATGTT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH cutadapt-1.15/tests/cut/paired-m27.2.fastq0000664000175000017500000000044513205526454021014 0ustar marcelmarcel00000000000000@read1/2 other text GCTGGAGACAAATAACAGTGGAGTAGTTTT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH @read2/2 TGTGGCCTGTTGCAGTGGAGTAACTCCAGC + ###HHHHHHHHHHHHHHHHHHHHHHHHHHH @read3/2 TGTTATTAATATCAAGTTGGCAGTG + #HHHHHHHHHHHHHHHHHHHHHHHH @read4/2 CATCCCGTCAACATTCAAACGGCCTGTCCA + HH############################ cutadapt-1.15/tests/cut/nextseq.fastq0000664000175000017500000000062613205526454020475 0ustar marcelmarcel00000000000000@NS500350:251:HLM7JBGXX:1:11101:12075:1120 1:N:0:TACAGC GATCGGAAGAGCACACGTCTGAACTCCAGTCACTACAGCATCTCGTATTCCGTCTTCTGCTTGAAAAAAAA + AAAAAEEEEEEAEEEEAEAEEEEEEAEEEEEEEEEEEEEEE///E/EE////AAEE/E//////EEEEEEE @NS500350:251:HLM7JBGXX:1:11101:22452:1121 1:N:0:TACAGC GATCGGAAGAGCACACGTCTGAACTCCAGTCACTACAGCATCGCGTATGCCGTCTTATGCTTGAAAAAAAAA + AAAAAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE/////E/EE//E6///E//A//E//EEEEEEEE cutadapt-1.15/tests/cut/trimN5.fasta0000664000175000017500000000006013205526454020134 0ustar marcelmarcel00000000000000>read1 GGCCTGGAATTCTCGGGTGCCAAGGAACTCCAGTCACCAG cutadapt-1.15/tests/cut/solid5p.fastq0000664000175000017500000000146713205526454020371 0ustar marcelmarcel00000000000000@read1 12001112122203233202221000211 + ;9C\'?276>#)49"<,>?/\'!A4$.%+ @read2 00121311212133113001311002032 + -9AA<&C2%$$;?A&5!C69:?-;&;65. @read3 11133003002232323010012320300 + !00>#97*B.0A-@(*","B3><4&16(: @read4 02010102312033021011121312131 + &-81+%)7;<)6?83!&CB9"9B6307=& @read5 21313210102120020302022233110 + 9)27,(-*=,#4:;"/4++5<,@-784*' @read6 31203203013323021010020301321 + !.;:C%97@>75-";';*)A67CCC")$* @read7 03020130202120211322010013211 + 8,4(2=+98:B@C@:+3*>2+6+2++C0. @read8 32202123123111113113003200330 + -'9<%">6,+)*,)1-;:(691>?C)4A; @read9 20123133023120320131020333011 + ?@&)6>79C>)6C'5-#0:A8+2* @read10 01130233321321011303133231200 + 47,2(55*1.,>%:(1A'A5=@7&&5?4' @read11 02010102312033021011121312131 + 8B"195'@,@&:5=7;!&-9:%((> @read12 1 + C @read13 + @read14 + @read15 + @read16 + cutadapt-1.15/tests/cut/paired-untrimmed.2.fastq0000664000175000017500000000011113205526454022401 0ustar marcelmarcel00000000000000@read4/2 CATCCCGTCAACATTCAAACGGCCTGTCCA + HH############################ cutadapt-1.15/tests/cut/demultiplexed.second.2.fastq0000664000175000017500000000004513205526454023260 0ustar marcelmarcel00000000000000@read2/2 TGTGGCCTGTTG + ###HHHHHHHHH cutadapt-1.15/tests/cut/anchored-back.fasta0000664000175000017500000000013013205526454021435 0ustar marcelmarcel00000000000000>read1 sequence >read2 sequenceBACKADAPTERblabla >read3 sequenceBACKADA >read4 sequence cutadapt-1.15/tests/cut/suffix.fastq0000664000175000017500000000553213205526454020313 0ustar marcelmarcel00000000000000@1_13_85_my_suffix_no_adapter T110020300.0113010210002110102330021 + 7&9<&77)&!<7))%4'657-1+9;9,.<8);.;8 @1_13_573_my_suffix_1 T312311200.30213011011132 + 6)3%)&&&&!.1&(6:<'67..*, @1_13_1259_my_suffix_1 T002112130.201222332211 + =;<:&:A;A!9<<<,7:<=3=; @1_13_1440_my_suffix_no_adapter T110020313.1113211010332111302330001 + =<=A:A=57!7<';<6?5;;6:+:=)71>70<,=: @1_14_177_my_suffix_no_adapter T31330222020233321121323302013303311 + :8957;;54)'98924905;;)6:7;1:3<88(9: @1_14_238_my_suffix_1 T0133103120031002212223 + ?><5=;<<<12>=<;1;;=5); @1_15_1098_my_suffix_no_adapter T32333033222233020223032312232220332 + #,##(#5##*#($$'#.##)$&#%)$1##-$&##% @1_16_404_my_suffix_1 T03310320002130202331112 + 78;:;;><>9=9;<<2=><<1;5 @1_16_904_my_suffix_no_adapter T21230102331022312232132021122111212 + 9>=::6;;99=+/'$+#.#&%$&'(($1*$($.#. @1_16_1315_my_suffix_1 T032312311122103330103103 + <9<8A?>?::;6&,%;6/)8<<#/ @1_16_1595_my_suffix_no_adapter T22323211312111230022210011213302012 + >,<=<>@6<;?<=>:/=.>&;;8;)17:=&,>1=+ @1_17_1379_my_suffix_no_adapter T32011212111223230232132311321200123 + /-1179<1;>>8:':7-%/::0&+=<29,7<8(,2 @1_18_1692_my_suffix_no_adapter T12322233031100211233323300112200210 + .#(###5%)%2)',2&:+#+&5,($/1#&4&))$6 @1_19_171_my_suffix_no_adapter T10101101220213201111011320201230032 + )6:65/=3*:(8%)%2>&8&%;%0&#;$3$&:$#& @1_22_72_my_suffix_no_adapter T13303032323221212301322233320210233 + 3/#678<:.=9::6:(<538295;9+;&*;)+',& @1_22_1377_my_suffix_no_adapter T22221333311222312201132312022322300 + )##0%.$.1*%,)95+%%14%$#8-###9-()#9+ @1_23_585_my_suffix_1 T300103103101303121221 + >55;8><96/18?)<3<58<5 @1_23_809_my_suffix_no_adapter T13130101101021211013220302223302112 + :7<59@;<<5;/9;=<;7::.)&&&827(+221%( @1_24_138_my_suffix_1 T33211130100120323002 + 6)68/;906#,25/&;<$0+ @1_24_206_my_suffix_no_adapter T33330332002223002020303331321221000 + ))4(&)9592)#)694(,)292:(=7$.18,()65 @1_25_143_my_suffix_no_adapter T23202003031200220301303302012203132 + :4;/#&<9;&*;95-7;85&;587#16>%&,9<2& @1_25_1866_my_suffix_no_adapter T03201321022131101112012330221130311 + =<>9;<@7?(=6,<&?=6=(=<641:?'<1=;':4 @1_27_584_my_suffix_no_adapter T10010330110103213112323303012103101 + 82'('*.-8+%#2)(-&3.,.2,),+.':&,'(&/ @1_27_1227_my_suffix_no_adapter T02003022123001003201002031303302011 + 492:;>A:<;34<<=);:<<;9=7<3::<::3=>' @1_27_1350_my_suffix_no_adapter T13130101101021211013220222221301231 + 95,)<(4./;<938=64=+2/,.4),3':97#33& @1_29_477_my_suffix_no_adapter T13130101101021211013300302223003030 + 94=55:75=+:/7><968;;#&+$#3&6,#1#4#' @1_30_882_my_suffix_1 T20102033000233 + 2(+-:-3<;5##/; @1_31_221_my_suffix_no_adapter T03301311201100030300100233220102031 + 89>9>5<139/,&:7969972.274&%:78&&746 @1_31_1313_my_suffix_1 T0133113130033012232100010101 + ;3<7=7::)5*4=&;<7>4;795065;9 @1_529_129_my_suffix_no_adapter T132222301020322102101322221322302.3302.3.3..221..3 + >>%/((B6-&5A0:6)>;'1)B*38/?(5=%B+!&<-9!%!@!!)%)!!( cutadapt-1.15/tests/cut/overlapa.fa0000664000175000017500000000075713205526454020074 0ustar marcelmarcel00000000000000>read1 T0021110233021 >read2 T0021110233021 >read3 T0021110233021 >read4 T0021110233021 >read5 T0021110233021 >read6 T0021110233021 >read7 T0021110233021 >read8 T0021110233021 >read9 T0021110233021 >read10 T0021110233021330201030 >read11 T002111023302133020103 >read12 T00211102330213302010 >read13 T0021110233021330201 >read14 T002111023302133020 >read15 T00211102330213302 >read16 T0021110233021330 >read17 T002111023302133 >read18 T00211102330213 >read19 T0021110233021 >read20 T002111023302 cutadapt-1.15/tests/cut/solidmaq.fastq0000664000175000017500000000461713205526454020623 0ustar marcelmarcel00000000000000@552:1_13_85/1 CAAGATAANACCTACAGCAAAGCCACAGTTAAGC + &9<&77)&!<7))%4'657-1+9;9,.<8);.;8 @552:1_13_573/1 CGTCCGAANTAGCTACCACCCTG + )3%)&&&&!.1&(6:<'67..*, @552:1_13_1259/1 AGCCGCTANGACGGGTTGGCC + ;<:&:A;A!9<<<,7:<=3=; @552:1_13_1440/1 CAAGATCTNCCCTGCCACATTGCCCTAGTTAAAC + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=: @552:1_14_177/1 CTTAGGGAGAGTTTGCCGCTGTTAGACTTATTCC + 8957;;54)'98924905;;)6:7;1:3<88(9: @552:1_14_238/1 CTTCATCGAATCAAGGCGGGT + ><5=;<<<12>=<;1;;=5); @552:1_15_1098/1 GTTTATTGGGGTTAGAGGTATGTCGGTGGGATTG + ,##(#5##*#($$'#.##)$&#%)$1##-$&##% @552:1_16_404/1 TTCATGAAAGCTAGAGTTCCCG + 8;:;;><>9=9;<<2=><<1;5 @552:1_16_904/1 CGTACAGTTCAGGTCGGTGCTGAGCCGGCCCGCG + >=::6;;99=+/'$+#.#&%$&'(($1*$($.#. @552:1_16_1315/1 TGTCGTCCCGGCATTTACATCAT + 9<8A?>?::;6&,%;6/)8<<#/ @552:1_16_1595/1 GTGTGCCTCGCCCGTAAGGGCAACCGCTTAGACG + ,<=<>@6<;?<=>:/=.>&;;8;)17:=&,>1=+ @552:1_17_1379/1 GACCGCGCCCGGTGTAGTGCTGTCCTGCGAACGT + -1179<1;>>8:':7-%/::0&+=<29,7<8(,2 @552:1_18_1692/1 GTGGGTTATCCAAGCCGTTTGTTAACCGGAAGCA + #(###5%)%2)',2&:+#+&5,($/1#&4&))$6 @552:1_19_171/1 ACACCACGGAGCTGACCCCACCTGAGACGTAATG + 6:65/=3*:(8%)%2>&8&%;%0&#;$3$&:$#& @552:1_22_72/1 TTATATGTGTGGCGCGTACTGGGTTTGAGCAGTT + /#678<:.=9::6:(<538295;9+;&*;)+',& @552:1_22_1377/1 GGGCTTTTCCGGGTCGGACCTGTCGAGGTGGTAA + ##0%.$.1*%,)95+%%14%$#8-###9-()#9+ @552:1_23_585/1 AACATCATCACTATCGCGGC + 55;8><96/18?)<3<58<5 @552:1_23_809/1 TCTACACCACAGCGCCACTGGATAGGGTTAGCCG + 7<59@;<<5;/9;=<;7::.)&&&827(+221%( @552:1_24_138/1 TGCCCTACAACGATGTAAG + )68/;906#,25/&;<$0+ @552:1_24_206/1 TTTATTGAAGGGTAAGAGATATTTCTGCGGCAAA + )4(&)9592)#)694(,)292:(=7$.18,()65 @552:1_25_143/1 TGAGAATATCGAAGGATACTATTAGACGGATCTG + 4;/#&<9;&*;95-7;85&;587#16>%&,9<2& @552:1_25_1866/1 TGACTGCAGGCTCCACCCGACGTTAGGCCTATCC + <>9;<@7?(=6,<&?=6=(=<641:?'<1=;':4 @552:1_27_584/1 AACATTACCACATGCTCCGTGTTATACGCATCAC + 2'('*.-8+%#2)(-&3.,.2,),+.':&,'(&/ @552:1_27_1227/1 GAATAGGCGTAACAATGACAAGATCTATTAGACC + 92:;>A:<;34<<=);:<<;9=7<3::<::3=>' @552:1_27_1350/1 TCTACACCACAGCGCCACTGGAGGGGGCTACGTC + 5,)<(4./;<938=64=+2/,.4),3':97#33& @552:1_29_477/1 TCTACACCACAGCGCCACTTAATAGGGTAATATA + 4=55:75=+:/7><968;;#&+$#3&6,#1#4#' @552:1_30_882/1 ACAGATTAAAGTT + (+-:-3<;5##/; @552:1_31_221/1 TTACTCCGACCAAATATAACAAGTTGGACAGATC + 9>9>5<139/,&:7969972.274&%:78&&746 @552:1_31_1313/1 CTTCCTCTAATTACGGTGCAAACACAC + 3<7=7::)5*4=&;<7>4;795065;9 @552:1_529_129/1 TGGGGTACAGATGGCAGCACTGGGGCTGGTAGNTTAGNTNTNNGGCNNT + >%/((B6-&5A0:6)>;'1)B*38/?(5=%B+!&<-9!%!@!!)%)!!( cutadapt-1.15/tests/cut/example.fa0000664000175000017500000000026613205526454017711 0ustar marcelmarcel00000000000000>read1 MYSEQUENCE >read2 MYSEQUENCE >read3 MYSEQUENCE >read4 MYSEQUENCEADABTER >read5 MYSEQUENCEADAPTR >read6 MYSEQUENCEADAPPTER >read7 MYSEQUENCE >read8 MYSEQUENCE >read9 SOMETHING cutadapt-1.15/tests/cut/pairedq.1.fastq0000664000175000017500000000015213205526454020564 0ustar marcelmarcel00000000000000@read1/1 some text TTATTTGTCTCCAGC + ##HHHHHHHHHHHHH @read3/1 CCAACTTGATATTAATAACA + HHHHHHHHHHHHHHHHHHHH cutadapt-1.15/tests/cut/solid.fasta0000664000175000017500000000011613205526454020072 0ustar marcelmarcel00000000000000>problem1 T0112021202222201123121023103020 >problem2 T20201030313112322220210 cutadapt-1.15/tests/cut/minlen.noprimer.fa0000664000175000017500000000024413205526454021366 0ustar marcelmarcel00000000000000>read_length6 23302 >read_length7 023302 >read_length8 1023302 >read_length9 11023302 >read_length10 111023302 >read_length11 2111023302 >read_length12 02111023302 cutadapt-1.15/tests/cut/anywhere_repeat.fastq0000664000175000017500000000120413205526454022161 0ustar marcelmarcel00000000000000@prefix:1_13_1400/1 CGTCCGAANTAGCTACCACCCTGATTAGACAAAT + )3%)&&&&!.1&(6:<'67..*,:75)'77&&&5 @prefix:1_13_1500/1 NNNNANNNNNNNNNNNNNNNNNNNNNNNNNNNNN + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=: @prefix:1_13_1550/1 NNNNANNNNNNNNNNNNNNNNNNNNNNNNNNNNN + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=: @prefix:1_13_1600/1 NNNNATGTCCCCTGCCACATTGCCCTAGTNNNNN + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=: @prefix:1_13_1700/1 NNNNATGTCCCCTGCCACATTGCCCTAGTTTATT + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=: @prefix:1_13_1800/1 GTTCATGTCCCCTGCCACATTGCCCTAGTTTATT + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=: @prefix:1_13_1900/1 ATGGCTGTCCCCTGCCACATTGCCCTAGTNNNNN + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=: cutadapt-1.15/tests/cut/discard-untrimmed.fastq0000664000175000017500000000012013205526454022406 0ustar marcelmarcel00000000000000@prefix:1_13_1440/1 CTNCCCTGCCACATTGCCCTAGTTAAAC + 57!7<';<6?5;;6:+:=)71>70<,=: cutadapt-1.15/tests/cut/unconditional-both.fastq0000664000175000017500000000032713205526454022604 0ustar marcelmarcel00000000000000@prefix:1_13_573/1 GAANTAGCTACCACCCTGATTAGA + &&&!.1&(6:<'67..*,:75)'7 @prefix:1_13_1259/1 CTANGACGGGTTGGCCCTTAGACG + A;A!9<<<,7:<=3=;:<&7 cutadapt-1.15/tests/cut/paired-onlyA.1.fastq0000664000175000017500000000045013205526454021464 0ustar marcelmarcel00000000000000@read1/1 some text TTATTTGTCTCCAGCTTAGACATATCGCCT + ##HHHHHHHHHHHHHHHHHHHHHHHHHHHH @read2/1 CAACAGGCCACATTAGACATATCGGATGGT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH @read3/1 CCAACTTGATATTAATAACATTAGACA + HHHHHHHHHHHHHHHHHHHHHHHHHHH @read4/1 GACAGGCCGTTTGAATGTTGACGGGATGTT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH cutadapt-1.15/tests/cut/maxn1.fasta0000664000175000017500000000003613205526454020005 0ustar marcelmarcel00000000000000>r1 >r2 N >r3 AAAA >r4 AAAAN cutadapt-1.15/tests/cut/demultiplexed.first.2.fastq0000664000175000017500000000006513205526454023136 0ustar marcelmarcel00000000000000@read3/2 TGTTATTAATATCAAGTTGG + #HHHHHHHHHHHHHHHHHHH cutadapt-1.15/tests/cut/restfront.fa0000664000175000017500000000020413205526454020274 0ustar marcelmarcel00000000000000>read1 REST1 >read2 RESTING >read3 >read4 RESTLESS >read5 RESTORE >read6 SOMETHING >read7 SOMETHING >read8 SOMETHING >read9 NOREST cutadapt-1.15/tests/cut/wildcard_adapter.fa0000664000175000017500000000004413205526454021541 0ustar marcelmarcel00000000000000>1 >2 >3b TGGCTGGCC >4b TGGCTGGCC cutadapt-1.15/tests/cut/discard.fastq0000664000175000017500000000013413205526454020411 0ustar marcelmarcel00000000000000@prefix:1_13_1440/1 CAAGATCTNCCCTGCCACATTGCCCTAGTTAAAC + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=: cutadapt-1.15/tests/cut/paired-filterboth.2.fastq0000664000175000017500000000036313205526454022550 0ustar marcelmarcel00000000000000@read1/2 other text GCTGGAGACAAATAACAGT + HHHHHHHHHHHHHHHHHHH @read2/2 TGTGGCCTGTTGCAGT + ###HHHHHHHHHHHHH @read3/2 TGTTATTAATATCAAGTTGGCAGTG + #HHHHHHHHHHHHHHHHHHHHHHHH @read4/2 CATCCCGTCAACATTCAAACGGCCTGTCCA + HH############################ cutadapt-1.15/tests/cut/paired-separate.1.fastq0000664000175000017500000000033013205526454022203 0ustar marcelmarcel00000000000000@read1/1 some text TTATTTGTCTCCAGC + ##HHHHHHHHHHHHH @read2/1 CAACAGGCCACA + HHHHHHHHHHHH @read3/1 CCAACTTGATATTAATAACA + HHHHHHHHHHHHHHHHHHHH @read4/1 GACAGGCCGTTTGAATGTTGACGGGATGTT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH cutadapt-1.15/tests/cut/maxn0.2.fasta0000664000175000017500000000003013205526454020136 0ustar marcelmarcel00000000000000>r1 >r3 AAAA >r4 AAAAN cutadapt-1.15/tests/cut/demultiplexed.unknown.2.fastq0000664000175000017500000000016513205526454023507 0ustar marcelmarcel00000000000000@read1/2 other text GCTGGAGACA + HHHHHHHHHH @read4/2 CATCCCGTCAACATTCAAACGGCCTGTCCA + HH############################ cutadapt-1.15/tests/cut/SRR2040271_1.fastq0000664000175000017500000000056013205526454020431 0ustar marcelmarcel00000000000000@SRR2040271.1 SN603_WBP007_8_1101_63.30_99.90 length=50 NTCATTCCATGACATTGTCTGTTGGTTGCTTTTTGAGTATATTTTCTCAT +SRR2040271.1 SN603_WBP007_8_1101_63.30_99.90 length=50 !1=DDFFFGHHHHIJJJJJIIJJJGGHJGJIJJGBGGHEGHJIIIIEHIJ @SRR2040271.2 SN603_WBP007_8_1101_79.90_99.30 length=20 NTAAAGACCCTTCAACTCAG +SRR2040271.2 SN603_WBP007_8_1101_79.90_99.30 length=20 !4=BBDDDFHHHH@FHIIII cutadapt-1.15/tests/cut/paired-too-short.1.fastq0000664000175000017500000000004513205526454022340 0ustar marcelmarcel00000000000000@read2/1 CAACAGGCCACA + HHHHHHHHHHHH cutadapt-1.15/tests/cut/illumina64.fastq0000664000175000017500000000366313205526454020776 0ustar marcelmarcel00000000000000@14569 AAGTTTATTCCTGGACGAAGGAAGAAAAGGCCAGATGGGAAACAAGAACAAGCCCCTGTTGAAGACGCAGGGCC + cceeeeceeeee`dedbdbdb_^b`abU_cacadabd`dLMZ[XTcT^a^adaaaddcd`aL^`^_`Y\]^`Y_ @19211 AGA + ^\` @9180 GAGGG + b`bLb @19132 TGTGATTATCCACTGGTATAT + Z[QZZLZ[]J[SHZNaZ[_Ia @15868 CTGCCAAGGCTGCCCCCAAA + `c`cc\`\Lb]bL`[`a]L` @1424 GGCCCCAGACTTGCTCCCCCAACAAGGACAATGTCCAAGGAGTGTCCCC + eeeeeeeea`bbdaaadad`Oaaaaccada_aa_d`_X`_^`[`_[_W^ @7855 GTGGGGGCT + ]^\]FW]Z` @17943 ACATGGGACCAGAAAACACCACCAGGGGTTTGGGGCTGTCCTGAG + ccc`\^`aba\b^`\FR`OOPYG[[W```[Ra_RR_\]\\P\_H_ @11100 CGGATAACTGAAAATGCATTTTTAACGCCATGACCGTGTCTCAAGGACCCGCTGTGGAAG + b`b_b_a\bc^Tabadaddcddd``bdaa_^aJ\^_\]\\__O[___L^\_aaa^^^UJ^ @15663 AGGT + aaKa @4698 CCAATTGGCACCCCTCTGCCTTCAGCCATT + cccc\`ccc\caccZccccc]^`LY\bL_b @20649 TCTGGACTGGATCTTTAGGATGGTGGAGATGATCTGGATGTAGGACAAAAGAACCAGGCAGAAGGGTG + eeeeeaddadacdddebeccdddadd\^abbT_]bccTac]]b]L^][]Ve[^ZaY_^_^`\\Y]^Y` @17259 + @6003 CTTCAACTCATCTTGTTATTAATACCATCAATATCCCATGAGGCTCATAAAACGAGTCTTTCTTCTTGGAAACATGACCAAGATTGGGCAAACGT + fffffffffffffffffdffecfcefeffdcfdeeebbbdbccccc\db\`^aa`^Y^^^cbcbaa`bbWY^^^__S_YYR]GWY]\]]XX\_`S @4118 TCAAATTGTACTGCAAAGAAGGTCCCAGCTGGTCTCTTCTGGGAGTGATCTAACTAACTTAAG + dc^ddeeeeeedeee`ceceddadadddcbde_dedc_ec_a^^b\b\\]VIPZY^T^^^\L_ @18416 GTGGGGAAGCCGAAGAAGCAGCGGAGATCGATTGTAAGAACGACG + dddacaabdbea\d^cce\da`dd_^__`a`a`b[_^__^\^^^_ @20115 TGAAAAAGGAAAACATGGTAGTTTTCTTGTATGAGAGAGCCAGAGCCACCTTGGAGATTTTGTTCTCTCTGTGCG + ed^eeafffaddfecdddabc^_badd`bd_ddadaa^bbcad\d\__^_\aaa_aY____aaN_\cdc\^aaYb @16139 TCATCCGAAGAGTTGGCAGGCCCTGTGAATTGTGAAAACAGTATACCCACCCCTTTCCC + cabacacY^c\daaddaadad^\ad_a\Y`[ZQ]Y^^OYQ^X^YT\\]U\^RRX^\YJ^ @14123 GATTTGGGGAAAGGAAACAATAGTTGAGTTTGGGCCACGGGAAATTCAAGATGCCTGGTATGTC + cccccccac^bYbbT_aa_Yb^^Ta\\^]]aaTaaaaab\b\XL`VZZV]QYYY[aa^^^^_^^ @8766 ACCTGTAAGGTCCGCTCCTGGTGGACACCCACGAAGTCCAGGGCCTCAGGCAGGAAGTTGTAGCGCAGAGTTTTGAGCAGCTGCTCCATC + fcfffffcffeffeeefdefddeecdccacddfdYd`d^\_^`\_abbc\b[ba^Y^Z_^^H^Z_^Y_Y_OKWPZR]]Z]`Z``Z^UHZ^ cutadapt-1.15/tests/cut/small.fasta0000664000175000017500000000021613205526454020071 0ustar marcelmarcel00000000000000>prefix:1_13_573/1 CGTCCGAANTAGCTACCACCCTGA >prefix:1_13_1259/1 AGCCGCTANGACGGGTTGGCCC >prefix:1_13_1440/1 CAAGATCTNCCCTGCCACATTGCCCTAGTTAAAC cutadapt-1.15/tests/cut/maxn0.4.fasta0000664000175000017500000000004213205526454020143 0ustar marcelmarcel00000000000000>r1 >r3 AAAA >r4 AAAAN >r5 AAANN cutadapt-1.15/tests/cut/dos.fastq0000664000175000017500000000034713205526454017573 0ustar marcelmarcel00000000000000@prefix:1_13_573/1 CGTCCGAANTAGCTACCACCCTGA + )3%)&&&&!.1&(6:<'67..*,: @prefix:1_13_1259/1 AGCCGCTANGACGGGTTGGCCC + ;<:&:A;A!9<<<,7:<=3=;: @prefix:1_13_1440/1 CAAGATCTNCCCTGCCACATTGCCCTAGTTAAAC + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=: cutadapt-1.15/tests/cut/paired-trimmed.2.fastq0000664000175000017500000000033413205526454022045 0ustar marcelmarcel00000000000000@read1/2 other text GCTGGAGACAAATAACAGTGGAGTAGTTTT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH @read2/2 TGTGGCCTGTTGCAGTGGAGTAACTCCAGC + ###HHHHHHHHHHHHHHHHHHHHHHHHHHH @read3/2 TGTTATTAATATCAAGTTGGCAGTG + #HHHHHHHHHHHHHHHHHHHHHHHH cutadapt-1.15/tests/cut/no_indels.fasta0000664000175000017500000000040413205526454020732 0ustar marcelmarcel00000000000000>3p_orig TGAACATAGC >3p_mism TGAACATAGC >3p_del TGAACATAGCTTAACATATAACCG >3p_ins TGAACATAGCTTAGGACATATAACCG >3p_frontins TAGACATATAACCG >5p_orig TACTGCTTCTCGAA >5p_mism TACTGCTTCTCGAA >5p_del TCCTCGAGATGCCATACTGCTTCTCGAA >5p_ins TCCTCGAGATATGCCATACTGCTTCTCGAA cutadapt-1.15/tests/cut/pairedu.2.fastq0000664000175000017500000000036513205526454020577 0ustar marcelmarcel00000000000000@read1/2 other text GAGACAAATAACAGTGGAGTAGTT + HHHHHHHHHHHHHHHHHHHHHHHH @read2/2 GCCTGTTGCAGTGGAGTAACTCCA + HHHHHHHHHHHHHHHHHHHHHHHH @read3/2 ATTAATATCAAGTTGGCAG + HHHHHHHHHHHHHHHHHHH @read4/2 CCGTCAACATTCAAACGGCCTGTC + ######################## cutadapt-1.15/tests/cut/linked.fasta0000664000175000017500000000056013205526454020231 0ustar marcelmarcel00000000000000>r1 5' adapter and 3' adapter CCCCCCCCCC >r2 without any adapter GGGGGGGGGGGGGGGGGGG >r3 5' adapter, partial 3' adapter CCCGGCCCCC >r4 only 3' adapter GGGGGGGGGGCCCCCCCCCCTTTTTTTTTTGGGGGGG >r5 only 5' adapter CCCCCCCCCCGGGGGGG >r6 partial 5' adapter AAAAAACCCCCCCCCCTTTTTTTTTTGGGGGGG >r7 5' adapter plus preceding bases AACCGGTTTTAAAAAAAAAACCCCCCCCCCTTTTTTTTTTGGGGGGG cutadapt-1.15/tests/cut/pairedq.2.fastq0000664000175000017500000000015313205526454020566 0ustar marcelmarcel00000000000000@read1/2 other text GCTGGAGACAAATAA + HHHHHHHHHHHHHHH @read3/2 TGTTATTAATATCAAGTTGG + #HHHHHHHHHHHHHHHHHHH cutadapt-1.15/tests/cut/sra.fastq0000664000175000017500000000070713205526454017573 0ustar marcelmarcel00000000000000@1_13_85_F3 T110020300.0113010210002110102330021 + 7&9<&77)&!<7))%4'657-1+9;9,.<8);.;8 @1_13_573_F3 T312311200.30213011011132 + 6)3%)&&&&!.1&(6:<'67..*, @1_13_1259_F3 T002112130.201222332211 + =;<:&:A;A!9<<<,7:<=3=; @1_13_1440_F3 T110020313.1113211010332111302330001 + =<=A:A=57!7<';<6?5;;6:+:=)71>70<,=: @1_14_177_F3 T31330222020233321121323302013303311 + :8957;;54)'98924905;;)6:7;1:3<88(9: @1_14_238_F3 T0133103120031002212223 + ?><5=;<<<12>=<;1;;=5); cutadapt-1.15/tests/cut/linked-discard-g.fasta0000664000175000017500000000025013205526454022060 0ustar marcelmarcel00000000000000>r1 5' adapter and 3' adapter CCCCCCCCCC >r3 5' adapter, partial 3' adapter CCCGGCCCCC >r6 partial 5' adapter CCCCCCCCCC >r7 5' adapter plus preceding bases CCCCCCCCCC cutadapt-1.15/tests/cut/paired.2.fastq0000664000175000017500000000026413205526454020410 0ustar marcelmarcel00000000000000@read1/2 other text GCTGGAGACAAATAA + HHHHHHHHHHHHHHH @read3/2 TGTTATTAATATCAAGTTGG + #HHHHHHHHHHHHHHHHHHH @read4/2 CATCCCGTCAACATTCAAACGGCCTGTCCA + HH############################ cutadapt-1.15/tests/cut/illumina.info.txt0000664000175000017500000006100513205526454021251 0ustar marcelmarcel00000000000000SEQ:1:1101:9010:3891#0/1 adapter start: 51 1 51 81 ATAACCGGAGTAGTTGAAATGGTAATAAGACGACCAATCTGACCAGCAAGG GCCTAACTTCTTAGACTGCCTTAAGGACGT AAGCCAAGATGGGAAAGGTC adapt FFFFFEDBE@79@@>@CBCBFDBDFDDDDD<@C>ADD@B;5:978@CBDDF FDB4B?DB21;84?DDBC9DEBAB;=@<@@ B@@@@B>CCBBDE98>>0@7 SEQ:1:1101:9240:3898#0/1 -1 CCAGCAAGGAAGCCAAGATGGGAAAGGTCATGCGGCATACGCTCGGCGCCAGTTTGAATATTAGACATAATTTATCCTCAAGTAAGGGGCCGAAGCCCCTG GHGHGHHHHGGGDHHGDCGFEEFHHGDFGEHHGFHHHHHGHEAFDHHGFHHEEFHGHFHHFHGEHFBHHFHHHH@GGGDGDFEEFC@=D?GBGFGF:FB6D SEQ:1:1101:9207:3899#0/1 adapter start: 64 1 64 94 TTAACTTCTCAGTAACAGATACAAACTCATCACGAACGTCAGAAGCAGCCTTATGGCCGTCAAC GCCTAACTTCTTAGACTGCCTTAAGGACGT ATACATA adapt HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFHHHHHHCFHHF HHFHFFFFFBHHGHHHFFHHFHGGHHDEBF GCDCEEEFDFFHHHCFFEFE?EBFEB?3 SEQ:1:1101:9185:3939#0/1 -1 CGTTGAGGCTTGCGTTTATGGTACGCTGGACTTTGTAGGATACCCTCGCTTTCCTGCTCCTGTTGAGTTTATTGCTGCCGTCATTGCTTATTATGTTCATC HHHHHHHHHHHHHHFHHEHHHDHHFGHHHCHHHHHDHHHHFECEGBD@@?A?DAFF9F<@@08?< SEQ:1:1101:9140:3961#0/1 adapter start: 66 1 66 96 CAGGAGAAACATACGAAGGCGCATAACGATACCACTGACCCTCAGCAATCTTAAACTTCTTAGACG GCCTAACTTCTTAGACTGCCTTAAGGACGT AATCA adapt HHHHHHHGHHHHHHHHHHHGHHHHHHHHHHHHHHHHFHHHHHHFGHHHHHHHHHHHHHHHHDHHFH HHHEHHFHFHHHHHGHHHHHFHGHGHHHHH EHCFG SEQ:1:1101:9073:3961#0/1 adapter start: 49 1 49 79 GTGGCAAGTCTGCCGCTGATAAAGGAAAGGATACTCGTGATTATCTTGC GCCTAACTTCTTAGACTGCCTTAAGGACGT TGCTGCATTTCCTGAGCTTAAT adapt HHHHHHHHFHHHHHHGHHHHHHHHHEHHGHHGHHHHHHHHHHGEHHHHH GFHFFGHFHHGHHCHHFDGHHHHHFHHHFC DFGHHHHHHCFGHHEGEFBGGB SEQ:1:1101:9196:3971#0/1 adapter start: 18 1 18 48 ACCAGAAGGCGGTTCCTG GCCTAACTTCTTAGACTGCCTTAAGGACGT AATGAATGGGAAGCCTTCAAGAAGGTGATAAGCAGGAGAAACATACGAAGGCG adapt HHHHHHHHHFHHHHHHHH HGHHHGHHHHHHHFHHHHHHHHHHHEHHHH HHHHHHHHFHHGHHHHHEHFHHHHBHEHHGEHFHFHHFHHHHFBDFHF?HHHH SEQ:1:1101:9053:3973#0/1 -1 TTCACGTTCTGGTTGGTTGTGGCCTGTTGATGCTAAAGGTGAGCCGCTTAAAGCTACCAGGTTTATTGCTGTTTGTTTCTATGTGGCTTAAAACGTTACCA A39>A################################################################################################ SEQ:1:1101:9120:3979#0/1 -1 GGCGTTGACAGATGTATCCATCTGAATGCAATGAAGAAAACCACCATTACCAGCATTAACCGTCAAACTATCAAAATATAACGTTGACGATGTAGCTTTAG HHHHHHHHHHHGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFFGFFDHBHHHFGEHHHFGHHHEHHHGH SEQ:1:1101:9045:3988#0/1 adapter start: 91 1 91 101 TAACCCTGAAACAAATGCTTAGGGATTTTATTGGTATCAGGGTTAATCGTGCCAAGAAAAGCGGCATGGTCAATATAACCAGCAGTGTTAA GCCTAACTTC adapt HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFHHHHHHHFHHHHHHHHHHHFHHHHHHDHHHHHHHFHFFHHGHEHHGHHHGHGHHFH GHHFFFEFFE SEQ:1:1101:9418:3756#0/1 -1 TAATCGTGCCAAGAAAAGCGGCATGGTCAATATAACCAGTAGTGTTAACAGTCGGGAGAGGAGTGGCATTAACACCATCCTTCATGAACTTAATCCACTGT HHHHHHHHHHHHHHHHFHHHGHEHHHFHHHHFFEHHFHHHHGHHFHFHHHGHHHDHFHCHFCFBCFEFDEHHHHHG@GGGGHHGHFFEG=AB@C:EDEEEH SEQ:1:1101:9394:3759#0/1 -1 CCCTCGCTTTCCTGCTCCTGTTGAGGTTATTGCTGCCGTCATTGCTTATTATGTTCATCTCGGCAACATTCATACGGTCTGGCTTATCCGTGCAGAGACTG ##################################################################################################### SEQ:1:1101:9365:3766#0/1 -1 AAGCACATCACCTTGAATGCCACCGGAGGCGGCTTTTTGACCGCCTCCAAACAATTTAGACATGGCGCCACCAGCAAGAGCAGAAGCAATACCGCCAGCAA HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFFHHHHFHHHHEHHFGHHHHFEHHHHFEHHFDFFAFHEFHFHDFFFFHHDH?DFABFDHADFDHHHFBF SEQ:1:1101:9436:3776#0/1 -1 GAAGGACGTCAATAGTCACACAGTCCTTGACGGTATAATAACCACCATCATGGCGACCATCCAAAGGATAAACATCATAGGCAGTCGGGAGGGGAGTCGGA HHHHHHHHHHHHGHHHHHHHHHHHHHHHHHHHHFHGHHHHHHHGHHHHHHFDHHHHHHHHHHHHHFH?HHHHHFBHEH@GHHGD=EEEE88==%893A@@; SEQ:1:1101:9354:3801#0/1 -1 CCAGCAAGAGCAGAAGCAATACCGCCAGCAATAGCACCAAACATAAATCACCTCACTTAAGTGGCTGGAGACAAATAATCTCTTTAATAACCTGATTCAGC HHHHHHHHHGHHGHHEGHHEHFGFEHHGHGGHHHHHHHFHGHHFHHEFFFHEHHFHHHDHE5EDFCAC+C)4&27DDA?7HFHDHEFGFG,<@7>?>??EDC@FDDDDCDFE?DEEFGFCC@;@D SEQ:1:1101:9477:3819#0/1 adapter start: 28 1 28 58 ATAAAGGAAAGGATACTCGTGATTATCT GCCTAACTTCTTAGACTGCCTTAAGGACGT TGCTGCTGCATTTCCTGAGCTTAATGCTTGGGAGCGTGCTGGT adapt HHHHHHHHHHHHHHHHGHHHHHHHHHHH HHHHHHHHHHHHHFHHFHFHHHHHHHEHHH HHEHHHHHHEHHDHDHBHHGCEHHHHHGGEFGG=DGDGCGC68 SEQ:1:1101:9428:3823#0/1 -1 CGTCAGTAAGAACGTCAGTGTTTCCTGCGCGTACACGCAAGGTAAACGCGAACAATTCAGCGGCTTTAACCGGACGCTCGACGCCATTAATAATGTTTTCC HHHHHHHHHHHHHHHHHHHHHHHHHFHHHHHFGHGHHHHHHHEHHHHFHHHHHFHHHFHH?FHEFFFDGFDAFDCFAFDBFGBFGFHHHHHHHHHFHFH;8 SEQ:1:1101:9403:3824#0/1 adapter start: 70 1 70 100 GCTCAGGAACAAAGAAACGCGGCACAGAATGTTTATAGGTCTGTTGAACACGACCAGAAAACTGGCCTAA GCCTAACTTCTTAGACTGCCTTAAGGACGT C adapt HHHHHHHHHHHHHHHHHHHEHHHHHHHHHHHHHHHHGDHDHHHHHHHHHGHHHHGHEHGHHHHFFHHHHH EHFHFEHHFGBFFFDHCEHHHHGH=HHH=G E SEQ:1:1101:9362:3824#0/1 -1 ACCATGAAACCAACATAAACATTATTGCCCGGCGTACGGGGAAGGACGTCAATAGTCACACAGTCCTTGACGGTATAATAACCACCATCATGGCGACCATC HHHHHHHGHHHHHHHHHHHHHHHGHHHHHFHHHHHHHHFHHFHHHFHHHHHHHHHFHEHHHFHBHFHHHFCEFDEHHHHGHHHHHHHHHEFFFHHFFFDAG SEQ:1:1101:9480:3842#0/1 adapter start: 54 1 54 84 GTACGGATTGTTCAGTAACTTGACTCATGATTTCTTACCTATTAGTGGTTGAAC GCCTAACTTCTTAGACTGCCTTAAGGACGT CGCATCGGACTCAGATA adapt BDCCC@5<<<@BBB7DDDDD<<<9>::@<5DDDDDCDCBEDCDDDDBDDDBAA1 /82638?D=CD2*><6BCFGFF?E?FEFFHBBFEE3E, ;/97-0(6,?=BB@A@D9D########### SEQ:1:1101:9360:3884#0/1 -1 TAATACCTTTCTTTTTGGGGTAATTATACTCATCGCGAATATCCTTAAGAGGGCGTTCAGCAGCCAGCTTGCGGCAAAACTGCGTAACCGTCTTCTCGTTC HGDEHGHDGHFGFGHFDFFF7EEEEGGFGGEGHEGHHHHFFFEHHHFHEHFBFFF>?DEEBF=?CDB:DFBGFBBGDFFHF?FAFGGABFGGFAFE6EDDC SEQ:1:1101:9323:3894#0/1 adapter start: 100 -1 ATACCGATATTGCTGGCGACCCTGTTTTGTATGGCAACTTGCCGCCGCGTGAAATTTCTATGAAGGATGTTTTCCGTTCTGGTGATTCGTCTAAGAAGTTG HHGHHHHHHHHHHHHHHHHHHHEHDHHHHHGEHHFFHHFFFHHHHHHHHFHDHHBHGHB?HHDFFF?EFEHFHBFGEGGFFFDFBHFHHHHHFHHEFFFCF SEQ:1:1101:9267:3900#0/1 adapter start: 89 1 89 101 GTTTTGGATTTAACCGAAGATGATTTCGATTTTCTGACGAGTAACAAAGTTTGGATTGCTACTGACCGCTCTCGTGCTCGTCGCTGCGT GCCTAACTTCTT adapt HHHHHHHHHHHHHHHHHHHHHHHHHHFHHHHHHHHHHHHHHFHHHHEHHEHHHFHHHHHHHHHHFHFHECFFHABGGGIGHHHGGFFGF FCACFECEB5<; SEQ:1:1101:9416:3909#0/1 -1 TAAACGTGACGATGAGGGACATAAAAAGTAAAAATGTCTACAGTAGAGTCAATAGCAAGGCCACGACGCAATGGAGAAAGACGGAGAGCGCCAACGGCGTC HHHHHHHHHHHHHHHHHHHHHHHHHHHHFHHHHHHHHHHHHHHHHHHHEHHGHHFEFHEFHFFDHEFHFAFFFA?GDFGFE@FFFB?B7EEFEFE?DAA## SEQ:1:1101:9360:3917#0/1 adapter start: 68 1 68 98 ATGCTTGGGAGCGTGCTGGTGCTGATGCTTCCTCTGCTGGTATGGTTGACGCCGGATTTGAGAATCAA GCCTAACTTCTTAGACTGCCTTAAGGACGT AAA adapt HHHHHHHHHHHHHHHHHHHFHHHHHHHHHHFHHHHHHHFHEFHHHEHHCFFEFEE9AFFBBDCDCAEE EFHD??>E4@EC>74<-5@############## SEQ:1:1101:9307:3927#0/1 adapter start: 15 1 15 45 TCAGCGCCTTCCATG GCCTAACTTCTTAGACTGCCTTAAGGACGT ATGAGACAGGCCGTTTGAATGTTGACGGGATGAACATAATAAGCAATGACGGCAGC adapt FFFFFFFFFFFFFDF =EEEEDFFFFBEEEEFFFFFFFFFFFDEEB DFFFFDFFFFEF@FFFBEFFBFFEF--@@EFHFHBHFHCFHHGGGHEGHEGHEF@GHHFHEDHH;H SEQ:1:1101:9309:3957#0/1 adapter start: 72 1 72 101 GTCAGATATGGACCTTGCTGCTAAAGGTCTAGGAGCTAAAGAATGGAACAACTCACTAAAAACCAAGCTGTC GCCTAACTTCTTAGACTGCCTTAAGGACG adapt HHHHHHHHHHHHHHHHHHHHHHHHHGHFHHHFHHHHHHHHGHHHFHHHHHHHFHDHHHHHHFHCHHEAHHDG GHFHFHDHHHGHHEHHFFH?HHHFDGGG? SEQ:1:1101:9425:3960#0/1 -1 CTGACGCAGAAGAAAACGTGCGTCAAAAATTACGTGCAGAAGGAGTGATGTAATGTCTAAAGGTAAAAAACGTTCTGGCGCTCGCCCTGGTCGTCCGCAGC 8?8?C?BC@BD=ABB==BD?CADD=AD>C@@CCBBDD@B/143'3.>>@9BCBDDDC8@@;@???FB=DFB=>C=EEFFFFFEFFFFF:FEF@FEF EFBGGGFFGHFFHD5DGB=>>@;A>C5?A SEQ:1:1101:9363:3989#0/1 adapter start: 95 -1 CCTCCAAGATTTGGAGGCATGAAAACATACAATTGGGAGGGTGTCAATCCTGACGGTTATTTCCTAGACAAATTAGAGCCAATACCATCAGCTTTGCCTAA HHHHHHHHHHHHHHHHHHHHHGHHHHHHHHHHGHHHHHHHGB B;FBFFEGGEGB==EGFHHGEEGB;5 SEQ:1:1101:9554:3781#0/1 -1 CACGCTCTTTTAAAATGTCAACAAGAGAATCTCTACCATGAACAAAATGTGACTCATATCTAAACCAGTCCTTGACGAACGTGCCAAGCATATTAAGCCAC HHHHHHHHHHHHHGGHHHHHHGHFHHHHHHEHHFHHHEHHHHHHHEHHGHHHHEHHHGFHHHEHHHHHHEEFFEDFEDFF>ACBAHGHHHHECEGHBCFEE SEQ:1:1101:9695:3783#0/1 adapter start: 52 1 52 82 AATAACCCTGAAACAAATGCTTAGGGATTTTATTGGTATCAGGGTTAATCGT GCCTAACTTCTTAGACTGCCTTAAGGACGT GCCAAGAAAAGCGGCATGG adapt HHHHHHHHHHHHHHHHHHHHHHHHHHGHHHHHHHHHHHHHGHHHHHHHHHHF HHHHHHFHGEHEHHHHHGHHHHHHHHHFHH FHGGHHHHHHGGHGFHHHG SEQ:1:1101:9572:3788#0/1 -1 ACCAACACGGCGAGTACAACGGCCCAGCTCAGAAGCGAGAACCAGCTGCGCTTGGGTGGGGCGATGGTGATGGTTTGCATGTTTGGCTCCGGTCTGTAGGC FFFFFFFFF=EBEB0A@A@>A?;FED;;<7??A>>9A>?DA1ADD?D:FF:BC;@############## SEQ:1:1101:9601:3793#0/1 -1 GCCGCTAATCAGGTTGTTTCTGTTGGTGCTGATATTGCTTTTGATGCCGACCCTAAATTTTTTGCCTGTTTGGTTCGCTTTGAGTCTTCTTCGGTTCCGAC HHHHHHHHHHHHHHHHHHHHHHHHHHHGHHHEHEGHFHHHHHHHHFHFHCHHHFHFFHHHHHH@HHHHHHGHHHFHHGFHHCFHEGGGFEGE?GCDAD6AD SEQ:1:1101:9634:3800#0/1 -1 TTTATGCGGACACTTCCTACAGGTAGCGTTGACCCTAATTTTGGTCGTCGGGTACGCAATCGCCGCCAGTTAAATAGCTTGCAAAATACGTGGCCTTATGG HHGHFHFHHHHCGHHFHHHHHHGEHHHHHGFBEFHHFEHDHHHGFHHEHHFF9ECD?CEEHEDF?GEEDEEG SEQ:1:1101:9501:3800#0/1 adapter start: 42 1 42 72 TGACCACCTACATACCAAAGACGAGCGCCTTTACGCTTGCCT GCCTAACTTCTTAGACTGCCTTAAGGACGT TTAGTACCTCGCAACGGCTGCGGACGACC adapt HHHHHHHHHHHHHHHHFHHHHHHHHFHHHHHHHHHHHHHHHH HHHHHFHHHHHHHHHHHHHHFBHAEDBEFB BEF=ADEEGGGEFCC>B1CCDCB7FGFFE SEQ:1:1101:9703:3807#0/1 adapter start: 27 1 27 57 TAATAACCTGATTCAGCGAAACCAATC GCCTAACTTCTTAGACTGCCTTAAGGACGT CGCGGCATTTAGTAGCGGTAAAGTTAGACCAAACCATGAAACCA adapt HHHHHHHHHHHHHHHHHHHHHHGHHHG HHHFHGFHHHHFFHHHHHDHHHHBGFEFHH HFHFHFDHFDFFFEHHGHDHHGHHEHHG@E?FDGBEBDGGFFGF SEQ:1:1101:9728:3808#0/1 adapter start: 7 1 7 37 CAGAAAA GCCTAACTTCTTAGACTGCCTTAAGGACGT CCTACCGCGCTTCGCTTGGTCAACCCCTCAGCGGCAAAAATTAAAATTTTTACCGCTTCGGCGT adapt HHHFHHH HHHHHHHHHHHHHHHFHHHHHHHHHHHFB8 @B9C?CC@CHCFFFHF=FEED<4:?:>@,@;@>.>6;+?&@><:BC?DE@=7@### SEQ:1:1101:9676:3812#0/1 adapter start: 1 1 1 31 T GCCTAACTTCTTAGACTGCCTTAAGGACGT TATTGCCCGGCGTACGGGGAAGGACGTCAATAGTCACACAGTCCTTGACGGTATAATAACCACCATCATG adapt H HHHHHHHHHHHHHHHHHHHHHHHFHHHHHH HDHFHHHHHHHECHHEHEHHH=HHFHHFHFHHFHFHGFFEECFFHEFFGFGHFFEHHFHHFFFHFDG?FCBCDFFFEBFFE@DFEGGEEG?GF>>:;@A SEQ:1:1101:9720:3834#0/1 adapter start: 74 1 74 101 TAGACATTTTTACTTTTTATGTCCCTCATCGTCACGTTTATGGTGAACAGTGGATTAAGTTCATGAAGGATGGT GCCTAACTTCTTAGACTGCCTTAAGGA adapt HGHHHHHHHHHHHHHHHGGHEGGFGHFGHFHHDGHGHGHHHHHHHHHHFHHHHHFHFHFFHEFHF=FFHFHHFF HFGAGGHHDHGHBHHHEGDGC>FEC@D SEQ:1:1101:9635:3844#0/1 adapter start: 4 1 4 34 GACC GCCTAACTTCTTAGACTGCCTTAAGGACGT ATCCAAAGGATAAACATCATAGGCAGTCGGGAGGGTAGTCGGAACCGAAGAAGACTCAAAGCGAACC adapt HHHH GHHHHHHHHHGHHHHHHGHHGHHHGHGHHH HFHHH;GGCGFH?HHFHEHHFFHFHFFFHHFDHHHHHHHHHEGHHHHGHGHEHHHHC@?GFEGBGHH SEQ:1:1101:9744:3849#0/1 adapter start: 55 1 55 85 AAACATAGTGCCATGCTCAGGAACAAAGAAACGCGGCACAGAATGTTTATAGGTC GCCTAACTTCTTAGACTGCCTTAAGGACGT TGTTGAACACGACCAG adapt HHHHHHHGCHHFHHFHHFFHEHFGCHHGDGHEFFHFHEHHGBBGFCDGFEEFDCF FGEEEHEHFHHHCFF?EEFDEFD6FHGEHH HEHHHBBE?:CCDA7G SEQ:1:1101:9725:3850#0/1 -1 ATAACCCTGAAACAAATGCTTAGGGATTTTATTGGTATCAGGGTTAATCGTGCCAAGAAAAGCGGCATGGTCAATATAACCAGTAGTGTTAACAGTCGGGA FDGGGDGGGEGGGGGBGBEGFFFDFFFFGGFGGGGFBGGGGGEFDFFGEGFFEFEDGGEEF9DCF?EFBBEDBBGFGGEGGGGCFGFEB@B7C>CDEEE## SEQ:1:1101:9544:3854#0/1 -1 TAGCGGTAAAGTTAGACCAAACCATGAAACCAACATAAACATTATTGCCCGGCGTACGGGGAAGGACGTCAATAGTCACACAGTCCTTGACGGTATAATAA HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFHHHHHHHHHHHHFFHHHHHHHHHBFHHHHHFHHHHHHHHHHHHHHFCHHHBHE SEQ:1:1101:9581:3856#0/1 -1 GGGCGGTGGTCTATAGTGTTATTAATATCAAGTTGGGGGAGCACATTGTAGCATTGTGCCAATTCATCCATTAACTTCTCAGTAACAGATACAAACTCATC HHHHHHEHHHHHHHGHHHHHHHHHHHHHHHHHHHHHHHFHHHHGHHHHHHHHHHHHHHHGGHHHFHHHHHGHFGHGEGHHHHHHFEHFHGDGGFFGHH@DH SEQ:1:1101:9649:3858#0/1 adapter start: 33 1 33 63 CCTCCAAACAATTTAGACATGGCGCCACCAGCA GCCTAACTTCTTAGACTGCCTTAAGGACGT AGAGCAGAAGCAATACCGCCAGCAATAGCAACAAACAT adapt BFEEEE@@BA@3>8<>CCDDBEE@ DEFFDDFE=EEB@EDEEFDFDECEEBEB:C -@<698<@BBA@DCBDDFCEBFCCD;DC=D@C###### SEQ:1:1101:9616:3862#0/1 adapter start: 91 1 91 101 GAATTAAATCGAAGTGGACTGCTGGCGGAAAATGAGAAAATTCGACCTATCCTTGCGCAGCTCGAGAAGCTCTTACTTTGCGACCTTTCGC GCCTAACTTC adapt HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFHHHHHHHEHHHHHHHHHHHHHHFHHHHHHHFFFHFDHHEHHHGHHHHGDEHHGHHEGH GCHHHHEHFG SEQ:1:1101:9696:3866#0/1 -1 CAAGTTGCCATACAAAACAGGGTCGCCAGCAATATCGGTATAAGTCAAAGCACCTTTAGCGTTAAGGTACTGAATCTCTTTAGTCGCAGTAGGCGGAAAAC HHHHHHHHHHHHHHHHHHHHEHEHHHEHHHHFHHHHHHFHHHFHFHHHHHHHHFHHHHFHHFEHBHFEHHHHCEEHHFHHHHHHHHHHHHEHHHHCAFEFG SEQ:1:1101:9512:3869#0/1 -1 GCTCGACGCCATTAATAATGTTTTCCGTAAATTCAGCGCCTTCCATGATGAGACAGGCCGTTTGAATGTTGACGGGATGAACATAATAAGCAATGACGGCA HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFHHHHFHHHDHHHEHHFFFFFFHFAFEFH?E@FFGGGFGHFHAEFGFFFCEEFF SEQ:1:1101:9723:3870#0/1 adapter start: 66 1 66 96 CTTTAGCAGCAAGGTATATATCTGACTTTTTGTTAACGTATTTAGCCACATAGCAACCAACAGACA GCCTAACTTCTTAGACTGCCTTAAGGACGT TATAA adapt ################################################################## ############################## ##### SEQ:1:1101:9667:3874#0/1 -1 CTGCTGCATTTCCTGAGCTTAATGCTTGGGAGCGTGCTGGTGCTGATGCTTCCTCTGCTGGTATGGTTGACGCCGGATTTGAGAATCAAAAAGAGCTTACT HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHAHHHHEHHD=DAD>D6ADGE@EBE;@?BCGGE?4>ADAAC SEQ:1:1101:9565:3879#0/1 adapter start: 24 1 24 54 AGCCTTATGGCCGTCAACATACAT GCCTAACTTCTTAGACTGCCTTAAGGACGT ATCACCATTATCGAACTCAACGCCCTGCATACGAAAAGACAGAATCT adapt HHHHHHHHHHHHHHHHHFHHGFFH HHHHHHHHHDGHHFHFHHHHHFECHFFHHH HHEHFCFFFFHEHDEFHHCHHEG?GFEGGEGHHHHHH?HH?EFFFFF SEQ:1:1101:9721:3885#0/1 adapter start: 51 1 51 81 TTCCTCAAACGCTTGTTCGGTGGATAAGTTATGGCATTAATCGATTTATTT GCCTAACTTCTTAGACTGCCTTAAGGACGT ATCTCGCGGAAGAAAAACAC adapt >BC?:A?=<>::A=528882.53)5.77;407)*9@:AA8CAA######## ############################## #################### SEQ:1:1101:9707:3894#0/1 adapter start: 40 1 40 70 AACACCATCCTTCATGAACTTAATCCACTGTTCACCATAA GCCTAACTTCTTAGACTGCCTTAAGGACGT ACGTGACGATGAGGGACATAAAAAGTAAAAA adapt F@F8DEE@EEBCCCCFFEFDDC=DCCFFF=ADD=D>@AA@ FFFDE99>,>>@=856>;6C<@1:39@>6@ =??:BAEEEBEDFBF69:<8B5D>@DEDEEF?F><>B@CBCD==BB DCDCCDD=8A>@<3A499:1@@@@CDC@@= @=<6@<@:=>189<16 SEQ:1:1101:9903:3754#0/1 -1 ACCAAAATTAGGGTCAACGCTACCTGTAGGAAGTGTCCGCATAAAGTGCACCGCATGGAAATGAAGACGGCCATCAGCTGTACCATACTCAGGCACACAAA GFEGGGGGBGE@EAEEGGFGGEGGFGEFFGFGFFGGEGGGGEFGCFCEFBF7FGEGEF?BFEEFDFFE??AADD+D@C@CGFCE6FDFFDFBGFDD@DAAD SEQ:1:1101:9878:3755#0/1 adapter start: 32 1 32 62 AGAACGTGAAAAAGCGTCCTGCGTGTAGCGAA GCCTAACTTCTTAGACTGCCTTAAGGACGT CTGCGATGGGCATACTGTAACCATAAGGCCACGTATTTT adapt HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH HFHHHBHHHHHHHHHFHFHEHHHHHHHHHH HHHEFHFHHHDFHHHHFGHHHHHFCEHECHHF?D5D7@D SEQ:1:1101:9833:3756#0/1 adapter start: 65 1 65 95 TCATCGTCACGTTTATGGTGAACAGTGGATTAAGTTCATGAAGGATGGTGTTAATGCCACTCCTC GCCTAACTTCTTAGACTGCCTTAAGGACGT TCCCGA adapt HHHHHHHHHHHHHHHHHFHHHHHHHHHHHHHHHHFHHHHGHHFHHHHHEHEHHHHFHEHHHEHFH HHFHHFEFFB=;,01:99;;HHHHHHEFGE EFFBFB SEQ:1:1101:9991:3777#0/1 -1 GCTTTGAGTCTTCTTCGGTTCCGACTACCCTCCCGACTGCCTATGATGTTTATCCTTTGGATGGTCGCCATGATGGTGGTTATTATACCGTCAAGGACTGT HHHHHHHHHHHHHHHHHHHHHHGHHHGHHHHHHHGHHHHHHGHHHHHHHHHHHHHFHHFFDFFFCFFDHCFF;BFGEFGEGFGGFFF.CFDCCEDB=CBC@ cutadapt-1.15/tests/cut/twoadapters.unknown.fasta0000664000175000017500000000013713205526454023016 0ustar marcelmarcel00000000000000>read3 (no adapter) AATGAAGGTTGTAACCATAACAGGAAGTCATGCGCATTTAGTCGAGCACGTAAGTTCATACGGAAATGGGTAAG cutadapt-1.15/tests/cut/empty.fastq0000664000175000017500000000000013205526454020126 0ustar marcelmarcel00000000000000cutadapt-1.15/tests/cut/minlen.fa0000664000175000017500000000030713205526454017534 0ustar marcelmarcel00000000000000>read_length5 T23302 >read_length6 T023302 >read_length7 T1023302 >read_length8 T11023302 >read_length9 T111023302 >read_length10 T2111023302 >read_length11 T02111023302 >read_length12 T002111023302 cutadapt-1.15/tests/cut/interleaved.fastq0000664000175000017500000000032513205526454021304 0ustar marcelmarcel00000000000000@read1/1 some text TTATTTGTCTCCAGC + ##HHHHHHHHHHHHH @read1/2 other text GCTGGAGACAAATAA + HHHHHHHHHHHHHHH @read3/1 CCAACTTGATATTAATAACA + HHHHHHHHHHHHHHHHHHHH @read3/2 TGTTATTAATATCAAGTTGG + #HHHHHHHHHHHHHHHHHHH cutadapt-1.15/tests/cut/illumina.fastq0000664000175000017500000004256413205526454020627 0ustar marcelmarcel00000000000000@SEQ:1:1101:9010:3891#0/1 adapter start: 51 ATAACCGGAGTAGTTGAAATGGTAATAAGACGACCAATCTGACCAGCAAGG + FFFFFEDBE@79@@>@CBCBFDBDFDDDDD<@C>ADD@B;5:978@CBDDF @SEQ:1:1101:9240:3898#0/1 CCAGCAAGGAAGCCAAGATGGGAAAGGTCATGCGGCATACGCTCGGCGCCAGTTTGAATATTAGACATAATTTATCCTCAAGTAAGGGGCCGAAGCCCCTG + GHGHGHHHHGGGDHHGDCGFEEFHHGDFGEHHGFHHHHHGHEAFDHHGFHHEEFHGHFHHFHGEHFBHHFHHHH@GGGDGDFEEFC@=D?GBGFGF:FB6D @SEQ:1:1101:9207:3899#0/1 adapter start: 64 TTAACTTCTCAGTAACAGATACAAACTCATCACGAACGTCAGAAGCAGCCTTATGGCCGTCAAC + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFHHHHHHCFHHF @SEQ:1:1101:9148:3908#0/1 adapter start: 28 ACGACGCAATGGAGAAAGACGGAGAGCG + HHHHHHHHHHHHGHHHHGHHHHHHHHHH @SEQ:1:1101:9044:3916#0/1 adapter start: 78 AACAGAAGGAGTCTACTGCTCGCGTTGCGTCTATTATGGAAAACACCAATCTTTCCAAGCAACAGCAGGTTTCCGAGA + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHGHHHHGHHHHHHHHHHHHFHEBFHFFEFHE @SEQ:1:1101:9235:3923#0/1 TTGATGCGGTTATCCATCTGCTTATGGAAGCCAAGCATTGGGGATTGAGAAAGAGTAGAAATGCCACAAGCCTCAATAGCAGGTTTAAGAGCCTCGATACG + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFHBHHFHFHHHHHFHHCHHFFHHHHEHHFDHCEEHHHFHHFHFEHHHHHHHHHEHHGFHHCDCEEEFDFFHHHCFFEFE?EBFEB?3 @SEQ:1:1101:9185:3939#0/1 CGTTGAGGCTTGCGTTTATGGTACGCTGGACTTTGTAGGATACCCTCGCTTTCCTGCTCCTGTTGAGTTTATTGCTGCCGTCATTGCTTATTATGTTCATC + HHHHHHHHHHHHHHFHHEHHHDHHFGHHHCHHHHHDHHHHFECEGBD@@?A?DAFF9F<@@08?< @SEQ:1:1101:9140:3961#0/1 adapter start: 66 CAGGAGAAACATACGAAGGCGCATAACGATACCACTGACCCTCAGCAATCTTAAACTTCTTAGACG + HHHHHHHGHHHHHHHHHHHGHHHHHHHHHHHHHHHHFHHHHHHFGHHHHHHHHHHHHHHHHDHHFH @SEQ:1:1101:9073:3961#0/1 adapter start: 49 GTGGCAAGTCTGCCGCTGATAAAGGAAAGGATACTCGTGATTATCTTGC + HHHHHHHHFHHHHHHGHHHHHHHHHEHHGHHGHHHHHHHHHHGEHHHHH @SEQ:1:1101:9196:3971#0/1 adapter start: 18 ACCAGAAGGCGGTTCCTG + HHHHHHHHHFHHHHHHHH @SEQ:1:1101:9053:3973#0/1 TTCACGTTCTGGTTGGTTGTGGCCTGTTGATGCTAAAGGTGAGCCGCTTAAAGCTACCAGGTTTATTGCTGTTTGTTTCTATGTGGCTTAAAACGTTACCA + A39>A################################################################################################ @SEQ:1:1101:9120:3979#0/1 GGCGTTGACAGATGTATCCATCTGAATGCAATGAAGAAAACCACCATTACCAGCATTAACCGTCAAACTATCAAAATATAACGTTGACGATGTAGCTTTAG + HHHHHHHHHHHGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFFGFFDHBHHHFGEHHHFGHHHEHHHGH @SEQ:1:1101:9045:3988#0/1 adapter start: 91 TAACCCTGAAACAAATGCTTAGGGATTTTATTGGTATCAGGGTTAATCGTGCCAAGAAAAGCGGCATGGTCAATATAACCAGCAGTGTTAA + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFHHHHHHHFHHHHHHHHHHHFHHHHHHDHHHHHHHFHFFHHGHEHHGHHHGHGHHFH @SEQ:1:1101:9418:3756#0/1 TAATCGTGCCAAGAAAAGCGGCATGGTCAATATAACCAGTAGTGTTAACAGTCGGGAGAGGAGTGGCATTAACACCATCCTTCATGAACTTAATCCACTGT + HHHHHHHHHHHHHHHHFHHHGHEHHHFHHHHFFEHHFHHHHGHHFHFHHHGHHHDHFHCHFCFBCFEFDEHHHHHG@GGGGHHGHFFEG=AB@C:EDEEEH @SEQ:1:1101:9394:3759#0/1 CCCTCGCTTTCCTGCTCCTGTTGAGGTTATTGCTGCCGTCATTGCTTATTATGTTCATCTCGGCAACATTCATACGGTCTGGCTTATCCGTGCAGAGACTG + ##################################################################################################### @SEQ:1:1101:9365:3766#0/1 AAGCACATCACCTTGAATGCCACCGGAGGCGGCTTTTTGACCGCCTCCAAACAATTTAGACATGGCGCCACCAGCAAGAGCAGAAGCAATACCGCCAGCAA + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFFHHHHFHHHHEHHFGHHHHFEHHHHFEHHFDFFAFHEFHFHDFFFFHHDH?DFABFDHADFDHHHFBF @SEQ:1:1101:9436:3776#0/1 GAAGGACGTCAATAGTCACACAGTCCTTGACGGTATAATAACCACCATCATGGCGACCATCCAAAGGATAAACATCATAGGCAGTCGGGAGGGGAGTCGGA + HHHHHHHHHHHHGHHHHHHHHHHHHHHHHHHHHFHGHHHHHHHGHHHHHHFDHHHHHHHHHHHHHFH?HHHHHFBHEH@GHHGD=EEEE88==%893A@@; @SEQ:1:1101:9354:3801#0/1 CCAGCAAGAGCAGAAGCAATACCGCCAGCAATAGCACCAAACATAAATCACCTCACTTAAGTGGCTGGAGACAAATAATCTCTTTAATAACCTGATTCAGC + HHHHHHHHHGHHGHHEGHHEHFGFEHHGHGGHHHHHHHFHGHHFHHEFFFHEHHFHHHDHE5EDFCAC+C)4&27DDA?7HFHDHEFGFG,<@7>?>??::@<5DDDDDCDCBEDCDDDDBDDDBAA1 @SEQ:1:1101:9286:3846#0/1 TGATTAAACTCCTAAGCAGAAAACCTACCGCGCTTCGCTTGGTCAACCCCTCAGCGGCAAAAATTAAAATTTTTACCGCTTCGGCGTTATAACCTCACACT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFHFHHDGCEGGHHHHFHHFHEHHFHEGHGHGF @SEQ:1:1101:9403:3867#0/1 adapter start: 1 G + H @SEQ:1:1101:9341:3873#0/1 adapter start: 88 CCTAAGCAGAAAACCTACCGCGCTTCGCTTGGTCAACCCCTCAGCGGCAAAAATTAAAATTTTTACCGCTTCGGCGTTATAACCTCAC + HHHHHHHGGFHGHHHHHGHHHHFGHGHHHHEHHHFHFHFHFHH?CEEEDFCEFCDFFHFEABEDF.ECDCDFEEEEEGGFADACDHHH @SEQ:1:1101:9381:3881#0/1 adapter start: 41 ACGTTCTGGTTGGTTGTGGCCTGTTGATGCTAAAGGTGAGC + HHHHHHHHHHHHGHGHDHHHHHHHHFEHHHGGGGFFBGFFF @SEQ:1:1101:9360:3884#0/1 TAATACCTTTCTTTTTGGGGTAATTATACTCATCGCGAATATCCTTAAGAGGGCGTTCAGCAGCCAGCTTGCGGCAAAACTGCGTAACCGTCTTCTCGTTC + HGDEHGHDGHFGFGHFDFFF7EEEEGGFGGEGHEGHHHHFFFEHHHFHEHFBFFF>?DEEBF=?CDB:DFBGFBBGDFFHF?FAFGGABFGGFAFE6EDDC @SEQ:1:1101:9323:3894#0/1 adapter start: 100 ATACCGATATTGCTGGCGACCCTGTTTTGTATGGCAACTTGCCGCCGCGTGAAATTTCTATGAAGGATGTTTTCCGTTCTGGTGATTCGTCTAAGAAGTTG + HHGHHHHHHHHHHHHHHHHHHHEHDHHHHHGEHHFFHHFFFHHHHHHHHFHDHHBHGHB?HHDFFF?EFEHFHBFGEGGFFFDFBHFHHHHHFHHEFFFCF @SEQ:1:1101:9267:3900#0/1 adapter start: 89 GTTTTGGATTTAACCGAAGATGATTTCGATTTTCTGACGAGTAACAAAGTTTGGATTGCTACTGACCGCTCTCGTGCTCGTCGCTGCGT + HHHHHHHHHHHHHHHHHHHHHHHHHHFHHHHHHHHHHHHHHFHHHHEHHEHHHFHHHHHHHHHHFHFHECFFHABGGGIGHHHGGFFGF @SEQ:1:1101:9416:3909#0/1 TAAACGTGACGATGAGGGACATAAAAAGTAAAAATGTCTACAGTAGAGTCAATAGCAAGGCCACGACGCAATGGAGAAAGACGGAGAGCGCCAACGGCGTC + HHHHHHHHHHHHHHHHHHHHHHHHHHHHFHHHHHHHHHHHHHHHHHHHEHHGHHFEFHEFHFFDHEFHFAFFFA?GDFGFE@FFFB?B7EEFEFE?DAA## @SEQ:1:1101:9360:3917#0/1 adapter start: 68 ATGCTTGGGAGCGTGCTGGTGCTGATGCTTCCTCTGCTGGTATGGTTGACGCCGGATTTGAGAATCAA + HHHHHHHHHHHHHHHHHHHFHHHHHHHHHHFHHHHHHHFHEFHHHEHHCFFEFEE9AFFBBDCDCAEE @SEQ:1:1101:9337:3918#0/1 adapter start: 14 CATCAGCACCAGCA + FDEGGGCDBEFCDF @SEQ:1:1101:9307:3927#0/1 adapter start: 15 TCAGCGCCTTCCATG + FFFFFFFFFFFFFDF @SEQ:1:1101:9479:3929#0/1 adapter start: 9 GACAAATTA + HHHHHHHHH @SEQ:1:1101:9277:3934#0/1 adapter start: 71 CTGTCTTTTCGTATGCAGGGCGTTGAGTTCGATAATGGTGATATGTATGTTGACGGCCATAAGGCTGCTTC + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFHHHHHHEHFHHHHFHHHHHFHHEHFHHHFHHFDHHFHHE @SEQ:1:1101:9442:3934#0/1 AGACCCATAATGTCAATAGATGTGGTAGAAGTCGTCATTTGGCGAGAAAGCTCAGTCTCAGGAGGAAGCGGAGCAGTCCAAATGTTTTTGAGATGGCAGCA + HHHHHHHHHGHHHHHFGHHBHHEHGFHHDHGDEGDHHHHHFHHHHHAHHH?FEEBEFDFBEBEEFEHFE7ECCDCG=FDFFDFFFHHHHFEEBEF;BEAEG @SEQ:1:1101:9329:3935#0/1 AGATGGATAACCGCATCAAGCTCTTGGAAGAGATTCTGTCTTTTCGTATGCAGGGCGTTGAGTTCGATAATGGTGATATGTATGTTGACGGCCATAAGGCT + GFGGGEEGDHHHGGEHHHHHHGGFHHEAHHAGDEGEGGEDG@GGGHHGHHFGGH6@CADDHHBEEE@8EBGEEFGGGHFHHHHGEGFGGEFBGEDDE?E7E @SEQ:1:1101:9445:3956#0/1 adapter start: 81 TGCAACAACTGAACGGACTGGAAACACTGGTCATAATCATGGTGGCGAATAAGTACGCGTTCTTGCAAATCACCAGAAGGC + HHHHHHHHHGFHHHHHHHHHHHHHHGHHHHFHHHHHHHHHHHFGHHHFGHHHHFGHHFHEHHHHHHHHHHHHGBHHHHGFG @SEQ:1:1101:9357:3957#0/1 TTAATCGTGCCAAGAAAAGCGGCATGGTCAATATAACCAGTAGTGTTAACAGTCGGGAGAGGAGTGGCATTAACACCATCCTTCATGAACTTAATCCACTG + HHHHHHGHHHHHHHHHHGHEHHHHHGHEHHHHHHHHHHHHHHGHEBGGFGFFFFFBH?HCEEEDEFHFHBHFHCFHHGGGHEGHEGHEF@GHHFHEDHH;H @SEQ:1:1101:9309:3957#0/1 adapter start: 72 GTCAGATATGGACCTTGCTGCTAAAGGTCTAGGAGCTAAAGAATGGAACAACTCACTAAAAACCAAGCTGTC + HHHHHHHHHHHHHHHHHHHHHHHHHGHFHHHFHHHHHHHHGHHHFHHHHHHHFHDHHHHHHFHCHHEAHHDG @SEQ:1:1101:9425:3960#0/1 CTGACGCAGAAGAAAACGTGCGTCAAAAATTACGTGCAGAAGGAGTGATGTAATGTCTAAAGGTAAAAAACGTTCTGGCGCTCGCCCTGGTCGTCCGCAGC + 8?8?C?BC@BD=ABB==BD?CADD=AD>C@@CCBBDD@B/143'3.>>@9BCBDDDC8@@;@???FB=DFB=>C=EEFFFFFEFFFFF:FEF@FEF @SEQ:1:1101:9363:3989#0/1 adapter start: 95 CCTCCAAGATTTGGAGGCATGAAAACATACAATTGGGAGGGTGTCAATCCTGACGGTTATTTCCTAGACAAATTAGAGCCAATACCATCAGCTTTGCCTAA + HHHHHHHHHHHHHHHHHHHHHGHHHHHHHHHHGHHHHHHHGGEEGB;5 @SEQ:1:1101:9554:3781#0/1 CACGCTCTTTTAAAATGTCAACAAGAGAATCTCTACCATGAACAAAATGTGACTCATATCTAAACCAGTCCTTGACGAACGTGCCAAGCATATTAAGCCAC + HHHHHHHHHHHHHGGHHHHHHGHFHHHHHHEHHFHHHEHHHHHHHEHHGHHHHEHHHGFHHHEHHHHHHEEFFEDFEDFF>ACBAHGHHHHECEGHBCFEE @SEQ:1:1101:9695:3783#0/1 adapter start: 52 AATAACCCTGAAACAAATGCTTAGGGATTTTATTGGTATCAGGGTTAATCGT + HHHHHHHHHHHHHHHHHHHHHHHHHHGHHHHHHHHHHHHHGHHHHHHHHHHF @SEQ:1:1101:9572:3788#0/1 ACCAACACGGCGAGTACAACGGCCCAGCTCAGAAGCGAGAACCAGCTGCGCTTGGGTGGGGCGATGGTGATGGTTTGCATGTTTGGCTCCGGTCTGTAGGC + FFFFFFFFF=EBEB0A@A@>A?;FED;;<7??A>>9A>?DA1ADD?D:FF:BC;@############## @SEQ:1:1101:9601:3793#0/1 GCCGCTAATCAGGTTGTTTCTGTTGGTGCTGATATTGCTTTTGATGCCGACCCTAAATTTTTTGCCTGTTTGGTTCGCTTTGAGTCTTCTTCGGTTCCGAC + HHHHHHHHHHHHHHHHHHHHHHHHHHHGHHHEHEGHFHHHHHHHHFHFHCHHHFHFFHHHHHH@HHHHHHGHHHFHHGFHHCFHEGGGFEGE?GCDAD6AD @SEQ:1:1101:9634:3800#0/1 TTTATGCGGACACTTCCTACAGGTAGCGTTGACCCTAATTTTGGTCGTCGGGTACGCAATCGCCGCCAGTTAAATAGCTTGCAAAATACGTGGCCTTATGG + HHGHFHFHHHHCGHHFHHHHHHGEHHHHHGFBEFHHFEHDHHHGFHHEHHFF9ECD?CEEHEDF?GEEDEEG @SEQ:1:1101:9501:3800#0/1 adapter start: 42 TGACCACCTACATACCAAAGACGAGCGCCTTTACGCTTGCCT + HHHHHHHHHHHHHHHHFHHHHHHHHFHHHHHHHHHHHHHHHH @SEQ:1:1101:9703:3807#0/1 adapter start: 27 TAATAACCTGATTCAGCGAAACCAATC + HHHHHHHHHHHHHHHHHHHHHHGHHHG @SEQ:1:1101:9728:3808#0/1 adapter start: 7 CAGAAAA + HHHFHHH @SEQ:1:1101:9676:3812#0/1 adapter start: 1 T + H @SEQ:1:1101:9620:3815#0/1 TCGCGTAGAGGCTTTGCTATTCAGCGTTTGATGAATGCAATGCGACAGGCTCATGCTGATGGTTGGTTTATCGTTTTTGACACTCTCACGTTGGCTGACGA + HHHHHHHHHHGGHHHGHHGHHHHHHHHHHGFHGHHHHHHHHHFHDHHHDDHFHFHFHHHHFF9EFF>DG?FCBCDFFFEBFFE@DFEGGEEG?GF>>:;@A @SEQ:1:1101:9720:3834#0/1 adapter start: 74 TAGACATTTTTACTTTTTATGTCCCTCATCGTCACGTTTATGGTGAACAGTGGATTAAGTTCATGAAGGATGGT + HGHHHHHHHHHHHHHHHGGHEGGFGHFGHFHHDGHGHGHHHHHHHHHHFHHHHHFHFHFFHEFHF=FFHFHHFF @SEQ:1:1101:9635:3844#0/1 adapter start: 4 GACC + HHHH @SEQ:1:1101:9744:3849#0/1 adapter start: 55 AAACATAGTGCCATGCTCAGGAACAAAGAAACGCGGCACAGAATGTTTATAGGTC + HHHHHHHGCHHFHHFHHFFHEHFGCHHGDGHEFFHFHEHHGBBGFCDGFEEFDCF @SEQ:1:1101:9725:3850#0/1 ATAACCCTGAAACAAATGCTTAGGGATTTTATTGGTATCAGGGTTAATCGTGCCAAGAAAAGCGGCATGGTCAATATAACCAGTAGTGTTAACAGTCGGGA + FDGGGDGGGEGGGGGBGBEGFFFDFFFFGGFGGGGFBGGGGGEFDFFGEGFFEFEDGGEEF9DCF?EFBBEDBBGFGGEGGGGCFGFEB@B7C>CDEEE## @SEQ:1:1101:9544:3854#0/1 TAGCGGTAAAGTTAGACCAAACCATGAAACCAACATAAACATTATTGCCCGGCGTACGGGGAAGGACGTCAATAGTCACACAGTCCTTGACGGTATAATAA + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFHHHHHHHHHHHHFFHHHHHHHHHBFHHHHHFHHHHHHHHHHHHHHFCHHHBHE @SEQ:1:1101:9581:3856#0/1 GGGCGGTGGTCTATAGTGTTATTAATATCAAGTTGGGGGAGCACATTGTAGCATTGTGCCAATTCATCCATTAACTTCTCAGTAACAGATACAAACTCATC + HHHHHHEHHHHHHHGHHHHHHHHHHHHHHHHHHHHHHHFHHHHGHHHHHHHHHHHHHHHGGHHHFHHHHHGHFGHGEGHHHHHHFEHFHGDGGFFGHH@DH @SEQ:1:1101:9649:3858#0/1 adapter start: 33 CCTCCAAACAATTTAGACATGGCGCCACCAGCA + BFEEEE@@BA@3>8<>CCDDBEE@ @SEQ:1:1101:9616:3862#0/1 adapter start: 91 GAATTAAATCGAAGTGGACTGCTGGCGGAAAATGAGAAAATTCGACCTATCCTTGCGCAGCTCGAGAAGCTCTTACTTTGCGACCTTTCGC + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFHHHHHHHEHHHHHHHHHHHHHHFHHHHHHHFFFHFDHHEHHHGHHHHGDEHHGHHEGH @SEQ:1:1101:9696:3866#0/1 CAAGTTGCCATACAAAACAGGGTCGCCAGCAATATCGGTATAAGTCAAAGCACCTTTAGCGTTAAGGTACTGAATCTCTTTAGTCGCAGTAGGCGGAAAAC + HHHHHHHHHHHHHHHHHHHHEHEHHHEHHHHFHHHHHHFHHHFHFHHHHHHHHFHHHHFHHFEHBHFEHHHHCEEHHFHHHHHHHHHHHHEHHHHCAFEFG @SEQ:1:1101:9512:3869#0/1 GCTCGACGCCATTAATAATGTTTTCCGTAAATTCAGCGCCTTCCATGATGAGACAGGCCGTTTGAATGTTGACGGGATGAACATAATAAGCAATGACGGCA + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFHHHHFHHHDHHHEHHFFFFFFHFAFEFH?E@FFGGGFGHFHAEFGFFFCEEFF @SEQ:1:1101:9723:3870#0/1 adapter start: 66 CTTTAGCAGCAAGGTATATATCTGACTTTTTGTTAACGTATTTAGCCACATAGCAACCAACAGACA + ################################################################## @SEQ:1:1101:9667:3874#0/1 CTGCTGCATTTCCTGAGCTTAATGCTTGGGAGCGTGCTGGTGCTGATGCTTCCTCTGCTGGTATGGTTGACGCCGGATTTGAGAATCAAAAAGAGCTTACT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHAHHHHEHHD=DAD>D6ADGE@EBE;@?BCGGE?4>ADAAC @SEQ:1:1101:9565:3879#0/1 adapter start: 24 AGCCTTATGGCCGTCAACATACAT + HHHHHHHHHHHHHHHHHFHHGFFH @SEQ:1:1101:9721:3885#0/1 adapter start: 51 TTCCTCAAACGCTTGTTCGGTGGATAAGTTATGGCATTAATCGATTTATTT + >BC?:A?=<>::A=528882.53)5.77;407)*9@:AA8CAA######## @SEQ:1:1101:9707:3894#0/1 adapter start: 40 AACACCATCCTTCATGAACTTAATCCACTGTTCACCATAA + F@F8DEE@EEBCCCCFFEFDDC=DCCFFF=ADD=D>@AA@ @SEQ:1:1101:9560:3900#0/1 adapter start: 6 AGAAGT + GGGGGF @SEQ:1:1101:9696:3913#0/1 adapter start: 2 CC + HH @SEQ:1:1101:9574:3914#0/1 adapter start: 5 GAACA + HHHHH @SEQ:1:1101:9508:3931#0/1 adapter start: 91 TAGAGAACGAGAAGACGGTTACGCAGTTTTGCCGCAAGCTGGCTGCTGAACGCCCTCTTAAGGATATTCGCGATGAGTATAATTACCCCAA + HGHHHHHHHHHHHHHHHHHHGHHHHHFHHHGHHHHFHHHHHHHHHD?ACFEF9FFEEBHBAEFB?E><>B@CBCD==BB @SEQ:1:1101:9903:3754#0/1 ACCAAAATTAGGGTCAACGCTACCTGTAGGAAGTGTCCGCATAAAGTGCACCGCATGGAAATGAAGACGGCCATCAGCTGTACCATACTCAGGCACACAAA + GFEGGGGGBGE@EAEEGGFGGEGGFGEFFGFGFFGGEGGGGEFGCFCEFBF7FGEGEF?BFEEFDFFE??AADD+D@C@CGFCE6FDFFDFBGFDD@DAAD @SEQ:1:1101:9878:3755#0/1 adapter start: 32 AGAACGTGAAAAAGCGTCCTGCGTGTAGCGAA + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH @SEQ:1:1101:9833:3756#0/1 adapter start: 65 TCATCGTCACGTTTATGGTGAACAGTGGATTAAGTTCATGAAGGATGGTGTTAATGCCACTCCTC + HHHHHHHHHHHHHHHHHFHHHHHHHHHHHHHHHHFHHHHGHHFHHHHHEHEHHHHFHEHHHEHFH @SEQ:1:1101:9991:3777#0/1 GCTTTGAGTCTTCTTCGGTTCCGACTACCCTCCCGACTGCCTATGATGTTTATCCTTTGGATGGTCGCCATGATGGTGGTTATTATACCGTCAAGGACTGT + HHHHHHHHHHHHHHHHHHHHHHGHHHGHHHHHHHGHHHHHHGHHHHHHHHHHHHHFHHFFDFFFCFFDHCFF;BFGEFGEGFGGFFF.CFDCCEDB=CBC@ cutadapt-1.15/tests/cut/paired-untrimmed.1.fastq0000664000175000017500000000011113205526454022400 0ustar marcelmarcel00000000000000@read4/1 GACAGGCCGTTTGAATGTTGACGGGATGTT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH cutadapt-1.15/tests/cut/paired-trimmed.1.fastq0000664000175000017500000000021713205526454022044 0ustar marcelmarcel00000000000000@read1/1 some text TTATTTGTCTCCAGC + ##HHHHHHHHHHHHH @read2/1 CAACAGGCCACA + HHHHHHHHHHHH @read3/1 CCAACTTGATATTAATAACA + HHHHHHHHHHHHHHHHHHHH cutadapt-1.15/tests/cut/plus.fastq0000664000175000017500000000024613205526454017767 0ustar marcelmarcel00000000000000@first_sequence some other text SEQUENCE1 +first_sequence some other text :6;;8<=:< @second_sequence and more text SEQUENCE2 +second_sequence and more text 83read1 12001112122203233202221000211 >read2 00121311212133113001311002032 >read3 11133003002232323010012320300 >read4 02010102312033021011121312131 >read5 21313210102120020302022233110 >read6 31203203013323021010020301321 >read7 03020130202120211322010013211 >read8 32202123123111113113003200330 >read9 20123133023120320131020333011 >read10 01130233321321011303133231200 >read11 02010102312033021011121312131 >read12 1 >read13 >read14 >read15 >read16 cutadapt-1.15/tests/cut/overlapb.fa0000664000175000017500000000102113205526454020056 0ustar marcelmarcel00000000000000>adaptlen18 ATACTTACCCGTA >adaptlen17 ATACTTACCCGTA >adaptlen16 ATACTTACCCGTA >adaptlen15 ATACTTACCCGTA >adaptlen14 ATACTTACCCGTA >adaptlen13 ATACTTACCCGTA >adaptlen12 ATACTTACCCGTA >adaptlen11 ATACTTACCCGTA >adaptlen10 ATACTTACCCGTA >adaptlen9 TCTCCGTCGATACTTACCCGTA >adaptlen8 CTCCGTCGATACTTACCCGTA >adaptlen7 TCCGTCGATACTTACCCGTA >adaptlen6 CCGTCGATACTTACCCGTA >adaptlen5 CGTCGATACTTACCCGTA >adaptlen4 GTCGATACTTACCCGTA >adaptlen3 TCGATACTTACCCGTA >adaptlen2 CGATACTTACCCGTA >adaptlen1 GATACTTACCCGTA >adaptlen0 ATACTTACCCGTA cutadapt-1.15/tests/cut/stripped.fasta0000664000175000017500000000004313205526454020611 0ustar marcelmarcel00000000000000>first SEQUENCE1 >second SEQUENCE2 cutadapt-1.15/tests/cut/maxn0.fasta0000664000175000017500000000001613205526454020002 0ustar marcelmarcel00000000000000>r1 >r3 AAAA cutadapt-1.15/tests/cut/maxn2.fasta0000664000175000017500000000005013205526454020002 0ustar marcelmarcel00000000000000>r1 >r2 N >r3 AAAA >r4 AAAAN >r5 AAANN cutadapt-1.15/tests/cut/illumina5.fastq0000664000175000017500000000154213205526454020703 0ustar marcelmarcel00000000000000@SEQ:1:1101:9010:3891#0/1 adapter start: 51 ATAACCGGAGTAGTTGAAATGGTAATAAGACGACCAATCTGACCAGCAAGG + FFFFFEDBE@79@@>@CBCBFDBDFDDDDD<@C>ADD@B;5:978@CBDDF @SEQ:1:1101:9240:3898#0/1 CCAGCAAGGAAGCCAAGATGGGAAAGGTCATGCGGCATACGCTCGGCGCCAGTTTGAATATTAGACATAATTTATCCTCAAGTAAGGGGCCGAAGCCCCTG + GHGHGHHHHGGGDHHGDCGFEEFHHGDFGEHHGFHHHHHGHEAFDHHGFHHEEFHGHFHHFHGEHFBHHFHHHH@GGGDGDFEEFC@=D?GBGFGF:FB6D @SEQ:1:1101:9207:3899#0/1 adapter start: 64 TTAACTTCTCAGTAACAGATACAAACTCATCACGAACGTCAGAAGCAGCCTTATGGCCGTCAAC + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFHHHHHHCFHHF @SEQ:1:1101:9148:3908#0/1 adapter start: 28 ACGACGCAATGGAGAAAGACGGAGAGCG + HHHHHHHHHHHHGHHHHGHHHHHHHHHH @SEQ:1:1101:9044:3916#0/1 adapter start: 78 AACAGAAGGAGTCTACTGCTCGCGTTGCGTCTATTATGGAAAACACCAATCTTTCCAAGCAACAGCAGGTTTCCGAGA + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHGHHHHGHHHHHHHHHHHHFHEBFHFFEFHE cutadapt-1.15/tests/cut/wildcard.fa0000664000175000017500000000003013205526454020034 0ustar marcelmarcel00000000000000>1 TGCATGCA >2 TGCATGCA cutadapt-1.15/tests/cut/s_1_sequence.txt0000664000175000017500000000011513205526454021052 0ustar marcelmarcel00000000000000@first_sequence SEQUENCE1 + :6;;8<=:< @second_sequence SEQUENCE2 + 83r1 5' adapter and 3' adapter CCCCCCCCCC >r3 5' adapter, partial 3' adapter CCCGGCCCCC >r5 only 5' adapter CCCCCCCCCCGGGGGGG cutadapt-1.15/tests/cut/polya.fasta0000664000175000017500000000005413205526454020105 0ustar marcelmarcel00000000000000>polyAlong CTTAGTTCAATWTTAACCAAACTTCAGAACAG cutadapt-1.15/tests/cut/small.untrimmed.fastq0000664000175000017500000000013413205526454022113 0ustar marcelmarcel00000000000000@prefix:1_13_1440/1 CAAGATCTNCCCTGCCACATTGCCCTAGTTAAAC + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=: cutadapt-1.15/tests/cut/examplefront.fa0000664000175000017500000000026413205526454020760 0ustar marcelmarcel00000000000000>read1 >read2 MYSEQUENCEADAP >read3 SOMETHINGELSE >read4 MYSEQUENCEADABTER >read5 MYSEQUENCEADAPTR >read6 MYSEQUENCEADAPPTER >read7 MYSEQUENCE >read8 MYSEQUENCE >read9 MYSEQUENCE cutadapt-1.15/tests/cut/solidbfast.fastq0000664000175000017500000000465513205526454021146 0ustar marcelmarcel00000000000000@abc:1_13_85 T110020300.0113010210002110102330021 + 7&9<&77)&!<7))%4'657-1+9;9,.<8);.;8 @abc:1_13_573 T312311200.30213011011132 + 6)3%)&&&&!.1&(6:<'67..*, @abc:1_13_1259 T002112130.201222332211 + =;<:&:A;A!9<<<,7:<=3=; @abc:1_13_1440 T110020313.1113211010332111302330001 + =<=A:A=57!7<';<6?5;;6:+:=)71>70<,=: @abc:1_14_177 T31330222020233321121323302013303311 + :8957;;54)'98924905;;)6:7;1:3<88(9: @abc:1_14_238 T0133103120031002212223 + ?><5=;<<<12>=<;1;;=5); @abc:1_15_1098 T32333033222233020223032312232220332 + #,##(#5##*#($$'#.##)$&#%)$1##-$&##% @abc:1_16_404 T03310320002130202331112 + 78;:;;><>9=9;<<2=><<1;5 @abc:1_16_904 T21230102331022312232132021122111212 + 9>=::6;;99=+/'$+#.#&%$&'(($1*$($.#. @abc:1_16_1315 T032312311122103330103103 + <9<8A?>?::;6&,%;6/)8<<#/ @abc:1_16_1595 T22323211312111230022210011213302012 + >,<=<>@6<;?<=>:/=.>&;;8;)17:=&,>1=+ @abc:1_17_1379 T32011212111223230232132311321200123 + /-1179<1;>>8:':7-%/::0&+=<29,7<8(,2 @abc:1_18_1692 T12322233031100211233323300112200210 + .#(###5%)%2)',2&:+#+&5,($/1#&4&))$6 @abc:1_19_171 T10101101220213201111011320201230032 + )6:65/=3*:(8%)%2>&8&%;%0&#;$3$&:$#& @abc:1_22_72 T13303032323221212301322233320210233 + 3/#678<:.=9::6:(<538295;9+;&*;)+',& @abc:1_22_1377 T22221333311222312201132312022322300 + )##0%.$.1*%,)95+%%14%$#8-###9-()#9+ @abc:1_23_585 T300103103101303121221 + >55;8><96/18?)<3<58<5 @abc:1_23_809 T13130101101021211013220302223302112 + :7<59@;<<5;/9;=<;7::.)&&&827(+221%( @abc:1_24_138 T33211130100120323002 + 6)68/;906#,25/&;<$0+ @abc:1_24_206 T33330332002223002020303331321221000 + ))4(&)9592)#)694(,)292:(=7$.18,()65 @abc:1_25_143 T23202003031200220301303302012203132 + :4;/#&<9;&*;95-7;85&;587#16>%&,9<2& @abc:1_25_1866 T03201321022131101112012330221130311 + =<>9;<@7?(=6,<&?=6=(=<641:?'<1=;':4 @abc:1_27_584 T10010330110103213112323303012103101 + 82'('*.-8+%#2)(-&3.,.2,),+.':&,'(&/ @abc:1_27_1227 T02003022123001003201002031303302011 + 492:;>A:<;34<<=);:<<;9=7<3::<::3=>' @abc:1_27_1350 T13130101101021211013220222221301231 + 95,)<(4./;<938=64=+2/,.4),3':97#33& @abc:1_29_477 T13130101101021211013300302223003030 + 94=55:75=+:/7><968;;#&+$#3&6,#1#4#' @abc:1_30_882 T20102033000233 + 2(+-:-3<;5##/; @abc:1_31_221 T03301311201100030300100233220102031 + 89>9>5<139/,&:7969972.274&%:78&&746 @abc:1_31_1313 T0133113130033012232100010101 + ;3<7=7::)5*4=&;<7>4;795065;9 @abc:1_529_129 T132222301020322102101322221322302.3302.3.3..221..3 + >>%/((B6-&5A0:6)>;'1)B*38/?(5=%B+!&<-9!%!@!!)%)!!( cutadapt-1.15/tests/cut/anchored_no_indels.fasta0000664000175000017500000000031413205526454022575 0ustar marcelmarcel00000000000000>no_mismatch (adapter: TTAGACATAT) GAGGTCAG >one_mismatch GAGGTCAG >two_mismatches TAAGACGTATGAGGTCAG >insertion ATTAGACATATGAGGTCAG >deletion TAGACATATGAGGTCAG >mismatch_plus_wildcard TNAGACGTATGAGGTCAG cutadapt-1.15/tests/cut/shortened.fastq0000664000175000017500000000014513205526454020775 0ustar marcelmarcel00000000000000@prefix:1_13_573/1 CGTCC + )3%)& @prefix:1_13_1259/1 AGCCG + ;<:&: @prefix:1_13_1440/1 CAAGA + <=A:A cutadapt-1.15/tests/cut/small-no-trim.fasta0000664000175000017500000000024413205526454021455 0ustar marcelmarcel00000000000000>prefix:1_13_573/1 CGTCCGAANTAGCTACCACCCTGATTAGACAAAT >prefix:1_13_1259/1 AGCCGCTANGACGGGTTGGCCCTTAGACGTATCT >prefix:1_13_1440/1 CAAGATCTNCCCTGCCACATTGCCCTAGTTAAAC cutadapt-1.15/tests/cut/trimN3.fasta0000664000175000017500000000004713205526454020137 0ustar marcelmarcel00000000000000>read1 CAGTCGGTCCTGAGAGATGGGCGAGCGCTGG cutadapt-1.15/tests/cut/solid-no-zerocap.fastq0000664000175000017500000000461713205526454022177 0ustar marcelmarcel00000000000000@1_13_85_F3 T110020300.0113010210002110102330021 + 7&9<&77)& <7))%4'657-1+9;9,.<8);.;8 @1_13_573_F3 T312311200.30213011011132 + 6)3%)&&&& .1&(6:<'67..*, @1_13_1259_F3 T002112130.201222332211 + =;<:&:A;A 9<<<,7:<=3=; @1_13_1440_F3 T110020313.1113211010332111302330001 + =<=A:A=57 7<';<6?5;;6:+:=)71>70<,=: @1_14_177_F3 T31330222020233321121323302013303311 + :8957;;54)'98924905;;)6:7;1:3<88(9: @1_14_238_F3 T0133103120031002212223 + ?><5=;<<<12>=<;1;;=5); @1_15_1098_F3 T32333033222233020223032312232220332 + #,##(#5##*#($$'#.##)$&#%)$1##-$&##% @1_16_404_F3 T03310320002130202331112 + 78;:;;><>9=9;<<2=><<1;5 @1_16_904_F3 T21230102331022312232132021122111212 + 9>=::6;;99=+/'$+#.#&%$&'(($1*$($.#. @1_16_1315_F3 T032312311122103330103103 + <9<8A?>?::;6&,%;6/)8<<#/ @1_16_1595_F3 T22323211312111230022210011213302012 + >,<=<>@6<;?<=>:/=.>&;;8;)17:=&,>1=+ @1_17_1379_F3 T32011212111223230232132311321200123 + /-1179<1;>>8:':7-%/::0&+=<29,7<8(,2 @1_18_1692_F3 T12322233031100211233323300112200210 + .#(###5%)%2)',2&:+#+&5,($/1#&4&))$6 @1_19_171_F3 T10101101220213201111011320201230032 + )6:65/=3*:(8%)%2>&8&%;%0&#;$3$&:$#& @1_22_72_F3 T13303032323221212301322233320210233 + 3/#678<:.=9::6:(<538295;9+;&*;)+',& @1_22_1377_F3 T22221333311222312201132312022322300 + )##0%.$.1*%,)95+%%14%$#8-###9-()#9+ @1_23_585_F3 T300103103101303121221 + >55;8><96/18?)<3<58<5 @1_23_809_F3 T13130101101021211013220302223302112 + :7<59@;<<5;/9;=<;7::.)&&&827(+221%( @1_24_138_F3 T33211130100120323002 + 6)68/;906#,25/&;<$0+ @1_24_206_F3 T33330332002223002020303331321221000 + ))4(&)9592)#)694(,)292:(=7$.18,()65 @1_25_143_F3 T23202003031200220301303302012203132 + :4;/#&<9;&*;95-7;85&;587#16>%&,9<2& @1_25_1866_F3 T03201321022131101112012330221130311 + =<>9;<@7?(=6,<&?=6=(=<641:?'<1=;':4 @1_27_584_F3 T10010330110103213112323303012103101 + 82'('*.-8+%#2)(-&3.,.2,),+.':&,'(&/ @1_27_1227_F3 T02003022123001003201002031303302011 + 492:;>A:<;34<<=);:<<;9=7<3::<::3=>' @1_27_1350_F3 T13130101101021211013220222221301231 + 95,)<(4./;<938=64=+2/,.4),3':97#33& @1_29_477_F3 T13130101101021211013300302223003030 + 94=55:75=+:/7><968;;#&+$#3&6,#1#4#' @1_30_882_F3 T20102033000233 + 2(+-:-3<;5##/; @1_31_221_F3 T03301311201100030300100233220102031 + 89>9>5<139/,&:7969972.274&%:78&&746 @1_31_1313_F3 T0133113130033012232100010101 + ;3<7=7::)5*4=&;<7>4;795065;9 @1_529_129_F3 T132222301020322102101322221322302.3302.3.3..221..3 + >>%/((B6-&5A0:6)>;'1)B*38/?(5=%B+ &<-9 % @ )%) ( cutadapt-1.15/tests/cut/solid5p-anchored.fastq0000664000175000017500000000221513205526454022142 0ustar marcelmarcel00000000000000@read1 212322332333012001112122203233202221000211 + 58)2";%4A,8>0;9C\'?276>#)49"<,>?/\'!A4$.%+ @read2 01212322332333200121311212133113001311002032 + 4<@;(<3.37/''=:-9AA<&C2%$$;?A&5!C69:?-;&;65. @read3 2201212322332333211133003002232323010012320300 + !#97*B.0A-@(*","B3><4&16(: @read4 02010102312033021011121312131 + &-81+%)7;<)6?83!&CB9"9B6307=& @read5 21313210102120020302022233110 + 9)27,(-*=,#4:;"/4++5<,@-784*' @read6 31203203013323021010020301321 + !.;:C%97@>75-";';*)A67CCC")$* @read7 1301020302201212322332333203020130202120211322010013211 + ;0B@A"98!<=!*;5;650;';79!+8,4(2=+98:B@C@:+3*>2+6+2++C0. @read8 310321030130120302201212322332333232202123123111113113003200330 + /$-"=6+1.8?AB!?'#.585@6:47@?>.315A-'9<%">6,+)*,)1-;:(691>?C)4A; @read9 002132103320302201212322332333020123133023120320131020333011 + &?527&:=;6@6@03%95(-0#$:B8::B*4?@&)6>79C>)6C'5-#0:A8+2* @read10 0322031320033220302201212322332333201130233321321011303133231200 + 53)>2.+9?7%=&21;8!820961%3#0'5C.28347,2(55*1.,>%:(1A'A5=@7&&5?4' @read11 02010102312033021011121312131 + 8B"195'@,@&:5=7;!&-9:%((> @read12 1 + C @read13 + @read14 + @read15 + @read16 + cutadapt-1.15/tests/cut/demultiplexed.second.1.fastq0000664000175000017500000000004113205526454023253 0ustar marcelmarcel00000000000000@read2/1 CAACAGGCCA + HHHHHHHHHH cutadapt-1.15/tests/cut/solid5p-anchored.notrim.fastq0000664000175000017500000000226713205526454023460 0ustar marcelmarcel00000000000000@read1 T1212322332333012001112122203233202221000211 + :58)2";%4A,8>0;9C\'?276>#)49"<,>?/\'!A4$.%+ @read2 T201212322332333200121311212133113001311002032 + 44<@;(<3.37/''=:-9AA<&C2%$$;?A&5!C69:?-;&;65. @read3 T02201212322332333211133003002232323010012320300 + 2!#97*B.0A-@(*","B3><4&16(: @read4 T302010102312033021011121312131 + <&-81+%)7;<)6?83!&CB9"9B6307=& @read5 T121313210102120020302022233110 + $9)27,(-*=,#4:;"/4++5<,@-784*' @read6 T331203203013323021010020301321 + 4!.;:C%97@>75-";';*)A67CCC")$* @read7 T21301020302201212322332333203020130202120211322010013211 + ,;0B@A"98!<=!*;5;650;';79!+8,4(2=+98:B@C@:+3*>2+6+2++C0. @read8 T2310321030130120302201212322332333232202123123111113113003200330 + C/$-"=6+1.8?AB!?'#.585@6:47@?>.315A-'9<%">6,+)*,)1-;:(691>?C)4A; @read9 T0002132103320302201212322332333020123133023120320131020333011 + (&?527&:=;6@6@03%95(-0#$:B8::B*4?@&)6>79C>)6C'5-#0:A8+2* @read10 T00322031320033220302201212322332333201130233321321011303133231200 + &53)>2.+9?7%=&21;8!820961%3#0'5C.28347,2(55*1.,>%:(1A'A5=@7&&5?4' @read11 T402010102312033021011121312131 + &8B"195'@,@&:5=7;!&-9:%((> @read12 T11 + ?C @read13 T1 + C @read14 T + @read15 T + @read16 T + cutadapt-1.15/tests/cut/454.fa0000664000175000017500000001607413205526454016576 0ustar marcelmarcel00000000000000>000163_1255_2627 length=8 uaccno=E0R4ISW01DCIQD GTGTGGTG >000652_1085_0667 length=80 uaccno=E0R4ISW01CXJXP ATTGAAGAGGTTGGTAAGTTTTAAGTTGGTAGGTGGTTGGGGAGTGGTTGGAGAGGAGTTGTTGGGAGTTTGTGTCCTGC >000653_1285_1649 length=92 uaccno=E0R4ISW01DE4SJ AATTAGTCGAGCGTTGTGGTGGGTATTTGTAATTTTAGCTACTCTGAAGGCTGAGGCAGGAGAACTGCTTGAACCCGGGAGGCGGAGGTTGC >000902_0715_2005 length=50 uaccno=E0R4ISW01B03K3 GGGTGTTGAATTTAATATGTAGTATATTGATTTGTGATGATTATTTTGCC >001146_1255_0340 length=50 uaccno=E0R4ISW01DCGYU GGGTGTTGAATTTAATATGTAGTATATTGATTTGTGATGATTATTTTGCC >001210_1147_1026 length=124 uaccno=E0R4ISW01C2Z5W GAGGTGGTGAGTGTTGTGTGTTTAGATTGTGTGTGGTGGTTGGGAGTGGGAGTTGTATTTTAGGGTGTGGGTTGGGAGAGTGAAAGTTGTGGGTGTTTTGGATGGTGGGTTAGGTGGTTGTGCC >001278_1608_2022 length=66 uaccno=E0R4ISW01D7HW4 CACACACACTCTTCCCCATACCTACTCACACACACACACACACACACAAACATACACAAATAATTC >001333_1518_1176 length=100 uaccno=E0R4ISW01DZKTM AATTGTCGTTTGATTGTTGGAAAGTAGAGGGTCGGGTTGGGGTAGATTCGAAAGGGGAATTTTGAGAAAAGAAATGGAGGGAGGTAGGAAAATTTTTTGC >001398_1584_1549 length=112 uaccno=E0R4ISW01D5DPB TAATGAAATGGAATGGAATGGAATGGAATGAAATGGAATGGAATGGAATGGAATGGAATGGAATGGAATGGAATGGAATGAAATGGAATGGAGTATAAAGGAATGGAATTAC >001455_1136_2179 length=50 uaccno=E0R4ISW01C12AD GGGTGTTGAATTTAATATGTAGTATATTGATTTGTGATGATTATTTTGCC >001481_1165_0549 length=50 uaccno=E0R4ISW01C4KON GGGTGTTGAATTTAATATGTAGTATATTGATTTGTGATGATTATTTTGCC >001744_1376_3512 length=101 uaccno=E0R4ISW01DM5T2 TAAGTAGGGAAGGTTTGAGGTTGTTGGTGTTGGTAGTAGGGGTGTTTTAGTTAGGGGTTGTAGTTTGTTAAGGGAATTTTATTTGAGTTTAGAATTGAGGC >001893_1084_1137 length=120 uaccno=E0R4ISW01CXG4Z TGTATATTTTGTTGGGTTTGTATATATTGTTAGGTGTGGTTGGTGAGTTGTATTGGTGGTGGTGTAAGGTGAGTGGAAATGGGAATGGATTGTAGATATGTTGGATTTGTGGTTTTTGGT >001927_0254_0706 length=139 uaccno=E0R4ISW01AWLLG TGGAATCATCTAAGGGACACAAATAGAATCATCATTGAATGGAATCGAATGGAATCATCTAATGTACTCGAATGGAATTATTATTGAATAGAATAGAATGGAATTATCGAATGGAATCAAATGGAATGTAATGGAATGC >002007_1338_1037 length=95 uaccno=E0R4ISW01DJRTR GGGTTGTGTATTTGGATAGTATGTGGAAAATGGTATTAAAAAGAATTTGTAGTTGGATTGTTGGTGGTTATTTAGTTTTTGGGTAATGGGTAGAT >002186_1130_0654 length=50 uaccno=E0R4ISW01C1H5C GGGTGTTGAATTTAATATGTAGTATATTGATTTGTGATGATTATTTTGCC >002282_1237_2702 length=92 uaccno=E0R4ISW01DAXWG AATTAGCCGGGCGTGATGGCGGGCGTTTGTAGTTTTAGTTATTCGGGAGGTTGAGGTAGGAGAATGGCGTGAATTCGGGAAGCGGAGTTTGC >002382_1259_0997 length=64 uaccno=E0R4ISW01DCT37 TAAGGGTTGAAGCGAGGTAGGTAGTTTGTTTGTGGTTTTGTTTCGTATTTTTGTTTCGTATCCC >002477_0657_0655 length=131 uaccno=E0R4ISW01BVY8H TTTTTGGAAAGTTGGGTGGGTATAGTTTTGAGTAGTTAGAGGTATTATAATAGTATTAGGAAGTTGAATGTGAGGGTATAAGAGTTAATTTGATTTTTCGTTGATATGTTTGTTGTTTGAAGTTAGAGTGC >003149_1553_2333 length=128 uaccno=E0R4ISW01D2OBZ TATTTAGTTTTAGTTTGTTTAGGTGGTTATAGAATACGGAGTTTATGAAGTTGATTAGGAATATTATTAGTTGAATTAAGAATTGGGAAGAGAGGGGAACGGGAAGGGACGTGAGTGATTATTATTGC >003194_1475_2845 length=58 uaccno=E0R4ISW01DVT7J TATTTTGGGTTAAGTCGGGTTTAGTTGTTAGGGCGAGAAGTTAGTTGTTGACCCCTGC >003206_1315_0479 length=52 uaccno=E0R4ISW01DHQPD GGGTTGGATAATATGATGGTGTTGGGGAATATTTAGGTATGTGGTTTGTGGC >003271_0173_0314 length=82 uaccno=E0R4ISW01APHAK GTTTATTTGTTATTTATTTTTAGGTTTAGAAGAGTGTTTGGTATTTATTGAGGATTTAGTATTTGTTAGAAGGATTGGATTC >003443_1737_2250 length=21 uaccno=E0R4ISW01EITSS TGTAGGTTGTGTTGTAGGTTG >002633_1776_1582 length=40 uaccno=E0R4ISW01EL8JK CAGGGTGGATTGGGGAACACACAGTGTGGCCGCGTGATTC >002663_0725_3154 length=84 uaccno=E0R4ISW01B1Z2S GCGTTTTATATTATAATTTAATATTTTGGAGGTTGGGTGCGGTGGTTTACGTTTGTAGTTTAGTATTTGGGAGGTTAAGGTAGC >002761_1056_4055 length=72 uaccno=E0R4ISW01CU2V9 AATTTTATTCGATTTATGTGATGATTTATTTATTTTATTTGAAGATGATTTTATTCGAGATTATTCGATGAT >002843_0289_2275 length=80 uaccno=E0R4ISW01AZPE9 ATTGAAGAGGTTGGTAAGTTTTAAGTTGGTAGGTGGTTGGGGAGTGGTTGGAGAGGAGTTGTTGGGAGTTTGTGTCCTGC >002934_1762_2177 length=50 uaccno=E0R4ISW01EK0Q7 GGGTGTTGAATTTAATATGTAGTATATTGATTTGTGATGATTATTTTGCC >003515_1711_1058 length=79 uaccno=E0R4ISW01EGIPG AATTGAATGGAATTATTATTGAATGGATTCGAATGGAATTATTATTGAATGGAATCATCGAGTGGAATCGAATGGAATC >003541_1276_1589 length=70 uaccno=E0R4ISW01DECAV TAGTTTAGGGTGGTAGTTTGGATAAGGTAGTTTTACGGTTTAGTAGTAGTAGGTTAAGTAGGAAAACTGC >003587_1522_1804 length=109 uaccno=E0R4ISW01DZXX6 AATTTATGTAGTGGAAGTAGGATATAAAGAATAGGTTAATGGATTTTGAGATATTAAAAAGAGTAGGAAATTAGTTGAGAGGTTAAGTAGTAGTTTATTTTAGCCACCC >003592_0076_0430 length=92 uaccno=E0R4ISW01AGYTC AATTAGTTAGGCGTGGTGGCGGGTGTTTGTAGTTTTAGTTATTCGGGAGGTTGAGGTAGGAGAATGTTGTGAATTTAGGAGGTGGAGTTTGC >003957_0595_0965 length=130 uaccno=E0R4ISW01BQJIV TAATATTAGGTGTCAATTTGACTGGATCGAGGGATGTGTGTCGGTGAGAGTCTCACTAGAGGTTGATATTTGAGTCGTTAGACTGGGAGAGGAAGACCGAACTGTCAAGTGTATGGGCGCCATCCAATTC >003986_1127_2937 length=61 uaccno=E0R4ISW01C1AFF TAATGGAATGGAATTTTCGGAATGGAATGGAATGGAATGGAATGGAATGGAATGGAATTAC >004012_1559_1491 length=72 uaccno=E0R4ISW01D26M9 TAGTGGATATAAATGGAATGGATTGGAATGGAATGGATACGAATGGAATGGATTGGAGTGGAATGGATTGAC >004030_1508_2061 length=123 uaccno=E0R4ISW01DYPWF TACGTATATACGCGTACGCGTATACGTATATACGCGTATACGTATACGCGTACGTATATATACGCGTATACGTTTACGTACGTACGCGTATATACGTACGTATACACACACGCATATGCATAC >004038_1061_2047 length=109 uaccno=E0R4ISW01CVG5D AATTGATTCGAATGGAATGGATTGGAATGGAACGGATTTGAATGGAATGGATTGGAATGGAATGGATTGAATGGAATGGATTGGAGAGGATTGGATTTGAATGGAATTC >004105_1121_0391 length=92 uaccno=E0R4ISW01C0PH1 AATTAGTTGGGCGTGGTGGCGAGTGTTTGTAATTTTAGTTATTTAGGAGGTTGAGGTAGGAGAATTATTTGAACCCGGTAGACGGAAGTTGC >004129_1618_3423 length=79 uaccno=E0R4ISW01D8ELT AATTGAATGGTATTGAAAGGTATTAATTTAGTGGAATGGAATGGAATGTATTGGAATGGAAAATAATGGAATGGAGTGC >004203_0451_0902 length=72 uaccno=E0R4ISW01BDWC4 TAGTTGGTGTGTTGTAATCGAGACGTAGTTGGTTGGTACGGGTTAGGGTTTTGATTGGGTTGTTGTGTTTGC >004626_1937_0919 length=180 uaccno=E0R4ISW01E0CVD TAGAGTAGATAGTAGGGTTAGAGAAGGTAGGGTACGTTTAGTTTGTTAGTAAGGTTTAAGTTTTGGGTGGGAAAGGTTAGTGGCGGGAAGGGACGAAGGTGGTAATCGAGAGTAGATTTAGAGAAGTTTTTGAAGTGGGCGTTGGGAGTTTTCGAAGTATTGAGAGAGAGGAGCTTGTGC >004913_0641_2071 length=92 uaccno=E0R4ISW01BULRD AATTAGTCGAGCGTTGTGGTGGGTATTTGTAATTTTAGCTACTCTGAAGGCTGAGGCAGGAGAACTGCTTGAACCCGGGAGGCGGAGGTTGC >005063_0599_1983 length=84 uaccno=E0R4ISW01BQWX9 ATGTGGTGAAGATTGGTTTTAGGTGTTTTAATGTGGATTTTCAGGGGTTTTAAAAGGGTTGGGAGAGTGAAATATATATAAGGC >005140_0759_3209 length=74 uaccno=E0R4ISW01B4ZKR TAGTATAGAGGGTTTGTGGTCGTGAGGGTGTTGATGGCGGGAGGGTTTTGATGGTAGGAGGGCCCGTGCTGTGC >005351_0883_3221 length=95 uaccno=E0R4ISW01CFVHJ TTAGGTGTTATAGTTGAGTGAGATGTTAGTGTTTAATGGTTTTATTTAGGTTGATGGGTTAATGAGGGGGTATTTGATAGTTTTGAAGATTTGAC >005380_1702_1187 length=160 uaccno=E0R4ISW01EFQC1 GTTTTTCGAGTATATATTTAGTAGTACGCTCGACTTCTCTTATATAAAGGTTTTGGTTTTTATAGGTTTTTCCATTGTGTCTGCCTGGGGGAGGGCCCTTCTCCTTCAGGATACTGTAGCTTCTCTGCGTGATAAGCCAGCATTCACGGCTTTCAGGTGC >005568_1060_1943 length=20 uaccno=E0R4ISW01CVDWP ATAGCGTATTTCTCACCTGC >005740_1536_2697 length=116 uaccno=E0R4ISW01D06VV TAAAGAGGTGTTATTATTAGTTAGGAGAGGAGGTGGTTAGATAGTAGTGGGATTATAGGGGAATATAGAGTTGTTAGTTTAGGGATAAGGGATTGATCGATGGGTTAGGTCTCTGC >005753_1884_3877 length=53 uaccno=E0R4ISW01EVRNB AAACTGAGTTGTGATGTTTGCATTCAACTCACAGAGTTCAACATTCCTTTAAC >read_equals_adapter 1a >read_equals_start_of_adapter 1b >read_equals_end_of_adapter 1c >read_equals_middle_of_adapter 1d >read_ends_with_adapter 2a GCTACTCTGAAGGCTGAGGCAGGAGAACTGCTTGAACCCGGGAGGCG >read_ends_with_start_of_adapter 2b GCTACTCTGAAGGCTGAGGCAGGAGAACTGCTTGAACCCGGGAGGCG >read_contains_adapter_in_the_middle 3 CGTAGTTGGTTGGTACG >read_starts_with_adapter 4a AAAGGTTTTGGTTTTTATAGGTTTTT >read_starts_with_end_of_adapter 4b AAAGGTTTTGGTTTTTATAGGTTTTT cutadapt-1.15/tests/cut/paired-m27.1.fastq0000664000175000017500000000045013205526454021007 0ustar marcelmarcel00000000000000@read1/1 some text TTATTTGTCTCCAGCTTAGACATATCGCCT + ##HHHHHHHHHHHHHHHHHHHHHHHHHHHH @read2/1 CAACAGGCCACATTAGACATATCGGATGGT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH @read3/1 CCAACTTGATATTAATAACATTAGACA + HHHHHHHHHHHHHHHHHHHHHHHHHHH @read4/1 GACAGGCCGTTTGAATGTTGACGGGATGTT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH cutadapt-1.15/tests/cut/paired-separate.2.fastq0000664000175000017500000000033113205526454022205 0ustar marcelmarcel00000000000000@read1/2 other text GCTGGAGACAAATAA + HHHHHHHHHHHHHHH @read2/2 TGTGGCCTGTTG + ###HHHHHHHHH @read3/2 TGTTATTAATATCAAGTTGG + #HHHHHHHHHHHHHHHHHHH @read4/2 CATCCCGTCAACATTCAAACGGCCTGTCCA + HH############################ cutadapt-1.15/tests/cut/solid5p-anchored.fasta0000664000175000017500000000116213205526454022122 0ustar marcelmarcel00000000000000>read1 212322332333012001112122203233202221000211 >read2 01212322332333200121311212133113001311002032 >read3 2201212322332333211133003002232323010012320300 >read4 02010102312033021011121312131 >read5 21313210102120020302022233110 >read6 31203203013323021010020301321 >read7 1301020302201212322332333203020130202120211322010013211 >read8 310321030130120302201212322332333232202123123111113113003200330 >read9 002132103320302201212322332333020123133023120320131020333011 >read10 0322031320033220302201212322332333201130233321321011303133231200 >read11 02010102312033021011121312131 >read12 1 >read13 >read14 >read15 >read16 cutadapt-1.15/tests/cut/paired-too-short.2.fastq0000664000175000017500000000004513205526454022341 0ustar marcelmarcel00000000000000@read2/2 TGTGGCCTGTTG + ###HHHHHHHHH cutadapt-1.15/tests/cut/wildcardN.fa0000664000175000017500000000005213205526454020156 0ustar marcelmarcel00000000000000>perfect TTT >withN TTT >1mism TTTGGGGCGG cutadapt-1.15/tests/cut/issue46.fasta0000664000175000017500000000001413205526454020257 0ustar marcelmarcel00000000000000>readname A cutadapt-1.15/tests/cut/linked-not-anchored.fasta0000664000175000017500000000047613205526454022616 0ustar marcelmarcel00000000000000>r1 5' adapter and 3' adapter CCCCCCCCCC >r2 without any adapter GGGGGGGGGGGGGGGGGGG >r3 5' adapter, partial 3' adapter CCCGGCCCCC >r4 only 3' adapter GGGGGGGGGGCCCCCCCCCCTTTTTTTTTTGGGGGGG >r5 only 5' adapter AAAAAAAAAACCCCCCCCCCGGGGGGG >r6 partial 5' adapter CCCCCCCCCC >r7 5' adapter plus preceding bases CCCCCCCCCC cutadapt-1.15/tests/cut/twoadapters.fasta0000664000175000017500000000032313205526454021315 0ustar marcelmarcel00000000000000>read1 GATCCTCCTGGAGCTGGCTGATACCAGTATACCAGTGCTGATTGTTG >read2 CTCGAGAATTCTGGATCCTCTCTTCTGCTACCTTTGGGATTTGCTTGCTCTTG >read3 (no adapter) AATGAAGGTTGTAACCATAACAGGAAGTCATGCGCATTTAGTCGAGCACGTAAGTTCATACGGAAATGGGTAAG cutadapt-1.15/tests/cut/unconditional-back.fastq0000664000175000017500000000036513205526454022552 0ustar marcelmarcel00000000000000@prefix:1_13_573/1 CGTCCGAANTAGCTACCACCCTGATTAGA + )3%)&&&&!.1&(6:<'67..*,:75)'7 @prefix:1_13_1259/1 AGCCGCTANGACGGGTTGGCCCTTAGACG + ;<:&:A;A!9<<<,7:<=3=;:<&7 cutadapt-1.15/tests/cut/paired-onlyA.2.fastq0000664000175000017500000000033113205526454021463 0ustar marcelmarcel00000000000000@read1/2 other text GCTGGAGACAAATAA + HHHHHHHHHHHHHHH @read2/2 TGTGGCCTGTTG + ###HHHHHHHHH @read3/2 TGTTATTAATATCAAGTTGG + #HHHHHHHHHHHHHHHHHHH @read4/2 CATCCCGTCAACATTCAAACGGCCTGTCCA + HH############################ cutadapt-1.15/tests/cut/small.fastq0000664000175000017500000000034713205526454020116 0ustar marcelmarcel00000000000000@prefix:1_13_573/1 CGTCCGAANTAGCTACCACCCTGA + )3%)&&&&!.1&(6:<'67..*,: @prefix:1_13_1259/1 AGCCGCTANGACGGGTTGGCCC + ;<:&:A;A!9<<<,7:<=3=;: @prefix:1_13_1440/1 CAAGATCTNCCCTGCCACATTGCCCTAGTTAAAC + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=: cutadapt-1.15/tests/cut/twoadapters.second.fasta0000664000175000017500000000007513205526454022573 0ustar marcelmarcel00000000000000>read2 CTCGAGAATTCTGGATCCTCTCTTCTGCTACCTTTGGGATTTGCTTGCTCTTG cutadapt-1.15/tests/cut/anchored.fasta0000664000175000017500000000012713205526454020545 0ustar marcelmarcel00000000000000>read1 sequence >read2 blablaFRONTADAPTsequence >read3 NTADAPTsequence >read4 sequence cutadapt-1.15/tests/test_modifiers.py0000664000175000017500000000312313205526454020540 0ustar marcelmarcel00000000000000# coding: utf-8 from __future__ import print_function, division, absolute_import from cutadapt.seqio import Sequence from cutadapt.modifiers import (UnconditionalCutter, NEndTrimmer, QualityTrimmer, Shortener) def test_unconditional_cutter(): uc = UnconditionalCutter(length=5) s = 'abcdefg' assert UnconditionalCutter(length=2)(s) == 'cdefg' assert UnconditionalCutter(length=-2)(s) == 'abcde' assert UnconditionalCutter(length=100)(s) == '' assert UnconditionalCutter(length=-100)(s) == '' def test_nend_trimmer(): trimmer = NEndTrimmer() seqs = ['NNNNAAACCTTGGNNN', 'NNNNAAACNNNCTTGGNNN', 'NNNNNN'] trims = ['AAACCTTGG', 'AAACNNNCTTGG', ''] for seq, trimmed in zip(seqs, trims): _seq = Sequence('read1', seq, qualities='#'*len(seq)) _trimmed = Sequence('read1', trimmed, qualities='#'*len(trimmed)) assert trimmer(_seq) == _trimmed def test_quality_trimmer(): read = Sequence('read1', 'ACGTTTACGTA', '##456789###') qt = QualityTrimmer(10, 10, 33) assert qt(read) == Sequence('read1', 'GTTTAC', '456789') qt = QualityTrimmer(0, 10, 33) assert qt(read) == Sequence('read1', 'ACGTTTAC', '##456789') qt = QualityTrimmer(10, 0, 33) assert qt(read) == Sequence('read1', 'GTTTACGTA', '456789###') def test_shortener(): read = Sequence('read1', 'ACGTTTACGTA', '##456789###') shortener = Shortener(0) assert shortener(read) == Sequence('read1', '', '') shortener = Shortener(1) assert shortener(read) == Sequence('read1', 'A', '#') shortener = Shortener(5) assert shortener(read) == Sequence('read1', 'ACGTT', '##456') shortener = Shortener(100) assert shortener(read) == read cutadapt-1.15/tests/test_adapters.py0000664000175000017500000001334413205526454020370 0ustar marcelmarcel00000000000000# coding: utf-8 from __future__ import print_function, division, absolute_import from nose.tools import raises, assert_raises from cutadapt.seqio import Sequence from cutadapt.adapters import (Adapter, Match, ColorspaceAdapter, FRONT, BACK, parse_braces, LinkedAdapter, AdapterStatistics) def test_issue_52(): adapter = Adapter( sequence='GAACTCCAGTCACNNNNN', where=BACK, max_error_rate=0.12, min_overlap=5, read_wildcards=False, adapter_wildcards=True) read = Sequence(name="abc", sequence='CCCCAGAACTACAGTCCCGGC') am = Match(astart=0, astop=17, rstart=5, rstop=21, matches=15, errors=2, remove_before=False, adapter=adapter, read=read) assert am.wildcards() == 'GGC' """ The result above should actually be 'CGGC' since the correct alignment is this one: adapter GAACTCCAGTCACNNNNN mismatches X X read CCCCAGAACTACAGTC-CCGGC Since we do not keep the alignment, guessing 'GGC' is the best we can currently do. """ def test_issue_80(): # This issue turned out to not be an actual issue with the alignment # algorithm. The following alignment is found because it has more matches # than the 'obvious' one: # # TCGTATGCCGTCTTC # =========X==XX= # TCGTATGCCCTC--C # # This is correct, albeit a little surprising, since an alignment without # indels would have only two errors. adapter = Adapter( sequence="TCGTATGCCGTCTTC", where=BACK, max_error_rate=0.2, min_overlap=3, read_wildcards=False, adapter_wildcards=False) read = Sequence(name="seq2", sequence="TCGTATGCCCTCC") result = adapter.match_to(read) assert result.errors == 3, result assert result.astart == 0, result assert result.astop == 15, result def test_str(): a = Adapter('ACGT', where=BACK, max_error_rate=0.1) str(a) str(a.match_to(Sequence(name='seq', sequence='TTACGT'))) ca = ColorspaceAdapter('0123', where=BACK, max_error_rate=0.1) str(ca) @raises(ValueError) def test_color(): ColorspaceAdapter('0123', where=FRONT, max_error_rate=0.1) def test_parse_braces(): assert parse_braces('') == '' assert parse_braces('A') == 'A' assert parse_braces('A{0}') == '' assert parse_braces('A{1}') == 'A' assert parse_braces('A{2}') == 'AA' assert parse_braces('A{2}C') == 'AAC' assert parse_braces('ACGTN{3}TGACCC') == 'ACGTNNNTGACCC' assert parse_braces('ACGTN{10}TGACCC') == 'ACGTNNNNNNNNNNTGACCC' assert parse_braces('ACGTN{3}TGA{4}CCC') == 'ACGTNNNTGAAAACCC' assert parse_braces('ACGTN{0}TGA{4}CCC') == 'ACGTTGAAAACCC' def test_parse_braces_fail(): for expression in ['{', '}', '{}', '{5', '{1}', 'A{-7}', 'A{', 'A{1', 'N{7', 'AN{7', 'A{4{}', 'A{4}{3}', 'A{b}', 'A{6X}', 'A{X6}']: assert_raises(ValueError, lambda: parse_braces(expression)) def test_linked_adapter(): linked_adapter = LinkedAdapter('AAAA', 'TTTT', min_overlap=4) assert linked_adapter.front_adapter.min_overlap == 4 assert linked_adapter.back_adapter.min_overlap == 4 sequence = Sequence(name='seq', sequence='AAAACCCCCTTTT') trimmed = linked_adapter.match_to(sequence).trimmed() assert trimmed.name == 'seq' assert trimmed.sequence == 'CCCCC' def test_info_record(): adapter = Adapter( sequence='GAACTCCAGTCACNNNNN', where=BACK, max_error_rate=0.12, min_overlap=5, read_wildcards=False, adapter_wildcards=True, name="Foo") read = Sequence(name="abc", sequence='CCCCAGAACTACAGTCCCGGC') am = Match(astart=0, astop=17, rstart=5, rstop=21, matches=15, errors=2, remove_before=False, adapter=adapter, read=read) assert am.get_info_record() == ( "abc", 2, 5, 21, 'CCCCA', 'GAACTACAGTCCCGGC', '', 'Foo', '', '', '' ) def test_random_match_probabilities(): a = Adapter('A', where=BACK, max_error_rate=0.1).create_statistics() assert a.back.random_match_probabilities(0.5) == [1, 0.25] assert a.back.random_match_probabilities(0.2) == [1, 0.4] for s in ('ACTG', 'XMWH'): a = Adapter(s, where=BACK, max_error_rate=0.1).create_statistics() assert a.back.random_match_probabilities(0.5) == [1, 0.25, 0.25**2, 0.25**3, 0.25**4] assert a.back.random_match_probabilities(0.2) == [1, 0.4, 0.4*0.1, 0.4*0.1*0.4, 0.4*0.1*0.4*0.1] a = Adapter('GTCA', where=FRONT, max_error_rate=0.1).create_statistics() assert a.front.random_match_probabilities(0.5) == [1, 0.25, 0.25**2, 0.25**3, 0.25**4] assert a.front.random_match_probabilities(0.2) == [1, 0.4, 0.4*0.1, 0.4*0.1*0.4, 0.4*0.1*0.4*0.1] def test_add_adapter_statistics(): stats = Adapter('A', name='name', where=BACK, max_error_rate=0.1).create_statistics() end_stats = stats.back end_stats.adjacent_bases['A'] = 7 end_stats.adjacent_bases['C'] = 19 end_stats.adjacent_bases['G'] = 23 end_stats.adjacent_bases['T'] = 42 end_stats.adjacent_bases[''] = 45 end_stats.errors[10][0] = 100 end_stats.errors[10][1] = 11 end_stats.errors[10][2] = 3 end_stats.errors[20][0] = 600 end_stats.errors[20][1] = 66 end_stats.errors[20][2] = 6 stats2 = Adapter('A', name='name', where=BACK, max_error_rate=0.1).create_statistics() end_stats2 = stats2.back end_stats2.adjacent_bases['A'] = 43 end_stats2.adjacent_bases['C'] = 31 end_stats2.adjacent_bases['G'] = 27 end_stats2.adjacent_bases['T'] = 8 end_stats2.adjacent_bases[''] = 5 end_stats2.errors[10][0] = 234 end_stats2.errors[10][1] = 14 end_stats2.errors[10][3] = 5 end_stats2.errors[15][0] = 90 end_stats2.errors[15][1] = 17 end_stats2.errors[15][2] = 2 stats += stats2 r = stats.back assert r.adjacent_bases == {'A': 50, 'C': 50, 'G': 50, 'T': 50, '': 50} assert r.errors == { 10: {0: 334, 1: 25, 2: 3, 3: 5}, 15: {0: 90, 1: 17, 2: 2}, 20: {0: 600, 1: 66, 2: 6}, } def test_issue_265(): """Crash when accessing the matches property of non-anchored linked adapters""" s = Sequence('name', 'AAAATTTT') la = LinkedAdapter('GGG', 'TTT', front_anchored=False, back_anchored=False) assert la.match_to(s).matches == 3 cutadapt-1.15/tests/utils.py0000664000175000017500000000306613205526454016666 0ustar marcelmarcel00000000000000# coding: utf-8 from __future__ import print_function, division, absolute_import import os.path import subprocess import sys from contextlib import contextmanager from shutil import rmtree from tempfile import mkdtemp from cutadapt.__main__ import main @contextmanager def redirect_stderr(): """Send stderr to stdout. Nose doesn't capture stderr, yet.""" old_stderr = sys.stderr sys.stderr = sys.stdout yield sys.stderr = old_stderr @contextmanager def temporary_path(name): tempdir = mkdtemp(prefix='cutadapt-tests.') path = os.path.join(tempdir, name) try: yield path finally: rmtree(tempdir) def datapath(path): return os.path.join(os.path.dirname(__file__), 'data', path) def cutpath(path): return os.path.join(os.path.dirname(__file__), 'cut', path) class FilesDifferent(Exception): pass def assert_files_equal(path1, path2): try: subprocess.check_output(['diff', '-u', path1, path2], stderr=subprocess.STDOUT) except subprocess.CalledProcessError as e: raise FilesDifferent('\n' + e.output.decode()) except AttributeError: # Python 2.6 does not have check_output assert subprocess.call(['diff', '-u', path1, path2]) == 0 def run(params, expected, inpath, inpath2=None): if type(params) is str: params = params.split() with temporary_path(expected) as tmp_fastaq: params += ['-o', tmp_fastaq] # TODO not parallelizable params += [datapath(inpath)] if inpath2: params += [datapath(inpath2)] assert main(params) is None # TODO redirect standard output assert_files_equal(cutpath(expected), tmp_fastaq) # TODO diff log files cutadapt-1.15/tests/test_filters.py0000664000175000017500000000254513205526454020236 0ustar marcelmarcel00000000000000# coding: utf-8 """ Tests write output (should it return True or False or write) """ from __future__ import print_function, division, absolute_import from cutadapt.filters import NContentFilter, DISCARD, KEEP, PairedRedirector from cutadapt.seqio import Sequence def test_ncontentfilter(): # third parameter is True if read should be discarded params = [ ('AAA', 0, KEEP), ('AAA', 1, KEEP), ('AAACCTTGGN', 1, KEEP), ('AAACNNNCTTGGN', 0.5, KEEP), ('NNNNNN', 1, DISCARD), ('ANAAAA', 1/6, KEEP), ('ANAAAA', 0, DISCARD) ] for seq, count, expected in params: filter = NContentFilter(count=count) _seq = Sequence('read1', seq, qualities='#'*len(seq)) assert filter(_seq) == expected def test_ncontentfilter_paired(): params = [ ('AAA', 'AAA', 0, KEEP), ('AAAN', 'AAA', 0, DISCARD), ('AAA', 'AANA', 0, DISCARD), ('ANAA', 'AANA', 1, KEEP), ] for seq1, seq2, count, expected in params: filter = NContentFilter(count=count) filter_legacy = PairedRedirector(None, filter, pair_filter_mode='first') filter_any = PairedRedirector(None, filter, pair_filter_mode='any') read1 = Sequence('read1', seq1, qualities='#'*len(seq1)) read2 = Sequence('read1', seq2, qualities='#'*len(seq2)) assert filter_legacy(read1, read2) == filter(read1) # discard entire pair if one of the reads fulfills criteria assert filter_any(read1, read2) == expected cutadapt-1.15/tests/test_colorspace.py0000664000175000017500000000776713205526454020733 0ustar marcelmarcel00000000000000# coding: utf-8 from __future__ import print_function, division, absolute_import from cutadapt.colorspace import encode, decode from cutadapt.__main__ import main from utils import run, datapath # If there are any unknown characters in the test sequence, # round tripping will only work if all characters after the # first unknown character are also unknown: # encode("TNGN") == "T444", but # decode("T444") == "TNNN". sequences = [ "", "C", "ACGGTC", "TN", "TN.", "TNN.N", "CCGGCAGCATTCATTACGACAACGTGGCACCGTGTTTTCTCGGTGGTA", "TGCAGTTGATGATCGAAGAAAACGACATCATCAGCCAGCAAGTGC", "CAGGGTTTGATGAGTGGCTGTGGGTGCTGGCGTATCCGGG" ] def test_encode(): assert encode("AA") == "A0" assert encode("AC") == "A1" assert encode("AG") == "A2" assert encode("AT") == "A3" assert encode("CA") == "C1" assert encode("CC") == "C0" assert encode("CG") == "C3" assert encode("CT") == "C2" assert encode("GA") == "G2" assert encode("GC") == "G3" assert encode("GG") == "G0" assert encode("GT") == "G1" assert encode("TA") == "T3" assert encode("TC") == "T2" assert encode("TG") == "T1" assert encode("TT") == "T0" assert encode("TN") == "T4" assert encode("NT") == "N4" assert encode("NN") == "N4" assert encode("ACGGTC") == "A13012" assert encode("TTT.N") == "T0044" assert encode("TTNT.N") == "T04444" def test_decode(): for s in sequences: expected = s.replace('.', 'N') encoded = encode(s) assert decode(encoded) == expected assert decode('A.') == 'AN' assert decode('C.') == 'CN' assert decode('G.') == 'GN' assert decode('T.') == 'TN' def test_qualtrim_csfastaqual(): """-q with csfasta/qual files""" run("-c -q 10", "solidqual.fastq", "solid.csfasta", 'solid.qual') def test_E3M(): """Read the E3M dataset""" # not really colorspace, but a fasta/qual file pair main(['-o', '/dev/null', datapath("E3M.fasta"), datapath("E3M.qual")]) def test_bwa(): """MAQ-/BWA-compatible output""" run("-c -e 0.12 -a 330201030313112312 -x 552: --maq", "solidmaq.fastq", "solid.csfasta", 'solid.qual') def test_bfast(): """BFAST-compatible output""" run("-c -e 0.12 -a 330201030313112312 -x abc: --strip-f3", "solidbfast.fastq", "solid.csfasta", 'solid.qual') def test_trim_095(): """some reads properly trimmed since cutadapt 0.9.5""" run("-c -e 0.122 -a 330201030313112312", "solid.fasta", "solid.fasta") def test_solid(): run("-c -e 0.122 -a 330201030313112312", "solid.fastq", "solid.fastq") def test_solid_basespace_adapter(): """colorspace adapter given in basespace""" run("-c -e 0.122 -a CGCCTTGGCCGTACAGCAG", "solid.fastq", "solid.fastq") def test_solid5p(): """test 5' colorspace adapter""" # this is not a real adapter, just a random string # in colorspace: C0302201212322332333 run("-c -e 0.1 --trim-primer -g CCGGAGGTCAGCTCGCTATA", "solid5p.fasta", "solid5p.fasta") def test_solid5p_prefix_notrim(): """test anchored 5' colorspace adapter, no primer trimming""" run("-c -e 0.1 -g ^CCGGAGGTCAGCTCGCTATA", "solid5p-anchored.notrim.fasta", "solid5p.fasta") def test_solid5p_prefix(): """test anchored 5' colorspace adapter""" run("-c -e 0.1 --trim-primer -g ^CCGGAGGTCAGCTCGCTATA", "solid5p-anchored.fasta", "solid5p.fasta") def test_solid5p_fastq(): """test 5' colorspace adapter""" # this is not a real adapter, just a random string # in colorspace: C0302201212322332333 run("-c -e 0.1 --trim-primer -g CCGGAGGTCAGCTCGCTATA", "solid5p.fastq", "solid5p.fastq") def test_solid5p_prefix_notrim_fastq(): """test anchored 5' colorspace adapter, no primer trimming""" run("-c -e 0.1 -g ^CCGGAGGTCAGCTCGCTATA", "solid5p-anchored.notrim.fastq", "solid5p.fastq") def test_solid5p_prefix_fastq(): """test anchored 5' colorspace adapter""" run("-c -e 0.1 --trim-primer -g ^CCGGAGGTCAGCTCGCTATA", "solid5p-anchored.fastq", "solid5p.fastq") def test_sra_fastq(): """test SRA-formatted colorspace FASTQ""" run("-c -e 0.1 --format sra-fastq -a CGCCTTGGCCGTACAGCAG", "sra.fastq", "sra.fastq") def test_no_zero_cap(): run("--no-zero-cap -c -e 0.122 -a CGCCTTGGCCGTACAGCAG", "solid-no-zerocap.fastq", "solid.fastq") cutadapt-1.15/tests/test_paired.py0000664000175000017500000003014413205526454020026 0ustar marcelmarcel00000000000000# coding: utf-8 from __future__ import print_function, division, absolute_import import os.path import shutil import tempfile import pytest from nose.tools import raises from cutadapt.compat import PY3 from cutadapt.__main__ import main from utils import run, assert_files_equal, datapath, cutpath, redirect_stderr, temporary_path if PY3: @pytest.fixture(params=[1, 2]) def cores(request): return request.param else: @pytest.fixture def cores(): return 1 def run_paired(params, in1, in2, expected1, expected2, cores): if type(params) is str: params = params.split() params += ['--cores', str(cores), '--buffer-size=512'] with temporary_path('tmp1-' + expected1) as p1: with temporary_path('tmp2-' + expected2) as p2: params += ['-o', p1, '-p', p2] params += [datapath(in1), datapath(in2)] assert main(params) is None assert_files_equal(cutpath(expected1), p1) assert_files_equal(cutpath(expected2), p2) def run_interleaved(params, inpath1, inpath2=None, expected1=None, expected2=None, cores=1): """ Interleaved input or output (or both) """ assert not (inpath1 and inpath2 and expected1 and expected2) assert not (expected2 and not expected1) assert not (inpath2 and not inpath1) if type(params) is str: params = params.split() params += ['--interleaved', '--cores', str(cores), '--buffer-size=512'] with temporary_path('tmp1-' + expected1) as tmp1: params += ['-o', tmp1] paths = [datapath(inpath1)] if inpath2: paths += [datapath(inpath2)] if expected2: with temporary_path('tmp2-' + expected2) as tmp2: params += ['-p', tmp2] assert main(params + paths) is None assert_files_equal(cutpath(expected2), tmp2) else: assert main(params + paths) is None assert_files_equal(cutpath(expected1), tmp1) def test_paired_separate(): """test separate trimming of paired-end reads""" run('-a TTAGACATAT', 'paired-separate.1.fastq', 'paired.1.fastq') run('-a CAGTGGAGTA', 'paired-separate.2.fastq', 'paired.2.fastq') def test_paired_end_legacy(cores): """--paired-output, not using -A/-B/-G""" # the -m 14 filters out one read, which should then also be filtered out in the second output file # -q 10 should not change anything: qualities in file 1 are high enough, # qualities in file 2 should not be inspected. run_paired( '-a TTAGACATAT -m 14 -q 10', in1='paired.1.fastq', in2='paired.2.fastq', expected1='paired.m14.1.fastq', expected2='paired.m14.2.fastq', cores=cores ) def test_untrimmed_paired_output(): with temporary_path("tmp-untrimmed.1.fastq") as untrimmed1: with temporary_path("tmp-untrimmed.2.fastq") as untrimmed2: run_paired( ['-a', 'TTAGACATAT', '--untrimmed-output', untrimmed1, '--untrimmed-paired-output', untrimmed2], in1='paired.1.fastq', in2='paired.2.fastq', expected1='paired-trimmed.1.fastq', expected2='paired-trimmed.2.fastq', cores=1 ) assert_files_equal(cutpath('paired-untrimmed.1.fastq'), untrimmed1) assert_files_equal(cutpath('paired-untrimmed.2.fastq'), untrimmed2) def test_explicit_format_with_paired(): # Use --format=fastq with input files whose extension is .txt with temporary_path("paired.1.txt") as txt1: with temporary_path("paired.2.txt") as txt2: shutil.copyfile(datapath("paired.1.fastq"), txt1) shutil.copyfile(datapath("paired.2.fastq"), txt2) run_paired( '--format=fastq -a TTAGACATAT -m 14', in1=txt1, in2=txt2, expected1='paired.m14.1.fastq', expected2='paired.m14.2.fastq', cores=1 ) def test_no_trimming_legacy(): # make sure that this doesn't divide by zero main([ '-a', 'XXXXX', '-o', '/dev/null', '-p', '/dev/null', datapath('paired.1.fastq'), datapath('paired.2.fastq')]) def test_no_trimming(): # make sure that this doesn't divide by zero main([ '-a', 'XXXXX', '-A', 'XXXXX', '-o', '/dev/null', '-p', '/dev/null', datapath('paired.1.fastq'), datapath('paired.2.fastq')]) @raises(SystemExit) def test_missing_file(): with redirect_stderr(): main(['-a', 'XX', '--paired-output', 'out.fastq', datapath('paired.1.fastq')]) def test_first_too_short(cores): with pytest.raises(SystemExit): with temporary_path("truncated.1.fastq") as trunc1: # Create a truncated file in which the last read is missing with open(datapath('paired.1.fastq')) as f: lines = f.readlines() lines = lines[:-4] with open(trunc1, 'w') as f: f.writelines(lines) with redirect_stderr(): main( '-a XX -o /dev/null --paired-output out.fastq'.split() + ['--cores', str(cores)] + [trunc1, datapath('paired.2.fastq')] ) def test_second_too_short(cores): with pytest.raises(SystemExit): with temporary_path("truncated.2.fastq") as trunc2: # Create a truncated file in which the last read is missing with open(datapath('paired.2.fastq')) as f: lines = f.readlines() lines = lines[:-4] with open(trunc2, 'w') as f: f.writelines(lines) with redirect_stderr(): main('-a XX -o /dev/null --paired-output out.fastq'.split() + ['--cores', str(cores)] + [datapath('paired.1.fastq'), trunc2]) def test_unmatched_read_names(cores): with pytest.raises(SystemExit): with temporary_path("swapped.1.fastq") as swapped: # Create a file in which reads 2 and 1 are swapped with open(datapath('paired.1.fastq')) as f: lines = f.readlines() lines = lines[0:4] + lines[8:12] + lines[4:8] + lines[12:] with open(swapped, 'w') as f: f.writelines(lines) with redirect_stderr(): main('-a XX -o out1.fastq --paired-output out2.fastq'.split() + ['--cores', str(cores)] + [swapped, datapath('paired.2.fastq')]) def test_p_without_o(cores): """Option -p given but -o missing""" with pytest.raises(SystemExit): main('-a XX -p /dev/null'.split() + ['--cores', str(cores)] + [datapath('paired.1.fastq'), datapath('paired.2.fastq')]) def test_paired_but_only_one_input_file(cores): """Option -p given but only one input file""" with pytest.raises(SystemExit): main('-a XX -o /dev/null -p /dev/null'.split() + ['--cores', str(cores)] + [datapath('paired.1.fastq')]) def test_legacy_minlength(cores): """Ensure -m is not applied to second read in a pair in legacy mode""" run_paired( '-a XXX -m 27', in1='paired.1.fastq', in2='paired.2.fastq', expected1='paired-m27.1.fastq', expected2='paired-m27.2.fastq', cores=cores ) def test_paired_end(cores): """single-pass paired-end with -m""" run_paired( '-a TTAGACATAT -A CAGTGGAGTA -m 14', in1='paired.1.fastq', in2='paired.2.fastq', expected1='paired.1.fastq', expected2='paired.2.fastq', cores=cores ) def test_paired_anchored_back_no_indels(): run_paired( '-a BACKADAPTER$ -A BACKADAPTER$ -N --no-indels', in1='anchored-back.fasta', in2='anchored-back.fasta', expected1='anchored-back.fasta', expected2="anchored-back.fasta", cores=1 ) def test_paired_end_qualtrim(cores): """single-pass paired-end with -q and -m""" run_paired( '-q 20 -a TTAGACATAT -A CAGTGGAGTA -m 14 -M 90', in1='paired.1.fastq', in2='paired.2.fastq', expected1='pairedq.1.fastq', expected2='pairedq.2.fastq', cores=cores ) def test_paired_end_qualtrim_swapped(cores): """single-pass paired-end with -q and -m, but files swapped""" run_paired( '-q 20 -a CAGTGGAGTA -A TTAGACATAT -m 14', in1='paired.2.fastq', in2='paired.1.fastq', expected1='pairedq.2.fastq', expected2='pairedq.1.fastq', cores=cores ) def test_paired_end_cut(cores): run_paired( '-u 3 -u -1 -U 4 -U -2', in1='paired.1.fastq', in2='paired.2.fastq', expected1='pairedu.1.fastq', expected2='pairedu.2.fastq', cores=cores ) def test_paired_end_upper_a_only(cores): run_paired( '-A CAGTGGAGTA', in1='paired.1.fastq', in2='paired.2.fastq', expected1='paired-onlyA.1.fastq', expected2='paired-onlyA.2.fastq', cores=cores ) def test_discard_untrimmed(cores): # issue #146 # the first adapter is a sequence cut out from the first read run_paired( '-a CTCCAGCTTAGACATATC -A XXXXXXXX --discard-untrimmed', in1='paired.1.fastq', in2='paired.2.fastq', expected1='empty.fastq', expected2='empty.fastq', cores=cores ) def test_discard_trimmed(cores): run_paired( '-A C -O 1 --discard-trimmed', # applies everywhere in1='paired.1.fastq', in2='paired.2.fastq', expected1='empty.fastq', expected2='empty.fastq', cores=cores ) def test_interleaved_in_and_out(cores): """Single-pass interleaved paired-end with -q and -m""" run_interleaved( '-q 20 -a TTAGACATAT -A CAGTGGAGTA -m 14 -M 90', inpath1='interleaved.fastq', expected1='interleaved.fastq', cores=cores ) def test_interleaved_in(cores): """Interleaved input, two files output""" run_interleaved( '-q 20 -a TTAGACATAT -A CAGTGGAGTA -m 14 -M 90', inpath1='interleaved.fastq', expected1='pairedq.1.fastq', expected2='pairedq.2.fastq', cores=cores ) def test_interleaved_out(cores): """Two files input, interleaved output""" run_interleaved( '-q 20 -a TTAGACATAT -A CAGTGGAGTA -m 14 -M 90', inpath1='paired.1.fastq', inpath2='paired.2.fastq', expected1='interleaved.fastq', cores=cores ) @raises(SystemExit) def test_interleaved_neither_nor(): """Option --interleaved used, but pairs of files given for input and output""" with temporary_path("temp-paired.1.fastq") as p1: with temporary_path("temp-paired.2.fastq") as p2: params = '-a XX --interleaved'.split() with redirect_stderr(): params += ['-o', p1, '-p1', p2, 'paired.1.fastq', 'paired.2.fastq'] main(params) def test_pair_filter(cores): run_paired( '--pair-filter=both -a TTAGACATAT -A GGAGTA -m 14', in1='paired.1.fastq', in2='paired.2.fastq', expected1='paired-filterboth.1.fastq', expected2='paired-filterboth.2.fastq', cores=cores ) def test_too_short_paired_output(): with temporary_path("temp-too-short.1.fastq") as p1: with temporary_path("temp-too-short.2.fastq") as p2: run_paired( '-a TTAGACATAT -A CAGTGGAGTA -m 14 --too-short-output ' '{0} --too-short-paired-output {1}'.format(p1, p2), in1='paired.1.fastq', in2='paired.2.fastq', expected1='paired.1.fastq', expected2='paired.2.fastq', cores=1 ) assert_files_equal(cutpath('paired-too-short.1.fastq'), p1) assert_files_equal(cutpath('paired-too-short.2.fastq'), p2) def test_too_long_output(): with temporary_path('temp-too-long.1.fastq') as p1: with temporary_path('temp-too-long.2.fastq') as p2: run_paired( '-a TTAGACATAT -A CAGTGGAGTA -M 14 --too-long-output ' '{0} --too-long-paired-output {1}'.format(p1, p2), in1='paired.1.fastq', in2='paired.2.fastq', expected1='paired-too-short.1.fastq', expected2='paired-too-short.2.fastq', cores=1 ) assert_files_equal(cutpath('paired.1.fastq'), p1) assert_files_equal(cutpath('paired.2.fastq'), p2) @raises(SystemExit) def test_too_short_output_paired_option_missing(): with temporary_path('temp-too-short.1.fastq') as p1: run_paired( '-a TTAGACATAT -A CAGTGGAGTA -m 14 --too-short-output ' '{0}'.format(p1), in1='paired.1.fastq', in2='paired.2.fastq', expected1='paired.1.fastq', expected2='paired.2.fastq', cores=1 ) def test_nextseq_paired(cores): run_paired('--nextseq-trim 22', in1='nextseq.fastq', in2='nextseq.fastq', expected1='nextseq.fastq', expected2='nextseq.fastq', cores=cores) def test_paired_demultiplex(): tempdir = tempfile.mkdtemp(prefix='cutadapt-tests.') multiout1 = os.path.join(tempdir, 'demultiplexed.{name}.1.fastq') multiout2 = os.path.join(tempdir, 'demultiplexed.{name}.2.fastq') params = [ '-a', 'first=AACATTAGACA', '-a', 'second=CATTAGACATATCGG', '-A', 'ignored=CAGTGGAGTA', '-A', 'alsoignored=AATAACAGTGGAGTA', '-o', multiout1, '-p', multiout2, datapath('paired.1.fastq'), datapath('paired.2.fastq')] assert main(params) is None assert_files_equal(cutpath('demultiplexed.first.1.fastq'), multiout1.format(name='first')) assert_files_equal(cutpath('demultiplexed.second.1.fastq'), multiout1.format(name='second')) assert_files_equal(cutpath('demultiplexed.unknown.1.fastq'), multiout1.format(name='unknown')) assert_files_equal(cutpath('demultiplexed.first.2.fastq'), multiout2.format(name='first')) assert_files_equal(cutpath('demultiplexed.second.2.fastq'), multiout2.format(name='second')) assert_files_equal(cutpath('demultiplexed.unknown.2.fastq'), multiout2.format(name='unknown')) shutil.rmtree(tempdir) cutadapt-1.15/tests/test_seqio.py0000664000175000017500000003074113205526454017705 0ustar marcelmarcel00000000000000# coding: utf-8 from __future__ import print_function, division, absolute_import from io import BytesIO import os import shutil from textwrap import dedent import pytest from nose.tools import raises from tempfile import mkdtemp from cutadapt.seqio import (Sequence, ColorspaceSequence, FormatError, FastaReader, FastqReader, FastaQualReader, InterleavedSequenceReader, FastaWriter, FastqWriter, InterleavedSequenceWriter, open as openseq, sequence_names_match, head, fastq_head, two_fastq_heads, find_fastq_record_end, read_paired_chunks, read_chunks_from_file) from cutadapt.compat import StringIO # files tests/data/simple.fast{q,a} simple_fastq = [ Sequence("first_sequence", "SEQUENCE1", ":6;;8<=:<"), Sequence("second_sequence", "SEQUENCE2", "83first_sequence\nSEQUENCE1\n>second_sequence\nSEQUENCE2\n") reads = list(FastaReader(fasta)) assert reads == simple_fasta def test_with_comments(self): fasta = StringIO(dedent( """ # a comment # another one >first_sequence SEQUENCE1 >second_sequence SEQUENCE2 """)) reads = list(FastaReader(fasta)) assert reads == simple_fasta @raises(FormatError) def test_wrong_format(self): fasta = StringIO(dedent( """ # a comment # another one unexpected >first_sequence SEQUENCE1 >second_sequence SEQUENCE2 """)) reads = list(FastaReader(fasta)) def test_fastareader_keeplinebreaks(self): with FastaReader("tests/data/simple.fasta", keep_linebreaks=True) as f: reads = list(f) assert reads[0] == simple_fasta[0] assert reads[1].sequence == 'SEQUEN\nCE2' def test_context_manager(self): filename = "tests/data/simple.fasta" with open(filename) as f: assert not f.closed reads = list(openseq(f)) assert not f.closed assert f.closed with FastaReader(filename) as sr: tmp_sr = sr assert not sr._file.closed reads = list(sr) assert not sr._file.closed assert tmp_sr._file is None # Open it a second time with FastaReader(filename) as sr: pass class TestFastqReader: def test_fastqreader(self): with FastqReader("tests/data/simple.fastq") as f: reads = list(f) assert reads == simple_fastq def test_fastqreader_dos(self): with FastqReader("tests/data/dos.fastq") as f: dos_reads = list(f) with FastqReader("tests/data/small.fastq") as f: unix_reads = list(f) assert dos_reads == unix_reads @raises(FormatError) def test_fastq_wrongformat(self): with FastqReader("tests/data/withplus.fastq") as f: reads = list(f) @raises(FormatError) def test_fastq_incomplete(self): fastq = StringIO("@name\nACGT+\n") with FastqReader(fastq) as fq: list(fq) def test_context_manager(self): filename = "tests/data/simple.fastq" with open(filename) as f: assert not f.closed reads = list(openseq(f)) assert not f.closed assert f.closed with FastqReader(filename) as sr: tmp_sr = sr assert not sr._file.closed reads = list(sr) assert not sr._file.closed assert tmp_sr._file is None class TestFastaQualReader: @raises(FormatError) def test_mismatching_read_names(self): fasta = StringIO(">name\nACG") qual = StringIO(">nome\n3 5 7") list(FastaQualReader(fasta, qual)) @raises(FormatError) def test_invalid_quality_value(self): fasta = StringIO(">name\nACG") qual = StringIO(">name\n3 xx 7") list(FastaQualReader(fasta, qual)) class TestSeqioOpen: def setup(self): self._tmpdir = mkdtemp() def teardown(self): shutil.rmtree(self._tmpdir) def test_sequence_reader(self): # test the autodetection with openseq("tests/data/simple.fastq") as f: reads = list(f) assert reads == simple_fastq with openseq("tests/data/simple.fasta") as f: reads = list(f) assert reads == simple_fasta with open("tests/data/simple.fastq") as f: reads = list(openseq(f)) assert reads == simple_fastq # make the name attribute unavailable f = StringIO(open("tests/data/simple.fastq").read()) reads = list(openseq(f)) assert reads == simple_fastq f = StringIO(open("tests/data/simple.fasta").read()) reads = list(openseq(f)) assert reads == simple_fasta def test_autodetect_fasta_format(self): path = os.path.join(self._tmpdir, 'tmp.fasta') with openseq(path, mode='w') as f: assert isinstance(f, FastaWriter) for seq in simple_fastq: f.write(seq) assert list(openseq(path)) == simple_fasta def test_write_qualities_to_fasta(self): path = os.path.join(self._tmpdir, 'tmp.fasta') with openseq(path, mode='w', qualities=True) as f: assert isinstance(f, FastaWriter) for seq in simple_fastq: f.write(seq) assert list(openseq(path)) == simple_fasta def test_autodetect_fastq_format(self): path = os.path.join(self._tmpdir, 'tmp.fastq') with openseq(path, mode='w') as f: assert isinstance(f, FastqWriter) for seq in simple_fastq: f.write(seq) assert list(openseq(path)) == simple_fastq @raises(ValueError) def test_fastq_qualities_missing(self): path = os.path.join(self._tmpdir, 'tmp.fastq') openseq(path, mode='w', qualities=False) class TestInterleavedReader: def test(self): expected = [ (Sequence('read1/1 some text', 'TTATTTGTCTCCAGC', '##HHHHHHHHHHHHH'), Sequence('read1/2 other text', 'GCTGGAGACAAATAA', 'HHHHHHHHHHHHHHH')), (Sequence('read3/1', 'CCAACTTGATATTAATAACA', 'HHHHHHHHHHHHHHHHHHHH'), Sequence('read3/2', 'TGTTATTAATATCAAGTTGG', '#HHHHHHHHHHHHHHHHHHH')) ] reads = list(InterleavedSequenceReader("tests/cut/interleaved.fastq")) for (r1, r2), (e1, e2) in zip(reads, expected): print(r1, r2, e1, e2) assert reads == expected with openseq("tests/cut/interleaved.fastq", interleaved=True) as f: reads = list(f) assert reads == expected @raises(FormatError) def test_missing_partner(self): s = StringIO('@r1\nACG\n+\nHHH') list(InterleavedSequenceReader(s)) @raises(FormatError) def test_incorrectly_paired(self): s = StringIO('@r1/1\nACG\n+\nHHH\n@wrong_name\nTTT\n+\nHHH') list(InterleavedSequenceReader(s)) class TestFastaWriter: def setup(self): self._tmpdir = mkdtemp() self.path = os.path.join(self._tmpdir, 'tmp.fasta') def teardown(self): shutil.rmtree(self._tmpdir) def test(self): with FastaWriter(self.path) as fw: fw.write("name", "CCATA") fw.write("name2", "HELLO") assert fw._file.closed with open(self.path) as t: assert t.read() == '>name\nCCATA\n>name2\nHELLO\n' def test_linelength(self): with FastaWriter(self.path, line_length=3) as fw: fw.write("r1", "ACG") fw.write("r2", "CCAT") fw.write("r3", "TACCAG") assert fw._file.closed with open(self.path) as t: d = t.read() assert d == '>r1\nACG\n>r2\nCCA\nT\n>r3\nTAC\nCAG\n' def test_write_sequence_object(self): with FastaWriter(self.path) as fw: fw.write(Sequence("name", "CCATA")) fw.write(Sequence("name2", "HELLO")) assert fw._file.closed with open(self.path) as t: assert t.read() == '>name\nCCATA\n>name2\nHELLO\n' def test_write_to_file_like_object(self): sio = StringIO() with FastaWriter(sio) as fw: fw.write(Sequence("name", "CCATA")) fw.write(Sequence("name2", "HELLO")) assert sio.getvalue() == '>name\nCCATA\n>name2\nHELLO\n' assert not fw._file.closed def test_write_zero_length_sequence(self): sio = StringIO() with FastaWriter(sio) as fw: fw.write(Sequence("name", "")) assert sio.getvalue() == '>name\n\n', '{0!r}'.format(sio.getvalue()) class TestFastqWriter: def setup(self): self._tmpdir = mkdtemp() self.path = os.path.join(self._tmpdir, 'tmp.fastq') def teardown(self): shutil.rmtree(self._tmpdir) def test(self): with FastqWriter(self.path) as fq: fq.writeseq("name", "CCATA", "!#!#!") fq.writeseq("name2", "HELLO", "&&&!&&") assert fq._file.closed with open(self.path) as t: assert t.read() == '@name\nCCATA\n+\n!#!#!\n@name2\nHELLO\n+\n&&&!&&\n' def test_twoheaders(self): with FastqWriter(self.path) as fq: fq.write(Sequence("name", "CCATA", "!#!#!", second_header=True)) fq.write(Sequence("name2", "HELLO", "&&&!&", second_header=True)) assert fq._file.closed with open(self.path) as t: assert t.read() == '@name\nCCATA\n+name\n!#!#!\n@name2\nHELLO\n+name2\n&&&!&\n' def test_write_to_file_like_object(self): sio = StringIO() with FastqWriter(sio) as fq: fq.writeseq("name", "CCATA", "!#!#!") fq.writeseq("name2", "HELLO", "&&&!&&") assert sio.getvalue() == '@name\nCCATA\n+\n!#!#!\n@name2\nHELLO\n+\n&&&!&&\n' class TestInterleavedWriter: def test(self): reads = [ (Sequence('A/1 comment', 'TTA', '##H'), Sequence('A/2 comment', 'GCT', 'HH#')), (Sequence('B/1', 'CC', 'HH'), Sequence('B/2', 'TG', '#H')) ] sio = StringIO() with InterleavedSequenceWriter(sio) as writer: for read1, read2 in reads: writer.write(read1, read2) assert sio.getvalue() == '@A/1 comment\nTTA\n+\n##H\n@A/2 comment\nGCT\n+\nHH#\n@B/1\nCC\n+\nHH\n@B/2\nTG\n+\n#H\n' class TestPairedSequenceReader: def test_sequence_names_match(self): def match(name1, name2): seq1 = Sequence(name1, 'ACGT') seq2 = Sequence(name2, 'AACC') return sequence_names_match(seq1, seq2) assert match('abc', 'abc') assert match('abc/1', 'abc/2') assert match('abc.1', 'abc.2') assert match('abc1', 'abc2') assert not match('abc', 'xyz') def test_head(): # no line break at end on purpose buf = b'first\nsecond\nthird\nfourth\nfifth' assert head(buf, 0) == 0 assert head(buf, 1) == len('first\n') assert head(buf, 2) == len('first\n') + len('second\n') assert head(buf, 3) == len('first\n') + len('second\n') + len('third\n') assert head(buf, 4) == len('first\n') + len('second\n') + len('third\n') + len('fourth\n') assert head(buf, 5) == len(buf) assert head(buf, 6) == len(buf) assert head(buf, 100) == len(buf) def test_two_fastq_heads(): buf1 = b'first\nsecond\nthird\nfourth\nfifth' buf2 = b'a\nb\nc\nd\ne\nf\ng' assert two_fastq_heads(buf1, buf2, len(buf1), len(buf2)) == ( len(b'first\nsecond\nthird\nfourth\n'), len(b'a\nb\nc\nd\n')) assert two_fastq_heads(b'abc', b'def', 3, 3) == (0, 0) assert two_fastq_heads(b'abc\n', b'def', 4, 3) == (0, 0) assert two_fastq_heads(b'abc', b'def\n', 3, 4) == (0, 0) assert two_fastq_heads(b'\n\n\n\n', b'\n\n\n\n', 4, 4) == (4, 4) def test_fastq_head(): assert fastq_head(b'') == 0 assert fastq_head(b'A\n') == 0 assert fastq_head(b'A\nB') == 0 assert fastq_head(b'A\nB\n') == 0 assert fastq_head(b'A\nB\nC') == 0 assert fastq_head(b'A\nB\nC\n') == 0 assert fastq_head(b'A\nB\nC\nD') == 0 assert fastq_head(b'A\nB\nC\nD\n') == 8 assert fastq_head(b'A\nB\nC\nD\nE') == 8 def test_fastq_record_end(): assert find_fastq_record_end(b'') == 0 assert find_fastq_record_end(b'A\n') == 0 assert find_fastq_record_end(b'A\nB') == 0 assert find_fastq_record_end(b'A\nB\n') == 0 assert find_fastq_record_end(b'A\nB\nC') == 0 assert find_fastq_record_end(b'A\nB\nC\n') == 0 assert find_fastq_record_end(b'A\nB\nC\nD') == 0 assert find_fastq_record_end(b'A\nB\nC\nD\n') == 0 assert find_fastq_record_end(b'A\nB\nC\nD\nE') == 0 assert find_fastq_record_end(b'A\nB\nC\nD\nE\n') == 0 assert find_fastq_record_end(b'A\nB\nC\nD\nE\nF') == 0 assert find_fastq_record_end(b'A\nB\nC\nD\nE\nF\n') == 0 assert find_fastq_record_end(b'A\nB\nC\nD\nE\nF\nG') == 0 assert find_fastq_record_end(b'A\nB\nC\nD\nE\nF\nG\n') == 0 assert find_fastq_record_end(b'A\nB\nC\nD\nE\nF\nG\nH') == 0 assert find_fastq_record_end(b'A\nB\nC\nD\nE\nF\nG\nH\n') == 16 assert find_fastq_record_end(b'A\nB\nC\nD\nE\nF\nG\nH\nI') == 16 assert find_fastq_record_end(b'A\nB\nC\nD\nE\nF\nG\nH\nI\n') == 16 def test_read_paired_chunks(): with open('tests/data/paired.1.fastq', 'rb') as f1: with open('tests/data/paired.2.fastq', 'rb') as f2: for c1, c2 in read_paired_chunks(f1, f2, buffer_size=128): print(c1, c2) def test_read_chunks_from_file(): for data in [b'@r1\nACG\n+\nHHH\n', b'>r1\nACGACGACG\n']: assert [m.tobytes() for m in read_chunks_from_file(BytesIO(data))] == [data] # Buffer too small with pytest.raises(OverflowError): list(read_chunks_from_file(BytesIO(data), buffer_size=4)) cutadapt-1.15/tests/data/0000775000175000017500000000000013205527004016050 5ustar marcelmarcel00000000000000cutadapt-1.15/tests/data/paired.1.fastq0000664000175000017500000000045013205526454020522 0ustar marcelmarcel00000000000000@read1/1 some text TTATTTGTCTCCAGCTTAGACATATCGCCT + ##HHHHHHHHHHHHHHHHHHHHHHHHHHHH @read2/1 CAACAGGCCACATTAGACATATCGGATGGT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH @read3/1 CCAACTTGATATTAATAACATTAGACA + HHHHHHHHHHHHHHHHHHHHHHHHHHH @read4/1 GACAGGCCGTTTGAATGTTGACGGGATGTT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH cutadapt-1.15/tests/data/small.fastq.xz0000664000175000017500000000040413205526454020666 0ustar marcelmarcel000000000000007zXZִF!t/]  FgB!1,h"zag|w\.C 9f9bfWRr,(_MLz)U0Au:1elZ(o2t{|B_ED⽛(a=ysV+QH Ѷ|FhYRWPȵV.q ei}{&9<4Z_d",gYZcutadapt-1.15/tests/data/rest.fa0000664000175000017500000000034213205526454017344 0ustar marcelmarcel00000000000000>read1 TESTINGADAPTERREST1 >read2 TESTINGADAPTERRESTING >read3 TESTINGADAPTER >read4 TESTINGADAPTERRESTLESS >read5 TESTINGADAPTERRESTORE >read6 ADAPTERSOMETHING >read7 DAPTERSOMETHING >read8 RESTADAPTERSOMETHING >read9 NOREST cutadapt-1.15/tests/data/solid.fastq0000664000175000017500000000517113205526454020236 0ustar marcelmarcel00000000000000@1_13_85_F3 T110020300.0113010210002110102330021 + 7&9<&77)& <7))%4'657-1+9;9,.<8);.;8 @1_13_573_F3 T312311200.3021301101113203302010003 + 6)3%)&&&& .1&(6:<'67..*,:75)'77&&&5 @1_13_1259_F3 T002112130.2012223322111330201230313 + =;<:&:A;A 9<<<,7:<=3=;:<&70<,=: @1_14_177_F3 T31330222020233321121323302013303311 + :8957;;54)'98924905;;)6:7;1:3<88(9: @1_14_238_F3 T01331031200310022122230330201030313 + ?><5=;<<<12>=<;1;;=5);.;14:0>2;:3;7 @1_15_1098_F3 T32333033222233020223032312232220332 + #,##(#5##*#($$'#.##)$&#%)$1##-$&##% @1_16_404_F3 T03310320002130202331112133020103031 + 78;:;;><>9=9;<<2=><<1;58;9<<;>(<;<; @1_16_904_F3 T21230102331022312232132021122111212 + 9>=::6;;99=+/'$+#.#&%$&'(($1*$($.#. @1_16_1315_F3 T03231231112210333010310323302010003 + <9<8A?>?::;6&,%;6/)8<<#/;79(448&*.) @1_16_1595_F3 T22323211312111230022210011213302012 + >,<=<>@6<;?<=>:/=.>&;;8;)17:=&,>1=+ @1_17_1379_F3 T32011212111223230232132311321200123 + /-1179<1;>>8:':7-%/::0&+=<29,7<8(,2 @1_18_1692_F3 T12322233031100211233323300112200210 + .#(###5%)%2)',2&:+#+&5,($/1#&4&))$6 @1_19_171_F3 T10101101220213201111011320201230032 + )6:65/=3*:(8%)%2>&8&%;%0&#;$3$&:$#& @1_22_72_F3 T13303032323221212301322233320210233 + 3/#678<:.=9::6:(<538295;9+;&*;)+',& @1_22_1377_F3 T22221333311222312201132312022322300 + )##0%.$.1*%,)95+%%14%$#8-###9-()#9+ @1_23_585_F3 T30010310310130312122123302013303131 + >55;8><96/18?)<3<58<5:;96=7:1=8=:-< @1_23_809_F3 T13130101101021211013220302223302112 + :7<59@;<<5;/9;=<;7::.)&&&827(+221%( @1_24_138_F3 T33211130100120323002033020123031311 + 6)68/;906#,25/&;<$0+250#2,<)5,9/+7) @1_24_206_F3 T33330332002223002020303331321221000 + ))4(&)9592)#)694(,)292:(=7$.18,()65 @1_25_143_F3 T23202003031200220301303302012203132 + :4;/#&<9;&*;95-7;85&;587#16>%&,9<2& @1_25_1866_F3 T03201321022131101112012330221130311 + =<>9;<@7?(=6,<&?=6=(=<641:?'<1=;':4 @1_27_584_F3 T10010330110103213112323303012103101 + 82'('*.-8+%#2)(-&3.,.2,),+.':&,'(&/ @1_27_1227_F3 T02003022123001003201002031303302011 + 492:;>A:<;34<<=);:<<;9=7<3::<::3=>' @1_27_1350_F3 T13130101101021211013220222221301231 + 95,)<(4./;<938=64=+2/,.4),3':97#33& @1_29_477_F3 T13130101101021211013300302223003030 + 94=55:75=+:/7><968;;#&+$#3&6,#1#4#' @1_30_882_F3 T20102033000233133320103031311233200 + 2(+-:-3<;5##/;:(%&84'#:,?3&&8>-();5 @1_31_221_F3 T03301311201100030300100233220102031 + 89>9>5<139/,&:7969972.274&%:78&&746 @1_31_1313_F3 T01331131300330122321000101010330201 + ;3<7=7::)5*4=&;<7>4;795065;9';896'= @1_529_129_F3 T132222301020322102101322221322302.3302.3.3..221..3 + >>%/((B6-&5A0:6)>;'1)B*38/?(5=%B+ &<-9 % @ )%) ( cutadapt-1.15/tests/data/lowqual.fastq0000664000175000017500000000011513205526454020601 0ustar marcelmarcel00000000000000@first_sequence SEQUENCE1 + ######### @second_sequence SEQUENCE2 + ######### cutadapt-1.15/tests/data/nextseq.fastq0000664000175000017500000000132013205526454020603 0ustar marcelmarcel00000000000000@NS500350:251:HLM7JBGXX:1:11101:12075:1120 1:N:0:TACAGC GATCGGAAGAGCACACGTCTGAACTCCAGTCACTACAGCATCTCGTATTCCGTCTTCTGCTTGAAAAAAAAAAAGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG + AAAAAEEEEEEAEEEEAEAEEEEEEAEEEEEEEEEEEEEEE///E/EE////AAEE/E//////EEEEEEE6///////E6EEA/AEAEAE6EEEEEEEEEEEEAEAA/E/EEEEA//EEEEEAEAEE/EEEAEEEEread1 NGGCCTGGAATTCTCGGGTGCCAAGGAACTCCAGTCACCAG cutadapt-1.15/tests/data/toolong.fa0000664000175000017500000000026213205526454020051 0ustar marcelmarcel00000000000000>read_length6 T023302 >read_length7 T1023302 >read_length8 T11023302 >read_length9 T111023302 >read_length10 T2111023302 >read_length11 T02111023302 >read_length12 T002111023302 cutadapt-1.15/tests/data/adapter.fasta0000664000175000017500000000010013205526454020507 0ustar marcelmarcel00000000000000>adapter1 GCCGAACTTCTTAGACTGCCTTAAGGACGT >adapter2 CAGGTATATCGA cutadapt-1.15/tests/data/solid5p.fastq0000664000175000017500000000301513205526454020476 0ustar marcelmarcel00000000000000@read1 T1212322332333012001112122203233202221000211 + :58)2";%4A,8>0;9C\'?276>#)49"<,>?/\'!A4$.%+ @read2 T201212322332333200121311212133113001311002032 + 44<@;(<3.37/''=:-9AA<&C2%$$;?A&5!C69:?-;&;65. @read3 T02201212322332333211133003002232323010012320300 + 2!#97*B.0A-@(*","B3><4&16(: @read4 T0302201212322332333002010102312033021011121312131 + 74-:$-;&@>@0581-82'<&-81+%)7;<)6?83!&CB9"9B6307=& @read5 T20302201212322332333221313210102120020302022233110 + ';4!-6?0$45.C#B+$(4+$9)27,(-*=,#4:;"/4++5<,@-784*' @read6 T20302211212322332333031203203013323021010020301321 + +3"85:2=3<")$66*#4".4!.;:C%97@>75-";';*)A67CCC")$* @read7 T21301020302201212322332333203020130202120211322010013211 + ,;0B@A"98!<=!*;5;650;';79!+8,4(2=+98:B@C@:+3*>2+6+2++C0. @read8 T2310321030130120302201212322332333232202123123111113113003200330 + C/$-"=6+1.8?AB!?'#.585@6:47@?>.315A-'9<%">6,+)*,)1-;:(691>?C)4A; @read9 T0002132103320302201212322332333020123133023120320131020333011 + (&?527&:=;6@6@03%95(-0#$:B8::B*4?@&)6>79C>)6C'5-#0:A8+2* @read10 T00322031320033220302201212322332333201130233321321011303133231200 + &53)>2.+9?7%=&21;8!820961%3#0'5C.28347,2(55*1.,>%:(1A'A5=@7&&5?4' @read11 T0302201212322332333.02010102312033021011121312131 + 6=@!85+6((> @read12 T030220121232233233321 + 4&1.?+<-0(!(;://+0@?C @read13 T03022012123223323332 + !&,>"772,,/2/2A1C%5C @read14 T0302201212322332333 + @%$#B$A0B0&((1_13_85_F3 T110020300.0113010210002110102330021 >1_13_573_F3 T312311200.3021301101113203302010003 >1_13_1259_F3 T002112130.2012223322111330201230313 >1_13_1440_F3 T110020313.1113211010332111302330001 >1_14_177_F3 T31330222020233321121323302013303311 >1_14_238_F3 T01331031200310022122230330201030313 >1_15_1098_F3 T32333033222233020223032312232220332 >1_16_404_F3 T03310320002130202331112133020103031 >1_16_904_F3 T21230102331022312232132021122111212 >1_16_1315_F3 T03231231112210333010310323302010003 >1_16_1595_F3 T22323211312111230022210011213302012 >1_17_1379_F3 T32011212111223230232132311321200123 >1_18_1692_F3 T12322233031100211233323300112200210 >1_19_171_F3 T10101101220213201111011320201230032 >1_22_72_F3 T13303032323221212301322233320210233 >1_22_1377_F3 T22221333311222312201132312022322300 >1_23_585_F3 T30010310310130312122123302013303131 >1_23_809_F3 T13130101101021211013220302223302112 >1_24_138_F3 T33211130100120323002033020123031311 >1_24_206_F3 T33330332002223002020303331321221000 >1_25_143_F3 T23202003031200220301303302012203132 >1_25_1866_F3 T03201321022131101112012330221130311 >1_27_584_F3 T10010330110103213112323303012103101 >1_27_1227_F3 T02003022123001003201002031303302011 >1_27_1350_F3 T13130101101021211013220222221301231 >1_29_477_F3 T13130101101021211013300302223003030 >1_30_882_F3 T20102033000233133320103031311233200 >1_31_221_F3 T03301311201100030300100233220102031 >1_31_1313_F3 T01331131300330122321000101010330201 >1_529_129_F3 T132222301020322102101322221322302.3302.3.3..221..3 cutadapt-1.15/tests/data/anchored-back.fasta0000664000175000017500000000015613205526454021563 0ustar marcelmarcel00000000000000>read1 sequenceBACKADAPTER >read2 sequenceBACKADAPTERblabla >read3 sequenceBACKADA >read4 sequenceBECKADAPTER cutadapt-1.15/tests/data/overlapa.fa0000664000175000017500000000115513205526454020203 0ustar marcelmarcel00000000000000>read1 T0021110233021330201030313112312 >read2 T002111023302133020103031311231 >read3 T00211102330213302010303131123 >read4 T0021110233021330201030313112 >read5 T002111023302133020103031311 >read6 T00211102330213302010303131 >read7 T0021110233021330201030313 >read8 T002111023302133020103031 >read9 T00211102330213302010303 >read10 T0021110233021330201030 >read11 T002111023302133020103 >read12 T00211102330213302010 >read13 T0021110233021330201 >read14 T002111023302133020 >read15 T00211102330213302 >read16 T0021110233021330 >read17 T002111023302133 >read18 T00211102330213 >read19 T0021110233021 >read20 T002111023302 cutadapt-1.15/tests/data/restfront.txt0000664000175000017500000000012113205526454020641 0ustar marcelmarcel00000000000000TESTING read1 TESTING read2 TESTING read3 TESTING read4 TESTING read5 REST read8 cutadapt-1.15/tests/data/example.fa0000664000175000017500000000036113205526454020023 0ustar marcelmarcel00000000000000>read1 MYSEQUENCEADAPTER >read2 MYSEQUENCEADAP >read3 MYSEQUENCEADAPTERSOMETHINGELSE >read4 MYSEQUENCEADABTER >read5 MYSEQUENCEADAPTR >read6 MYSEQUENCEADAPPTER >read7 ADAPTERMYSEQUENCE >read8 PTERMYSEQUENCE >read9 SOMETHINGADAPTERMYSEQUENCE cutadapt-1.15/tests/data/solid.fasta0000664000175000017500000000013613205526454020212 0ustar marcelmarcel00000000000000>problem1 T01120212022222011231210231030201330 >problem2 T20201030313112322220210033020133031 cutadapt-1.15/tests/data/anywhere_repeat.fastq0000664000175000017500000000120313205526454022276 0ustar marcelmarcel00000000000000@prefix:1_13_1400/1 CGTCCGAANTAGCTACCACCCTGATTAGACAAAT + )3%)&&&&!.1&(6:<'67..*,:75)'77&&&5 @prefix:1_13_1500/1 CAAGACAAGACCTGCCACATTGCCCTAGTATTAA + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=: @prefix:1_13_1550/1 CAAGACAAGACCTGCCACATTGCCCTAGTCAAGA + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=: @prefix:1_13_1600/1 CAAGATGTCCCCTGCCACATTGCCCTAGTCAAGA + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=: @prefix:1_13_1700/1 CAAGATGTCCCCTGCCACATTGCCCTAGTTTATT + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=: @prefix:1_13_1800/1 GTTCATGTCCCCTGCCACATTGCCCTAGTTTATT + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=: @prefix:1_13_1900/1 ATGGCTGTCCCCTGCCACATTGCCCTAGTCAAGA + <=A:A=57!7<';<6?5;;6:+:=)71>70<,=:cutadapt-1.15/tests/data/tooshort.fa0000664000175000017500000000015413205526454020251 0ustar marcelmarcel00000000000000>read_length0a T >read_length0b T >read_length1 T2 >read_length2 T02 >read_length3 T302 >read_length4 T3302 cutadapt-1.15/tests/data/wildcard_adapter.fa0000664000175000017500000000014413205526454021660 0ustar marcelmarcel00000000000000>1 ACGTAAAACGTTGCATGCA >2 ACGTGGGACGTTGCATGCA >3b TGGCTGGCCACGTCCCACGTAA >4b TGGCTGGCCACGTTTTACGTCC cutadapt-1.15/tests/data/multiblock.fastq.bz20000664000175000017500000000044513205526454021764 0ustar marcelmarcel00000000000000BZh91AY&SY=߀h P@ TP 5O)PT5\j~֮"E74<ܑN$"j@BZh91AY&SYݟ߀@# P@0U?CSi<"yh U?d@d =Ee9lN$hY@ptu̔צj.\%(0r{tf֎ 5{7-Mҩ,,)mS%^@yb" œ(*\8i!UTE ܑN$4wgcutadapt-1.15/tests/data/SRR2040271_1.fastq0000664000175000017500000000117013205526454020545 0ustar marcelmarcel00000000000000@SRR2040271.1 SN603_WBP007_8_1101_63.30_99.90 length=100 NTCATTCCATGACATTGTCTGTTGGTTGCTTTTTGAGTATATTTTCTCATGGCTTCATCTATCTTGCTCATAAGACTAAATGGGGAGACAGACTTCCTGG +SRR2040271.1 SN603_WBP007_8_1101_63.30_99.90 length=100 !1=DDFFFGHHHHIJJJJJIIJJJGGHJGJIJJGBGGHEGHJIIIIEHIJEH>@G;FHCG<EE>EED(,,(;((,;;@A>CC @SRR2040271.2 SN603_WBP007_8_1101_79.90_99.30 length=100 NTAAAGACCCTTCAACTCAGGGCTTCTGAACCCTGGCTACCCATTAGAATCACTTAGGGAGCTTTGAAAAATATCAACACCCCAGCCCTAACCCAGCCCA +SRR2040271.2 SN603_WBP007_8_1101_79.90_99.30 length=100 !4=BBDDDFHHHH@FHIIIIIIIIIGIIHGIIIIIIIIHIIIIIICEGGIIIIIIGHIIEGHIGIIIHHHFHEEEEEEECC=B=@BBBCCCBBBBA(88? cutadapt-1.15/tests/data/rest.txt0000664000175000017500000000010713205526454017574 0ustar marcelmarcel00000000000000REST1 read1 RESTING read2 RESTLESS read4 RESTORE read5 SOMETHING read8 cutadapt-1.15/tests/data/illumina64.fastq0000664000175000017500000000765513205526454021121 0ustar marcelmarcel00000000000000@14569 AAGTTTATTCCTGGACGAAGGAAGAAAAGGCCAGATGGGAAACAAGAACAAGCCCCTGTTGAAGACGCAGGGCCAACAGGGGCCAACGAAGCTGC + cceeeeceeeee`dedbdbdb_^b`abU_cacadabd`dLMZ[XTcT^a^adaaaddcd`aL^`^_`Y\]^`Y_BBBBBBBBBBBBBBBBBBBBB @19211 AGAGGGCGTGTGATTGCTGGATGTGGGCGGGGGGCCGGGGGAGCCCCATGGGCAGGAGACCTGAGAGCCAGGCGGTGAGGCACTATGAACGCGAG + ^\`BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB @9180 GAGGGGCAGCGACTAGTCACCGGACCTGTCAGGCAAGCATAAGCCGTGCGTCAGCACCACGCTGACGGTGCTCCCGCACTCGCGGGACGCGCCAC + b`bLbBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB @19132 TGTGATTATCCACTGGTATATCGGCGTGCCGTCCGCACGAGGAAAAAAGGCATTATTGTTGTGGATCTGTACCATCGTTTGTCCCGTTACCCTTC + Z[QZZLZ[]J[SHZNaZ[_IaBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB @15868 CTGCCAAGGCTGCCCCCAAACCTGGCCCTCCGCGCACCCCACCACGGATCCTGACGTCCTGTCCCCCGCGGCTATGACAGCCAAGTCCCGTCAGC + `c`cc\`\Lb]bL`[`a]L`BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB @1424 GGCCCCAGACTTGCTCCCCCAACAAGGACAATGTCCAAGGAGTGTCCCCTGGGAAGGGTGGGCCTCCCCAGGTGCGGGCGGTGGGCACTGCCCCC + eeeeeeeea`bbdaaadad`Oaaaaccada_aa_d`_X`_^`[`_[_W^BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB @7855 GTGGGGGCTACAATGTGGCTCCAAGTTTTTTCCCGGGAGGTAAGGCCGGGAGCCCCCGCCCTGAGGGGGCGGGAAAGAGGAAGCCCGACGCGGAC + ]^\]FW]Z`BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB @17943 ACATGGGACCAGAAAACACCACCAGGGGTTTGGGGCTGTCCTGAGGCTCGGGTAGCAAGCAGCGGGGCTCCGTGTCCAAGCACGCCGGTGTCACC + ccc`\^`aba\b^`\FR`OOPYG[[W```[Ra_RR_\]\\P\_H_BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB @11100 CGGATAACTGAAAATGCATTTTTAACGCCATGACCGTGTCTCAAGGACCCGCTGTGGAAGGGGCGCCGCAGCCAGAAGCTGGCCATGTCAGCGCG + b`b_b_a\bc^Tabadaddcddd``bdaa_^aJ\^_\]\\__O[___L^\_aaa^^^UJ^BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB @15663 AGGTGAAGTGGCAGGAGGACCGCCGGAAGAAGCTCTTCAGAACTCAGGGGGAGGGGGAAAGCAGAAACCAGAAGTCCAGTGAGCAGGGGGCTGAG + aaKaBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB @4698 CCAATTGGCACCCCTCTGCCTTCAGCCATTCCCTCTGGCTACTGCTCTCTGGTCGGGGCGCCTGGGCGACAGACTCTCTCCCCCCACCCCCCCGC + cccc\`ccc\caccZccccc]^`LY\bL_bBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB @20649 TCTGGACTGGATCTTTAGGATGGTGGAGATGATCTGGATGTAGGACAAAAGAACCAGGCAGAAGGGTGTCATCAGAAGAACACTGCTAGACACCA + eeeeeaddadacdddebeccdddadd\^abbT_]bccTac]]b]L^][]Ve[^ZaY_^_^`\\Y]^Y`BBBBBBBBBBBBBBBBBBBBBBBBBBB @17259 GCCTTGTGTTGTTCCTGGCATCACCGCAGGGAGCCCTGGGGGGCCAGGCGGGCGCTGACCCTGGGCACTGCCGCGCCTGGAGGGGCTGAGCACCG + BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB @6003 CTTCAACTCATCTTGTTATTAATACCATCAATATCCCATGAGGCTCATAAAACGAGTCTTTCTTCTTGGAAACATGACCAAGATTGGGCAAACGT + fffffffffffffffffdffecfcefeffdcfdeeebbbdbccccc\db\`^aa`^Y^^^cbcbaa`bbWY^^^__S_YYR]GWY]\]]XX\_`S @4118 TCAAATTGTACTGCAAAGAAGGTCCCAGCTGGTCTCTTCTGGGAGTGATCTAACTAACTTAAGCTGACCCTGTGACTGGCTGAGGATAATCCCTT + dc^ddeeeeeedeee`ceceddadadddcbde_dedc_ec_a^^b\b\\]VIPZY^T^^^\L_BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB @18416 GTGGGGAAGCCGAAGAAGCAGCGGAGATCGATTGTAAGAACGACGTCCATGACCAGGGTTGGTGGAGACTGCTTCTCTGCATGCGGGGGAAGGCG + dddacaabdbea\d^cce\da`dd_^__`a`a`b[_^__^\^^^_BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB @20115 TGAAAAAGGAAAACATGGTAGTTTTCTTGTATGAGAGAGCCAGAGCCACCTTGGAGATTTTGTTCTCTCTGTGCGCACCAGTGATGACACAGGGG + ed^eeafffaddfecdddabc^_badd`bd_ddadaa^bbcad\d\__^_\aaa_aY____aaN_\cdc\^aaYbBBBBBBBBBBBBBBBBBBBB @16139 TCATCCGAAGAGTTGGCAGGCCCTGTGAATTGTGAAAACAGTATACCCACCCCTTTCCCGGAGCAGGACGCTGAATGTCCAGAGGATGCCAGACC + cabacacY^c\daaddaadad^\ad_a\Y`[ZQ]Y^^OYQ^X^YT\\]U\^RRX^\YJ^BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB @14123 GATTTGGGGAAAGGAAACAATAGTTGAGTTTGGGCCACGGGAAATTCAAGATGCCTGGTATGTCAAGTCTGGCAGTTGAAGCAGCAGGGCTGGCG + cccccccac^bYbbT_aa_Yb^^Ta\\^]]aaTaaaaab\b\XL`VZZV]QYYY[aa^^^^_^^BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB @8766 ACCTGTAAGGTCCGCTCCTGGTGGACACCCACGAAGTCCAGGGCCTCAGGCAGGAAGTTGTAGCGCAGAGTTTTGAGCAGCTGCTCCATCAGGGA + fcfffffcffeffeeefdefddeecdccacddfdYd`d^\_^`\_abbc\b[ba^Y^Z_^^H^Z_^Y_Y_OKWPZR]]Z]`Z``Z^UHZ^BBBBB cutadapt-1.15/tests/data/dos.fastq0000664000175000017500000000043713205526454017711 0ustar marcelmarcel00000000000000@prefix:1_13_573/1 CGTCCGAANTAGCTACCACCCTGATTAGACAAAT + )3%)&&&&!.1&(6:<'67..*,:75)'77&&&5 @prefix:1_13_1259/1 AGCCGCTANGACGGGTTGGCCCTTAGACGTATCT + ;<:&:A;A!9<<<,7:<=3=;:<&70<,=: cutadapt-1.15/tests/data/no_indels.fasta0000664000175000017500000000056213205526454021055 0ustar marcelmarcel00000000000000# 3' adapter: TTAGACATAT # 5' adapter: GAGATTGCCA >3p_orig TGAACATAGCTTAGACATATAACCG >3p_mism TGAACATAGCTTACACATATAACCG >3p_del TGAACATAGCTTAACATATAACCG >3p_ins TGAACATAGCTTAGGACATATAACCG >3p_frontins TAGACATATAACCG >5p_orig TCCTCGAGATTGCCATACTGCTTCTCGAA >5p_mism TCCTCGAGATAGCCATACTGCTTCTCGAA >5p_del TCCTCGAGATGCCATACTGCTTCTCGAA >5p_ins TCCTCGAGATATGCCATACTGCTTCTCGAA cutadapt-1.15/tests/data/small.myownextension0000664000175000017500000000042313205526454022217 0ustar marcelmarcel00000000000000@prefix:1_13_573/1 CGTCCGAANTAGCTACCACCCTGATTAGACAAAT + )3%)&&&&!.1&(6:<'67..*,:75)'77&&&5 @prefix:1_13_1259/1 AGCCGCTANGACGGGTTGGCCCTTAGACGTATCT + ;<:&:A;A!9<<<,7:<=3=;:<&70<,=: cutadapt-1.15/tests/data/linked.fasta0000664000175000017500000000064413205526454020352 0ustar marcelmarcel00000000000000>r1 5' adapter and 3' adapter AAAAAAAAAACCCCCCCCCCTTTTTTTTTTGGGGGGG >r2 without any adapter GGGGGGGGGGGGGGGGGGG >r3 5' adapter, partial 3' adapter AAAAAAAAAACCCGGCCCCCTTTTT >r4 only 3' adapter GGGGGGGGGGCCCCCCCCCCTTTTTTTTTTGGGGGGG >r5 only 5' adapter AAAAAAAAAACCCCCCCCCCGGGGGGG >r6 partial 5' adapter AAAAAACCCCCCCCCCTTTTTTTTTTGGGGGGG >r7 5' adapter plus preceding bases AACCGGTTTTAAAAAAAAAACCCCCCCCCCTTTTTTTTTTGGGGGGG cutadapt-1.15/tests/data/sra.fastq0000664000175000017500000000102713205526454017705 0ustar marcelmarcel00000000000000@1_13_85_F3 T110020300.0113010210002110102330021 + !7&9<&77)& <7))%4'657-1+9;9,.<8);.;8 @1_13_573_F3 T312311200.3021301101113203302010003 + !6)3%)&&&& .1&(6:<'67..*,:75)'77&&&5 @1_13_1259_F3 T002112130.2012223322111330201230313 + !=;<:&:A;A 9<<<,7:<=3=;:<&70<,=: @1_14_177_F3 T31330222020233321121323302013303311 + !:8957;;54)'98924905;;)6:7;1:3<88(9: @1_14_238_F3 T01331031200310022122230330201030313 + !?><5=;<<<12>=<;1;;=5);.;14:0>2;:3;7 cutadapt-1.15/tests/data/small.fastq.bz20000664000175000017500000000033613205526454020726 0ustar marcelmarcel00000000000000BZh91AY&SY`kH߀@# P@0"ii?T&42F ɡT!E r5MAV`jd_v5}#[ (!|R[O.֑+ݶV-l)87drZÅyfEW -wU XD$V* $DQ!DB#{G)„Xcutadapt-1.15/tests/data/withplus.fastq0000664000175000017500000000015413205526454020777 0ustar marcelmarcel00000000000000@first_sequence SEQUENCE1 +this is different :6;;8<=:< @second_sequence SEQUENCE2 +also different 83read_length0a >read_length0b >read_length1 >read_length2 2 >read_length3 02 >read_length4 302 >read_length5 3302 cutadapt-1.15/tests/data/simple.fasta0000664000175000017500000000012013205526454020362 0ustar marcelmarcel00000000000000# a comment # another one >first_sequence SEQUENCE1 >second_sequence SEQUEN CE2 cutadapt-1.15/tests/data/empty.fastq0000664000175000017500000000000013205526454020244 0ustar marcelmarcel00000000000000cutadapt-1.15/tests/data/small.fastq.gz0000664000175000017500000000033213205526454020645 0ustar marcelmarcel00000000000000Osmall.fastq]1n0 @]Pn '#:ngjlE"~|nie)2o*">bfp2Dݔ/0Mo#Bz_pO|qEi撪6|ؤم0".D4RkAAR|SfW\ܖ;~Ȼm\3t@}eͥ,x:@F%cutadapt-1.15/tests/data/suffix-adapter.fasta0000664000175000017500000000003413205526454022017 0ustar marcelmarcel00000000000000>suffixadapter BACKADAPTER$ cutadapt-1.15/tests/data/interleaved.fastq0000664000175000017500000000111513205526454021420 0ustar marcelmarcel00000000000000@read1/1 some text TTATTTGTCTCCAGCTTAGACATATCGCCT + ##HHHHHHHHHHHHHHHHHHHHHHHHHHHH @read1/2 other text GCTGGAGACAAATAACAGTGGAGTAGTTTT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH @read2/1 CAACAGGCCACATTAGACATATCGGATGGT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH @read2/2 TGTGGCCTGTTGCAGTGGAGTAACTCCAGC + ###HHHHHHHHHHHHHHHHHHHHHHHHHHH @read3/1 CCAACTTGATATTAATAACATTAGACA + HHHHHHHHHHHHHHHHHHHHHHHHHHH @read3/2 TGTTATTAATATCAAGTTGGCAGTG + #HHHHHHHHHHHHHHHHHHHHHHHH @read4/1 GACAGGCCGTTTGAATGTTGACGGGATGTT + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH @read4/2 CATCCCGTCAACATTCAAACGGCCTGTCCA + HH############################ cutadapt-1.15/tests/data/lengths.fa0000664000175000017500000000107413205526454020036 0ustar marcelmarcel00000000000000>read_length0a T330201030313112312 >read_length0b T1330201030313112312 >read_length1 T21330201030313112312 >read_length2 T021330201030313112312 >read_length3 T3021330201030313112312 >read_length4 T33021330201030313112312 >read_length5 T233021330201030313112312 >read_length6 T0233021330201030313112312 >read_length7 T10233021330201030313112312 >read_length8 T110233021330201030313112312 >read_length9 T1110233021330201030313112312 >read_length10 T21110233021330201030313112312 >read_length11 T021110233021330201030313112312 >read_length12 T0021110233021330201030313112312 cutadapt-1.15/tests/data/prefix-adapter.fasta0000664000175000017500000000003313205526454022007 0ustar marcelmarcel00000000000000>prefixadapter ^FRONTADAPT cutadapt-1.15/tests/data/plus.fastq0000664000175000017500000000024613205526454020105 0ustar marcelmarcel00000000000000@first_sequence some other text SEQUENCE1 +first_sequence some other text :6;;8<=:< @second_sequence and more text SEQUENCE2 +second_sequence and more text 83read1 T1212322332333012001112122203233202221000211 >read2 T201212322332333200121311212133113001311002032 >read3 T02201212322332333211133003002232323010012320300 >read4 T0302201212322332333002010102312033021011121312131 >read5 T20302201212322332333221313210102120020302022233110 >read6 T20302211212322332333031203203013323021010020301321 >read7 T21301020302201212322332333203020130202120211322010013211 >read8 T2310321030130120302201212322332333232202123123111113113003200330 >read9 T0002132103320302201212322332333020123133023120320131020333011 >read10 T00322031320033220302201212322332333201130233321321011303133231200 >read11 T0302201212322332333.02010102312033021011121312131 >read12 T030220121232233233321 >read13 T03022012123223323332 >read14 T0302201212322332333 >read15 T030220121232233233 >read16 T030220121232233233 cutadapt-1.15/tests/data/simple.fastq0000664000175000017500000000011513205526454020406 0ustar marcelmarcel00000000000000@first_sequence SEQUENCE1 + :6;;8<=:< @second_sequence SEQUENCE2 + 83adaptlen18 TTAGACATATCTCCGTCGATACTTACCCGTA >adaptlen17 TAGACATATCTCCGTCGATACTTACCCGTA >adaptlen16 AGACATATCTCCGTCGATACTTACCCGTA >adaptlen15 GACATATCTCCGTCGATACTTACCCGTA >adaptlen14 ACATATCTCCGTCGATACTTACCCGTA >adaptlen13 CATATCTCCGTCGATACTTACCCGTA >adaptlen12 ATATCTCCGTCGATACTTACCCGTA >adaptlen11 TATCTCCGTCGATACTTACCCGTA >adaptlen10 ATCTCCGTCGATACTTACCCGTA >adaptlen9 TCTCCGTCGATACTTACCCGTA >adaptlen8 CTCCGTCGATACTTACCCGTA >adaptlen7 TCCGTCGATACTTACCCGTA >adaptlen6 CCGTCGATACTTACCCGTA >adaptlen5 CGTCGATACTTACCCGTA >adaptlen4 GTCGATACTTACCCGTA >adaptlen3 TCGATACTTACCCGTA >adaptlen2 CGATACTTACCCGTA >adaptlen1 GATACTTACCCGTA >adaptlen0 ATACTTACCCGTA cutadapt-1.15/tests/data/illumina5.fastq0000664000175000017500000000232013205526454021014 0ustar marcelmarcel00000000000000@SEQ:1:1101:9010:3891#0/1 adapter start: 51 ATAACCGGAGTAGTTGAAATGGTAATAAGACGACCAATCTGACCAGCAAGGGCCTAACTTCTTAGACTGCCTTAAGGACGTAAGCCAAGATGGGAAAGGTC + FFFFFEDBE@79@@>@CBCBFDBDFDDDDD<@C>ADD@B;5:978@CBDDFFDB4B?DB21;84?DDBC9DEBAB;=@<@@B@@@@B>CCBBDE98>>0@7 @SEQ:1:1101:9240:3898#0/1 CCAGCAAGGAAGCCAAGATGGGAAAGGTCATGCGGCATACGCTCGGCGCCAGTTTGAATATTAGACATAATTTATCCTCAAGTAAGGGGCCGAAGCCCCTG + GHGHGHHHHGGGDHHGDCGFEEFHHGDFGEHHGFHHHHHGHEAFDHHGFHHEEFHGHFHHFHGEHFBHHFHHHH@GGGDGDFEEFC@=D?GBGFGF:FB6D @SEQ:1:1101:9207:3899#0/1 adapter start: 64 TTAACTTCTCAGTAACAGATACAAACTCATCACGAACGTCAGAAGCAGCCTTATGGCCGTCAACGCCTAACTTCTTAGACTGCCTTAAGGACGTATACATA + HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHFHHHHHHCFHHFHHFHFFFFFBHHGHHHFFHHFHGGHHDEBFGE3MFGYR02JWQ7T length=260 xy=3946_2103 region=2 run=R_2008_01_09_16_16_00_ 23 24 26 38 31 11 27 28 25 28 22 25 27 28 36 27 32 22 33 23 27 16 40 33 18 28 28 24 25 20 26 26 37 31 10 21 27 16 36 28 32 22 27 26 28 37 30 9 28 27 26 36 29 8 33 23 37 30 9 37 30 9 34 26 32 22 28 28 28 22 33 23 28 31 21 28 26 33 23 28 27 28 28 28 21 25 37 33 16 34 28 25 28 37 33 17 28 28 27 34 27 25 30 25 26 24 34 27 34 27 23 28 36 32 14 24 28 27 27 23 26 25 27 25 36 32 18 1 27 29 21 26 24 27 31 22 27 26 26 34 26 28 27 33 26 34 26 33 26 28 26 27 27 27 27 28 19 25 25 31 23 28 28 28 27 33 26 26 26 27 18 21 35 31 12 21 28 34 28 32 26 27 27 23 25 27 28 26 34 28 34 28 27 34 28 28 26 28 26 19 32 27 28 25 27 27 26 33 25 34 28 24 28 21 30 21 37 33 16 23 12 27 18 27 18 25 34 28 24 30 22 22 23 28 27 25 26 34 28 33 26 19 6 34 28 25 25 32 27 34 28 37 33 17 25 34 28 36 32 18 2 17 24 14 17 >E3MFGYR02JA6IL length=265 xy=3700_3115 region=2 run=R_2008_01_09_16_16_00_ 24 24 26 28 45 32 22 17 12 9 5 1 36 28 40 34 15 36 27 42 35 21 6 28 34 24 27 28 28 21 28 28 28 28 25 27 28 28 28 27 36 28 27 28 28 24 28 28 28 28 28 24 28 28 36 27 28 36 28 43 36 22 10 28 19 5 36 28 28 25 28 37 28 28 12 28 33 26 28 24 11 35 26 41 34 15 27 40 33 18 28 28 24 24 44 26 17 13 10 7 6 4 2 1 22 9 27 36 33 17 27 26 26 27 28 30 22 33 26 36 33 19 4 25 18 27 24 22 24 26 31 23 27 24 28 25 25 31 23 27 27 28 26 32 28 7 27 23 24 25 26 33 25 32 24 24 34 26 25 23 27 33 29 8 25 25 26 25 26 25 27 29 20 28 26 32 24 33 25 25 29 20 24 26 28 23 25 26 26 27 25 27 27 27 18 27 28 31 23 27 31 23 27 23 27 33 27 34 27 27 26 28 26 27 28 27 37 33 15 24 33 26 27 27 18 26 25 27 27 27 25 28 26 27 25 34 28 27 24 27 25 34 28 31 23 22 34 28 26 27 27 28 27 34 28 25 25 23 36 32 14 37 33 17 37 33 17 23 25 25 15 >E3MFGYR02JHD4H length=292 xy=3771_2095 region=2 run=R_2008_01_09_16_16_00_ 19 23 27 28 41 34 16 27 27 27 27 16 28 22 33 23 23 28 27 27 36 28 28 28 28 22 26 26 28 26 34 24 36 27 26 37 28 28 27 28 36 28 43 36 22 9 24 21 26 28 36 27 27 28 28 28 27 37 28 36 27 28 24 28 27 27 28 24 28 28 40 33 14 26 21 28 27 28 27 28 23 27 27 28 27 27 26 33 25 27 26 25 34 27 28 28 27 28 28 38 34 22 10 34 28 27 27 34 27 34 28 27 27 33 27 27 28 35 30 11 28 37 33 17 27 28 26 27 27 23 25 36 32 14 27 27 24 32 28 7 28 36 32 19 3 30 21 22 37 33 15 21 34 27 28 22 26 36 33 17 34 28 37 33 17 26 21 26 24 34 27 35 31 12 20 27 27 28 25 34 28 27 25 27 27 25 27 28 27 28 23 28 27 28 20 28 38 34 22 9 23 24 28 28 36 32 13 27 19 7 20 26 37 33 17 21 9 37 33 17 23 32 25 22 29 21 27 24 34 30 10 28 26 25 28 33 26 23 21 27 28 27 26 23 32 20 11 7 5 3 2 1 1 1 1 1 1 1 20 25 33 21 13 8 6 4 3 2 2 1 1 1 1 23 34 25 16 11 9 7 5 4 3 1 1 21 37 33 17 21 27 25 28 28 34 27 32 27 21 9 17 25 20 27 18 17 32 24 17 16 >E3MFGYR02GFKUC length=295 xy=2520_2738 region=2 run=R_2008_01_09_16_16_00_ 24 23 24 27 28 36 28 37 28 39 32 13 34 25 22 28 27 28 26 28 28 37 28 28 36 28 26 36 28 36 28 27 28 27 28 26 36 28 36 28 35 26 28 41 34 17 28 28 28 27 36 28 37 28 28 27 28 41 34 16 25 28 28 26 27 36 28 28 27 28 41 34 17 28 25 28 28 27 28 27 26 27 34 27 37 33 17 25 33 27 26 27 27 28 25 28 28 27 27 25 27 26 28 38 32 23 17 12 8 2 37 33 17 28 26 38 34 23 12 1 28 34 23 15 10 8 6 4 3 2 1 1 1 31 23 28 26 26 28 26 34 27 24 34 27 28 34 27 37 33 16 27 24 25 28 34 27 34 27 28 28 34 26 26 34 28 27 27 28 27 28 27 28 28 34 28 38 34 23 11 34 28 34 27 34 26 34 28 28 27 26 38 35 22 9 27 30 22 33 26 28 34 28 34 28 28 27 28 37 33 15 25 27 23 32 27 6 32 25 28 22 26 26 32 24 27 33 26 26 17 34 30 11 28 26 27 22 33 26 34 30 10 26 30 22 34 28 33 25 26 27 34 28 31 26 24 28 28 28 28 26 28 28 27 28 32 24 26 34 26 27 28 26 34 30 10 32 28 7 27 33 25 35 31 12 34 27 25 30 22 23 28 27 23 38 34 23 11 26 >E3MFGYR02FTGED length=277 xy=2268_2739 region=2 run=R_2008_01_09_16_16_00_ 21 24 28 24 28 35 27 28 35 28 28 44 35 24 16 9 2 41 34 17 40 34 15 34 26 43 36 22 9 28 25 26 26 41 34 20 5 26 37 28 27 27 28 28 28 28 28 28 37 28 36 28 37 28 28 28 27 26 26 38 31 11 28 24 28 28 36 27 36 29 8 26 27 28 36 29 8 27 28 27 28 28 24 34 27 5 32 22 40 33 14 28 37 28 41 34 16 28 32 24 23 34 28 34 27 38 34 22 9 27 34 28 34 27 27 26 26 36 32 13 28 27 26 28 28 25 34 26 27 28 28 27 28 23 27 28 34 26 27 25 27 26 28 23 32 24 34 28 33 26 28 26 27 27 18 25 36 32 13 27 27 32 24 27 32 25 35 31 12 27 28 26 27 21 27 27 27 26 28 28 27 26 28 33 25 22 28 28 37 33 17 26 37 33 17 20 36 32 14 28 34 27 26 27 28 34 28 38 34 22 8 37 33 15 27 28 34 27 33 26 27 26 27 28 28 33 25 34 28 34 28 34 26 24 24 28 25 34 28 28 27 25 23 38 33 24 17 11 5 34 28 25 31 26 22 27 27 27 26 22 34 26 34 27 26 24 34 30 11 19 37 33 15 34 28 27 25 28 25 27 27 >E3MFGYR02FR9G7 length=256 xy=2255_0361 region=2 run=R_2008_01_09_16_16_00_ 21 22 26 28 28 24 35 26 27 28 36 28 28 37 28 36 27 28 28 26 25 24 37 30 9 28 36 28 28 21 28 26 28 28 28 28 36 28 28 35 26 27 25 25 28 28 36 28 23 31 20 32 22 29 18 27 27 34 25 28 39 33 13 36 27 28 28 35 25 28 28 40 34 15 27 28 28 27 27 28 28 28 34 28 27 27 34 28 27 27 27 34 27 28 28 28 27 34 27 27 28 34 26 28 27 27 27 27 28 34 27 27 35 31 11 34 27 34 30 10 28 27 34 30 10 27 28 37 33 15 33 25 33 26 26 28 26 27 27 27 28 26 26 28 27 34 27 26 31 23 34 28 34 28 37 33 15 34 28 34 28 27 23 27 28 27 27 28 23 28 27 25 27 24 27 22 34 28 37 33 16 26 33 26 25 34 26 25 28 33 25 27 27 23 27 28 28 32 24 34 27 27 27 27 28 27 29 20 27 33 28 8 32 27 23 28 25 24 34 28 26 38 34 22 9 27 26 38 34 23 13 3 27 26 34 28 26 28 36 32 14 23 28 27 20 33 25 28 30 22 26 33 25 23 34 28 23 34 30 10 27 >E3MFGYR02GAZMS length=271 xy=2468_1618 region=2 run=R_2008_01_09_16_16_00_ 18 25 28 28 40 34 17 19 33 26 21 17 34 24 31 21 28 41 34 17 28 37 28 28 41 34 17 27 27 21 28 18 24 23 26 25 31 20 28 26 27 28 23 25 27 25 33 23 30 20 28 28 26 31 21 27 28 23 38 31 11 28 28 28 28 28 26 39 33 13 28 28 35 25 28 26 28 27 28 35 26 36 27 35 31 11 28 32 24 34 28 26 25 34 28 28 34 28 24 33 25 27 27 28 26 27 27 26 27 27 27 27 27 26 27 28 34 27 38 34 22 10 25 23 32 25 28 37 33 16 26 26 29 20 33 26 27 18 27 25 23 13 32 24 27 22 24 27 34 28 27 27 36 32 14 27 27 18 26 33 29 8 28 34 27 23 26 28 27 28 27 32 24 28 27 23 34 26 25 27 27 24 34 28 26 25 27 36 32 17 25 25 27 33 27 27 27 34 28 28 28 27 25 34 28 33 27 34 28 28 27 23 25 34 28 27 27 27 28 27 34 27 20 23 38 34 24 15 7 26 22 11 28 27 23 26 36 32 14 22 34 28 28 33 27 27 30 22 25 22 24 27 34 28 34 28 26 26 27 37 33 20 6 28 0 25 28 27 24 34 28 25 28 28 27 25 26 26 >E3MFGYR02HHZ8O length=150 xy=2958_1574 region=2 run=R_2008_01_09_16_16_00_ 22 22 25 23 25 28 41 34 17 28 37 28 28 35 28 6 24 30 19 28 25 32 22 27 25 37 28 28 27 15 38 31 11 36 28 27 24 28 28 27 20 28 23 26 25 22 19 28 35 26 34 25 26 41 34 17 26 28 36 29 7 36 29 8 35 26 28 28 28 24 33 23 28 24 27 27 23 25 34 24 26 24 28 27 22 28 26 28 24 27 28 34 27 34 27 26 27 28 26 27 28 28 34 28 31 23 25 30 22 27 29 21 26 27 34 27 28 26 37 33 17 17 26 18 28 34 30 11 19 6 27 24 27 35 30 11 27 22 28 32 19 11 6 4 3 2 1 1 1 1 1 1 1 1 27 36 28 19 14 11 8 6 4 2 19 19 27 27 28 27 33 26 33 26 25 27 25 28 26 22 28 25 27 27 28 25 34 28 28 24 38 34 21 7 28 25 17 33 26 26 31 26 34 27 27 27 27 26 26 28 38 34 23 12 27 28 25 33 27 0 0 >E3MFGYR02GPGB1 length=221 xy=2633_0607 region=2 run=R_2008_01_09_16_16_00_ 21 24 27 28 36 28 28 28 26 28 28 36 28 28 27 24 28 36 27 28 28 28 23 27 27 28 28 37 28 36 27 27 37 28 28 28 37 28 36 27 41 34 17 28 28 28 28 27 28 28 28 26 28 28 28 28 28 28 28 28 28 37 28 28 27 28 39 32 13 41 34 16 28 37 28 28 34 28 34 28 34 28 34 27 27 26 34 28 27 27 34 28 34 28 34 28 27 37 33 15 34 27 28 34 28 28 28 37 33 16 28 34 26 27 37 33 16 27 34 27 26 27 27 27 28 34 28 26 23 34 27 25 34 27 28 26 34 28 27 25 28 34 27 27 33 26 34 28 27 28 34 27 27 27 27 34 28 34 27 25 26 34 27 26 24 27 28 34 27 32 24 27 31 23 28 34 27 27 25 28 27 25 27 27 27 28 27 17 32 24 35 16 8 4 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 21 9 36 31 13 24 27 26 28 34 28 34 27 19 22 23 19 28 28 26 26 20 23 22 26 34 27 25 25 36 32 17 27 27 24 24 14 21 34 27 31 23 23 28 22 27 27 28 36 32 18 2 27 27 22 25 15 0 >E3MFGYR02F7Z7G length=130 xy=2434_1658 region=2 run=R_2008_01_09_16_16_00_ 22 21 23 28 26 15 12 21 28 21 36 28 27 27 43 35 23 12 1 36 28 27 27 41 34 20 5 28 43 36 22 9 27 35 26 28 26 27 26 28 22 33 26 37 28 26 36 27 28 35 27 31 20 26 28 13 38 32 12 26 23 24 27 28 27 22 25 28 19 27 28 20 36 27 25 20 26 41 34 17 28 28 17 36 28 35 27 20 28 28 43 36 22 8 33 26 25 27 27 31 26 38 34 22 10 25 34 28 26 34 27 32 27 5 37 33 17 20 23 13 27 37 33 19 4 27 28 20 37 33 17 24 26 23 27 21 26 33 26 26 27 28 34 27 21 38 34 21 7 28 25 24 37 33 17 28 34 28 32 24 27 33 27 27 20 28 27 27 22 28 19 25 22 28 32 26 27 23 37 33 20 5 24 24 34 28 28 11 26 30 25 33 26 28 25 22 26 27 27 38 34 23 11 28 26 28 34 26 0 0 0 0 0 0 0 0 0 0 0 cutadapt-1.15/tests/data/wildcard.fa0000664000175000017500000000005013205526454020154 0ustar marcelmarcel00000000000000>1 ANGTACGTTGCATGCA >2 ACGTANGTTGCATGCA cutadapt-1.15/tests/data/polya.fasta0000664000175000017500000000026113205526454020223 0ustar marcelmarcel00000000000000>polyA AAACTTCAGAACAGAAAAAAAAAAAAAAAAAAAAA >polyAlong CTTAGTTCAATWTTAACCAAACTTCAGAACAGAAAAAAAAAAAAAAAAAAAAAGAAAAAAAAAAAAAAAAAAAA >polyA2 AAACTTAACAAGAACAAGAAAAAAAAAAAAAAAAAAAAA cutadapt-1.15/tests/data/illumina.fastq.gz0000664000175000017500000001577113205526454021364 0ustar marcelmarcel00000000000000S\ےHn}WlĆ;;=x{ҏ6~w(T=*4Bvpe.vfo?nc'kMZ;e:zO8ts4ى__~KO_71hƘx] .ކ`ti^ !G7]MκkgZcw.Ħ6^,fkߏi  '>kh9x=&+bZ ZHŐ#Gz)s1QʑѦ O<cr|@ß@]N9];ۊl4|>n,Yt'I&:fy^"QXNFV$!1zO`%n &Y:$&^GwrhzeOlV 폤</]+m׋^ oL.昳/3O k?H^ DELpC p z*3~~>ʼ/tGNc}M جu3yخix@XŶh$,spؾl| cG"$g5l ,@j,;x`aѼj_Hg>%nClp9˶kG4yB0_q AG2٧LkvS,w<})<b n8,W͖|hDN$_:pQaG,ItakMB&'9% eH63B<[s$/wpga::x``Sjm=(My9"3Y,鑋<ԈN{c~ H7S.aѳC="VmKɏ&YhX$e'E B7XTo0,o;wfO8K4 yCY/yѫZ|ǙY0[ElxKʲdyՆ=D[YˋRqRA1 |u^5k}C[^z3Bq>$9B{JWl!2r1(OІ|m*P$h/{ 1a#?F07Grq]"-*lHIlWa5Y^T *@ \Sz>) T7J,>J~QN?o0DPh.궂\2ij069Ө_XivB,`$H(+wBÇrj~]!h0.Wy@ԉxL\ERIkIEeAY4Կ(D.U5VIނOmXdhPEe R@)(Tșg mz 0`zh~ _gk5!ǗSX>_56td`.y"~&PܨYѻ_E B̕ϹSCȑ9![b.Yea?BCŊr_ZSC? ]Y7,U/`߫Ĉ2,E/Ax:#LbɬoBR\I >(f 3p$ } ހ"C$t{s5*X1[ev kQd0$`5&L醎 <3/_rPrs Xk/rey@boɇY%)[#8RR>UZYxwV~cd"6QDHSx]ʹ=]m7E#V.lvh% {ellT_<.O0"9Q$,#j ć\.e6ϒ KP DZ:T4_ogMY  N+1*)&.jc,qʿ7"!h!It慱RAdQ>'a{Irh!ͩm[㜫uoۦ\L{  ŇPa=;z_]߼%6}k V}Tk&d)vR/s)u\C3 a-VAR;o7jݼA?ۈfoXJwN ˁvMDTJ"pܑR.s\ (MuT !\`ϥhӷ葔ll#)R8t͒Oo"VCg hQTu@Crnz2tkB>("8ǹ(D0iu8 b .iw %U74!3̨ R"CWgQK^ 2>P~5v S8G;p9E=]uf\W<N#{e1s^^@&sW@z> -͔ؐ1\hD1-; h,$?mVټqcFg?̥ 6GI"q,qA2yOڬ}Hٴ"d(!r4O06(d},(EKgm`hBnnr}d~@HHZ"Є9\\Հ.Y:2^ M源J7~G:%;Yxl[$'SAf/?/i!:0jb6bYeY$wrBԐy2ϋ>ZBVB"7g^OӨrR+AG_ѴPdD$ul6O1y`V1OX䘊*Zbr~xB9†, ic0Oh:ه[x<7LloW;R|i1Фp:\׹0pl1 ;Mx4ژkkl`/\_㗶_!ڮAsSO[Y/bBGu UK J."tR}&1I܍0Zvu<+ު'눰!+6#1ۼ@O8LڌnZ H&q[ ւ vr+!S,:4sR-jVP%w@IeG 2a[$Fc~=5_=bt[,cjϒ5Kdц4edft萄%3gqM蚾ղڎҥZcM…uf Wqej\Jڼ^jl7ݑT>o9 72#SV4V2Um•]W)C!joze.8NR+Os4u{TLihȞl22azo$@Y!Bb[檅0+ä%/J{X:PJhY) }MTV*S.JGQ151CGSxɡc(Ozxo&#eRF&3z翘+~kv~m*Y3Wmr7K"qƶ~0V=ҫHTTat͈eZ-,[LB^eE]UxOm’ymZ; xœvۄU ]g#GCAjG8{c-μE]b*;|,$$+[ Ν3|s_w@S,6W\Ie@9Mɾm8%פwRC*YW*ĒRMEHEcV۞؋\lwuv:rVUoX[{XR"˩v`Ҥ}ۜxj1I5[C T . P#_Ͼ5g Ås3ӈ:RFiF3ƒIhEFmP[%x?-x*%#e>@%6$㱭գ\ ` .T}Ds=tn.mݺoz^sCy7a ggݳAty" 7?Ӓ-Vm q5(@beݣW9;s;ozuOs*L8_ܰd|q>+=f*u } -zu8Yé!mk [hzJ:e 8!JR oiVXȜ62b:]Qn47l- c .c.0Y^|ߕl79wja"qTvtAU7[owu;:Wq[q r+>;gN{5j''6|,}y ZSL%X4v:mo?|?-LnOtq1eAͻ6nWO,{xk¼|=B2\\`՞_߻KYѲ ik9fKQ&[я4/:4dћSRz qgm`U|Ӣ..n餙 [nK;6تl Jiz߽iGxNLS3a8&<~]:5@5jzEn;]&e{K&0:yr@x-qޝ 2Mqw>2a~Vˎ{.7vMM_w|udjۛ`Ms=1Z_]vCߞMk.];p8}m**Zہ3-gnQ򆍽:/3\s휊Sa,Tr, JkAťgٸt'zI֥[Y䦡q,UtYm%Sj]ΑU=8.zZ^aO&ٝ4G {ĕŖ!c㏏hQ!BH֘j\d=cGw\Zrw-:`ʉxN){5O@.l*$\*V!̔K ar k] va?J'$&;[%tObpՄz^cutadapt-1.15/tests/data/anchored_no_indels.fasta0000664000175000017500000000034013205526454022712 0ustar marcelmarcel00000000000000>no_mismatch (adapter: TTAGACATAT) TTAGACATATGAGGTCAG >one_mismatch TAAGACATATGAGGTCAG >two_mismatches TAAGACGTATGAGGTCAG >insertion ATTAGACATATGAGGTCAG >deletion TAGACATATGAGGTCAG >mismatch_plus_wildcard TNAGACGTATGAGGTCAG cutadapt-1.15/tests/data/solid.qual0000664000175000017500000000726213205526454020065 0ustar marcelmarcel00000000000000# Tue May 5 13:57:32 2009 /share/apps/corona/bin/filter_fasta.pl --output=/data/results/s0103/s0103_20090430_552to561_2_2/552to561/results.01/primary.20090505091459275 --name=s0103_20090430_552to561_2_2_552to561 --tag=F3 --minlength=35 --mincalls=25 --prefix=T /data/results/s0103/s0103_20090430_552to561_2_2/552to561/jobs/postPrimerSetPrimary.197/rawseq # Cwd: /state/partition1/home/pipeline # Title: s0103_20090430_552to561_2_2_552to561 >1_13_85_F3 22 5 24 27 5 22 22 8 5 -1 27 22 8 8 4 19 6 21 20 22 12 16 10 24 26 24 11 13 27 23 8 26 13 26 23 >1_13_573_F3 21 8 18 4 8 5 5 5 5 -1 13 16 5 7 21 25 27 6 21 22 13 13 9 11 25 22 20 8 6 22 22 5 5 5 20 >1_13_1259_F3 28 26 27 25 5 25 32 26 32 -1 24 27 27 27 11 22 25 27 28 18 28 26 25 27 5 27 30 27 30 23 27 26 28 27 5 >1_13_1440_F3 28 27 28 32 25 32 28 20 22 -1 22 27 6 26 27 21 30 20 26 26 21 25 10 25 28 8 22 16 29 22 15 27 11 28 25 >1_14_177_F3 25 23 24 20 22 26 26 20 19 8 6 24 23 24 17 19 24 15 20 26 26 8 21 25 22 26 16 25 18 27 23 23 7 24 25 >1_14_238_F3 30 29 27 20 28 26 27 27 27 16 17 29 28 27 26 16 26 26 28 20 8 26 13 26 16 19 25 15 29 17 26 25 18 26 22 >1_15_1098_F3 2 11 2 2 7 2 20 2 2 9 2 7 3 3 6 2 13 2 2 8 3 5 2 4 8 3 16 2 2 12 3 5 2 2 4 >1_16_404_F3 22 23 26 25 26 26 29 27 29 24 28 24 26 27 27 17 28 29 27 27 16 26 20 23 26 24 27 27 26 29 7 27 26 27 26 >1_16_904_F3 24 29 28 25 25 21 26 26 24 24 28 10 14 6 3 10 2 13 2 5 4 3 5 6 7 7 3 16 9 3 7 3 13 2 13 >1_16_1315_F3 27 24 27 23 32 30 29 30 25 25 26 21 5 11 4 26 21 14 8 23 27 27 2 14 26 22 24 7 19 19 23 5 9 13 8 >1_16_1595_F3 29 11 27 28 27 29 31 21 27 26 30 27 28 29 25 14 28 13 29 5 26 26 23 26 8 16 22 25 28 5 11 29 16 28 10 >1_17_1379_F3 14 12 16 16 22 24 27 16 26 29 29 23 25 6 25 22 12 4 14 25 25 15 5 10 28 27 17 24 11 22 27 23 7 11 17 >1_18_1692_F3 13 2 7 2 2 2 20 4 8 4 17 8 6 11 17 5 25 10 2 10 5 20 11 7 3 14 16 2 5 19 5 8 8 3 21 >1_19_171_F3 8 21 25 21 20 14 28 18 9 25 7 23 4 8 4 17 29 5 23 5 4 26 4 15 5 2 26 3 18 3 5 25 3 2 5 >1_22_72_F3 18 14 2 21 22 23 27 25 13 28 24 25 25 21 25 7 27 20 18 23 17 24 20 26 24 10 26 5 9 26 8 10 6 11 5 >1_22_1377_F3 8 2 2 15 4 13 3 13 16 9 4 11 8 24 20 10 4 4 16 19 4 3 2 23 12 2 2 2 24 12 7 8 2 24 10 >1_23_585_F3 29 20 20 26 23 29 27 24 21 14 16 23 30 8 27 18 27 20 23 27 20 25 26 24 21 28 22 25 16 28 23 28 25 12 27 >1_23_809_F3 25 22 27 20 24 31 26 27 27 20 26 14 24 26 28 27 26 22 25 25 13 8 5 5 5 23 17 22 7 10 17 17 16 4 7 >1_24_138_F3 21 8 21 23 14 26 24 15 21 2 11 17 20 14 5 26 27 3 15 10 17 20 15 2 17 11 27 8 20 11 24 14 10 22 8 >1_24_206_F3 8 8 19 7 5 8 24 20 24 17 8 2 8 21 24 19 7 11 8 17 24 17 25 7 28 22 3 13 16 23 11 7 8 21 20 >1_25_143_F3 25 19 26 14 2 5 27 24 26 5 9 26 24 20 12 22 26 23 20 5 26 20 23 22 2 16 21 29 4 5 11 24 27 17 5 >1_25_1866_F3 28 27 29 24 26 27 31 22 30 7 28 21 11 27 5 30 28 21 28 7 28 27 21 19 16 25 30 6 27 16 28 26 6 25 19 >1_27_584_F3 23 17 6 7 6 9 13 12 23 10 4 2 17 8 7 12 5 18 13 11 13 17 11 8 11 10 13 6 25 5 11 6 7 5 14 >1_27_1227_F3 19 24 17 25 26 29 32 25 27 26 18 19 27 27 28 8 26 25 27 27 26 24 28 22 27 18 25 25 27 25 25 18 28 29 6 >1_27_1350_F3 24 20 11 8 27 7 19 13 14 26 27 24 18 23 28 21 19 28 10 17 14 11 13 19 8 11 18 6 25 24 22 2 18 18 5 >1_29_477_F3 24 19 28 20 20 25 22 20 28 10 25 14 22 29 27 24 21 23 26 26 2 5 10 3 2 18 5 21 11 2 16 2 19 2 6 >1_30_882_F3 17 7 10 12 25 12 18 27 26 20 2 2 14 26 25 7 4 5 23 19 6 2 25 11 30 18 5 5 23 29 12 7 8 26 20 >1_31_221_F3 23 24 29 24 29 20 27 16 18 24 14 11 5 25 22 24 21 24 24 22 17 13 17 22 19 5 4 25 22 23 5 5 22 19 21 >1_31_1313_F3 26 18 27 22 28 22 25 25 8 20 9 19 28 5 26 27 22 29 19 26 22 24 20 15 21 20 26 24 6 26 23 24 21 6 28 >1_529_129_F3 29 29 4 14 7 7 33 21 12 5 20 32 15 25 21 8 29 26 6 16 8 33 9 18 23 14 30 7 20 28 4 33 10 -1 5 27 12 24 -1 4 -1 31 -1 -1 8 4 8 -1 -1 7 cutadapt-1.15/tests/data/trimN3.fasta0000664000175000017500000000006113205526454020251 0ustar marcelmarcel00000000000000>read1 CAGTCGGTCCTGAGAGATGGGCGAGCGCTGGNANNNNNNNG cutadapt-1.15/tests/data/454.fa0000664000175000017500000002277713205526454016723 0ustar marcelmarcel00000000000000>000163_1255_2627 length=52 uaccno=E0R4ISW01DCIQD CCATCTCATCCCTGCGTGTCCCATCTGTTCCCTTCCTTGTCTCAGTGTGGTG >000652_1085_0667 length=122 uaccno=E0R4ISW01CXJXP ATTGAAGAGGTTGGTAAGTTTTAAGTTGGTAGGTGGTTGGGGAGTGGTTGGAGAGGAGTTGTTGGGAGTTTGTGTCCTGCTGAGACACGCAACGGGGATAGGCAAGGCACACAGGGGATAGG >000653_1285_1649 length=135 uaccno=E0R4ISW01DE4SJ AATTAGTCGAGCGTTGTGGTGGGTATTTGTAATTTTAGCTACTCTGAAGGCTGAGGCAGGAGAACTGCTTGAACCCGGGAGGCGGAGGTTGCTGAGACACGCAACAGGAGATAGGCAAGGCACACAGGGGATAGG >000902_0715_2005 length=92 uaccno=E0R4ISW01B03K3 GGGTGTTGAATTTAATATGTAGTATATTGATTTGTGATGATTATTTTGCCTGAGACACGCAACAGGGGTAGGCAAGGCACACAGGGGATAGG >001146_1255_0340 length=92 uaccno=E0R4ISW01DCGYU GGGTGTTGAATTTAATATGTAGTATATTGATTTGTGATGATTATTTTGCCTGAGACACGCAACAGGGGTAGGCAAGGCACACAGGGGATAGG >001210_1147_1026 length=171 uaccno=E0R4ISW01C2Z5W TAGGGAGGTGGTGAGTGTTGTGTGTTTAGATTGTGTGTGGTGGTTGGGAGTGGGAGTTGTATTTTAGGGTGTGGGTTGGGAGAGTGAAAGTTGTGGGTGTTTTGGATGGTGGGTTAGGTGGTTGTGCCTGAGACACGCAACAGGGGAAAGGCAAGGCACACAGGGGATAGG >001278_1608_2022 length=109 uaccno=E0R4ISW01D7HW4 CACACACACTCTTCCCCATACCTACTCACACACACACACACACACACAAACATACACAAATAATTCTGAGACACGCAACAGGAGATAGGCAAGGCACACAGGGGATAGG >001333_1518_1176 length=142 uaccno=E0R4ISW01DZKTM AATTGTCGTTTGATTGTTGGAAAGTAGAGGGTCGGGTTGGGGTAGATTCGAAAGGGGAATTTTGAGAAAAGAAATGGAGGGAGGTAGGAAAATTTTTTGCTGAGACACGCAACAGGGGTAGGCAAGGCACACAGGGGATAGG >001398_1584_1549 length=154 uaccno=E0R4ISW01D5DPB TAATGAAATGGAATGGAATGGAATGGAATGAAATGGAATGGAATGGAATGGAATGGAATGGAATGGAATGGAATGGAATGAAATGGAATGGAGTATAAAGGAATGGAATTACTGAGACACGCAACAGGGGAAGGCAAGGCACACAGGGGATAGG >001455_1136_2179 length=92 uaccno=E0R4ISW01C12AD GGGTGTTGAATTTAATATGTAGTATATTGATTTGTGATGATTATTTTGCCTGAGACACGCAACAGGGGTAGGCAAGGCACACAGGGGATAGG >001481_1165_0549 length=92 uaccno=E0R4ISW01C4KON GGGTGTTGAATTTAATATGTAGTATATTGATTTGTGATGATTATTTTGCCTGAGACACGCAACAGGGGTAGGCAAGGCACACAGGGGATAGG >001744_1376_3512 length=144 uaccno=E0R4ISW01DM5T2 TAAGTAGGGAAGGTTTGAGGTTGTTGGTGTTGGTAGTAGGGGTGTTTTAGTTAGGGGTTGTAGTTTGTTAAGGGAATTTTATTTGAGTTTAGAATTGAGGCTGAGACACGCAAAAGGGGATAGGCAAGGCACACAGGGGATAGG >001893_1084_1137 length=162 uaccno=E0R4ISW01CXG4Z TGTATATTTTGTTGGGTTTGTATATATTGTTAGGTGTGGTTGGTGAGTTGTATTGGTGGTGGTGTAAGGTGAGTGGAAATGGGAATGGATTGTAGATATGTTGGATTTGTGGTTTTTGGTTGAGACACGAACAGGGGATAGGCAAGGCACACAGGGGATAGG >001927_0254_0706 length=182 uaccno=E0R4ISW01AWLLG TGGAATCATCTAAGGGACACAAATAGAATCATCATTGAATGGAATCGAATGGAATCATCTAATGTACTCGAATGGAATTATTATTGAATAGAATAGAATGGAATTATCGAATGGAATCAAATGGAATGTAATGGAATGCTGAGACACGCAACAGGGGAAAGGCAAGGCACACAGGGGATAGG >002007_1338_1037 length=139 uaccno=E0R4ISW01DJRTR GGGTTGTGTATTTGGATAGTATGTGGAAAATGGTATTAAAAAGAATTTGTAGTTGGATTGTTGGTGGTTATTTAGTTTTTGGGTAATGGGTAGATTCCTGAGACACGCAAAGGGATAGGCAAGGCACACAGGGGATAGG >002186_1130_0654 length=92 uaccno=E0R4ISW01C1H5C GGGTGTTGAATTTAATATGTAGTATATTGATTTGTGATGATTATTTTGCCTGAGACACGCAACAGGGGTAGGCAAGGCACACAGGGGATAGG >002282_1237_2702 length=134 uaccno=E0R4ISW01DAXWG AATTAGCCGGGCGTGATGGCGGGCGTTTGTAGTTTTAGTTATTCGGGAGGTTGAGGTAGGAGAATGGCGTGAATTCGGGAAGCGGAGTTTGCTGAGACACGCAACAGGGGTAGGCAAGGCACACAGGGGATAGG >002382_1259_0997 length=107 uaccno=E0R4ISW01DCT37 TAAGGGTTGAAGCGAGGTAGGTAGTTTGTTTGTGGTTTTGTTTCGTATTTTTGTTTCGTATCCCTGAGACACGCAACAGAGGATAGGCAAGGCACACAGGGGATAGG >002477_0657_0655 length=174 uaccno=E0R4ISW01BVY8H TTTTTGGAAAGTTGGGTGGGTATAGTTTTGAGTAGTTAGAGGTATTATAATAGTATTAGGAAGTTGAATGTGAGGGTATAAGAGTTAATTTGATTTTTCGTTGATATGTTTGTTGTTTGAAGTTAGAGTGCTGAGACACGCAACAGGAGATAGGCAAGGCACACAGGGGATAGG >003149_1553_2333 length=170 uaccno=E0R4ISW01D2OBZ TATTTAGTTTTAGTTTGTTTAGGTGGTTATAGAATACGGAGTTTATGAAGTTGATTAGGAATATTATTAGTTGAATTAAGAATTGGGAAGAGAGGGGAACGGGAAGGGACGTGAGTGATTATTATTGCTGAGACACGCAAAGGGGATAGGCAAGGCACACAGGGGATAGG >003194_1475_2845 length=101 uaccno=E0R4ISW01DVT7J TATTTTGGGTTAAGTCGGGTTTAGTTGTTAGGGCGAGAAGTTAGTTGTTGACCCCTGCTGAGACACGCAAAAGGGGATAGGCAAGGCACACAGGGGATAGG >003206_1315_0479 length=95 uaccno=E0R4ISW01DHQPD GGGTTGGATAATATGATGGTGTTGGGGAATATTTAGGTATGTGGTTTGTGGCTGAGACACGCAACAGAGGATAGGCAAGGCACACAGGGGATAGG >003271_0173_0314 length=125 uaccno=E0R4ISW01APHAK GTTTATTTGTTATTTATTTTTAGGTTTAGAAGAGTGTTTGGTATTTATTGAGGATTTAGTATTTGTTAGAAGGATTGGATTCTGAGACACGCAACAGGGGGTAGGCAAGGCACACAGGGGATAGG >003443_1737_2250 length=67 uaccno=E0R4ISW01EITSS TGTAGGTTGTGTTGTAGGTTGTCCTGAGACACGCAACAGGGGAAAGGCAAGGCACACAGGGGATAGG >002633_1776_1582 length=81 uaccno=E0R4ISW01EL8JK CAGGGTGGATTGGGGAACACACAGTGTGGCCGCGTGATTCTGAGACACGCAACAGGGAAGGCAAGGCACACAGGGGATAGG >002663_0725_3154 length=126 uaccno=E0R4ISW01B1Z2S GCGTTTTATATTATAATTTAATATTTTGGAGGTTGGGTGCGGTGGTTTACGTTTGTAGTTTAGTATTTGGGAGGTTAAGGTAGCTGAGACACGCAACGGGGATAGGCAAGGCACACAGGGGATAGG >002761_1056_4055 length=121 uaccno=E0R4ISW01CU2V9 AATTTTATTCGATTTATGTGATGATTTATTTATTTTATTTGAAGATGATTTTATTCGAGATTATTCGATGATTCCATTCCTGAGACACGCAAGGGGATAGGCAAGGCACACAGGGGATAGG >002843_0289_2275 length=122 uaccno=E0R4ISW01AZPE9 ATTGAAGAGGTTGGTAAGTTTTAAGTTGGTAGGTGGTTGGGGAGTGGTTGGAGAGGAGTTGTTGGGAGTTTGTGTCCTGCTGAGACACGCAACGGGGATAGGCAAGGCACACAGGGGATAGG >002934_1762_2177 length=92 uaccno=E0R4ISW01EK0Q7 GGGTGTTGAATTTAATATGTAGTATATTGATTTGTGATGATTATTTTGCCTGAGACACGCAACAGGGGTAGGCAAGGCACACAGGGGATAGG >003515_1711_1058 length=122 uaccno=E0R4ISW01EGIPG AATTGAATGGAATTATTATTGAATGGATTCGAATGGAATTATTATTGAATGGAATCATCGAGTGGAATCGAATGGAATCTGAGACACGCAACAGGGGAAAGGCAAGGCACACAGGGGATAGG >003541_1276_1589 length=112 uaccno=E0R4ISW01DECAV TAGTTTAGGGTGGTAGTTTGGATAAGGTAGTTTTACGGTTTAGTAGTAGTAGGTTAAGTAGGAAAACTGCTGAGACACGCAAAGGGGATAGGCAAGGCACACAGGGGATAGG >003587_1522_1804 length=152 uaccno=E0R4ISW01DZXX6 AATTTATGTAGTGGAAGTAGGATATAAAGAATAGGTTAATGGATTTTGAGATATTAAAAAGAGTAGGAAATTAGTTGAGAGGTTAAGTAGTAGTTTATTTTAGCCACCCTGAGACACGCAACAGGAGATAGGCAAGGCACACAGGGGATAGG >003592_0076_0430 length=134 uaccno=E0R4ISW01AGYTC AATTAGTTAGGCGTGGTGGCGGGTGTTTGTAGTTTTAGTTATTCGGGAGGTTGAGGTAGGAGAATGTTGTGAATTTAGGAGGTGGAGTTTGCTGAGACACGCAACAGGGGAAGGCAAGGCACACAGGGGATAGG >003957_0595_0965 length=173 uaccno=E0R4ISW01BQJIV TAATATTAGGTGTCAATTTGACTGGATCGAGGGATGTGTGTCGGTGAGAGTCTCACTAGAGGTTGATATTTGAGTCGTTAGACTGGGAGAGGAAGACCGAACTGTCAAGTGTATGGGCGCCATCCAATTCTGAGACACGCAACAGGGGAAAGGCAAGGCACACAGGGGATAGG >003986_1127_2937 length=103 uaccno=E0R4ISW01C1AFF TAATGGAATGGAATTTTCGGAATGGAATGGAATGGAATGGAATGGAATGGAATGGAATTACTGAGACACGCAACAGGGGAAGGCAAGGCACACAGGGGATAGG >004012_1559_1491 length=111 uaccno=E0R4ISW01D26M9 TAGTGGATATAAATGGAATGGATTGGAATGGAATGGATACGAATGGAATGGATTGGAGTGGAATGGATTGACTGAGACACGCAACAGGGGGCAAGGCACACAGGGGATAGG >004030_1508_2061 length=166 uaccno=E0R4ISW01DYPWF TACGTATATACGCGTACGCGTATACGTATATACGCGTATACGTATACGCGTACGTATATATACGCGTATACGTTTACGTACGTACGCGTATATACGTACGTATACACACACGCATATGCATACTGAGACACGCAACAGGGGAAAGGCAAGGCACACAGGGGATAGG >004038_1061_2047 length=152 uaccno=E0R4ISW01CVG5D AATTGATTCGAATGGAATGGATTGGAATGGAACGGATTTGAATGGAATGGATTGGAATGGAATGGATTGAATGGAATGGATTGGAGAGGATTGGATTTGAATGGAATTCTGAGACACGCAACAGGGGAAAGGCAAGGCACACAGGGGATAGG >004105_1121_0391 length=135 uaccno=E0R4ISW01C0PH1 AATTAGTTGGGCGTGGTGGCGAGTGTTTGTAATTTTAGTTATTTAGGAGGTTGAGGTAGGAGAATTATTTGAACCCGGTAGACGGAAGTTGCTGAGACACGCAACAGGGGAAAGGCAAGGCACACAGGGGATAGG >004129_1618_3423 length=122 uaccno=E0R4ISW01D8ELT AATTGAATGGTATTGAAAGGTATTAATTTAGTGGAATGGAATGGAATGTATTGGAATGGAAAATAATGGAATGGAGTGCTGAGACACGCAACAGGGGAAAGGCAAGGCACACAGGGGATAGG >004203_0451_0902 length=115 uaccno=E0R4ISW01BDWC4 TAGTTGGTGTGTTGTAATCGAGACGTAGTTGGTTGGTACGGGTTAGGGTTTTGATTGGGTTGTTGTGTTTGCTGAGACACGCAACATGGGATAGGCAAGGCACACAGGGGATAGG >004626_1937_0919 length=223 uaccno=E0R4ISW01E0CVD TAGAGTAGATAGTAGGGTTAGAGAAGGTAGGGTACGTTTAGTTTGTTAGTAAGGTTTAAGTTTTGGGTGGGAAAGGTTAGTGGCGGGAAGGGACGAAGGTGGTAATCGAGAGTAGATTTAGAGAAGTTTTTGAAGTGGGCGTTGGGAGTTTTCGAAGTATTGAGAGAGAGGAGCTTGTGCTGAGACATGCAACAGAGGATAGGCAAGGCACACAGGGGATAGG >004913_0641_2071 length=135 uaccno=E0R4ISW01BULRD AATTAGTCGAGCGTTGTGGTGGGTATTTGTAATTTTAGCTACTCTGAAGGCTGAGGCAGGAGAACTGCTTGAACCCGGGAGGCGGAGGTTGCTGAGACACGCAACAGGAGATAGGCAAGGCACACAGGGGATAGG >005063_0599_1983 length=127 uaccno=E0R4ISW01BQWX9 ATGTGGTGAAGATTGGTTTTAGGTGTTTTAATGTGGATTTTCAGGGGTTTTAAAAGGGTTGGGAGAGTGAAATATATATAAGGCTGAGACACGCAAAAGGGGATAGGCAAGGCACACAGGGGATAGG >005140_0759_3209 length=116 uaccno=E0R4ISW01B4ZKR TAGTATAGAGGGTTTGTGGTCGTGAGGGTGTTGATGGCGGGAGGGTTTTGATGGTAGGAGGGCCCGTGCTGTGCTGAGACACGCAACAGGGGAAGGCAAGGCACACAGGGGATAGG >005351_0883_3221 length=137 uaccno=E0R4ISW01CFVHJ TTAGGTGTTATAGTTGAGTGAGATGTTAGTGTTTAATGGTTTTATTTAGGTTGATGGGTTAATGAGGGGGTATTTGATAGTTTTGAAGATTTGACTGAGACACGCAACGGGGATAGGCAAGGCACACAGGGGATAGG >005380_1702_1187 length=207 uaccno=E0R4ISW01EFQC1 TAGGGTTTTTCGAGTATATATTTAGTAGTACGCTCGACTTCTCTTATATAAAGGTTTTGGTTTTTATAGGTTTTTCCATTGTGTCTGCCTGGGGGAGGGCCCTTCTCCTTCAGGATACTGTAGCTTCTCTGCGTGATAAGCCAGCATTCACGGCTTTCAGGTGCTGAGACATGCAACAGGGGAAAGGCAAGGCACACAGGGGATAGG >005568_1060_1943 length=63 uaccno=E0R4ISW01CVDWP ATAGCGTATTTCTCACCTGCTGAGACACGCAACAGGGGAAAGGCAAGGCACACAGGGGATAGG >005740_1536_2697 length=159 uaccno=E0R4ISW01D06VV TAAAGAGGTGTTATTATTAGTTAGGAGAGGAGGTGGTTAGATAGTAGTGGGATTATAGGGGAATATAGAGTTGTTAGTTTAGGGATAAGGGATTGATCGATGGGTTAGGTCTCTGCTGAGACACGCAAAAGGGGATAGGCAAGGCACACAGGGGATAGG >005753_1884_3877 length=95 uaccno=E0R4ISW01EVRNB AAACTGAGTTGTGATGTTTGCATTCAACTCACAGAGTTCAACATTCCTTTAACTGAGACACGCAACAGGGTTAGGCAAGGCACACAGGGTATAGG >read_equals_adapter 1a TGAGACACGCAACAGGGGAAAGGCAAGGCACACAGGGGATAGG >read_equals_start_of_adapter 1b TGAGACACGCAACAGGGGAAAG >read_equals_end_of_adapter 1c GAAAGGCAAGGCACACAGGGGATAGG >read_equals_middle_of_adapter 1d GCAACAGGGGAAAGGCAAGGCACACAGG >read_ends_with_adapter 2a GCTACTCTGAAGGCTGAGGCAGGAGAACTGCTTGAACCCGGGAGGCGTGAGACACGCAACAGGGGAAAGGCAAGGCACACAGGGGATAGG >read_ends_with_start_of_adapter 2b GCTACTCTGAAGGCTGAGGCAGGAGAACTGCTTGAACCCGGGAGGCGTGAGACACGCAACAGGGGAAAGGCAAGG >read_contains_adapter_in_the_middle 3 CGTAGTTGGTTGGTACGTGAGACACGCAACAGGGGAAAGGCAAGGCACACAGGGGATAGGGGTTAGGGTTTTGATTGGGTTGT >read_starts_with_adapter 4a TGAGACACGCAACAGGGGAAAGGCAAGGCACACAGGGGATAGGAAAGGTTTTGGTTTTTATAGGTTTTT >read_starts_with_end_of_adapter 4b AACAGGGGAAAGGCAAGGCACACAGGGGATAGGAAAGGTTTTGGTTTTTATAGGTTTTT cutadapt-1.15/tests/data/E3M.fasta0000664000175000017500000000663313205526454017474 0ustar marcelmarcel00000000000000>E3MFGYR02JWQ7T length=260 xy=3946_2103 region=2 run=R_2008_01_09_16_16_00_ tcagGGTCTACATGTTGGTTAACCCGTACTGATTTGAATTGGCTCTTTGTCTTTCCAAAG GGAATTCATCTTCTTATGGCACACATAAAGGATAAATACAAGAATCTTCCTATTTACATC ACTGAAAATGGCATGGCTGAATCAAGGAATGACTCAATACCAGTCAATGAAGCCCGCAAG GATAGTATAAGGATTAGATACCATGATGGCCATCTTAAATTCCTTCTTCAAGCGATCAAG GAAGGTGTTAATTTGAAGGGGCTTa >E3MFGYR02JA6IL length=265 xy=3700_3115 region=2 run=R_2008_01_09_16_16_00_ tcagTTTTTTTTGGAAAGGAAAACGGACGTACTCATAGATGGATCATACTGACGTTAGGA AAATAATTCATAAGACAATAAGGAAACAAAGTGTAAAAAAAAAACCTAAATGCTCAAGGA AAATACATAGCCATCTGAACAGATTTCTGCTGGAAGCCACATTTCTCGTAGAACGCCTTG TTCTCGACGCTGCAATCAAGAATCACCTTGTAGCATCCCATTGAACGCGCATGCTCCGTG AGGAACTTGATGATTCTCTTTCCCAAATGcc >E3MFGYR02JHD4H length=292 xy=3771_2095 region=2 run=R_2008_01_09_16_16_00_ tcagAAAGACAAGTGGTATCAACGCAGAGTGGCCATTACGCCGGGGACTAGGTCATGTTA AGAGTGTAGCTTTGTGATGCTCTGCATCCGTCTTATGATAAAATTGAGGTTATCCTGAAA TAAAGTGTCTCAAACGATTTATTTTCCATTTATTGTATTTAATTTGAGTCCAAACTAGAT TAGAGATCTCTGTAATAAAACATGTTTGTTAGTTTAATTTCAATAACATTTAGTATTGTG TCGTAAAAAAAAAAAAAACGAAAAAAAAAAAAACAAAAAAAAAAACAAATGTACGGccgg ctagagaacg >E3MFGYR02GFKUC length=295 xy=2520_2738 region=2 run=R_2008_01_09_16_16_00_ tcagCGGCCGGGCCTCTCATCGGTGGTGGAATCACTGGCCTTGTTTACGAGGTTGTCTTT ATCAGCCACACCCACGAGCAGCTTCCCACCACTGACTACTAGAGGGGGGGAAATGAAAAA TAAAAAAAAAAAATTGTGTATTATTGAATTTCTCTGGAATCTTCTTCTGTGTATGGTTTT CCTTCCTTGTGTTTTCTTCCTAATTCACTTTCGAGGGTTGTACTTGTTCCTTTCGTCTTA AATCCTTGGATGGTTGATGATCATGAAGTTCTCTTTAAAGTTAAATTATTATCATTTTG >E3MFGYR02FTGED length=277 xy=2268_2739 region=2 run=R_2008_01_09_16_16_00_ tcagTGGTAATGGGGGGAAATTTAATTTTCTGATTTTATTATATATAGTTAATTGATGCT TTCGACGGTTTATATTTATGCGATTTGGTTTAGGTTTCAATGGAATTTTGTTGGTAGTTT ATATGATTGTATATAGTTATCAGCAACCTTATATTGTTTGCTTGCCTTTCTAGAGCACTC AGTGGAGATTTGAAACTTTGTTAGTGGAAAATTTGCAATTGTATGTTAATTGGAGATGGA GACAAAAAAGGAGGCAGATATTAATATTTATTTGGATATCA >E3MFGYR02FR9G7 length=256 xy=2255_0361 region=2 run=R_2008_01_09_16_16_00_ tcagCTCCGTAAGAAGGTGCTGCCCGCCGTCATCGTCCGCCAGCGCAAGCCTTGGCGCCG AAAGGACGGTGTTTACATGTACTTCGAAGATAATGCTGGTGTTATCGTGAATCCCAAGGG TGAAATGAAAGGTTCTGCTATCACTGGTCCAATTGGGAAGGAGTGTGCTGATCTGTGGCC CAGGATTGCAAGTGCTGCCAATGCTATTGTTTAAGCTAGGATTTTAGTTTTTGTAATGTT TCAGCTTCTTGAAGTTGTTTc >E3MFGYR02GAZMS length=271 xy=2468_1618 region=2 run=R_2008_01_09_16_16_00_ tcagAAAGAAGTAAGGTAAATAACAAACGACAGAGTGGCACATACTCCGGCAGTTCATGG GCAGTGACCCAGTTCAGAGAACCAAAGAACCTGAATAAGAATCTATGTCTACTGTGAATT TTGTGGCTTTCGTTGGAACGAAGGTAGCTTCGAAACAATAAAGTTATCTACTTCGCAATA TGAAGTGTTTCTGTTAGTTCTATGGTTCCTACTCCTAGCACCTCTTTTTCTTATAGAAAT GGACCACCGTGATTGGTACAAAAGNTGTACCTAGAtga >E3MFGYR02HHZ8O length=150 xy=2958_1574 region=2 run=R_2008_01_09_16_16_00_ tcagACTTTCTTCTTTACCGTAACGTTGTTAAATTATCTGAGTATATGAAGGACCCTATT TGGGTTCTATAACTACAGAACATATCTCAGTCCAATAGTGACGGAATAACAATATTATAA ACTAGTTTAACGCTTTATGAAAAAAAAAAAAAAAgaaaaaaaaacatgtcggccgctgag acacgcaacaggggataggcaaggcacacaggggataggnn >E3MFGYR02GPGB1 length=221 xy=2633_0607 region=2 run=R_2008_01_09_16_16_00_ tcagAAGCAGTGGTATCAACGCAGAGTGGCCATTACGGCCGGGTCTGATGAGTATGTGTC GAAGATCCCAAATAACAAGGTTGGTCTTGTAATTGGTAAAGGTGGAGAAACAATAAAGAA TATGCAAGCTTCAACTGGAGCAAGAATTCAGGTGATTCCTCTTCATCTTCCACCTGGTGA CACATCTACCAAAAAAAAAAAAAAAAAAAAACCAAATGTCGGCCGctgagacacgcaaca gggataggcaaggcacacaggggataggn >E3MFGYR02F7Z7G length=130 xy=2434_1658 region=2 run=R_2008_01_09_16_16_00_ tcagAATCATCCACTTTTTAACGTTTTGTTTTGTTCATCTCTTAACAACAATTCTAGGGC GACAGAGAGAGTAAGTACCCACTAACCAGTCCCCAAGTACCAAAATAACAATTTAAACAA CAAAACACAAACAGatcttatcaacaaaactcaaagttcctaactgagacacgcaacagg ggataagacaaggcacacaggggataggnnnnnnnnnnn cutadapt-1.15/tests/data/multiblock.fastq.gz0000664000175000017500000000040613205526454021704 0ustar marcelmarcel00000000000000/Ns((JMˬ2747577rvqvvwt qtwqtv"w 1KKXUS  4̬ltM5́\8 [/NUͫ@aoQSBJB^ҞXW5 ALq,Pb0c@Q-jX bV<m0 jS"]fZfY}ߺpŅuÏےACXy`|LZ9e _fB:cutadapt-1.15/tests/data/maxn.fasta0000664000175000017500000000006213205526454020041 0ustar marcelmarcel00000000000000>r1 >r2 N >r3 AAAA >r4 AAAAN >r5 AAANN >r6 AANNN cutadapt-1.15/tests/data/s_1_sequence.txt.gz0000664000175000017500000000014113205526454021606 0ustar marcelmarcel00000000000000Mcompressed.fastqsH,*./N-,MKN v usv52r(NMKTfTfalcooaf>Mcutadapt-1.15/tests/data/wildcardN.fa0000664000175000017500000000007013205526454020274 0ustar marcelmarcel00000000000000>perfect TTTGGGGGGG >withN TTTGGNGGGG >1mism TTTGGGGCGG cutadapt-1.15/tests/data/issue46.fasta0000664000175000017500000000002013205526454020372 0ustar marcelmarcel00000000000000>readname CGTGA cutadapt-1.15/tests/data/twoadapters.fasta0000664000175000017500000000040713205526454021436 0ustar marcelmarcel00000000000000>read1 GATCCTCCTGGAGCTGGCTGATACCAGTATACCAGTGCTGATTGTTGAATTTCAGGAATTTCTCAAGCTCGGTAGC >read2 CTCGAGAATTCTGGATCCTCTCTTCTGCTACCTTTGGGATTTGCTTGCTCTTGGTTCTCTAGTTCTTGTAGTGGTG >read3 (no adapter) AATGAAGGTTGTAACCATAACAGGAAGTCATGCGCATTTAGTCGAGCACGTAAGTTCATACGGAAATGGGTAAG cutadapt-1.15/tests/data/small.fastq0000664000175000017500000000042313205526454020227 0ustar marcelmarcel00000000000000@prefix:1_13_573/1 CGTCCGAANTAGCTACCACCCTGATTAGACAAAT + )3%)&&&&!.1&(6:<'67..*,:75)'77&&&5 @prefix:1_13_1259/1 AGCCGCTANGACGGGTTGGCCCTTAGACGTATCT + ;<:&:A;A!9<<<,7:<=3=;:<&70<,=: cutadapt-1.15/tests/data/anchored.fasta0000664000175000017500000000015313205526454020662 0ustar marcelmarcel00000000000000>read1 FRONTADAPTsequence >read2 blablaFRONTADAPTsequence >read3 NTADAPTsequence >read4 FRINTADAPTsequence cutadapt-1.15/tests/test_trim.py0000664000175000017500000000400413205526454017531 0ustar marcelmarcel00000000000000# coding: utf-8 from __future__ import print_function, division, absolute_import from cutadapt.seqio import ColorspaceSequence, Sequence from cutadapt.adapters import Adapter, ColorspaceAdapter, PREFIX, BACK from cutadapt.modifiers import AdapterCutter def test_cs_5p(): read = ColorspaceSequence("name", "0123", "DEFG", "T") adapter = ColorspaceAdapter("CG", PREFIX, 0.1) cutter = AdapterCutter([adapter]) trimmed_read = cutter(read) # no assertion here, just make sure the above code runs without # an exception def test_statistics(): read = Sequence('name', 'AAAACCCCAAAA') adapters = [Adapter('CCCC', BACK, 0.1)] cutter = AdapterCutter(adapters, times=3) trimmed_read = cutter(read) # TODO make this a lot simpler trimmed_bp = 0 for adapter in adapters: for d in (cutter.adapter_statistics[adapter].front.lengths, cutter.adapter_statistics[adapter].back.lengths): trimmed_bp += sum(seqlen * count for (seqlen, count) in d.items()) assert trimmed_bp <= len(read), trimmed_bp def test_end_trim_with_mismatch(): """ Test the not-so-obvious case where an adapter of length 13 is trimmed from the end of a sequence with overlap 9 and there is one deletion. In this case the algorithm starts with 10 bases of the adapter to get the hit and so the match is considered good. An insertion or substitution at the same spot is not a match. """ adapter = Adapter('TCGATCGATCGAT', BACK, 0.1) read = Sequence('foo1', 'AAAAAAAAAAATCGTCGATC') cutter = AdapterCutter([adapter], times=1) trimmed_read = cutter(read) assert trimmed_read.sequence == 'AAAAAAAAAAA' assert cutter.adapter_statistics[adapter].back.lengths == {9: 1} # We see 1 error at length 9 even though the number of allowed mismatches at # length 9 is 0. assert cutter.adapter_statistics[adapter].back.errors[9][1] == 1 read = Sequence('foo2', 'AAAAAAAAAAATCGAACGA') cutter = AdapterCutter([adapter], times=1) trimmed_read = cutter(read) assert trimmed_read.sequence == read.sequence assert cutter.adapter_statistics[adapter].back.lengths == {} cutadapt-1.15/tests/test_align.py0000664000175000017500000000745513205526454017665 0ustar marcelmarcel00000000000000# coding: utf-8 from __future__ import print_function, division, absolute_import from cutadapt.align import (locate, compare_prefixes, compare_suffixes, Aligner) from cutadapt.adapters import BACK class TestAligner(): def test(self): reference = 'CTCCAGCTTAGACATATC' aligner = Aligner(reference, 0.1, flags=BACK) aligner.locate('CC') def test_100_percent_error_rate(self): reference = 'GCTTAGACATATC' aligner = Aligner(reference, 1.0, flags=BACK) aligner.locate('CAA') def test_polya(): s = 'AAAAAAAAAAAAAAAAA' t = 'ACAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' result = locate(s, t, 0.0, BACK) #start_s, stop_s, start_t, stop_t, matches, cost = result assert result == (0, len(s), 4, 4 + len(s), len(s), 0) # Sequences with IUPAC wildcards # R=A|G, Y=C|T, S=G|C, W=A|T, K=G|T, M=A|C, B=C|G|T, D=A|G|T, H=A|C|T, V=A|C|G, # N=A|C|G|T, X={} WILDCARD_SEQUENCES = [ 'CCCATTGATC', # original sequence without wildcards 'CCCRTTRATC', # R=A|G 'YCCATYGATC', # Y=C|T 'CSSATTSATC', # S=G|C 'CCCWWWGATC', # W=A|T 'CCCATKKATC', # K=G|T 'CCMATTGMTC', # M=A|C 'BCCATTBABC', # B=C|G|T 'BCCATTBABC', # B 'CCCDTTDADC', # D=A|G|T 'CHCATHGATC', # H=A|C|T 'CVCVTTVATC', # V=A|C|G 'CCNATNGATC', # N=A|C|G|T 'CCCNTTNATC', # N # 'CCCXTTXATC', # X ] def test_compare_prefixes(): assert compare_prefixes('AAXAA', 'AAAAATTTTTTTTT') == (0, 5, 0, 5, 4, 1) assert compare_prefixes('AANAA', 'AACAATTTTTTTTT', wildcard_ref=True) == (0, 5, 0, 5, 5, 0) assert compare_prefixes('AANAA', 'AACAATTTTTTTTT', wildcard_ref=True) == (0, 5, 0, 5, 5, 0) assert compare_prefixes('XAAAAA', 'AAAAATTTTTTTTT') == (0, 6, 0, 6, 4, 2) a = WILDCARD_SEQUENCES[0] for s in WILDCARD_SEQUENCES: r = s + 'GCCAGGGTTGATTCGGCTGATCTGGCCG' result = compare_prefixes(a, r, wildcard_query=True) assert result == (0, 10, 0, 10, 10, 0), result result = compare_prefixes(r, a, wildcard_ref=True) assert result == (0, 10, 0, 10, 10, 0) for s in WILDCARD_SEQUENCES: for t in WILDCARD_SEQUENCES: r = s + 'GCCAGGG' result = compare_prefixes(s, r, ) assert result == (0, 10, 0, 10, 10, 0) result = compare_prefixes(r, s, wildcard_ref=True, wildcard_query=True) assert result == (0, 10, 0, 10, 10, 0) r = WILDCARD_SEQUENCES[0] + 'GCCAGG' for wildc_ref in (False, True): for wildc_query in (False, True): result = compare_prefixes('CCCXTTXATC', r, wildcard_ref=wildc_ref, wildcard_query=wildc_query) assert result == (0, 10, 0, 10, 8, 2) def test_compare_suffixes(): assert compare_suffixes('AAXAA', 'TTTTTTTAAAAA') == (0, 5, 7, 12, 4, 1) assert compare_suffixes('AANAA', 'TTTTTTTAACAA', wildcard_ref=True) == (0, 5, 7, 12, 5, 0) assert compare_suffixes('AANAA', 'TTTTTTTAACAA', wildcard_ref=True) == (0, 5, 7, 12, 5, 0) assert compare_suffixes('AAAAAX', 'TTTTTTTAAAAA') == (0, 6, 6, 12, 4, 2) def test_wildcards_in_adapter(): r = 'CATCTGTCC' + WILDCARD_SEQUENCES[0] + 'GCCAGGGTTGATTCGGCTGATCTGGCCG' for a in WILDCARD_SEQUENCES: result = locate(a, r, 0.0, BACK, wildcard_ref=True) assert result == (0, 10, 9, 19, 10, 0), result a = 'CCCXTTXATC' result = locate(a, r, 0.0, BACK, wildcard_ref=True) assert result is None def test_wildcards_in_read(): a = WILDCARD_SEQUENCES[0] for s in WILDCARD_SEQUENCES: r = 'CATCTGTCC' + s + 'GCCAGGGTTGATTCGGCTGATCTGGCCG' result = locate(a, r, 0.0, BACK, wildcard_query=True) if 'X' in s: assert result is None else: assert result == (0, 10, 9, 19, 10, 0), result def test_wildcards_in_both(): for a in WILDCARD_SEQUENCES: for s in WILDCARD_SEQUENCES: if 'X' in s or 'X' in a: continue r = 'CATCTGTCC' + s + 'GCCAGGGTTGATTCGGCTGATCTGGCCG' result = locate(a, r, 0.0, BACK, wildcard_ref=True, wildcard_query=True) assert result == (0, 10, 9, 19, 10, 0), result def test_no_match(): a = locate('CTGATCTGGCCG', 'AAAAGGG', 0.1, BACK) assert a is None, a cutadapt-1.15/tests/test_qualtrim.py0000664000175000017500000000073713205526454020425 0ustar marcelmarcel00000000000000# coding: utf-8 from __future__ import print_function, division, absolute_import from cutadapt.seqio import Sequence from cutadapt.qualtrim import nextseq_trim_index def test_nextseq_trim(): s = Sequence('n', '', '') assert nextseq_trim_index(s, cutoff=22) == 0 s = Sequence('n', 'TCTCGTATGCCGTCTTATGCTTGAAAAAAAAAAGGGGGGGGGGGGGGGGGNNNNNNNNNNNGGNGG', 'AA//EAEE//A6///E//A//EA/EEEEEEAEA//EEEEEEEEEEEEEEE###########EE#EA' ) assert nextseq_trim_index(s, cutoff=22) == 33 cutadapt-1.15/versioneer.py0000664000175000017500000020032313205526454016540 0ustar marcelmarcel00000000000000 # Version: 0.16 """The Versioneer - like a rocketeer, but for versions. The Versioneer ============== * like a rocketeer, but for versions! * https://github.com/warner/python-versioneer * Brian Warner * License: Public Domain * Compatible With: python2.6, 2.7, 3.3, 3.4, 3.5, and pypy * [![Latest Version] (https://pypip.in/version/versioneer/badge.svg?style=flat) ](https://pypi.python.org/pypi/versioneer/) * [![Build Status] (https://travis-ci.org/warner/python-versioneer.png?branch=master) ](https://travis-ci.org/warner/python-versioneer) This is a tool for managing a recorded version number in distutils-based python projects. The goal is to remove the tedious and error-prone "update the embedded version string" step from your release process. Making a new release should be as easy as recording a new tag in your version-control system, and maybe making new tarballs. ## Quick Install * `pip install versioneer` to somewhere to your $PATH * add a `[versioneer]` section to your setup.cfg (see below) * run `versioneer install` in your source tree, commit the results ## Version Identifiers Source trees come from a variety of places: * a version-control system checkout (mostly used by developers) * a nightly tarball, produced by build automation * a snapshot tarball, produced by a web-based VCS browser, like github's "tarball from tag" feature * a release tarball, produced by "setup.py sdist", distributed through PyPI Within each source tree, the version identifier (either a string or a number, this tool is format-agnostic) can come from a variety of places: * ask the VCS tool itself, e.g. "git describe" (for checkouts), which knows about recent "tags" and an absolute revision-id * the name of the directory into which the tarball was unpacked * an expanded VCS keyword ($Id$, etc) * a `_version.py` created by some earlier build step For released software, the version identifier is closely related to a VCS tag. Some projects use tag names that include more than just the version string (e.g. "myproject-1.2" instead of just "1.2"), in which case the tool needs to strip the tag prefix to extract the version identifier. For unreleased software (between tags), the version identifier should provide enough information to help developers recreate the same tree, while also giving them an idea of roughly how old the tree is (after version 1.2, before version 1.3). Many VCS systems can report a description that captures this, for example `git describe --tags --dirty --always` reports things like "0.7-1-g574ab98-dirty" to indicate that the checkout is one revision past the 0.7 tag, has a unique revision id of "574ab98", and is "dirty" (it has uncommitted changes. The version identifier is used for multiple purposes: * to allow the module to self-identify its version: `myproject.__version__` * to choose a name and prefix for a 'setup.py sdist' tarball ## Theory of Operation Versioneer works by adding a special `_version.py` file into your source tree, where your `__init__.py` can import it. This `_version.py` knows how to dynamically ask the VCS tool for version information at import time. `_version.py` also contains `$Revision$` markers, and the installation process marks `_version.py` to have this marker rewritten with a tag name during the `git archive` command. As a result, generated tarballs will contain enough information to get the proper version. To allow `setup.py` to compute a version too, a `versioneer.py` is added to the top level of your source tree, next to `setup.py` and the `setup.cfg` that configures it. This overrides several distutils/setuptools commands to compute the version when invoked, and changes `setup.py build` and `setup.py sdist` to replace `_version.py` with a small static file that contains just the generated version data. ## Installation First, decide on values for the following configuration variables: * `VCS`: the version control system you use. Currently accepts "git". * `style`: the style of version string to be produced. See "Styles" below for details. Defaults to "pep440", which looks like `TAG[+DISTANCE.gSHORTHASH[.dirty]]`. * `versionfile_source`: A project-relative pathname into which the generated version strings should be written. This is usually a `_version.py` next to your project's main `__init__.py` file, so it can be imported at runtime. If your project uses `src/myproject/__init__.py`, this should be `src/myproject/_version.py`. This file should be checked in to your VCS as usual: the copy created below by `setup.py setup_versioneer` will include code that parses expanded VCS keywords in generated tarballs. The 'build' and 'sdist' commands will replace it with a copy that has just the calculated version string. This must be set even if your project does not have any modules (and will therefore never import `_version.py`), since "setup.py sdist" -based trees still need somewhere to record the pre-calculated version strings. Anywhere in the source tree should do. If there is a `__init__.py` next to your `_version.py`, the `setup.py setup_versioneer` command (described below) will append some `__version__`-setting assignments, if they aren't already present. * `versionfile_build`: Like `versionfile_source`, but relative to the build directory instead of the source directory. These will differ when your setup.py uses 'package_dir='. If you have `package_dir={'myproject': 'src/myproject'}`, then you will probably have `versionfile_build='myproject/_version.py'` and `versionfile_source='src/myproject/_version.py'`. If this is set to None, then `setup.py build` will not attempt to rewrite any `_version.py` in the built tree. If your project does not have any libraries (e.g. if it only builds a script), then you should use `versionfile_build = None`. To actually use the computed version string, your `setup.py` will need to override `distutils.command.build_scripts` with a subclass that explicitly inserts a copy of `versioneer.get_version()` into your script file. See `test/demoapp-script-only/setup.py` for an example. * `tag_prefix`: a string, like 'PROJECTNAME-', which appears at the start of all VCS tags. If your tags look like 'myproject-1.2.0', then you should use tag_prefix='myproject-'. If you use unprefixed tags like '1.2.0', this should be an empty string, using either `tag_prefix=` or `tag_prefix=''`. * `parentdir_prefix`: a optional string, frequently the same as tag_prefix, which appears at the start of all unpacked tarball filenames. If your tarball unpacks into 'myproject-1.2.0', this should be 'myproject-'. To disable this feature, just omit the field from your `setup.cfg`. This tool provides one script, named `versioneer`. That script has one mode, "install", which writes a copy of `versioneer.py` into the current directory and runs `versioneer.py setup` to finish the installation. To versioneer-enable your project: * 1: Modify your `setup.cfg`, adding a section named `[versioneer]` and populating it with the configuration values you decided earlier (note that the option names are not case-sensitive): ```` [versioneer] VCS = git style = pep440 versionfile_source = src/myproject/_version.py versionfile_build = myproject/_version.py tag_prefix = parentdir_prefix = myproject- ```` * 2: Run `versioneer install`. This will do the following: * copy `versioneer.py` into the top of your source tree * create `_version.py` in the right place (`versionfile_source`) * modify your `__init__.py` (if one exists next to `_version.py`) to define `__version__` (by calling a function from `_version.py`) * modify your `MANIFEST.in` to include both `versioneer.py` and the generated `_version.py` in sdist tarballs `versioneer install` will complain about any problems it finds with your `setup.py` or `setup.cfg`. Run it multiple times until you have fixed all the problems. * 3: add a `import versioneer` to your setup.py, and add the following arguments to the setup() call: version=versioneer.get_version(), cmdclass=versioneer.get_cmdclass(), * 4: commit these changes to your VCS. To make sure you won't forget, `versioneer install` will mark everything it touched for addition using `git add`. Don't forget to add `setup.py` and `setup.cfg` too. ## Post-Installation Usage Once established, all uses of your tree from a VCS checkout should get the current version string. All generated tarballs should include an embedded version string (so users who unpack them will not need a VCS tool installed). If you distribute your project through PyPI, then the release process should boil down to two steps: * 1: git tag 1.0 * 2: python setup.py register sdist upload If you distribute it through github (i.e. users use github to generate tarballs with `git archive`), the process is: * 1: git tag 1.0 * 2: git push; git push --tags Versioneer will report "0+untagged.NUMCOMMITS.gHASH" until your tree has at least one tag in its history. ## Version-String Flavors Code which uses Versioneer can learn about its version string at runtime by importing `_version` from your main `__init__.py` file and running the `get_versions()` function. From the "outside" (e.g. in `setup.py`), you can import the top-level `versioneer.py` and run `get_versions()`. Both functions return a dictionary with different flavors of version information: * `['version']`: A condensed version string, rendered using the selected style. This is the most commonly used value for the project's version string. The default "pep440" style yields strings like `0.11`, `0.11+2.g1076c97`, or `0.11+2.g1076c97.dirty`. See the "Styles" section below for alternative styles. * `['full-revisionid']`: detailed revision identifier. For Git, this is the full SHA1 commit id, e.g. "1076c978a8d3cfc70f408fe5974aa6c092c949ac". * `['dirty']`: a boolean, True if the tree has uncommitted changes. Note that this is only accurate if run in a VCS checkout, otherwise it is likely to be False or None * `['error']`: if the version string could not be computed, this will be set to a string describing the problem, otherwise it will be None. It may be useful to throw an exception in setup.py if this is set, to avoid e.g. creating tarballs with a version string of "unknown". Some variants are more useful than others. Including `full-revisionid` in a bug report should allow developers to reconstruct the exact code being tested (or indicate the presence of local changes that should be shared with the developers). `version` is suitable for display in an "about" box or a CLI `--version` output: it can be easily compared against release notes and lists of bugs fixed in various releases. The installer adds the following text to your `__init__.py` to place a basic version in `YOURPROJECT.__version__`: from ._version import get_versions __version__ = get_versions()['version'] del get_versions ## Styles The setup.cfg `style=` configuration controls how the VCS information is rendered into a version string. The default style, "pep440", produces a PEP440-compliant string, equal to the un-prefixed tag name for actual releases, and containing an additional "local version" section with more detail for in-between builds. For Git, this is TAG[+DISTANCE.gHEX[.dirty]] , using information from `git describe --tags --dirty --always`. For example "0.11+2.g1076c97.dirty" indicates that the tree is like the "1076c97" commit but has uncommitted changes (".dirty"), and that this commit is two revisions ("+2") beyond the "0.11" tag. For released software (exactly equal to a known tag), the identifier will only contain the stripped tag, e.g. "0.11". Other styles are available. See details.md in the Versioneer source tree for descriptions. ## Debugging Versioneer tries to avoid fatal errors: if something goes wrong, it will tend to return a version of "0+unknown". To investigate the problem, run `setup.py version`, which will run the version-lookup code in a verbose mode, and will display the full contents of `get_versions()` (including the `error` string, which may help identify what went wrong). ## Updating Versioneer To upgrade your project to a new release of Versioneer, do the following: * install the new Versioneer (`pip install -U versioneer` or equivalent) * edit `setup.cfg`, if necessary, to include any new configuration settings indicated by the release notes * re-run `versioneer install` in your source tree, to replace `SRC/_version.py` * commit any changed files ### Upgrading to 0.16 Nothing special. ### Upgrading to 0.15 Starting with this version, Versioneer is configured with a `[versioneer]` section in your `setup.cfg` file. Earlier versions required the `setup.py` to set attributes on the `versioneer` module immediately after import. The new version will refuse to run (raising an exception during import) until you have provided the necessary `setup.cfg` section. In addition, the Versioneer package provides an executable named `versioneer`, and the installation process is driven by running `versioneer install`. In 0.14 and earlier, the executable was named `versioneer-installer` and was run without an argument. ### Upgrading to 0.14 0.14 changes the format of the version string. 0.13 and earlier used hyphen-separated strings like "0.11-2-g1076c97-dirty". 0.14 and beyond use a plus-separated "local version" section strings, with dot-separated components, like "0.11+2.g1076c97". PEP440-strict tools did not like the old format, but should be ok with the new one. ### Upgrading from 0.11 to 0.12 Nothing special. ### Upgrading from 0.10 to 0.11 You must add a `versioneer.VCS = "git"` to your `setup.py` before re-running `setup.py setup_versioneer`. This will enable the use of additional version-control systems (SVN, etc) in the future. ## Future Directions This tool is designed to make it easily extended to other version-control systems: all VCS-specific components are in separate directories like src/git/ . The top-level `versioneer.py` script is assembled from these components by running make-versioneer.py . In the future, make-versioneer.py will take a VCS name as an argument, and will construct a version of `versioneer.py` that is specific to the given VCS. It might also take the configuration arguments that are currently provided manually during installation by editing setup.py . Alternatively, it might go the other direction and include code from all supported VCS systems, reducing the number of intermediate scripts. ## License To make Versioneer easier to embed, all its code is dedicated to the public domain. The `_version.py` that it creates is also in the public domain. Specifically, both are released under the Creative Commons "Public Domain Dedication" license (CC0-1.0), as described in https://creativecommons.org/publicdomain/zero/1.0/ . """ from __future__ import print_function try: import configparser except ImportError: import ConfigParser as configparser import errno import json import os import re import subprocess import sys class VersioneerConfig: """Container for Versioneer configuration parameters.""" def get_root(): """Get the project root directory. We require that all commands are run from the project root, i.e. the directory that contains setup.py, setup.cfg, and versioneer.py . """ root = os.path.realpath(os.path.abspath(os.getcwd())) setup_py = os.path.join(root, "setup.py") versioneer_py = os.path.join(root, "versioneer.py") if not (os.path.exists(setup_py) or os.path.exists(versioneer_py)): # allow 'python path/to/setup.py COMMAND' root = os.path.dirname(os.path.realpath(os.path.abspath(sys.argv[0]))) setup_py = os.path.join(root, "setup.py") versioneer_py = os.path.join(root, "versioneer.py") if not (os.path.exists(setup_py) or os.path.exists(versioneer_py)): err = ("Versioneer was unable to run the project root directory. " "Versioneer requires setup.py to be executed from " "its immediate directory (like 'python setup.py COMMAND'), " "or in a way that lets it use sys.argv[0] to find the root " "(like 'python path/to/setup.py COMMAND').") raise VersioneerBadRootError(err) try: # Certain runtime workflows (setup.py install/develop in a setuptools # tree) execute all dependencies in a single python process, so # "versioneer" may be imported multiple times, and python's shared # module-import table will cache the first one. So we can't use # os.path.dirname(__file__), as that will find whichever # versioneer.py was first imported, even in later projects. me = os.path.realpath(os.path.abspath(__file__)) if os.path.splitext(me)[0] != os.path.splitext(versioneer_py)[0]: print("Warning: build in %s is using versioneer.py from %s" % (os.path.dirname(me), versioneer_py)) except NameError: pass return root def get_config_from_root(root): """Read the project setup.cfg file to determine Versioneer config.""" # This might raise EnvironmentError (if setup.cfg is missing), or # configparser.NoSectionError (if it lacks a [versioneer] section), or # configparser.NoOptionError (if it lacks "VCS="). See the docstring at # the top of versioneer.py for instructions on writing your setup.cfg . setup_cfg = os.path.join(root, "setup.cfg") parser = configparser.SafeConfigParser() with open(setup_cfg, "r") as f: parser.readfp(f) VCS = parser.get("versioneer", "VCS") # mandatory def get(parser, name): if parser.has_option("versioneer", name): return parser.get("versioneer", name) return None cfg = VersioneerConfig() cfg.VCS = VCS cfg.style = get(parser, "style") or "" cfg.versionfile_source = get(parser, "versionfile_source") cfg.versionfile_build = get(parser, "versionfile_build") cfg.tag_prefix = get(parser, "tag_prefix") if cfg.tag_prefix in ("''", '""'): cfg.tag_prefix = "" cfg.parentdir_prefix = get(parser, "parentdir_prefix") cfg.verbose = get(parser, "verbose") return cfg class NotThisMethod(Exception): """Exception raised if a method is not valid for the current scenario.""" # these dictionaries contain VCS-specific tools LONG_VERSION_PY = {} HANDLERS = {} def register_vcs_handler(vcs, method): # decorator """Decorator to mark a method as the handler for a particular VCS.""" def decorate(f): """Store f in HANDLERS[vcs][method].""" if vcs not in HANDLERS: HANDLERS[vcs] = {} HANDLERS[vcs][method] = f return f return decorate def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False): """Call the given command(s).""" assert isinstance(commands, list) p = None for c in commands: try: dispcmd = str([c] + args) # remember shell=False, so use git.cmd on windows, not just git p = subprocess.Popen([c] + args, cwd=cwd, stdout=subprocess.PIPE, stderr=(subprocess.PIPE if hide_stderr else None)) break except EnvironmentError: e = sys.exc_info()[1] if e.errno == errno.ENOENT: continue if verbose: print("unable to run %s" % dispcmd) print(e) return None else: if verbose: print("unable to find command, tried %s" % (commands,)) return None stdout = p.communicate()[0].strip() if sys.version_info[0] >= 3: stdout = stdout.decode() if p.returncode != 0: if verbose: print("unable to run %s (error)" % dispcmd) return None return stdout LONG_VERSION_PY['git'] = ''' # This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains the computed version number. # This file is released into the public domain. Generated by # versioneer-0.16 (https://github.com/warner/python-versioneer) """Git implementation of _version.py.""" import errno import os import re import subprocess import sys def get_keywords(): """Get the keywords needed to look up the version information.""" # these strings will be replaced by git during git-archive. # setup.py/versioneer.py will grep for the variable names, so they must # each be defined on a line of their own. _version.py will just call # get_keywords(). git_refnames = "%(DOLLAR)sFormat:%%d%(DOLLAR)s" git_full = "%(DOLLAR)sFormat:%%H%(DOLLAR)s" keywords = {"refnames": git_refnames, "full": git_full} return keywords class VersioneerConfig: """Container for Versioneer configuration parameters.""" def get_config(): """Create, populate and return the VersioneerConfig() object.""" # these strings are filled in when 'setup.py versioneer' creates # _version.py cfg = VersioneerConfig() cfg.VCS = "git" cfg.style = "%(STYLE)s" cfg.tag_prefix = "%(TAG_PREFIX)s" cfg.parentdir_prefix = "%(PARENTDIR_PREFIX)s" cfg.versionfile_source = "%(VERSIONFILE_SOURCE)s" cfg.verbose = False return cfg class NotThisMethod(Exception): """Exception raised if a method is not valid for the current scenario.""" LONG_VERSION_PY = {} HANDLERS = {} def register_vcs_handler(vcs, method): # decorator """Decorator to mark a method as the handler for a particular VCS.""" def decorate(f): """Store f in HANDLERS[vcs][method].""" if vcs not in HANDLERS: HANDLERS[vcs] = {} HANDLERS[vcs][method] = f return f return decorate def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False): """Call the given command(s).""" assert isinstance(commands, list) p = None for c in commands: try: dispcmd = str([c] + args) # remember shell=False, so use git.cmd on windows, not just git p = subprocess.Popen([c] + args, cwd=cwd, stdout=subprocess.PIPE, stderr=(subprocess.PIPE if hide_stderr else None)) break except EnvironmentError: e = sys.exc_info()[1] if e.errno == errno.ENOENT: continue if verbose: print("unable to run %%s" %% dispcmd) print(e) return None else: if verbose: print("unable to find command, tried %%s" %% (commands,)) return None stdout = p.communicate()[0].strip() if sys.version_info[0] >= 3: stdout = stdout.decode() if p.returncode != 0: if verbose: print("unable to run %%s (error)" %% dispcmd) return None return stdout def versions_from_parentdir(parentdir_prefix, root, verbose): """Try to determine the version from the parent directory name. Source tarballs conventionally unpack into a directory that includes both the project name and a version string. """ dirname = os.path.basename(root) if not dirname.startswith(parentdir_prefix): if verbose: print("guessing rootdir is '%%s', but '%%s' doesn't start with " "prefix '%%s'" %% (root, dirname, parentdir_prefix)) raise NotThisMethod("rootdir doesn't start with parentdir_prefix") return {"version": dirname[len(parentdir_prefix):], "full-revisionid": None, "dirty": False, "error": None} @register_vcs_handler("git", "get_keywords") def git_get_keywords(versionfile_abs): """Extract version information from the given file.""" # the code embedded in _version.py can just fetch the value of these # keywords. When used from setup.py, we don't want to import _version.py, # so we do it with a regexp instead. This function is not used from # _version.py. keywords = {} try: f = open(versionfile_abs, "r") for line in f.readlines(): if line.strip().startswith("git_refnames ="): mo = re.search(r'=\s*"(.*)"', line) if mo: keywords["refnames"] = mo.group(1) if line.strip().startswith("git_full ="): mo = re.search(r'=\s*"(.*)"', line) if mo: keywords["full"] = mo.group(1) f.close() except EnvironmentError: pass return keywords @register_vcs_handler("git", "keywords") def git_versions_from_keywords(keywords, tag_prefix, verbose): """Get version information from git keywords.""" if not keywords: raise NotThisMethod("no keywords at all, weird") refnames = keywords["refnames"].strip() if refnames.startswith("$Format"): if verbose: print("keywords are unexpanded, not using") raise NotThisMethod("unexpanded keywords, not a git-archive tarball") refs = set([r.strip() for r in refnames.strip("()").split(",")]) # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of # just "foo-1.0". If we see a "tag: " prefix, prefer those. TAG = "tag: " tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) if not tags: # Either we're using git < 1.8.3, or there really are no tags. We use # a heuristic: assume all version tags have a digit. The old git %%d # expansion behaves like git log --decorate=short and strips out the # refs/heads/ and refs/tags/ prefixes that would let us distinguish # between branches and tags. By ignoring refnames without digits, we # filter out many common branch names like "release" and # "stabilization", as well as "HEAD" and "master". tags = set([r for r in refs if re.search(r'\d', r)]) if verbose: print("discarding '%%s', no digits" %% ",".join(refs-tags)) if verbose: print("likely tags: %%s" %% ",".join(sorted(tags))) for ref in sorted(tags): # sorting will prefer e.g. "2.0" over "2.0rc1" if ref.startswith(tag_prefix): r = ref[len(tag_prefix):] if verbose: print("picking %%s" %% r) return {"version": r, "full-revisionid": keywords["full"].strip(), "dirty": False, "error": None } # no suitable tags, so version is "0+unknown", but full hex is still there if verbose: print("no suitable tags, using unknown + full revision id") return {"version": "0+unknown", "full-revisionid": keywords["full"].strip(), "dirty": False, "error": "no suitable tags"} @register_vcs_handler("git", "pieces_from_vcs") def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): """Get version from 'git describe' in the root of the source tree. This only gets called if the git-archive 'subst' keywords were *not* expanded, and _version.py hasn't already been rewritten with a short version string, meaning we're inside a checked out source tree. """ if not os.path.exists(os.path.join(root, ".git")): if verbose: print("no .git in %%s" %% root) raise NotThisMethod("no .git directory") GITS = ["git"] if sys.platform == "win32": GITS = ["git.cmd", "git.exe"] # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] # if there isn't one, this yields HEX[-dirty] (no NUM) describe_out = run_command(GITS, ["describe", "--tags", "--dirty", "--always", "--long", "--match", "%%s*" %% tag_prefix], cwd=root) # --long was added in git-1.5.5 if describe_out is None: raise NotThisMethod("'git describe' failed") describe_out = describe_out.strip() full_out = run_command(GITS, ["rev-parse", "HEAD"], cwd=root) if full_out is None: raise NotThisMethod("'git rev-parse' failed") full_out = full_out.strip() pieces = {} pieces["long"] = full_out pieces["short"] = full_out[:7] # maybe improved later pieces["error"] = None # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] # TAG might have hyphens. git_describe = describe_out # look for -dirty suffix dirty = git_describe.endswith("-dirty") pieces["dirty"] = dirty if dirty: git_describe = git_describe[:git_describe.rindex("-dirty")] # now we have TAG-NUM-gHEX or HEX if "-" in git_describe: # TAG-NUM-gHEX mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) if not mo: # unparseable. Maybe git-describe is misbehaving? pieces["error"] = ("unable to parse git-describe output: '%%s'" %% describe_out) return pieces # tag full_tag = mo.group(1) if not full_tag.startswith(tag_prefix): if verbose: fmt = "tag '%%s' doesn't start with prefix '%%s'" print(fmt %% (full_tag, tag_prefix)) pieces["error"] = ("tag '%%s' doesn't start with prefix '%%s'" %% (full_tag, tag_prefix)) return pieces pieces["closest-tag"] = full_tag[len(tag_prefix):] # distance: number of commits since tag pieces["distance"] = int(mo.group(2)) # commit: short hex revision ID pieces["short"] = mo.group(3) else: # HEX: no tags pieces["closest-tag"] = None count_out = run_command(GITS, ["rev-list", "HEAD", "--count"], cwd=root) pieces["distance"] = int(count_out) # total number of commits return pieces def plus_or_dot(pieces): """Return a + if we don't already have one, else return a .""" if "+" in pieces.get("closest-tag", ""): return "." return "+" def render_pep440(pieces): """Build up version string, with post-release "local version identifier". Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty Exceptions: 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"] or pieces["dirty"]: rendered += plus_or_dot(pieces) rendered += "%%d.g%%s" %% (pieces["distance"], pieces["short"]) if pieces["dirty"]: rendered += ".dirty" else: # exception #1 rendered = "0+untagged.%%d.g%%s" %% (pieces["distance"], pieces["short"]) if pieces["dirty"]: rendered += ".dirty" return rendered def render_pep440_pre(pieces): """TAG[.post.devDISTANCE] -- No -dirty. Exceptions: 1: no tags. 0.post.devDISTANCE """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"]: rendered += ".post.dev%%d" %% pieces["distance"] else: # exception #1 rendered = "0.post.dev%%d" %% pieces["distance"] return rendered def render_pep440_post(pieces): """TAG[.postDISTANCE[.dev0]+gHEX] . The ".dev0" means dirty. Note that .dev0 sorts backwards (a dirty tree will appear "older" than the corresponding clean one), but you shouldn't be releasing software with -dirty anyways. Exceptions: 1: no tags. 0.postDISTANCE[.dev0] """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"] or pieces["dirty"]: rendered += ".post%%d" %% pieces["distance"] if pieces["dirty"]: rendered += ".dev0" rendered += plus_or_dot(pieces) rendered += "g%%s" %% pieces["short"] else: # exception #1 rendered = "0.post%%d" %% pieces["distance"] if pieces["dirty"]: rendered += ".dev0" rendered += "+g%%s" %% pieces["short"] return rendered def render_pep440_old(pieces): """TAG[.postDISTANCE[.dev0]] . The ".dev0" means dirty. Eexceptions: 1: no tags. 0.postDISTANCE[.dev0] """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"] or pieces["dirty"]: rendered += ".post%%d" %% pieces["distance"] if pieces["dirty"]: rendered += ".dev0" else: # exception #1 rendered = "0.post%%d" %% pieces["distance"] if pieces["dirty"]: rendered += ".dev0" return rendered def render_git_describe(pieces): """TAG[-DISTANCE-gHEX][-dirty]. Like 'git describe --tags --dirty --always'. Exceptions: 1: no tags. HEX[-dirty] (note: no 'g' prefix) """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"]: rendered += "-%%d-g%%s" %% (pieces["distance"], pieces["short"]) else: # exception #1 rendered = pieces["short"] if pieces["dirty"]: rendered += "-dirty" return rendered def render_git_describe_long(pieces): """TAG-DISTANCE-gHEX[-dirty]. Like 'git describe --tags --dirty --always -long'. The distance/hash is unconditional. Exceptions: 1: no tags. HEX[-dirty] (note: no 'g' prefix) """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] rendered += "-%%d-g%%s" %% (pieces["distance"], pieces["short"]) else: # exception #1 rendered = pieces["short"] if pieces["dirty"]: rendered += "-dirty" return rendered def render(pieces, style): """Render the given version pieces into the requested style.""" if pieces["error"]: return {"version": "unknown", "full-revisionid": pieces.get("long"), "dirty": None, "error": pieces["error"]} if not style or style == "default": style = "pep440" # the default if style == "pep440": rendered = render_pep440(pieces) elif style == "pep440-pre": rendered = render_pep440_pre(pieces) elif style == "pep440-post": rendered = render_pep440_post(pieces) elif style == "pep440-old": rendered = render_pep440_old(pieces) elif style == "git-describe": rendered = render_git_describe(pieces) elif style == "git-describe-long": rendered = render_git_describe_long(pieces) else: raise ValueError("unknown style '%%s'" %% style) return {"version": rendered, "full-revisionid": pieces["long"], "dirty": pieces["dirty"], "error": None} def get_versions(): """Get version information or return default if unable to do so.""" # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have # __file__, we can work backwards from there to the root. Some # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which # case we can only use expanded keywords. cfg = get_config() verbose = cfg.verbose try: return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, verbose) except NotThisMethod: pass try: root = os.path.realpath(__file__) # versionfile_source is the relative path from the top of the source # tree (where the .git directory might live) to this file. Invert # this to find the root from __file__. for i in cfg.versionfile_source.split('/'): root = os.path.dirname(root) except NameError: return {"version": "0+unknown", "full-revisionid": None, "dirty": None, "error": "unable to find root of source tree"} try: pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose) return render(pieces, cfg.style) except NotThisMethod: pass try: if cfg.parentdir_prefix: return versions_from_parentdir(cfg.parentdir_prefix, root, verbose) except NotThisMethod: pass return {"version": "0+unknown", "full-revisionid": None, "dirty": None, "error": "unable to compute version"} ''' @register_vcs_handler("git", "get_keywords") def git_get_keywords(versionfile_abs): """Extract version information from the given file.""" # the code embedded in _version.py can just fetch the value of these # keywords. When used from setup.py, we don't want to import _version.py, # so we do it with a regexp instead. This function is not used from # _version.py. keywords = {} try: f = open(versionfile_abs, "r") for line in f.readlines(): if line.strip().startswith("git_refnames ="): mo = re.search(r'=\s*"(.*)"', line) if mo: keywords["refnames"] = mo.group(1) if line.strip().startswith("git_full ="): mo = re.search(r'=\s*"(.*)"', line) if mo: keywords["full"] = mo.group(1) f.close() except EnvironmentError: pass return keywords @register_vcs_handler("git", "keywords") def git_versions_from_keywords(keywords, tag_prefix, verbose): """Get version information from git keywords.""" if not keywords: raise NotThisMethod("no keywords at all, weird") refnames = keywords["refnames"].strip() if refnames.startswith("$Format"): if verbose: print("keywords are unexpanded, not using") raise NotThisMethod("unexpanded keywords, not a git-archive tarball") refs = set([r.strip() for r in refnames.strip("()").split(",")]) # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of # just "foo-1.0". If we see a "tag: " prefix, prefer those. TAG = "tag: " tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) if not tags: # Either we're using git < 1.8.3, or there really are no tags. We use # a heuristic: assume all version tags have a digit. The old git %d # expansion behaves like git log --decorate=short and strips out the # refs/heads/ and refs/tags/ prefixes that would let us distinguish # between branches and tags. By ignoring refnames without digits, we # filter out many common branch names like "release" and # "stabilization", as well as "HEAD" and "master". tags = set([r for r in refs if re.search(r'\d', r)]) if verbose: print("discarding '%s', no digits" % ",".join(refs-tags)) if verbose: print("likely tags: %s" % ",".join(sorted(tags))) for ref in sorted(tags): # sorting will prefer e.g. "2.0" over "2.0rc1" if ref.startswith(tag_prefix): r = ref[len(tag_prefix):] if verbose: print("picking %s" % r) return {"version": r, "full-revisionid": keywords["full"].strip(), "dirty": False, "error": None } # no suitable tags, so version is "0+unknown", but full hex is still there if verbose: print("no suitable tags, using unknown + full revision id") return {"version": "0+unknown", "full-revisionid": keywords["full"].strip(), "dirty": False, "error": "no suitable tags"} @register_vcs_handler("git", "pieces_from_vcs") def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): """Get version from 'git describe' in the root of the source tree. This only gets called if the git-archive 'subst' keywords were *not* expanded, and _version.py hasn't already been rewritten with a short version string, meaning we're inside a checked out source tree. """ if not os.path.exists(os.path.join(root, ".git")): if verbose: print("no .git in %s" % root) raise NotThisMethod("no .git directory") GITS = ["git"] if sys.platform == "win32": GITS = ["git.cmd", "git.exe"] # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] # if there isn't one, this yields HEX[-dirty] (no NUM) describe_out = run_command(GITS, ["describe", "--tags", "--dirty", "--always", "--long", "--match", "%s*" % tag_prefix], cwd=root) # --long was added in git-1.5.5 if describe_out is None: raise NotThisMethod("'git describe' failed") describe_out = describe_out.strip() full_out = run_command(GITS, ["rev-parse", "HEAD"], cwd=root) if full_out is None: raise NotThisMethod("'git rev-parse' failed") full_out = full_out.strip() pieces = {} pieces["long"] = full_out pieces["short"] = full_out[:7] # maybe improved later pieces["error"] = None # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] # TAG might have hyphens. git_describe = describe_out # look for -dirty suffix dirty = git_describe.endswith("-dirty") pieces["dirty"] = dirty if dirty: git_describe = git_describe[:git_describe.rindex("-dirty")] # now we have TAG-NUM-gHEX or HEX if "-" in git_describe: # TAG-NUM-gHEX mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) if not mo: # unparseable. Maybe git-describe is misbehaving? pieces["error"] = ("unable to parse git-describe output: '%s'" % describe_out) return pieces # tag full_tag = mo.group(1) if not full_tag.startswith(tag_prefix): if verbose: fmt = "tag '%s' doesn't start with prefix '%s'" print(fmt % (full_tag, tag_prefix)) pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" % (full_tag, tag_prefix)) return pieces pieces["closest-tag"] = full_tag[len(tag_prefix):] # distance: number of commits since tag pieces["distance"] = int(mo.group(2)) # commit: short hex revision ID pieces["short"] = mo.group(3) else: # HEX: no tags pieces["closest-tag"] = None count_out = run_command(GITS, ["rev-list", "HEAD", "--count"], cwd=root) pieces["distance"] = int(count_out) # total number of commits return pieces def do_vcs_install(manifest_in, versionfile_source, ipy): """Git-specific installation logic for Versioneer. For Git, this means creating/changing .gitattributes to mark _version.py for export-time keyword substitution. """ GITS = ["git"] if sys.platform == "win32": GITS = ["git.cmd", "git.exe"] files = [manifest_in, versionfile_source] if ipy: files.append(ipy) try: me = __file__ if me.endswith(".pyc") or me.endswith(".pyo"): me = os.path.splitext(me)[0] + ".py" versioneer_file = os.path.relpath(me) except NameError: versioneer_file = "versioneer.py" files.append(versioneer_file) present = False try: f = open(".gitattributes", "r") for line in f.readlines(): if line.strip().startswith(versionfile_source): if "export-subst" in line.strip().split()[1:]: present = True f.close() except EnvironmentError: pass if not present: f = open(".gitattributes", "a+") f.write("%s export-subst\n" % versionfile_source) f.close() files.append(".gitattributes") run_command(GITS, ["add", "--"] + files) def versions_from_parentdir(parentdir_prefix, root, verbose): """Try to determine the version from the parent directory name. Source tarballs conventionally unpack into a directory that includes both the project name and a version string. """ dirname = os.path.basename(root) if not dirname.startswith(parentdir_prefix): if verbose: print("guessing rootdir is '%s', but '%s' doesn't start with " "prefix '%s'" % (root, dirname, parentdir_prefix)) raise NotThisMethod("rootdir doesn't start with parentdir_prefix") return {"version": dirname[len(parentdir_prefix):], "full-revisionid": None, "dirty": False, "error": None} SHORT_VERSION_PY = """ # This file was generated by 'versioneer.py' (0.16) from # revision-control system data, or from the parent directory name of an # unpacked source archive. Distribution tarballs contain a pre-generated copy # of this file. import json import sys version_json = ''' %s ''' # END VERSION_JSON def get_versions(): return json.loads(version_json) """ def versions_from_file(filename): """Try to determine the version from _version.py if present.""" try: with open(filename) as f: contents = f.read() except EnvironmentError: raise NotThisMethod("unable to read _version.py") mo = re.search(r"version_json = '''\n(.*)''' # END VERSION_JSON", contents, re.M | re.S) if not mo: raise NotThisMethod("no version_json in _version.py") return json.loads(mo.group(1)) def write_to_version_file(filename, versions): """Write the given version number to the given _version.py file.""" os.unlink(filename) contents = json.dumps(versions, sort_keys=True, indent=1, separators=(",", ": ")) with open(filename, "w") as f: f.write(SHORT_VERSION_PY % contents) print("set %s to '%s'" % (filename, versions["version"])) def plus_or_dot(pieces): """Return a + if we don't already have one, else return a .""" if "+" in pieces.get("closest-tag", ""): return "." return "+" def render_pep440(pieces): """Build up version string, with post-release "local version identifier". Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty Exceptions: 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"] or pieces["dirty"]: rendered += plus_or_dot(pieces) rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) if pieces["dirty"]: rendered += ".dirty" else: # exception #1 rendered = "0+untagged.%d.g%s" % (pieces["distance"], pieces["short"]) if pieces["dirty"]: rendered += ".dirty" return rendered def render_pep440_pre(pieces): """TAG[.post.devDISTANCE] -- No -dirty. Exceptions: 1: no tags. 0.post.devDISTANCE """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"]: rendered += ".post.dev%d" % pieces["distance"] else: # exception #1 rendered = "0.post.dev%d" % pieces["distance"] return rendered def render_pep440_post(pieces): """TAG[.postDISTANCE[.dev0]+gHEX] . The ".dev0" means dirty. Note that .dev0 sorts backwards (a dirty tree will appear "older" than the corresponding clean one), but you shouldn't be releasing software with -dirty anyways. Exceptions: 1: no tags. 0.postDISTANCE[.dev0] """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"] or pieces["dirty"]: rendered += ".post%d" % pieces["distance"] if pieces["dirty"]: rendered += ".dev0" rendered += plus_or_dot(pieces) rendered += "g%s" % pieces["short"] else: # exception #1 rendered = "0.post%d" % pieces["distance"] if pieces["dirty"]: rendered += ".dev0" rendered += "+g%s" % pieces["short"] return rendered def render_pep440_old(pieces): """TAG[.postDISTANCE[.dev0]] . The ".dev0" means dirty. Eexceptions: 1: no tags. 0.postDISTANCE[.dev0] """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"] or pieces["dirty"]: rendered += ".post%d" % pieces["distance"] if pieces["dirty"]: rendered += ".dev0" else: # exception #1 rendered = "0.post%d" % pieces["distance"] if pieces["dirty"]: rendered += ".dev0" return rendered def render_git_describe(pieces): """TAG[-DISTANCE-gHEX][-dirty]. Like 'git describe --tags --dirty --always'. Exceptions: 1: no tags. HEX[-dirty] (note: no 'g' prefix) """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] if pieces["distance"]: rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) else: # exception #1 rendered = pieces["short"] if pieces["dirty"]: rendered += "-dirty" return rendered def render_git_describe_long(pieces): """TAG-DISTANCE-gHEX[-dirty]. Like 'git describe --tags --dirty --always -long'. The distance/hash is unconditional. Exceptions: 1: no tags. HEX[-dirty] (note: no 'g' prefix) """ if pieces["closest-tag"]: rendered = pieces["closest-tag"] rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) else: # exception #1 rendered = pieces["short"] if pieces["dirty"]: rendered += "-dirty" return rendered def render(pieces, style): """Render the given version pieces into the requested style.""" if pieces["error"]: return {"version": "unknown", "full-revisionid": pieces.get("long"), "dirty": None, "error": pieces["error"]} if not style or style == "default": style = "pep440" # the default if style == "pep440": rendered = render_pep440(pieces) elif style == "pep440-pre": rendered = render_pep440_pre(pieces) elif style == "pep440-post": rendered = render_pep440_post(pieces) elif style == "pep440-old": rendered = render_pep440_old(pieces) elif style == "git-describe": rendered = render_git_describe(pieces) elif style == "git-describe-long": rendered = render_git_describe_long(pieces) else: raise ValueError("unknown style '%s'" % style) return {"version": rendered, "full-revisionid": pieces["long"], "dirty": pieces["dirty"], "error": None} class VersioneerBadRootError(Exception): """The project root directory is unknown or missing key files.""" def get_versions(verbose=False): """Get the project version from whatever source is available. Returns dict with two keys: 'version' and 'full'. """ if "versioneer" in sys.modules: # see the discussion in cmdclass.py:get_cmdclass() del sys.modules["versioneer"] root = get_root() cfg = get_config_from_root(root) assert cfg.VCS is not None, "please set [versioneer]VCS= in setup.cfg" handlers = HANDLERS.get(cfg.VCS) assert handlers, "unrecognized VCS '%s'" % cfg.VCS verbose = verbose or cfg.verbose assert cfg.versionfile_source is not None, \ "please set versioneer.versionfile_source" assert cfg.tag_prefix is not None, "please set versioneer.tag_prefix" versionfile_abs = os.path.join(root, cfg.versionfile_source) # extract version from first of: _version.py, VCS command (e.g. 'git # describe'), parentdir. This is meant to work for developers using a # source checkout, for users of a tarball created by 'setup.py sdist', # and for users of a tarball/zipball created by 'git archive' or github's # download-from-tag feature or the equivalent in other VCSes. get_keywords_f = handlers.get("get_keywords") from_keywords_f = handlers.get("keywords") if get_keywords_f and from_keywords_f: try: keywords = get_keywords_f(versionfile_abs) ver = from_keywords_f(keywords, cfg.tag_prefix, verbose) if verbose: print("got version from expanded keyword %s" % ver) return ver except NotThisMethod: pass try: ver = versions_from_file(versionfile_abs) if verbose: print("got version from file %s %s" % (versionfile_abs, ver)) return ver except NotThisMethod: pass from_vcs_f = handlers.get("pieces_from_vcs") if from_vcs_f: try: pieces = from_vcs_f(cfg.tag_prefix, root, verbose) ver = render(pieces, cfg.style) if verbose: print("got version from VCS %s" % ver) return ver except NotThisMethod: pass try: if cfg.parentdir_prefix: ver = versions_from_parentdir(cfg.parentdir_prefix, root, verbose) if verbose: print("got version from parentdir %s" % ver) return ver except NotThisMethod: pass if verbose: print("unable to compute version") return {"version": "0+unknown", "full-revisionid": None, "dirty": None, "error": "unable to compute version"} def get_version(): """Get the short version string for this project.""" return get_versions()["version"] def get_cmdclass(): """Get the custom setuptools/distutils subclasses used by Versioneer.""" if "versioneer" in sys.modules: del sys.modules["versioneer"] # this fixes the "python setup.py develop" case (also 'install' and # 'easy_install .'), in which subdependencies of the main project are # built (using setup.py bdist_egg) in the same python process. Assume # a main project A and a dependency B, which use different versions # of Versioneer. A's setup.py imports A's Versioneer, leaving it in # sys.modules by the time B's setup.py is executed, causing B to run # with the wrong versioneer. Setuptools wraps the sub-dep builds in a # sandbox that restores sys.modules to it's pre-build state, so the # parent is protected against the child's "import versioneer". By # removing ourselves from sys.modules here, before the child build # happens, we protect the child from the parent's versioneer too. # Also see https://github.com/warner/python-versioneer/issues/52 cmds = {} # we add "version" to both distutils and setuptools from distutils.core import Command class cmd_version(Command): description = "report generated version string" user_options = [] boolean_options = [] def initialize_options(self): pass def finalize_options(self): pass def run(self): vers = get_versions(verbose=True) print("Version: %s" % vers["version"]) print(" full-revisionid: %s" % vers.get("full-revisionid")) print(" dirty: %s" % vers.get("dirty")) if vers["error"]: print(" error: %s" % vers["error"]) cmds["version"] = cmd_version # we override "build_py" in both distutils and setuptools # # most invocation pathways end up running build_py: # distutils/build -> build_py # distutils/install -> distutils/build ->.. # setuptools/bdist_wheel -> distutils/install ->.. # setuptools/bdist_egg -> distutils/install_lib -> build_py # setuptools/install -> bdist_egg ->.. # setuptools/develop -> ? # we override different "build_py" commands for both environments if "setuptools" in sys.modules: from setuptools.command.build_py import build_py as _build_py else: from distutils.command.build_py import build_py as _build_py class cmd_build_py(_build_py): def run(self): root = get_root() cfg = get_config_from_root(root) versions = get_versions() _build_py.run(self) # now locate _version.py in the new build/ directory and replace # it with an updated value if cfg.versionfile_build: target_versionfile = os.path.join(self.build_lib, cfg.versionfile_build) print("UPDATING %s" % target_versionfile) write_to_version_file(target_versionfile, versions) cmds["build_py"] = cmd_build_py if "cx_Freeze" in sys.modules: # cx_freeze enabled? from cx_Freeze.dist import build_exe as _build_exe class cmd_build_exe(_build_exe): def run(self): root = get_root() cfg = get_config_from_root(root) versions = get_versions() target_versionfile = cfg.versionfile_source print("UPDATING %s" % target_versionfile) write_to_version_file(target_versionfile, versions) _build_exe.run(self) os.unlink(target_versionfile) with open(cfg.versionfile_source, "w") as f: LONG = LONG_VERSION_PY[cfg.VCS] f.write(LONG % {"DOLLAR": "$", "STYLE": cfg.style, "TAG_PREFIX": cfg.tag_prefix, "PARENTDIR_PREFIX": cfg.parentdir_prefix, "VERSIONFILE_SOURCE": cfg.versionfile_source, }) cmds["build_exe"] = cmd_build_exe del cmds["build_py"] # we override different "sdist" commands for both environments if "setuptools" in sys.modules: from setuptools.command.sdist import sdist as _sdist else: from distutils.command.sdist import sdist as _sdist class cmd_sdist(_sdist): def run(self): versions = get_versions() self._versioneer_generated_versions = versions # unless we update this, the command will keep using the old # version self.distribution.metadata.version = versions["version"] return _sdist.run(self) def make_release_tree(self, base_dir, files): root = get_root() cfg = get_config_from_root(root) _sdist.make_release_tree(self, base_dir, files) # now locate _version.py in the new base_dir directory # (remembering that it may be a hardlink) and replace it with an # updated value target_versionfile = os.path.join(base_dir, cfg.versionfile_source) print("UPDATING %s" % target_versionfile) write_to_version_file(target_versionfile, self._versioneer_generated_versions) cmds["sdist"] = cmd_sdist return cmds CONFIG_ERROR = """ setup.cfg is missing the necessary Versioneer configuration. You need a section like: [versioneer] VCS = git style = pep440 versionfile_source = src/myproject/_version.py versionfile_build = myproject/_version.py tag_prefix = parentdir_prefix = myproject- You will also need to edit your setup.py to use the results: import versioneer setup(version=versioneer.get_version(), cmdclass=versioneer.get_cmdclass(), ...) Please read the docstring in ./versioneer.py for configuration instructions, edit setup.cfg, and re-run the installer or 'python versioneer.py setup'. """ SAMPLE_CONFIG = """ # See the docstring in versioneer.py for instructions. Note that you must # re-run 'versioneer.py setup' after changing this section, and commit the # resulting files. [versioneer] #VCS = git #style = pep440 #versionfile_source = #versionfile_build = #tag_prefix = #parentdir_prefix = """ INIT_PY_SNIPPET = """ from ._version import get_versions __version__ = get_versions()['version'] del get_versions """ def do_setup(): """Main VCS-independent setup function for installing Versioneer.""" root = get_root() try: cfg = get_config_from_root(root) except (EnvironmentError, configparser.NoSectionError, configparser.NoOptionError) as e: if isinstance(e, (EnvironmentError, configparser.NoSectionError)): print("Adding sample versioneer config to setup.cfg", file=sys.stderr) with open(os.path.join(root, "setup.cfg"), "a") as f: f.write(SAMPLE_CONFIG) print(CONFIG_ERROR, file=sys.stderr) return 1 print(" creating %s" % cfg.versionfile_source) with open(cfg.versionfile_source, "w") as f: LONG = LONG_VERSION_PY[cfg.VCS] f.write(LONG % {"DOLLAR": "$", "STYLE": cfg.style, "TAG_PREFIX": cfg.tag_prefix, "PARENTDIR_PREFIX": cfg.parentdir_prefix, "VERSIONFILE_SOURCE": cfg.versionfile_source, }) ipy = os.path.join(os.path.dirname(cfg.versionfile_source), "__init__.py") if os.path.exists(ipy): try: with open(ipy, "r") as f: old = f.read() except EnvironmentError: old = "" if INIT_PY_SNIPPET not in old: print(" appending to %s" % ipy) with open(ipy, "a") as f: f.write(INIT_PY_SNIPPET) else: print(" %s unmodified" % ipy) else: print(" %s doesn't exist, ok" % ipy) ipy = None # Make sure both the top-level "versioneer.py" and versionfile_source # (PKG/_version.py, used by runtime code) are in MANIFEST.in, so # they'll be copied into source distributions. Pip won't be able to # install the package without this. manifest_in = os.path.join(root, "MANIFEST.in") simple_includes = set() try: with open(manifest_in, "r") as f: for line in f: if line.startswith("include "): for include in line.split()[1:]: simple_includes.add(include) except EnvironmentError: pass # That doesn't cover everything MANIFEST.in can do # (http://docs.python.org/2/distutils/sourcedist.html#commands), so # it might give some false negatives. Appending redundant 'include' # lines is safe, though. if "versioneer.py" not in simple_includes: print(" appending 'versioneer.py' to MANIFEST.in") with open(manifest_in, "a") as f: f.write("include versioneer.py\n") else: print(" 'versioneer.py' already in MANIFEST.in") if cfg.versionfile_source not in simple_includes: print(" appending versionfile_source ('%s') to MANIFEST.in" % cfg.versionfile_source) with open(manifest_in, "a") as f: f.write("include %s\n" % cfg.versionfile_source) else: print(" versionfile_source already in MANIFEST.in") # Make VCS-specific changes. For git, this means creating/changing # .gitattributes to mark _version.py for export-time keyword # substitution. do_vcs_install(manifest_in, cfg.versionfile_source, ipy) return 0 def scan_setup_py(): """Validate the contents of setup.py against Versioneer's expectations.""" found = set() setters = False errors = 0 with open("setup.py", "r") as f: for line in f.readlines(): if "import versioneer" in line: found.add("import") if "versioneer.get_cmdclass()" in line: found.add("cmdclass") if "versioneer.get_version()" in line: found.add("get_version") if "versioneer.VCS" in line: setters = True if "versioneer.versionfile_source" in line: setters = True if len(found) != 3: print("") print("Your setup.py appears to be missing some important items") print("(but I might be wrong). Please make sure it has something") print("roughly like the following:") print("") print(" import versioneer") print(" setup( version=versioneer.get_version(),") print(" cmdclass=versioneer.get_cmdclass(), ...)") print("") errors += 1 if setters: print("You should remove lines like 'versioneer.VCS = ' and") print("'versioneer.versionfile_source = ' . This configuration") print("now lives in setup.cfg, and should be removed from setup.py") print("") errors += 1 return errors if __name__ == "__main__": cmd = sys.argv[1] if cmd == "setup": errors = do_setup() errors += scan_setup_py() if errors: sys.exit(1) cutadapt-1.15/setup.cfg0000664000175000017500000000034513205527004015620 0ustar marcelmarcel00000000000000[versioneer] vcs = git style = pep440 versionfile_source = src/cutadapt/_version.py versionfile_build = cutadapt/_version.py tag_prefix = v parentdir_prefix = cutadapt- [egg_info] tag_build = tag_svn_revision = 0 tag_date = 0 cutadapt-1.15/CITATION0000664000175000017500000000105213205526454015140 0ustar marcelmarcel00000000000000Marcel Martin. Cutadapt removes adapter sequences from high-throughput sequencing reads. EMBnet.journal, 17(1):10-12, May 2011. DOI: http://dx.doi.org/10.14806/ej.17.1.200 @ARTICLE{Martin2011Cutadapt, author = {Marcel Martin}, title = {Cutadapt removes adapter sequences from high-throughput sequencing reads}, journal = {EMBnet.journal}, year = 2011, month = may, volume = 17, pages = {10--12}, number = 1, doi = {http://dx.doi.org/10.14806/ej.17.1.200}, url = {http://journal.embnet.org/index.php/embnetjournal/article/view/200} } cutadapt-1.15/MANIFEST.in0000664000175000017500000000041213205526454015540 0ustar marcelmarcel00000000000000include CHANGES.rst include CITATION include LICENSE include doc/*.rst include doc/conf.py include doc/Makefile include versioneer.py include src/cutadapt/*.c include src/cutadapt/*.pyx include tests/utils.py include tests/test_*.py graft tests/data graft tests/cut cutadapt-1.15/README.rst0000664000175000017500000000342013205526454015473 0ustar marcelmarcel00000000000000.. image:: https://travis-ci.org/marcelm/cutadapt.svg?branch=master :target: https://travis-ci.org/marcelm/cutadapt .. image:: https://img.shields.io/pypi/v/cutadapt.svg?branch=master :target: https://pypi.python.org/pypi/cutadapt ======== cutadapt ======== Cutadapt finds and removes adapter sequences, primers, poly-A tails and other types of unwanted sequence from your high-throughput sequencing reads. Cleaning your data in this way is often required: Reads from small-RNA sequencing contain the 3’ sequencing adapter because the read is longer than the molecule that is sequenced. Amplicon reads start with a primer sequence. Poly-A tails are useful for pulling out RNA from your sample, but often you don’t want them to be in your reads. Cutadapt helps with these trimming tasks by finding the adapter or primer sequences in an error-tolerant way. It can also modify and filter reads in various ways. Adapter sequences can contain IUPAC wildcard characters. Also, paired-end reads and even colorspace data is supported. If you want, you can also just demultiplex your input data, without removing adapter sequences at all. Cutadapt comes with an extensive suite of automated tests and is available under the terms of the MIT license. If you use cutadapt, please cite `DOI:10.14806/ej.17.1.200 `_ . Links ----- * `Documentation `_ * `Source code `_ * `Report an issue `_ * `Project page on PyPI (Python package index) `_ * `Follow @marcelm_ on Twitter `_ * `Wrapper for the Galaxy platform `_ cutadapt-1.15/doc/0000775000175000017500000000000013205527004014542 5ustar marcelmarcel00000000000000cutadapt-1.15/doc/colorspace.rst0000664000175000017500000001321113205526454017434 0ustar marcelmarcel00000000000000.. _colorspace: Colorspace reads ================ Cutadapt was designed to work with colorspace reads from the ABi SOLiD sequencer. Colorspace trimming is activated by the ``--colorspace`` option (or use ``-c`` for short). The input reads can be given either: - in a FASTA file (typically extensions ``.csfasta`` or ``.csfa``) - in a FASTQ file - in a ``.csfasta`` and a ``.qual`` file (this is the native SOLiD format). That is, cutadapt expects *two* file names in this case. In all cases, the colors must be represented by the characters 0, 1, 2, 3. Here is an example input file in ``.fastq`` format that is accepted:: @1_13_85_F3 T110020300.0113010210002110102330021 + 7&9<&77)& <7))%4'657-1+9;9,.<8);.;8 @1_13_573_F3 T312311200.3021301101113203302010003 + 6)3%)&&&& .1&(6:<'67..*,:75)'77&&&5 Further example input files can be found in the cutadapt distribution at ``tests/data/solid.*``. The ``.csfasta``/``.qual`` file format is automatically assumed if two input files are given to cutadapt, and when no paired-end trimming options are used. Cutadapt always converts input data given as a pair of FASTA/QUAL files to FASTQ. In colorspace mode, the adapter sequences given to the ``-a``, ``-b`` and ``-g`` options can be given both as colors or as nucleotides. If given as nucleotides, they will automatically be converted to colorspace. For example, to trim an adapter from ``solid.csfasta`` and ``solid.qual``, use this command-line:: cutadapt -c -a CGCCTTGGCCGTACAGCAG solid.csfasta solid.qual > output.fastq In case you know the colorspace adapter sequence, you can also write ``330201030313112312`` instead of ``CGCCTTGGCCGTACAGCAG``, and the result is the same. Ambiguity in colorspace ----------------------- The ambiguity of colorspace encoding leads to some effects to be aware of when trimming 3' adapters from colorspace reads. For example, when trimming the adapter ``AACTC``, cutadapt searches for its colorspace-encoded version ``0122``. But also ``TTGAG``, ``CCAGA`` and ``GGTCT`` have an encoding of ``0122``. This means that effectively four different adapter sequences are searched and trimmed at the same time. There is no way around this, unless the decoded sequence were available, but that is usually only the case after read mapping. The effect should usually be quite small. The number of false positives is multiplied by four, but with a sufficiently large overlap (3 or 4 is already enough), this is still only around 0.2 bases lost per read on average. If inspecting k-mer frequencies or using small overlaps, you need to be aware of the effect, however. Double-encoding, BWA and MAQ ---------------------------- The read mappers MAQ and BWA (and possibly others) need their colorspace input reads to be in a so-called "double encoding". This simply means that they cannot deal with the characters 0, 1, 2, 3 in the reads, but require that the letters A, C, G, T be used for colors. For example, the colorspace sequence ``0011321`` would be ``AACCTGC`` in double-encoded form. This is not the same as conversion to basespace! The read is still in colorspace, only letters are used instead of digits. If that sounds confusing, that is because it is. Note that MAQ is unmaintained and should not be used in new projects. BWA’s colorspace support was dropped in versions more recent than 0.5.9, but that version works well. When you want to trim reads that will be mapped with BWA or MAQ, you can use the ``--bwa`` option, which enables colorspace mode (``-c``), double-encoding (``-d``), primer trimming (``-t``), all of which are required for BWA, in addition to some other useful options. The ``--maq`` option is an alias for ``--bwa``. Colorspace examples ------------------- To cut an adapter from SOLiD data given in ``solid.csfasta`` and ``solid.qual``, to produce MAQ- and BWA-compatible output, allow the default of 10% errors and write the resulting FASTQ file to output.fastq:: cutadapt --bwa -a CGCCTTGGCCGTACAGCAG solid.csfasta solid.qual > output.fastq Instead of redirecting standard output with ``>``, the ``-o`` option can be used. This also shows that you can give the adapter in colorspace and how to use a different error rate:: cutadapt --bwa -e 0.15 -a 330201030313112312 -o output.fastq solid.csfasta solid.qual This does the same as above, but produces BFAST-compatible output, strips the \_F3 suffix from read names and adds the prefix "abc:" to them:: cutadapt -c -e 0.15 -a 330201030313112312 -x abc: --strip-f3 solid.csfasta solid.qual > output.fastq Bowtie ------ Quality values of colorspace reads are sometimes negative. Bowtie gets confused and prints this message:: Encountered a space parsing the quality string for read xyz BWA also has a problem with such data. Cutadapt therefore converts negative quality values to zero in colorspace data. Use the option ``--no-zero-cap`` to turn this off. .. _sra-fastq: Sequence Read Archive --------------------- The Sequence Read Archive provides files in a special "SRA" file format. When the ``fastq-dump`` program from the sra-toolkit package is used to convert these ``.sra`` files to FASTQ format, colorspace reads will get an extra quality value in the beginning of each read. You may get an error like this:: cutadapt: error: In read named 'xyz': length of colorspace quality sequence (36) and length of read (35) do not match (primer is: 'T') To make cutadapt ignore the extra quality base, add ``--format=sra-fastq`` to your command-line, as in this example:: cutadapt -c --format=sra-fastq -a CGCCTTGGCCG sra.fastq > trimmed.fastq When you use ``--format=sra-fastq``, the spurious quality value will be removed from all reads in the file. cutadapt-1.15/doc/Makefile0000664000175000017500000001517513205526454016223 0ustar marcelmarcel00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # User-friendly check for sphinx-build ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) $(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) endif # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext all: html help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " xml to make Docutils-native XML files" @echo " pseudoxml to make pseudoxml-XML files for display purposes" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/cutadapt.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/cutadapt.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/cutadapt" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/cutadapt" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." latexpdfja: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through platex and dvipdfmx..." $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." xml: $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml @echo @echo "Build finished. The XML files are in $(BUILDDIR)/xml." pseudoxml: $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml @echo @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." cutadapt-1.15/doc/recipes.rst0000664000175000017500000001760213205526454016744 0ustar marcelmarcel00000000000000============= Recipes (FAQ) ============= This section gives answers to frequently asked questions. It shows you how to get cutadapt to do what you want it to do! .. _avoid-internal-adapter-matches: Avoid internal adapter matches ------------------------------ To force matches to be at the end of the read and thus avoiding internal adapter matches, append a few ``X`` characters to the adapter sequence, like this: ``-a TACGGCATXXX``. The ``X`` is counted as a mismatch and will force the match to be at the end. Just make sure that there are more ``X`` characters than the length of the adapter times the error rate. This is not the same as an anchored 3' adapter since partial matches are still allowed. Remove more than one adapter ---------------------------- If you want to remove a 5' and 3' adapter at the same time, :ref:`use the support for linked adapters `. If your situation is different, for example, when you have many 5' adapters but only one 3' adapter, then you have two options. First, you can specify the adapters and also ``--times=2`` (or the short version ``-n 2``). For example:: cutadapt -g ^TTAAGGCC -g ^AAGCTTA -a TACGGACT -n 2 -o output.fastq input.fastq This instructs cutadapt to run two rounds of adapter finding and removal. That means that, after the first round and only when an adapter was actually found, another round is performed. In both rounds, all given adapters are searched and removed. The problem is that it could happen that one adapter is found twice (so the 3' adapter, for example, could be removed twice). The second option is to not use the ``-n`` option, but to run cutadapt twice, first removing one adapter and then the other. It is easiest if you use a pipe as in this example:: cutadapt -g ^TTAAGGCC -g ^AAGCTTA input.fastq | cutadapt -a TACGGACT - > output.fastq Trim poly-A tails ----------------- If you want to trim a poly-A tail from the 3' end of your reads, use the 3' adapter type (``-a``) with an adapter sequence of many repeated ``A`` nucleotides. Starting with version 1.8 of cutadapt, you can use the following notation to specify a sequence that consists of 100 ``A``:: cutadapt -a "A{100}" -o output.fastq input.fastq This also works when there are sequencing errors in the poly-A tail. So this read :: TACGTACGTACGTACGAAATAAAAAAAAAAA will be trimmed to:: TACGTACGTACGTACG If for some reason you would like to use a shorter sequence of ``A``, you can do so: The matching algorithm always picks the leftmost match that it can find, so cutadapt will do the right thing even when the tail has more ``A`` than you used in the adapter sequence. However, sequencing errors may result in shorter matches than desired. For example, using ``-a "A{10}"``, the read above (where the ``AAAT`` is followed by eleven ``A``) would be trimmed to:: TACGTACGTACGTACGAAAT Depending on your application, perhaps a variant of ``-a A{10}N{90}`` is an alternative, forcing the match to be located as much to the left as possible, while still allowing for non-``A`` bases towards the end of the read. Trim a fixed number of bases after adapter trimming --------------------------------------------------- If the adapters you want to remove are preceded by some unknown sequence (such as a random tag/molecular identifier), you can specify this as part of the adapter sequence in order to remove both in one go. For example, assume you want to trim Illumina adapters preceded by 10 bases that you want to trim as well. Instead of this command:: cutadapt -a AGATCGGAAGAGCACACGTCTGAACTCCAGTCAC ... Use this command:: cutadapt -O 13 -a N{10}AGATCGGAAGAGCACACGTCTGAACTCCAGTCAC ... The ``-O 13`` is the minimum overlap for an adapter match, where the 13 is computed as 3 plus 10 (where 3 is the default minimum overlap and 10 is the length of the unknown section). If you do not specify it, the adapter sequence would match the end of every read (because ``N`` matches anything), and ten bases would then be removed from every read. Trimming (amplicon-) primers from both ends of paired-end reads --------------------------------------------------------------- If you want to remove primer sequences that flank your sequence of interest, you should use a :ref:`"linked adapter" ` to remove them. If you have paired-end data (with R1 and R2), you can correctly trim both R1 and R2 by using linked adapters for both R1 and R2. Here is how to do this. The full DNA fragment that is put on the sequencer looks like this (looking only at the forward strand): 5' sequencing primer -- forward primer -- sequence of interest -- reverse complement of reverse primer -- reverse complement of 3' sequencing primer Since sequencing of R1 starts after the 5' sequencing primer, R1 will start with the forward primer and then continue into the sequence of interest and into the two primers to the right of it, depending on the read length and how long the sequence of interest is. For R1, the linked adapter option that needs to be used is therefore :: -a FWDPRIMER...RCREVPRIMER where ``FWDPRIMER`` needs to be replaced with the sequence of your forward primer and ``RCREVPRIMER`` with the reverse complement of the reverse primer. The three dots ``...`` need to be entered as they are -- they tell cutadapt that this is a linked adapter with a 5' and a 3' part. Sequencing of R2 starts before the 3' sequencing primer and proceeds along the reverse-complementary strand. For the correct linked adapter, the sequences from above therefore need to be swapped and reverse-complemented:: -A REVPRIMER...RCFWDPRIMER The uppercase ``-A`` specifies that this option is meant to work on R2. Similar to above, ``REVPRIMER`` is the sequence of the reverse primer and ``RCFWDPRIMER`` is the reverse-complement of the forward primer. Note that cutadapt does not reverse-complement any sequences of its own; you will have to do that yourself. Finally, you may want to filter the trimmed read pairs. Use ``--discard-untrimmed`` to throw away all read pairs in which R1 doesn’t start with ``FWDPRIMER`` or in which R2 does not start with ``REVPRIMER``. A note on how the filtering works: In linked adapters, by default the first part (before the ``...``) is anchored. Anchored sequences *must* occur. If they don’t, then the other sequence (after the ``...``) is not even searched for and the entire read is internally marked as “untrimmed”. This is done for both R1 and R2 and as soon as *any* of them is marked as “untrimmed”, the entire pair is considered to be “untrimmed”. If ``--discard-untrimmed`` is used, this means that the entire pair is discarded if R1 or R2 are untrimmed. (Option ``--pair-filter=both`` can be used to change this to require that *both* were marked as untrimmed.) In summary, this is how to trim your data and discard all read pairs that do not contain the primer sequences that you know must be there:: cutadapt -a FWDPRIMER...RCREVPRIMER -A REVPRIMER...RCFWDPRIMER --discard-untrimmed -o out.1.fastq.gz -p out.2.fastq.gz in.1.fastq.gz in.2.fastq.gz Piping paired-end data ---------------------- Sometimes it is necessary to run cutadapt twice on your data. For example, when you want to change the order in which read modification or filtering options are applied. To simplify this, you can use Unix pipes (``|``), but this is more difficult with paired-end data since then input and output consists of two files each. The solution is to interleave the paired-end data, send it over the pipe and then de-interleave it in the other process. Here is how this looks in principle:: cutadapt [options] --interleaved in.1.fastq.gz in.2.fastq.gz | \ cutadapt [options] --interleaved -o out.1.fastq.gz -p out.2.fastq.gz - Note the ``-`` character in the second invocation to cutadapt. Other things (unfinished) ------------------------- * How to detect adapters * Use cutadapt for quality-trimming only * Use it for minimum/maximum length filtering * Use it for conversion to FASTQ cutadapt-1.15/doc/index.rst0000664000175000017500000000046513205526454016420 0ustar marcelmarcel00000000000000.. include:: ../README.rst ================= Table of contents ================= .. toctree:: :maxdepth: 2 installation guide colorspace recipes ideas develop changes .. Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` cutadapt-1.15/doc/develop.rst0000664000175000017500000001023713205526454016745 0ustar marcelmarcel00000000000000Developing ========== The `Cutadapt source code is on GitHub `_. Cutadapt is written in Python with some extension modules that are written in Cython. Cutadapt uses a single code base that is compatible with both Python 2 and 3. Python 2.7 is the minimum supported Python version. With relatively little effort, compatibility with Python 2.6 could be restored. Development installation ------------------------ For development, make sure that you install Cython and tox. We also recommend using a virtualenv. This sequence of commands should work:: git clone https://github.com/marcelm/cutadapt.git # or clone your own fork cd cutadapt virtualenv -p python3 venv # or omit the "-p python3" for Python 2 venv/bin/pip3 install Cython nose tox # pip3 becomes just pip for Python 2 venv/bin/pip3 install -e . Then you can run Cutadapt like this (or activate the virtualenv and omit the ``venv/bin`` part):: venv/bin/cutadapt --help The tests can then be run like this:: venv/bin/nosetests Or with tox (but then you will need to have binaries for all tested Python versions installed):: venv/bin/tox Development installation (without virtualenv) --------------------------------------------- Alternatively, if you do not want to use virtualenv, you can do the following from within the cloned repository:: python3 setup.py build_ext -i # omit the "3" for Python 2 nosetests This requires Cython and nose to be installed. Code style ---------- Cutadapt tries to follow PEP8, with some exceptions: * Indentation is made with tabs, not with spaces * The maximum line length for code 100 characters, not 80, but try to wrap comments at 80 characters for readability. Yes, there are inconsistencies in the current code base since it’s a few years old already. Making a release ---------------- If this is the first time you attempt to upload a distribution to PyPI, create a configuration file named ``.pypirc`` in your home directory with the following contents:: [distutils] index-servers = pypi [pypi] username=my-user-name password=my-password See also `this blog post about getting started with PyPI `_. In particular, note that a ``%`` in your password needs to be doubled and that the password must *not* be put between quotation marks even if it contains spaces. Cutadapt uses `versioneer `_ to automatically manage version numbers. This means that the version is not stored in the source code but derived from the most recent Git tag. The following procedure can be used to bump the version and make a new release. #. Update ``CHANGES.rst`` (version number and list of changes) #. Ensure you have no uncommitted changes in the working copy. #. Run a ``git pull``. #. Run ``tox``, ensuring all tests pass. #. Tag the current commit with the version number (there must be a ``v`` prefix):: git tag v0.1 #. Create a distribution (``.tar.gz`` file). Double-check that the auto-generated version number in the tarball is as you expect it by looking at the name of the generated file in ``dist/``:: python3 setup.py sdist #. If necessary, pip install ``twine`` and then upload the generated tar file to PyPI:: twine upload dist/cutadapt-0.1.tar.gz # adjust version number #. Push the tag:: git push --tags #. Update the `bioconda recipe `_. It is probly easiest to edit the recipe via the web interface and send in a pull request. Ensure that the list of dependencies (the ``requirements:`` section in the recipe) is in sync with the ``setup.py`` file. Since this is just a version bump, the pull request does not need a review by other bioconda developers. As soon as the tests pass and if you have the proper permissions, it can be merged directly. If something went wrong *after* you uploaded a tarball, fix the problem and follow the above instructions again, but with an incremented revision in the version number. That is, go from version x.y to x.y.1. Do not change a version that has already been uploaded. cutadapt-1.15/doc/conf.py0000664000175000017500000002104413205526454016052 0ustar marcelmarcel00000000000000# -*- coding: utf-8 -*- # # cutadapt documentation build configuration file, created by # sphinx-quickstart on Fri Sep 12 09:11:16 2014. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys import os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath(os.path.join(os.pardir, 'src'))) # -- General configuration ------------------------------------------------ # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ 'sphinx.ext.autodoc', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'cutadapt' copyright = u'2010-2017, Marcel Martin' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. from cutadapt import __version__ # The short X.Y version. version = __version__ # Read The Docs modifies the conf.py script and we therefore get # version numbers like 0.7+0.g27d0d31.dirty from versioneer. if version.endswith('.dirty') and os.environ.get('READTHEDOCS') == 'True': version, _, rest = version.partition('+') if not rest.startswith('0.'): version = version + '+' + rest[:-6] # The full version, including alpha/beta/rc tags. release = version suppress_warnings = ['image.nonlocal_uri'] # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all # documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # If true, keep warnings as "system message" paragraphs in the built documents. #keep_warnings = False # -- Options for HTML output ---------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'default' try: from better import better_theme_path html_theme_path = [better_theme_path] html_theme = 'better' except ImportError: pass # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = 'logo.png' # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied # directly to the root of the documentation. #html_extra_path = [] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'cutadaptdoc' # -- Options for LaTeX output --------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). 'papersize': 'a4paper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ ('index', 'cutadapt.tex', u'cutadapt Documentation', u'Marcel Martin', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output --------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'cutadapt', u'cutadapt Documentation', [u'Marcel Martin'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'cutadapt', u'cutadapt Documentation', u'Marcel Martin', 'cutadapt', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # If true, do not generate a @detailmenu in the "Top" node's menu. #texinfo_no_detailmenu = False cutadapt-1.15/doc/changes.rst0000664000175000017500000000003413205526454016711 0ustar marcelmarcel00000000000000.. include:: ../CHANGES.rst cutadapt-1.15/doc/guide.rst0000664000175000017500000020312213205526454016401 0ustar marcelmarcel00000000000000========== User guide ========== Basic usage =========== To trim a 3' adapter, the basic command-line for cutadapt is:: cutadapt -a AACCGGTT -o output.fastq input.fastq The sequence of the adapter is given with the ``-a`` option. You need to replace ``AACCGGTT`` with the correct adapter sequence. Reads are read from the input file ``input.fastq`` and are written to the output file ``output.fastq``. Compressed in- and output files are also supported:: cutadapt -a AACCGGTT -o output.fastq.gz input.fastq.gz Cutadapt searches for the adapter in all reads and removes it when it finds it. Unless you use a filtering option, all reads that were present in the input file will also be present in the output file, some of them trimmed, some of them not. Even reads that were trimmed entirely (because the adapter was found in the very beginning) are output. All of this can be changed with command-line options, explained further down. Input and output file formats ----------------------------- Input files for cutadapt need to be in one the these formats: * FASTA with extensions ``.fasta``, ``.fa`` or ``.fna`` * FASTQ with extensions ``.fastq`` or ``.fq`` * Any of the above, but compressed as ``.gz``, ``.bz2`` or ``.xz`` :ref:`Cutadapt’s support for processing of colorspace data is described elsewhere `. Input and output file formats are recognized from the file name extension. You can override the input format with the ``--format`` option. You can use the automatic format detection to convert from FASTQ to FASTA (without doing any adapter trimming):: cutadapt -o output.fasta.gz input.fastq.gz .. _compressed-files: Compressed files ---------------- Cutadapt supports compressed input and output files. Whether an input file needs to be decompressed or an output file needs to be compressed is detected automatically by inspecting the file name: If it ends in ``.gz``, then gzip compression is assumed. This is why the example given above works:: cutadapt -a AACCGGTT -o output.fastq.gz input.fastq.gz All of cutadapt's options that expect a file name support this. Files compressed with bzip2 (``.bz2``) or xz (``.xz``) are also supported, but only if the Python installation includes the proper modules. xz files require Python 3.3 or later. Concatenated bz2 input files are *not supported* on Python versions before 3.3. These files are created by utilities such as ``pbzip2`` (parallel bzip2). Concatenated gz input files *are* supported on all supported Python versions. Standard input and output ------------------------- If no output file is specified via the ``-o`` option, then the output is sent to the standard output stream. Instead of the example command line from above, you can therefore also write:: cutadapt -a AACCGGTT input.fastq > output.fastq There is one difference in behavior if you use cutadapt without ``-o``: The report is sent to the standard error stream instead of standard output. You can redirect it to a file like this:: cutadapt -a AACCGGTT input.fastq > output.fastq 2> report.txt Wherever cutadapt expects a file name, you can also write a dash (``-``) in order to specify that standard input or output should be used. For example:: tail -n 4 input.fastq | cutadapt -a AACCGGTT - > output.fastq The ``tail -n 4`` prints out only the last four lines of ``input.fastq``, which are then piped into cutadapt. Thus, cutadapt will work only on the last read in the input file. In most cases, you should probably use ``-`` at most once for an input file and at most once for an output file, in order not to get mixed output. You cannot combine ``-`` and gzip compression since cutadapt needs to know the file name of the output or input file. if you want to have a gzip-compressed output file, use ``-o`` with an explicit name. One last "trick" is to use ``/dev/null`` as an output file name. This special file discards everything you send into it. If you only want to see the statistics output, for example, and do not care about the trimmed reads at all, you could use something like this:: cutadapt -a AACCGGTT -o /dev/null input.fastq .. _multicore: Multi-core support ------------------ Cutadapt supports parallel processing, that is, it can use multiple CPU cores. Multi-core is currently not enabled by default. To enable it, use the option ``-j N`` (or the spelled-out version ``--cores=N``), where ``N`` is the number of cores to use. Make also sure that you have ``pigz`` (parallel gzip) installed if you use multiple cores and write to a ``.gz`` output file. Otherwise, compression of the output will be done in a single thread and therefore be the main bottleneck. .. note:: In a future release, the plan is to make cutadapt automatically use as many CPU cores as are available, even when no ``--cores`` option was given. Please help to ensure that multi-core support is as stable as possible by `reporting any problems `_ you may find! There are some limitations: * Multi-core is *only* available when you run cutadapt with Python 3.3 or later. * Multi-core cutadapt can only write to output files given by ``-o`` and ``-p``. This implies that the following command-line arguments are not compatible with multi-core: - ``--info-file`` - ``--rest-file`` - ``--wildcard-file`` - ``--untrimmed-output``, ``--untrimmed-paired-output`` - ``--too-short-output``, ``--too-short-paired-output`` - ``--too-long-output``, ``--too-long-paired-output`` - ``--format`` - ``--colorspace`` * Multi-core is also not available when you use cutadapt for demultiplexing. If you try to use multiple cores with an incompatible commandline option, you will get an error message. Some of these limitations will be lifted in the future, as time allows. .. versionadded:: 1.15 Read processing =============== Cutadapt can do a lot more in addition to removing adapters. There are various command-line options that make it possible to modify and filter reads and to redirect them to various output files. Each read is processed in the following way: 1. :ref:`Read modification options ` are applied. This includes :ref:`adapter removal `, :ref:`quality trimming `, read name modifications etc. The order in which they are applied is the order in which they are listed in the help shown by ``cutadapt --help`` under the “Additional read modifications” heading. Adapter trimming itself does not appear in that list and is done after quality trimming and before length trimming (``--length``/``-l``). 2. :ref:`Filtering options ` are applied, such as removal of too short or untrimmed reads. Some of the filters also allow to redirect a read to a separate output file. The filters are applied in the order in which they are listed in the help shown by ``cutadapt --help`` under the “Filtering of processed reads” heading. 3. If the read has passed all the filters, it is written to the output file. .. _removing-adapters: Removing adapters ================= Cutadapt supports trimming of multiple types of adapters: ======================================================= =========================== Adapter type Command-line option ======================================================= =========================== :ref:`3' adapter ` ``-a ADAPTER`` :ref:`5' adapter ` ``-g ADAPTER`` :ref:`Anchored 3' adapter ` ``-a ADAPTER$`` :ref:`Anchored 5' adapter ` ``-g ^ADAPTER`` :ref:`5' or 3' (both possible) ` ``-b ADAPTER`` :ref:`Linked adapter ` ``-a ADAPTER1...ADAPTER2`` :ref:`Non-anchored linked adapter ` ``-g ADAPTER1...ADAPTER2`` ======================================================= =========================== Here is an illustration of the allowed adapter locations relative to the read and depending on the adapter type: | .. image:: _static/adapters.svg | By default, all adapters :ref:`are searched error-tolerantly `. Adapter sequences :ref:`may also contain any IUPAC wildcard character ` (such as ``N``). In addition, it is possible to :ref:`remove a fixed number of bases ` from the beginning or end of each read, and to :ref:`remove low-quality bases (quality trimming) ` from the 3' and 5' ends. .. _three-prime-adapters: 3' adapters ----------- A 3' adapter is a piece of DNA ligated to the 3' end of the DNA fragment you are interested in. The sequencer starts the sequencing process at the 5' end of the fragment and sequences into the adapter if the read is long enough. The read that it outputs will then have a part of the adapter in the end. Or, if the adapter was short and the read length quite long, then the adapter will be somewhere within the read (followed by other bases). For example, assume your fragment of interest is *MYSEQUENCE* and the adapter is *ADAPTER*. Depending on the read length, you will get reads that look like this:: MYSEQUEN MYSEQUENCEADAP MYSEQUENCEADAPTER MYSEQUENCEADAPTERSOMETHINGELSE Use cutadapt's ``-a ADAPTER`` option to remove this type of adapter. This will be the result:: MYSEQUEN MYSEQUENCE MYSEQUENCE MYSEQUENCE As can be seen, cutadapt correctly deals with partial adapter matches, and also with any trailing sequences after the adapter. Cutadapt deals with 3' adapters by removing the adapter itself and any sequence that may follow. If the sequence starts with an adapter, like this:: ADAPTERSOMETHING Then the sequence will be empty after trimming. By default, empty reads are kept and will appear in the output. .. _five-prime-adapters: 5' adapters ----------- .. note:: Unless your adapter may also occur in a degraded form, you probably want to use an anchored 5' adapter, described in the next section. A 5' adapter is a piece of DNA ligated to the 5' end of the DNA fragment of interest. The adapter sequence is expected to appear at the start of the read, but may be partially degraded. The sequence may also appear somewhere within the read. In all cases, the adapter itself and the sequence preceding it is removed. Again, assume your fragment of interest is *MYSEQUENCE* and the adapter is *ADAPTER*. The reads may look like this:: ADAPTERMYSEQUENCE DAPTERMYSEQUENCE TERMYSEQUENCE SOMETHINGADAPTERMYSEQUENCE All the above sequences are trimmed to ``MYSEQUENCE`` when you use `-g ADAPTER`. As with 3' adapters, the resulting read may have a length of zero when the sequence ends with the adapter. For example, the read :: SOMETHINGADAPTER will be empty after trimming. .. _anchored-5adapters: Anchored 5' adapters -------------------- In many cases, the above behavior is not really what you want for trimming 5' adapters. You may know, for example, that degradation does not occur and that the adapter is also not expected to be within the read. Thus, you always expect the read to look like the first example from above:: ADAPTERSOMETHING If you want to trim only this type of adapter, use ``-g ^ADAPTER``. The ``^`` is supposed to indicate the the adapter is "anchored" at the beginning of the read. In other words: The adapter is expected to be a prefix of the read. Note that cases like these are also recognized:: ADAPTER ADAPT ADA The read will simply be empty after trimming. Be aware that cutadapt still searches for adapters error-tolerantly and, in particular, allows insertions. So if your maximum error rate is sufficiently high, even this read will be trimmed:: BADAPTERSOMETHING The ``B`` in the beginning is seen as an insertion. If you also want to prevent this from happening, use the option ``--no-indels`` to disallow insertions and deletions entirely. .. _anchored-3adapters: Anchored 3' adapters -------------------- It is also possible to anchor 3' adapters to the end of the read. This is rarely necessary, but if you have merged, for example, overlapping paired-end reads, then it is useful. Add the ``$`` character to the end of an adapter sequence specified via ``-a`` in order to anchor the adapter to the end of the read, such as ``-a ADAPTER$``. The adapter will only be found if it is a *suffix* of the read, but errors are still allowed as for 5' adapters. You can disable insertions and deletions with ``--no-indels``. Anchored 3' adapters work as if you had reversed the sequence and used an appropriate anchored 5' adapter. As an example, assume you have these reads:: MYSEQUENCEADAP MYSEQUENCEADAPTER MYSEQUENCEADAPTERSOMETHINGELSE Using ``-a ADAPTER$`` will result in:: MYSEQUENCEADAP MYSEQUENCE MYSEQUENCEADAPTERSOMETHINGELSE That is, only the middle read is trimmed at all. .. _linked-adapters: Linked adapters (combined 5' and 3' adapter) -------------------------------------------- If your sequence of interest ist “framed” by a 5' and a 3' adapter, and you want to remove both adapters, then you may want to use a *linked adapter*. A linked adapter combines an anchored 5' adapter and a 3' adapter. The 3' adapter can be regular or anchored. The idea is that a read is only trimmed if the anchored adapters occur. Thus, the 5' adapter is always required, and if the 3' adapter was specified as anchored, it also must exist for a successful match. :ref:`See the previous sections ` for what anchoring means. Use ``-a ADAPTER1...ADAPTER2`` to search for a linked adapter. ADAPTER1 is always interpreted as an anchored 5' adapter. Here, ADAPTER2 is a regular 3' adapter. If you write ``-a ADAPTER1...ADAPTER2$`` instead, then the 3' adapter also becomes anchored, that is, for a read to be trimmed, both adapters must exist at the respective ends. Note that the ADAPTER1 is always interpreted as an anchored 5' adapter even though there is no ``^`` character in the beginning. In summary: * ``-a ADAPTER1...ADAPTER2``: The 5' adapter is removed if it occurs. If a 3' adapter occurs, it is removed only when also a 5' adapter is present. * ``-a ADAPTER1...ADAPTER2$``: The adapters are removed only if both occur. As an example, assume the 5' adapter is *FIRST* and the 3' adapter is *SECOND* and you have these input reads:: FIRSTMYSEQUENCESECONDEXTRABASES FIRSTMYSEQUENCESEC FIRSTMYSEQUE ANOTHERREADSECOND Trimming with :: cutadapt -a FIRST...SECOND -o output.fastq input.fastq will result in :: MYSEQUENCE MYSEQUENCE MYSEQUE ANOTHERREADSECOND The 3' adapter in the last read is not trimmed because the read does not contain the 5' adapter. This feature does not work when used in combination with some other options, such as ``--info-file``, ``--mask-adapter``. .. versionadded:: 1.10 .. versionadded:: 1.13 Ability to anchor the 3' adapter. .. _linked-nonanchored: Linked adapters without anchoring ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This adapter type is especially suited for trimming CRISR screening reads. Sometimes, the 5' adapter of a linked adapter pair should not be anchored. It is possible to specify linked adapters also with ``-g ADAPTER1...ADAPTER2`` (note that ``-g`` is used instead of ``-a``). These work like the linked adapters described in the previous section, but with these two differences: * The 5' adapter is not anchored by default. (So neither the 5' nor 3' adapter are anchored.) * *Both* adapters are required. If one of them is not found, the read is not trimmed. That is, when you use the `--discard-untrimmed`` option (or ``--trimmed-only``) with a linked adapter specified with ``-g``, then a read is considered to be trimmed if *both* adapter parts (5' and 3') are present in the read. This is different from linked adapters specified with ``-a``, where a non-anchored 3' adapter is optional. This feature has been added on a tentative basis. It may change in the next program version. .. versionadded:: 1.13 .. versionchanged:: 1.15 Require both adapters for a read to be trimmed. Linked adapter statistics ~~~~~~~~~~~~~~~~~~~~~~~~~ For linked adapters, the statistics report contains a line like this:: === Adapter 1 === Sequence: AAAAAAAAA...TTTTTTTTTT; Type: linked; Length: 9+10; Trimmed: 3 times; Half matches: 2 The value for “Half matches” tells you how often only the 5'-side of the adapter was found, but not the 3'-side of it. This applies only to linked adapters with regular (non-anchored) 3' adapters. .. _anywhere-adapters: 5' or 3' adapters ----------------- The last type of adapter is a combination of the 5' and 3' adapter. You can use it when your adapter is ligated to the 5' end for some reads and to the 3' end in other reads. This probably does not happen very often, and this adapter type was in fact originally implemented because the library preparation in an experiment did not work as it was supposed to. For this type of adapter, the sequence is specified with ``-b ADAPTER`` (or use the longer spelling ``--anywhere ADAPTER``). The adapter may appear in the beginning (even degraded), within the read, or at the end of the read (even partially). The decision which part of the read to remove is made as follows: If there is at least one base before the found adapter, then the adapter is considered to be a 3' adapter and the adapter itself and everything following it is removed. Otherwise, the adapter is considered to be a 5' adapter and it is removed from the read, but the sequence after it remains. Here are some examples. ============================== =================== ===================== Read before trimming Read after trimming Detected adapter type ============================== =================== ===================== ``MYSEQUENCEADAPTERSOMETHING`` ``MYSEQUENCE`` 3' adapter ``MYSEQUENCEADAPTER`` ``MYSEQUENCE`` 3' adapter ``MYSEQUENCEADAP`` ``MYSEQUENCE`` 3' adapter ``MADAPTER`` ``M`` 3' adapter ``ADAPTERMYSEQUENCE`` ``MYSEQUENCE`` 5' adapter ``PTERMYSEQUENCE`` ``MYSEQUENCE`` 5' adapter ``TERMYSEQUENCE`` ``MYSEQUENCE`` 5' adapter ============================== =================== ===================== The ``-b`` option cannot be used with colorspace data. .. _error-tolerance: Error tolerance --------------- All searches for adapter sequences are error tolerant. Allowed errors are mismatches, insertions and deletions. For example, if you search for the adapter sequence ``ADAPTER`` and the error tolerance is set appropriately (as explained below), then also ``ADABTER`` will be found (with 1 mismatch), as well as ``ADAPTR`` (with 1 deletion), and also ``ADAPPTER`` (with 1 insertion). The level of error tolerance is adjusted by specifying a *maximum error rate*, which is 0.1 (=10%) by default. Use the ``-e`` option to set a different value. To determine the number of allowed errors, the maximum error rate is multiplied by the length of the match (and then rounded off). What does that mean? Assume you have a long adapter ``LONGADAPTER`` and it appears in full somewhere within the read. The length of the match is 11 characters since the full adapter has a length of 11, therefore 11·0.1=1.1 errors are allowed with the default maximum error rate of 0.1. This is rounded off to 1 allowed error. So the adapter will be found within this read:: SEQUENCELONGADUPTERSOMETHING If the match is a bit shorter, however, the result is different:: SEQUENCELONGADUPT Only 9 characters of the adapter match: ``LONGADAPT`` matches ``LONGADUPT`` with one substitution. Therefore, only 9·0.1=0.9 errors are allowed. Since this is rounded off to zero allowed errors, the adapter will not be found. The number of errors allowed for a given adapter match length is also shown in the report that cutadapt prints:: Sequence: 'LONGADAPTER'; Length: 11; Trimmed: 2 times. No. of allowed errors: 0-9 bp: 0; 10-11 bp: 1 This tells us what we now already know: For match lengths of 0-9 bases, zero errors are allowed and for matches of length 10-11 bases, one error is allowed. The reason for this behavior is to ensure that short matches are not favored unfairly. For example, assume the adapter has 40 bases and the maximum error rate is 0.1, which means that four errors are allowed for full-length matches. If four errors were allowed even for a short match such as one with 10 bases, this would mean that the error rate for such a case is 40%, which is clearly not what was desired. Insertions and deletions can be disallowed by using the option ``--no-indels``. See also the :ref:`section on details of the alignment algorithm `. Multiple adapter occurrences within a single read ------------------------------------------------- If a single read contains multiple copies of the same adapter, the basic rule is that the leftmost match is used for both 5' and 3' adapters. For example, when searching for a 3' adapter in :: cccccADAPTERgggggADAPTERttttt the read will be trimmed to :: ccccc When the adapter is a 5' adapter instead, the read will be trimmed to :: gggggADAPTERttttt The above applies when both occurrences of the adapter are *exact* matches, and it also applies when both occurrences of the adapter are *inexact* matches (that is, it has at least one indel or mismatch). However, if one match is exact, but the other is inexact, then the exact match wins, even if it is not the leftmost one! The reason for this behavior is that cutadapt searches for exact matches first and, to improve performance, skips the error-tolerant matching step if an exact match was found. Reducing random matches ----------------------- Since cutadapt allows partial matches between the read and the adapter sequence, short matches can occur by chance, leading to erroneously trimmed bases. For example, roughly 25% of all reads end with a base that is identical to the first base of the adapter. To reduce the number of falsely trimmed bases, the alignment algorithm requires that at least *three bases* match between adapter and read. The minimum overlap length can be changed with the parameter ``--overlap`` (or its short version ``-O``). Shorter matches are simply ignored, and the bases are not trimmed. Requiring at least three bases to match is quite conservative. Even if no minimum overlap was required, we can compute that we lose only about 0.44 bases per read on average, see `Section 2.3.3 in my thesis `_. With the default minimum overlap length of 3, only about 0.07 bases are lost per read. When choosing an appropriate minimum overlap length, take into account that true adapter matches are also lost when the overlap length is higher than zero, reducing cutadapt's sensitivity. .. _wildcards: Wildcards --------- All `IUPAC nucleotide codes `_ (wildcard characters) are supported. For example, use an ``N`` in the adapter sequence to match any nucleotide in the read, or use ``-a YACGT`` for an adapter that matches both ``CACGT`` and ``TACGT``. The wildcard character ``N`` is useful for trimming adapters with an embedded variable barcode:: cutadapt -a ACGTAANNNNTTAGC -o output.fastq input.fastq Even the ``X`` wildcard that does not match any nucleotide is supported. It is useful, for example, :ref:`as a trick for avoiding internal adapter matches `. Wildcard characters are by default only allowed in adapter sequences and are not recognized when they occur in a read. This is to avoid matches in reads that consist of many (often low-quality) ``N`` bases. Use ``--match-read-wildcards`` to enable wildcards also in reads. Use the option ``-N`` to disable interpretation of wildcard characters even in the adapters. If wildcards are disabled entirely, that is, when you use ``-N`` and *do not* use ``--match-read-wildcards``, then cutadapt compares characters by their ASCII value. Thus, both the read and adapter can be arbitrary strings (such as ``SEQUENCE`` or ``ADAPTER`` as used here in the examples). Wildcards do not work in colorspace. Repeated bases in the adapter sequence -------------------------------------- If you have many repeated bases in the adapter sequence, such as many ``N`` s or many ``A`` s, you do not have to spell them out. For example, instead of writing ten ``A`` in a row (``AAAAAAAAAA``), write ``A{10}`` instead. The number within the curly braces specifies how often the character that preceeds it will be repeated. This works also for IUPAC wildcard characters, as in ``N{5}``. It is recommended that you use quotation marks around your adapter sequence if you use this feature. For poly-A trimming, for example, you would write:: cutadapt -a "A{100}" -o output.fastq input.fastq .. _modifying-reads: Modifying reads =============== This section describes in which ways reads can be modified other than adapter removal. .. _cut-bases: Removing a fixed number of bases -------------------------------- By using the ``--cut`` option or its abbreviation ``-u``, it is possible to unconditionally remove bases from the beginning or end of each read. If the given length is positive, the bases are removed from the beginning of each read. If it is negative, the bases are removed from the end. For example, to remove the first five bases of each read:: cutadapt -u 5 -o trimmed.fastq reads.fastq To remove the last seven bases of each read:: cutadapt -u -7 -o trimmed.fastq reads.fastq The ``-u``/``--cut`` option can be combined with the other options, but the ``--cut`` is applied *before* any adapter trimming. .. _quality-trimming: Quality trimming ---------------- The ``-q`` (or ``--quality-cutoff``) parameter can be used to trim low-quality ends from reads before adapter removal. For this to work correctly, the quality values must be encoded as ascii(phred quality + 33). If they are encoded as ascii(phred quality + 64), you need to add ``--quality-base=64`` to the command line. Quality trimming can be done without adapter trimming, so this will work:: cutadapt -q 10 -o output.fastq input.fastq By default, only the 3' end of each read is quality-trimmed. If you want to trim the 5' end as well, use the ``-q`` option with two comma-separated cutoffs:: cutadapt -q 15,10 -o output.fastq input.fastq The 5' end will then be trimmed with a cutoff of 15, and the 3' end will be trimmed with a cutoff of 10. If you only want to trim the 5' end, then use a cutoff of 0 for the 3' end, as in ``-q 10,0``. .. _nextseq-trim: Quality trimming of reads using two-color chemistry (NextSeq) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Some Illumina instruments use a two-color chemistry to encode the four bases. This includes the NextSeq and the (at the time of this writing) recently announced NovaSeq. In those instruments, a 'dark cycle' (with no detected color) encodes a ``G``. However, dark cycles also occur when when sequencing "falls off" the end of the fragment. The read then `contains a run of high-quality, but incorrect ``G`` calls `_ at its 3' end. Since the regular quality-trimming algorithm cannot deal with this situation, you need to use the ``--nextseq-trim`` option:: cutadapt --nextseq-trim=20 -o out.fastq input.fastq This works like regular quality trimming (where one would use ``-q 20`` instead), except that the qualities of ``G`` bases are ignored. .. versionadded:: 1.10 Quality trimming algorithm ~~~~~~~~~~~~~~~~~~~~~~~~~~ The trimming algorithm is the same as the one used by BWA, but applied to both ends of the read in turn (if requested). That is: Subtract the given cutoff from all qualities; compute partial sums from all indices to the end of the sequence; cut the sequence at the index at which the sum is minimal. If both ends are to be trimmed, repeat this for the other end. The basic idea is to remove all bases starting from the end of the read whose quality is smaller than the given threshold. This is refined a bit by allowing some good-quality bases among the bad-quality ones. In the following example, we assume that the 3' end is to be quality-trimmed. Assume you use a threshold of 10 and have these quality values: 42, 40, 26, 27, 8, 7, 11, 4, 2, 3 Subtracting the threshold gives: 32, 30, 16, 17, -2, -3, 1, -6, -8, -7 Then sum up the numbers, starting from the end (partial sums). Stop early if the sum is greater than zero: (70), (38), 8, -8, -25, -23, -20, -21, -15, -7 The numbers in parentheses are not computed (because 8 is greater than zero), but shown here for completeness. The position of the minimum (-25) is used as the trimming position. Therefore, the read is trimmed to the first four bases, which have quality values 42, 40, 26, 27. Shortening reads to a fixed length ---------------------------------- To shorten each read down to a certain length, use the ``--length`` option or the short version ``-l``:: cutadapt -l 10 -o output.fastq.gz input.fastq.gz This shortens all reads from ``input.fastq.gz`` down to 10 bases. The removed bases are those on the 3' end. If you want to remove a fixed number of bases from each read, use :ref:`the --cut option instead `. Modifying read names -------------------- If you feel the need to modify the names of processed reads, some of the following options may be useful. Use ``-y`` or ``--suffix`` to append a text to read names. The given string can contain the placeholder ``{name}``, which will be replaced with the name of the adapter found in that read. For example, writing :: cutadapt -a adapter1=ACGT -y ' we found {name}' input.fastq changes a read named ``read1`` to ``read1 we found adapter1`` if the adapter ``ACGT`` was found. The options ``-x``/``--prefix`` work the same, but the text is added in front of the read name. For both options, spaces need to be specified explicitly, as in the above example. If no adapter was found in a read, the text ``no_adapter`` is inserted for ``{name}``. In order to remove a suffix of each read name, use ``--strip-suffix``. Some old 454 read files contain the length of the read in the name:: >read1 length=17 ACGTACGTACAAAAAAA If you want to update this to the correct length after trimming, use the option ``--length-tag``. In this example, this would be ``--length-tag 'length='``. After trimming, the read would perhaps look like this:: >read1 length=10 ACGTACGTAC Read modification order ----------------------- The read modifications described above are applied in the following order to each read. Steps not requested on the command-line are skipped. 1. Unconditional base removal with ``--cut`` 2. Quality trimming (``-q``) 3. Adapter trimming (``-a``, ``-b``, ``-g`` and uppercase versions) 4. Read shortening (``--length``) 5. N-end trimming (``--trim-n``) 6. Length tag modification (``--length-tag``) 7. Read name suffix removal (``--strip-suffix``) 8. Addition of prefix and suffix to read name (``-x``/``--prefix`` and ``-y``/``--suffix``) 9. Double-encode the sequence (only colorspace) 10. Replace negative quality values with zero (zero capping, only colorspace) 11. Trim primer base (only colorspace) The last three steps are colorspace-specific. .. _filtering: Filtering reads =============== By default, all processed reads, no matter whether they were trimmed are not, are written to the output file specified by the ``-o`` option (or to standard output if ``-o`` was not provided). For paired-end reads, the second read in a pair is always written to the file specified by the ``-p`` option. The options described here make it possible to filter reads by either discarding them entirely or by redirecting them to other files. When redirecting reads, the basic rule is that *each read is written to at most one file*. You cannot write reads to more than one output file. In the following, the term "processed read" refers to a read to which all modifications have been applied (adapter removal, quality trimming etc.). A processed read can be identical to the input read if no modifications were done. ``--minimum-length LENGTH`` or ``-m LENGTH`` Discard processed reads that are shorter than LENGTH. Reads that are too short even before adapter removal are also discarded. Without this option, reads that have a length of zero (empty reads) are kept in the output. ``--too-short-output FILE`` Instead of discarding the reads that are too short according to ``-m``, write them to *FILE* (in FASTA/FASTQ format). ``--maximum-length LENGTH`` or ``-M LENGTH`` Discard processed reads that are longer than LENGTH. Reads that are too long even before adapter removal are also discarded. ``--too-long-output FILE`` Instead of discarding reads that are too long (according to ``-M``), write them to *FILE* (in FASTA/FASTQ format). ``--untrimmed-output FILE`` Write all reads without adapters to *FILE* (in FASTA/FASTQ format) instead of writing them to the regular output file. ``--discard-trimmed`` Discard reads in which an adapter was found. ``--discard-untrimmed`` Discard reads in which *no* adapter was found. This has the same effect as specifying ``--untrimmed-output /dev/null``. The options ``--too-short-output`` and ``--too-long-output`` are applied first. This means, for example, that a read that is too long will never end up in the ``--untrimmed-output`` file when ``--too-long-output`` was given, no matter whether it was trimmed or not. The options ``--untrimmed-output``, ``--discard-trimmed`` and ``-discard-untrimmed`` are mutually exclusive. .. _paired-end: Trimming paired-end reads ========================= Cutadapt supports trimming of paired-end reads, trimming both reads in a pair at the same time. Assume the input is in ``reads.1.fastq`` and ``reads.2.fastq`` and that ``ADAPTER_FWD`` should be trimmed from the forward reads (first file) and ``ADAPTER_REV`` from the reverse reads (second file). The basic command-line is:: cutadapt -a ADAPTER_FWD -A ADAPTER_REV -o out.1.fastq -p out.2.fastq reads.1.fastq reads.2.fastq ``-p`` is the short form of ``--paired-output``. The option ``-A`` is used here to specify an adapter sequence that cutadapt should remove from the second read in each pair. There are also the options ``-G``, ``-B``. All of them work just like their lowercase counterparts, except that the adapter is searched for in the second read in each paired-end read. There is also option ``-U``, which you can use to remove a fixed number of bases from the second read in a pair. While it is possible to run cutadapt on the two files separately, processing both files at the same time is highly recommended since the program can check for problems in your input files only when they are processed together. When you use ``-p``/``--paired-output``, cutadapt checks whether the files are properly paired. An error is raised if one of the files contains more reads than the other or if the read names in the two files do not match. Only the part of the read name before the first space is considered. If the read name ends with ``/1`` or ``/2``, then that is also ignored. For example, two FASTQ headers that would be considered to denote properly paired reads are:: @my_read/1 a comment and:: @my_read/2 another comment This is an example for *improperly paired* read names:: @my_read/1;1 and:: @my_read/2;1 Since the ``/1`` and ``/2`` are ignored only if the occur at the end of the read name, and since the ``;1`` is considered to be part of the read name, these reads will not be considered to be propely paired. As soon as you start to use one of the filtering options that discard reads, it is mandatory you process both files at the same time to make sure that the output files are kept synchronized: If a read is removed from one of the files, cutadapt will ensure it is also removed from the other file. The following command-line options are applied to *both* reads: * ``-q`` (along with ``--quality-base``) * ``--times`` applies to all the adapters given * ``--no-trim`` * ``--trim-n`` * ``--mask`` * ``--length`` * ``--length-tag`` * ``--prefix``, ``--suffix`` * ``--strip-f3`` * ``--colorspace``, ``--bwa``, ``-z``, ``--no-zero-cap``, ``--double-encode``, ``--trim-primer`` The following limitations still exist: * The ``--info-file``, ``--rest-file`` and ``--wildcard-file`` options write out information only from the first read. .. _filtering-paired: Filtering paired-end reads -------------------------- The :ref:`filtering options listed above ` can also be used when trimming paired-end data. Importantly, cutadapt *always discards both reads of a pair* if it determines that the pair should be discarded. This ensures that the reads in the output files are in sync. (If you don’t want or need this, you can run cutadapt separately on the R1 and R2 files.) The same applies also to the options that redirect reads to other files if they fulfill a filtering criterion, such as ``--too-short-output``/``--too-short-paired-output``. That is, the reads are always sent in pairs to these alternative output files. By default, a read pair is discarded (or redirected) if one of the reads (R1 or R2) fulfills the filtering criterion. As an example, if option ``--minimum-length=20`` is used and paired-end data is processed, a read pair if discarded if one of the reads is shorter than 20 nt. To require that filtering criteria must apply to *both* reads in order for a read pair to be discarded, use the option ``--pair-filter=both``. The following table describes the effect for each filtering option. +----------------------------+------------------------------------------------+-----------------------------------------+ | Filtering option | With ``--pair-filter=any``, the pair | With ``-pair-filter=both``, the pair | | | is discarded if ... | is discarded if ... | +============================+================================================+=========================================+ | ``--minimum-length`` | one of the reads is too short | both reads are too short | +----------------------------+------------------------------------------------+-----------------------------------------+ | ``--maximum-length`` | one of the reads is too long | both reads are too long | +----------------------------+------------------------------------------------+-----------------------------------------+ | ``--discard-trimmed`` | one of the reads contains an adapter | both reads contain an adapter | +----------------------------+------------------------------------------------+-----------------------------------------+ | ``--discard-untrimmed`` | one of the reads does not contain an adapter | both reads do not contain an adapter | +----------------------------+------------------------------------------------+-----------------------------------------+ | ``--max-n`` | one of the reads contains too many ``N`` bases | both reads contain too many ``N`` bases | +----------------------------+------------------------------------------------+-----------------------------------------+ To further complicate matters, cutadapt switches to a backwards compatibility mode ("legacy mode") when none of the uppercase modification options (``-A``/``-B``/``-G``/``-U``) are given. In that mode, filtering criteria are checked only for the *first* read. Cutadapt will also tell you at the top of the report whether legacy mode is active. Check that line if you get strange results! These are the paired-end specific filtering and output options: ``--paired-output FILE`` or ``-p FILE`` Write the second read of each processed pair to *FILE* (in FASTA/FASTQ format). ``--untrimmed-paired-output FILE`` Used together with ``--untrimmed-output``. The second read in a pair is written to this file when the processed pair was *not* trimmed. ``--too-short-paired-output FILE`` Write the second read in a pair to this file if pair is too short. Use together with ``--too-short-output``. ``--too-long-paired-output FILE`` Write the second read in a pair to this file if pair is too long. Use together with ``--too-long-output``. ``--pair-filter=(any|both)`` Which of the reads in a paired-end read have to match the filtering criterion in order for it to be filtered. Note that the option names can be abbreviated as long as it is clear which option is meant (unique prefix). For example, instead of ``--untrimmed-output`` and ``--untrimmed-paired-output``, you can write ``--untrimmed-o`` and ``--untrimmed-p``. Interleaved paired-end reads ---------------------------- Paired-end reads can be read from a single FASTQ file in which the entries for the first and second read from each pair alternate. The first read in each pair comes before the second. Enable this file format by adding the ``--interleaved`` option to the command-line. For example:: cutadapt --interleaved -q 20 -a ACGT -A TGCA -o trimmed.fastq reads.fastq To read from an interleaved file, but write regular two-file output, provide the second output file as usual with the ``-p`` option:: cutadapt --interleaved -q 20 -a ACGT -A TGCA -o trimmed.1.fastq -p trimmed.2.fastq reads.fastq Reading two-file input and writing interleaved is also possible by providing a second input file:: cutadapt --interleaved -q 20 -a ACGT -A TGCA -o trimmed.1.fastq reads.1.fastq reads.2.fastq Cutadapt will detect if an input file is not properly interleaved by checking whether read names match and whether the file contains an even number of entries. When ``--interleaved`` is used, legacy mode is disabled (that is, read-modification options such as ``-q`` always apply to both reads). Legacy paired-end read trimming ------------------------------- .. note:: This section describes the way paired-end trimming was done in cutadapt before 1.8, where the ``-A``, ``-G``, ``-B`` options were not available. It is less safe and more complicated, but you can still use it. If you do not use any of the filtering options that discard reads, such as ``--discard``, ``--minimum-length`` or ``--maximum-length``, you can run cutadapt on each file separately:: cutadapt -a ADAPTER_FWD -o trimmed.1.fastq reads1.fastq cutadapt -a ADAPTER_REV -o trimmed.2.fastq reads2.fastq You can use the options that are listed under 'Additional modifications' in cutadapt's help output without problems. For example, if you want to quality-trim the first read in each pair with a threshold of 10, and the second read in each pair with a threshold of 15, then the commands could be:: cutadapt -q 10 -a ADAPTER_FWD -o trimmed.1.fastq reads1.fastq cutadapt -q 15 -a ADAPTER_REV -o trimmed.2.fastq reads2.fastq If you use any of the filtering options, you must use cutadapt in the following way (with the ``-p`` option) to make sure that read pairs remain sychronized. First trim the forward read, writing output to temporary files (we also add some quality trimming):: cutadapt -q 10 -a ADAPTER_FWD --minimum-length 20 -o tmp.1.fastq -p tmp.2.fastq reads.1.fastq reads.2.fastq Then trim the reverse read, using the temporary files as input:: cutadapt -q 15 -a ADAPTER_REV --minimum-length 20 -o trimmed.2.fastq -p trimmed.1.fastq tmp.2.fastq tmp.1.fastq Finally, remove the temporary files:: rm tmp.1.fastq tmp.2.fastq Please see the previous section for a much simpler way of trimming paired-end reads! In legacy paired-end mode, the read-modifying options such as ``-q`` only apply to the first file in each call to cutadapt (first ``reads.1.fastq``, then ``tmp.2.fastq`` in this example). Reads in the second file are not affected by those options, but by the filtering options: If a read in the first file is discarded, then the matching read in the second file is also filtered and not written to the output given by ``--paired-output`` in order to keep both output files synchronized. .. _multiple-adapters: Multiple adapters ================= It is possible to specify more than one adapter sequence by using the options ``-a``, ``-b`` and ``-g`` more than once. Any combination is allowed, such as five ``-a`` adapters and two ``-g`` adapters. Each read will be searched for all given adapters, but **only the best matching adapter is removed**. (But it is possible to :ref:`trim more than one adapter from each read `). This is how a command may look like to trim one of two possible 3' adapters:: cutadapt -a TGAGACACGCA -a AGGCACACAGGG -o output.fastq input.fastq The adapter sequences can also be read from a FASTA file. Instead of giving an explicit adapter sequence, you need to write ``file:`` followed by the name of the FASTA file:: cutadapt -a file:adapters.fasta -o output.fastq input.fastq All of the sequences in the file ``adapters.fasta`` will be used as 3' adapters. The other adapter options ``-b`` and ``-g`` also support this. Again, only the best matching adapter is trimmed from each read. When cutadapt has multiple adapter sequences to work with, either specified explicitly on the command line or via a FASTA file, it decides in the following way which adapter should be trimmed: * All given adapter sequences are matched to the read. * Adapter matches where the overlap length (see the ``-O`` parameter) is too small or where the error rate is too high (``-e``) are removed from further consideration. * Among the remaining matches, the one with the **greatest number of matching bases** is chosen. * If there is a tie, the first adapter wins. The order of adapters is the order in which they are given on the command line or in which they are found in the FASTA file. If your adapter sequences are all similar and differ only by a variable barcode sequence, you should use a single adapter sequence instead that :ref:`contains wildcard characters `. If you want to search for a combination of a 5' and a 3' adapter, you may want to provide them as a single so-called :ref:`"linked adapter" ` instead. .. _named-adapters: Named adapters -------------- Cutadapt reports statistics for each adapter separately. To identify the adapters, they are numbered and the adapter sequence is also printed:: === Adapter 1 === Sequence: AACCGGTT; Length 8; Trimmed: 5 times. If you want this to look a bit nicer, you can give each adapter a name in this way:: cutadapt -a My_Adapter=AACCGGTT -o output.fastq input.fastq The actual adapter sequence in this example is ``AACCGGTT`` and the name assigned to it is ``My_Adapter``. The report will then contain this name in addition to the other information:: === Adapter 'My_Adapter' === Sequence: TTAGACATATCTCCGTCG; Length 18; Trimmed: 5 times. When adapters are read from a FASTA file, the sequence header is used as the adapter name. Adapter names are also used in column 8 of :ref:`info files `. .. _demultiplexing: Demultiplexing -------------- Cutadapt supports demultiplexing, which means that reads are written to different output files depending on which adapter was found in them. To use this, include the string ``{name}`` in the name of the output file and give each adapter a name. The path is then interpreted as a template and each trimmed read is written to the path in which ``{name}`` is replaced with the name of the adapter that was found in the read. Reads in which no adapter was found will be written to a file in which ``{name}`` is replaced with ``unknown``. Example:: cutadapt -a one=TATA -a two=GCGC -o trimmed-{name}.fastq.gz input.fastq.gz This command will create the three files ``demulti-one.fastq.gz``, ``demulti-two.fastq.gz`` and ``demulti-unknown.fastq.gz``. You can :ref:`also provide adapter sequences in a FASTA file `. In order to not trim the input files at all, but to only do multiplexing, use option ``--no-trim``. And if you want to output the reads in which no adapters were found to a different file, use the ``--untrimmed-output`` parameter with a file name. Here is an example that uses both parameters and reads the adapters from a FASTA file (note that ``--untrimmed-output`` can be abbreviated):: cutadapt -a file:barcodes.fasta --no-trim --untrimmed-o untrimmed.fastq.gz -o trimmed-{name}.fastq.gz input.fastq.gz Here is a made-up example for the ``barcodes.fasta`` file:: >barcode01 TTAAGGCC >barcode02 TAGCTAGC >barcode03 ATGATGAT Demultiplexing is also supported for paired-end data if you provide the ``{name}`` template in both output file names (``-o`` and ``-p``). Paired-end demultiplexing always uses the adapter matches of the *first* read to decide where a read should be written. If adapters to be found in read 2 are given (``-A``/``-G``), they are detected and removed as normal, but these matches do not influence where the read pair is written. This is to ensure that read 1 and read 2 are always synchronized. Example:: cutadapt -a first=AACCGG -a second=TTTTGG -A ACGTACGT -A TGCATGCA -o trimmed-{name}.1.fastq.gz -p trimmed-{name}.2.fastq.gz input.1.fastq.gz input.2.fastq.gz This will create up to six output files named ``trimmed-first.1.fastq.gz``, ``trimmed-second.1.fastq.gz``, ``trimmed-unknown.1.fastq.gz`` and ``trimmed-first.2.fastq.gz``, ``trimmed-second.2.fastq.gz``, ``trimmed-unknown.2.fastq.gz``. You can use ``--untrimmed-paired-output`` to change the name for the output file that receives the untrimmed second reads. .. versionadded:: 1.15 Demultiplexing of paired-end data. .. _more-than-one: Trimming more than one adapter from each read --------------------------------------------- By default, at most one adapter sequence is removed from each read, even if multiple adapter sequences were provided. This can be changed by using the ``--times`` option (or its abbreviated form ``-n``). Cutadapt will then search for all the given adapter sequences repeatedly, either until no adapter match was found or until the specified number of rounds was reached. As an example, assume you have a protocol in which a 5' adapter gets ligated to your DNA fragment, but it's possible that the adapter is ligated more than once. So your sequence could look like this:: ADAPTERADAPTERADAPTERMYSEQUENCE To be on the safe side, you assume that there are at most five copies of the adapter sequence. This command can be used to trim the reads correctly:: cutadapt -g ^ADAPTER -n 5 -o output.fastq.gz input.fastq.gz To search for a combination of a 5' and a 3' adapter, have a look at the :ref:`support for "linked adapters" ` instead, which works better for that particular case because it is allows you to require that the 3' adapter is trimmed only when the 5' adapter also occurs, and it cannot happen that the same adapter is trimmed twice. Before cutadapt supported linked adapters, the ``--times`` option was the recommended way to search for 5'/3' linked adapters. For completeness, we describe how it was done. For example, when the 5' adapter is *FIRST* and the 3' adapter is *SECOND*, then the read could look like this:: FIRSTMYSEQUENCESECOND That is, the sequence of interest is framed by the 5' and the 3' adapter. The following command can be used to trim such a read:: cutadapt -g ^FIRST -a SECOND -n 2 ... .. _truseq: Illumina TruSeq =============== If you have reads containing Illumina TruSeq adapters, follow these steps. Single-end reads as well as the first reads of paired-end data need to be trimmed with ``A`` + the “TruSeq Indexed Adapter”. Use only the prefix of the adapter sequence that is common to all Indexed Adapter sequences:: cutadapt -a AGATCGGAAGAGCACACGTCTGAACTCCAGTCAC -o trimmed.fastq.gz reads.fastq.gz If you have paired-end data, trim also read 2 with the reverse complement of the “TruSeq Universal Adapter”. The full command-line looks as follows:: cutadapt \ -a AGATCGGAAGAGCACACGTCTGAACTCCAGTCAC \ -A AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGTAGATCTCGGTGGTCGCCGTATCATT \ -o trimmed.1.fastq.gz -p trimmed.2.fastq.gz \ reads.1.fastq.gz reads.2.fastq.gz See also the :ref:`section about paired-end adapter trimming above `. If you want to simplify this a bit, you can also use the common prefix ``AGATCGGAAGAGC`` as the adapter sequence in both cases. However, you should be aware that this sequence occurs multiple times in the human genome and it could therefore skew your results very slightly at those loci :: cutadapt \ -a AGATCGGAAGAGC -A AGATCGGAAGAGC \ -o trimmed.1.fastq.gz -p trimmed.2.fastq.gz \ reads.1.fastq.gz reads.2.fastq.gz The adapter sequences can be found in the document `Illumina TruSeq Adapters De-Mystified `__. Under some circumstances you may want to consider not trimming adapters at all. If you have whole-exome or whole-genome reads, there will be very few reads with adapters anyway. And if you use BWA-MEM, the trailing (5') bases of a read that do not match the reference are soft-clipped, which covers those cases in which an adapter does occur. .. _warnbase: Warning about incomplete adapter sequences ------------------------------------------ Sometimes cutadapt’s report ends with these lines:: WARNING: One or more of your adapter sequences may be incomplete. Please see the detailed output above. Further up, you’ll see a message like this:: Bases preceding removed adapters: A: 95.5% C: 1.0% G: 1.6% T: 1.6% none/other: 0.3% WARNING: The adapter is preceded by "A" extremely often. The provided adapter sequence may be incomplete. To fix the problem, add "A" to the beginning of the adapter sequence. This means that in 95.5% of the cases in which an adapter was removed from a read, the base coming *before* that was an ``A``. If your DNA fragments are not random, such as in amplicon sequencing, then this is to be expected and the warning can be ignored. If the DNA fragments are supposed to be random, then the message may be genuine: The adapter sequence may be incomplete and should include an additional ``A`` in the beginning. This warning exists because some documents list the Illumina TruSeq adapters as starting with ``GATCGGA...``. While that is technically correct, the library preparation actually results in an additional ``A`` before that sequence, which also needs to be removed. See the :ref:`previous section ` for the correct sequence. .. _dealing-with-ns: Dealing with ``N`` bases ======================== Cutadapt supports the following options to deal with ``N`` bases in your reads: ``--max-n COUNT`` Discard reads containing more than *COUNT* ``N`` bases. A fractional *COUNT* between 0 and 1 can also be given and will be treated as the proportion of maximally allowed ``N`` bases in the read. ``--trim-n`` Remove flanking ``N`` bases from each read. That is, a read such as this:: NNACGTACGTNNNN Is trimmed to just ``ACGTACGT``. This option is applied *after* adapter trimming. If you want to get rid of ``N`` bases before adapter removal, use quality trimming: ``N`` bases typically also have a low quality value associated with them. .. _bisulfite: Bisulfite sequencing (RRBS) =========================== When trimming reads that come from a library prepared with the RRBS (reduced representation bisulfite sequencing) protocol, the last two 3' bases must be removed in addition to the adapter itself. This can be achieved by using not the adapter sequence itself, but by adding two wildcard characters to its beginning. If the adapter sequence is ``ADAPTER``, the command for trimming should be:: cutadapt -a NNADAPTER -o output.fastq input.fastq Details can be found in `Babraham bioinformatics' "Brief guide to RRBS" `_. A summary follows. During RRBS library preparation, DNA is digested with the restriction enzyme MspI, generating a two-base overhang on the 5' end (``CG``). MspI recognizes the sequence ``CCGG`` and cuts between ``C`` and ``CGG``. A double-stranded DNA fragment is cut in this way:: 5'-NNNC|CGGNNN-3' 3'-NNNGGC|CNNN-5' The fragment between two MspI restriction sites looks like this:: 5'-CGGNNN...NNNC-3' 3'-CNNN...NNNGGC-5' Before sequencing (or PCR) adapters can be ligated, the missing base positions must be filled in with GTP and CTP:: 5'-ADAPTER-CGGNNN...NNNCcg-ADAPTER-3' 3'-ADAPTER-gcCNNN...NNNGGC-ADAPTER-5' The filled-in bases, marked in lowercase above, do not contain any original methylation information, and must therefore not be used for methylation calling. By prefixing the adapter sequence with ``NN``, the bases will be automatically stripped during adapter trimming. Cutadapt's output ================= How to read the report ---------------------- After every run, cutadapt prints out per-adapter statistics. The output starts with something like this:: Sequence: 'ACGTACGTACGTTAGCTAGC'; Length: 20; Trimmed: 2402 times. The meaning of this should be obvious. The next piece of information is this:: No. of allowed errors: 0-7 bp: 0; 8-15 bp: 1; 16-20 bp: 2 The adapter, as was shown above, has a length of 20 characters. We are using a custom error rate of 0.12. What this implies is shown above: Matches up to a length of 7 bp are allowed to have no errors. Matches of lengths 8-15 bp are allowd to have 1 error and matches of length 16 or more can have 2 errors. See also :ref:`the section about error-tolerant matching `. Finally, a table is output that gives more detailed information about the lengths of the removed sequences. The following is only an excerpt; some rows are left out:: Overview of removed sequences length count expect max.err error counts 3 140 156.2 0 140 4 57 39.1 0 57 5 50 9.8 0 50 6 35 2.4 0 35 7 13 0.3 0 1 12 8 31 0.1 1 0 31 ... 100 397 0.0 3 358 36 3 The first row tells us the following: Three bases were removed in 140 reads; randomly, one would expect this to occur 156.2 times; the maximum number of errors at that match length is 0 (this is actually redundant since we know already that no errors are allowed at lengths 0-7 bp). The last column shows the number of reads that had 0, 1, 2 ... errors. In the last row, for example, 358 reads matched the adapter with zero errors, 36 with 1 error, and 3 matched with 2 errors. In the row for length 7 is an apparent anomaly, where the max.err column is 0 and yet we have 31 reads matching with 1 error. This is because the matches are actually contributed by alignments to the first 8 bases of the adapter with one deletion, so 7 bases are removed but the error cut-off applied is for length 8. The "expect" column gives only a rough estimate of the number of sequences that is expected to match randomly, but it can help to estimate whether the matches that were found are true adapter matches or if they are due to chance. At lengths 6, for example, only 2.4 reads are expected, but 35 do match, which hints that most of these matches are due to actual adapters. For slightly more accurate estimates, you can provide the correct GC content (as a percentage) of your reads with the option ``--gc-content``. The default is ``--gc-content=50``. Note that the "length" column refers to the length of the removed sequence. That is, the actual length of the match in the above row at length 100 is 20 since that is the adapter length. Assuming the read length is 100, the adapter was found in the beginning of 397 reads and therefore those reads were trimmed to a length of zero. The table may also be useful in case the given adapter sequence contains an error. In that case, it may look like this:: ... length count expect max.err error counts 10 53 0.0 1 51 2 11 45 0.0 1 42 3 12 51 0.0 1 48 3 13 39 0.0 1 0 39 14 40 0.0 1 0 40 15 36 0.0 1 0 36 ... We can see that no matches longer than 12 have zero errors. In this case, it indicates that the 13th base of the given adapter sequence is incorrect. .. _info-file: Format of the info file ----------------------- When the ``--info-file`` command-line parameter is given, detailed information about the found adapters is written to the given file. The output is a tab-separated text file. Each line corresponds to one read of the input file (unless `--times` is used, see below). A row is written for *all* reads, even those that are discarded from the final output FASTA/FASTQ due to filtering options (such as ``--minimum-length``). The fields in each row are: 1. Read name 2. Number of errors 3. 0-based start coordinate of the adapter match 4. 0-based end coordinate of the adapter match 5. Sequence of the read to the left of the adapter match (can be empty) 6. Sequence of the read that was matched to the adapter 7. Sequence of the read to the right of the adapter match (can be empty) 8. Name of the found adapter. 9. Quality values corresponding to sequence left of the adapter match (can be empty) 10. Quality values corresponding to sequence matched to the adapter (can be empty) 11. Quality values corresponding to sequence to the right of the adapter match (can be empty) The concatenation of the fields 5-7 yields the full read sequence. Column 8 identifies the found adapter. `The section about named adapters ` describes how to give a name to an adapter. Adapters without a name are numbered starting from 1. Fields 9-11 are empty if quality values are not available. Concatenating them yields the full sequence of quality values. If no adapter was found, the format is as follows: 1. Read name 2. The value -1 3. The read sequence 4. Quality values When parsing the file, be aware that additional columns may be added in the future. Note also that some fields can be empty, resulting in consecutive tabs within a line. If the ``--times`` option is used and greater than 1, each read can appear more than once in the info file. There will be one line for each found adapter, all with identical read names. Only for the first of those lines will the concatenation of columns 5-7 be identical to the original read sequence (and accordingly for columns 9-11). For subsequent lines, the shown sequence are the ones that were used in subsequent rounds of adapter trimming, that is, they get successively shorter. .. versionadded:: 1.9 Columns 9-11 were added. .. _algorithm: The alignment algorithm ======================= Since the publication of the `EMBnet journal application note about cutadapt `_, the alignment algorithm used for finding adapters has changed significantly. An overview of this new algorithm is given in this section. An even more detailed description is available in Chapter 2 of my PhD thesis `Algorithms and tools for the analysis of high-throughput DNA sequencing data `_. The algorithm is based on *semiglobal alignment*, also called *free-shift*, *ends-free* or *overlap* alignment. In a regular (global) alignment, the two sequences are compared from end to end and all differences occuring over that length are counted. In semiglobal alignment, the sequences are allowed to freely shift relative to each other and differences are only penalized in the overlapping region between them:: FANTASTIC ELEFANT The prefix ``ELE`` and the suffix ``ASTIC`` do not have a counterpart in the respective other row, but this is not counted as an error. The overlap ``FANT`` has a length of four characters. Traditionally, *alignment scores* are used to find an optimal overlap aligment: This means that the scoring function assigns a positive value to matches, while mismatches, insertions and deletions get negative values. The optimal alignment is then the one that has the maximal total score. Usage of scores has the disadvantage that they are not at all intuitive: What does a total score of *x* mean? Is that good or bad? How should a threshold be chosen in order to avoid finding alignments with too many errors? For cutadapt, the adapter alignment algorithm uses *unit costs* instead. This means that mismatches, insertions and deletions are counted as one error, which is easier to understand and allows to specify a single parameter for the algorithm (the maximum error rate) in order to describe how many errors are acceptable. There is a problem with this: When using costs instead of scores, we would like to minimize the total costs in order to find an optimal alignment. But then the best alignment would always be the one in which the two sequences do not overlap at all! This would be correct, but meaningless for the purpose of finding an adapter sequence. The optimization criteria are therefore a bit different. The basic idea is to consider the alignment optimal that maximizes the overlap between the two sequences, as long as the allowed error rate is not exceeded. Conceptually, the procedure is as follows: 1. Consider all possible overlaps between the two sequences and compute an alignment for each, minimizing the total number of errors in each one. 2. Keep only those alignments that do not exceed the specified maximum error rate. 3. Then, keep only those alignments that have a maximal number of matches (that is, there is no alignment with more matches). 4. If there are multiple alignments with the same number of matches, then keep only those that have the smallest error rate. 5. If there are still multiple candidates left, choose the alignment that starts at the leftmost position within the read. In Step 1, the different adapter types are taken into account: Only those overlaps that are actually allowed by the adapter type are actually considered. cutadapt-1.15/doc/ideas.rst0000664000175000017500000001003213205526454016365 0ustar marcelmarcel00000000000000Ideas/To Do =========== This is a rather unsorted list of features that would be nice to have, of things that could be improved in the source code, and of possible algorithmic improvements. - show average error rate - In colorspace and probably also for Illumina data, gapped alignment is not necessary - ``--progress`` - run pylint, pychecker - length histogram - check whether input is FASTQ although -f fasta is given - search for adapters in the order in which they are given on the command line - more tests for the alignment algorithm - ``--detect`` prints out best guess which of the given adapters is the correct one - alignment algorithm: make a 'banded' version - it seems the str.find optimization isn't very helpful. In any case, it should be moved into the Aligner class. - allow to remove not the adapter itself, but the sequence before or after it - instead of trimming, convert adapter to lowercase - warn when given adapter sequence contains non-IUPAC characters - try multithreading again, this time use os.pipe() or 0mq - extensible file type detection - the --times setting should be an attribute of Adapter Backwards-incompatible changes ------------------------------ - Drop ``--rest-file`` support - Possibly drop wildcard-file support, extend info-file instead - Drop "legacy mode" - For non-anchored 5' adapters, find rightmost match - Move ``scripts/cutadapt.py`` to ``__main__.py`` Specifying adapters ------------------- The idea is to deprecate the ``-b``, ``-g`` and ``-u`` parameters. Only ``-a`` is used with a special syntax for each adapter type. This makes it a bit easier to add new adapter types in the feature. .. csv-table:: back,``-a ADAPTER``,``-a ADAPTER`` or ``-a ...ADAPTER`` suffix,``-a ADAPTER$``,``-a ...ADAPTER$`` front,``-g ADAPTER``,``-a ADAPTER...`` prefix,``-g ^ADAPTER``,``-a ^ADAPTER...`` (or have anchoring by default?) anywhere,``-b ADAPTER``, ``-a ...ADAPTER...`` ??? unconditional,``-u +10``,``-a 10...`` (collides with colorspace) unconditional,``-u -10``,``-a ...10$`` linked,``-a ADAPTER...ADAPTER``,``-a ADAPTER...ADAPTER`` or ``-a ^ADAPTER...ADAPTER`` Or add only ``-a ADAPTER...`` as an alias for ``-g ^ADAPTER`` and ``-a ...ADAPTER`` as an alias for ``-a ADAPTER``. The ``...`` would be equivalent to ``N*`` as in regular expressions. Another idea: Allow something such as ``-a ADAP$TER`` or ``-a ADAPTER$NNN``. This would be a way to specify less strict anchoring. Make it possible to specify that the rightmost or leftmost match should be picked. Default right now: Leftmost, even for -g adapters. Allow ``N{3,10}`` as in regular expressions (for a variable-length sequence). Use parentheses to specify the part of the sequence that should be kept: * ``-a (...)ADAPTER`` (default) * ``-a (...ADAPTER)`` (default) * ``-a ADAPTER(...)`` (default) * ``-a (ADAPTER...)`` (??) Or, specify the part that should be removed: ``-a ...(ADAPTER...)`` ``-a ...ADAPTER(...)`` ``-a (ADAPTER)...`` Model somehow all the flags that exist for semiglobal alignment. For start of the adapter: * Start of adapter can be degraded or not * Bases are allowed to be before adapter or not Not degraded and no bases before allowed = anchored. Degraded and bases before allowed = regular 5' By default, the 5' end should be anchored, the 3' end not. * ``-a ADAPTER...`` → not degraded, no bases before allowed * ``-a N*ADAPTER...`` → not degraded, bases before allowed * ``-a ADAPTER^...`` → degraded, no bases before allowed * ``-a N*ADAPTER^...`` → degraded, bases before allowed * ``-a ...ADAPTER`` → degraded, bases after allowed * ``-a ...ADAPTER$`` → not degraded, no bases after allowed Paired-end trimming ------------------- * Could also use a paired-end read merger, then remove adapters with -a and -g Available/used letters for command-line options ----------------------------------------------- * Remaining characters: All uppercase letters except A, B, G, M, N, O, U * Lowercase letters: i, j, k, s, w * Planned/reserved: Q (paired-end quality trimming), j (multithreading) cutadapt-1.15/doc/installation.rst0000664000175000017500000001300213205526454020001 0ustar marcelmarcel00000000000000============ Installation ============ Cutadapt is being developed and tested under Linux. Users have run it successfully under macOS and Windows. Quick installation ------------------ The easiest way to install cutadapt is to use ``pip`` on the command line:: pip install --user --upgrade cutadapt This will download the software from `PyPI (the Python packaging index) `_, and install the cutadapt binary into ``$HOME/.local/bin``. If an old version of cutadapt exists on your system, the ``--upgrade`` parameter is required in order to install a newer version. You can then run the program like this:: ~/.local/bin/cutadapt --help If you want to avoid typing the full path, add the directory ``$HOME/.local/bin`` to your ``$PATH`` environment variable. Installation with conda ----------------------- Alternatively, cutadapt is available as a conda package from the `bioconda channel `_. If you do not have conda, `install miniconda `_ first. Then install cutadapt like this:: conda install -c bioconda cutadapt If neither `pip` nor `conda` installation works, keep reading. .. _dependencies: Dependencies ------------ Cutadapt installation requires this software to be installed: * Python 2.7 or at least Python 3.3 * Possibly a C compiler. For Linux, cutadapt packages are provided as so-called “wheels” (``.whl`` files) which come pre-compiled. Under Ubuntu, you may need to install the packages ``build-essential`` and ``python-dev`` (or ``python3-dev``) to get a C compiler. On Windows, you need `Microsoft Visual C++ Compiler for Python 2.7 `_. If you get an error message:: error: command 'gcc' failed with exit status 1 Then check the entire error message. If it says something about a missing ``Python.h`` file, then the problem are missing Python development packages (``python-dev``/``python3-dev`` in Ubuntu). System-wide installation (root required) ---------------------------------------- If you have root access, then you can install cutadapt system-wide by running:: sudo pip install cutadapt This installs cutadapt into `/usr/local/bin`. If you want to upgrade from an older version, use this command instead:: sudo pip install --upgrade cutadapt Uninstalling ------------ Type :: pip uninstall cutadapt and confirm with ``y`` to remove the package. Under some circumstances, multiple versions may be installed at the same time. Repeat the above command until you get an error message in order to make sure that all versions are removed. Shared installation (on a cluster) ---------------------------------- If you have a larger installation and want to provide cutadapt as a module that can be loaded and unloaded (with the Lmod system, for example), we recommend that you create a virtual environment and 'pip install' cutadapt into it. These instructions work on our SLURM cluster that uses the Lmod system (replace ``1.9.1`` with the actual version you want to use):: BASE=/software/cutadapt-1.9.1 virtualenv $BASE/venv $BASE/venv/bin/pip install --install-option="--install-scripts=$BASE/bin" cutadapt==1.9.1 The ``install-option`` part is important. It ensures that a second, separate ``bin/`` directory is created (``/software/cutadapt-1.9.1/bin/``) that *only* contains the ``cutadapt`` script and nothing else. To make cutadapt available to the users, that directory (``$BASE/bin``) needs to be added to the ``$PATH``. Make sure you *do not* add the ``bin/`` directory within the ``venv`` directory to the ``$PATH``! Otherwise, a user trying to run ``python`` who also has the cutadapt module loaded would get the python from the virtual environment, which leads to confusing error messages. A simple module file for the Lmod system matching the above example could look like this:: conflict("cutadapt") whatis("adapter trimming tool") prepend_path("PATH", "/software/cutadapt-1.9.1/bin") Please note that there is no need to “activate” the virtual environment: Activation merely adds the ``bin/`` directory to the ``$PATH``, so the ``prepend_path`` directive is equivalent to activating the virtual environment. Installing the development version ---------------------------------- We recommend that you install cutadapt into a so-called virtual environment if you decide to use the development version. The virtual environment is a single directory that contains everything needed to run the software. Nothing else on your system is changed, so you can simply uninstall this particular version of cutadapt by removing the directory with the virtual environment. The following instructions work on Linux using Python 3. Make sure you have installed the :ref:`dependencies ` (``python3-dev`` and ``build-essential`` on Ubuntu)! First, choose where you want to place the directory with the virtual environment and what you want to call it. Let us assume you chose the path ``~/cutadapt-venv``. Then use these commands for the installation:: python3 -m venv ~/cutadapt-venv ~/cutadapt-venv/bin/pip install Cython ~/cutadapt-venv/bin/pip install https://github.com/marcelm/cutadapt/archive/master.zip To run cutadapt and see the version number, type :: ~/cutadapt-venv/bin/cutadapt --version The reported version number will be something like ``1.14+65.g5610275``. This means that you are now running a cutadapt version that contains 65 additional changes (*commits*) since version 1.14. cutadapt-1.15/CHANGES.rst0000664000175000017500000005203513205526454015614 0ustar marcelmarcel00000000000000======= Changes ======= v1.15 (2017-11-23) ------------------ * Cutadapt can now run on multiple CPU cores in parallel! To enable it, use the option ``-j N`` (or the long form ``--cores=N``), where ``N`` is the number of cores to use. Multi-core support is only available on Python 3, and not yet with some command-line arguments. See :ref:`the new section about multi-core in the documentation ` for details. When writing ``.gz`` files, make sure you have ``pigz`` installed to get the best speedup. * The plan is to make multi-core the default (automatically using as many cores as are available) in future releases, so please test it and `report an issue `_ if you find problems! * `Issue #256 `_: ``--discard-untrimmed`` did not have an effect on non-anchored linked adapters. * `Issue #118 `_: Added support for demultiplexing of paired-end data. v1.14 (2017-06-16) ------------------ * Fix: Statistics for 3' part of a linked adapter were reported incorrectly * Fix `issue #244 `_: Quality trimming with ``--nextseq-trim`` would not apply to R2 when trimming paired-end reads. * ``--nextseq-trim`` now disables legacy mode. * Fix `issue #246 `_: installation failed on non-UTF8 locale v1.13 (2017-03-16) ------------------ * The 3' adapter of linked adapters can now be anchored. Write ``-a ADAPTER1...ADAPTER2$`` to enable this. Note that the 5' adapter is always anchored in this notation. * Issue #224: If you want the 5' part of a linked adapter *not* to be anchored, you can now write ``-g ADAPTER...ADAPTER2`` (note ``-g`` instead of ``-a``). This feature is experimental and may change behavior in the next release. * Issue #236: For more accurate statistics, it is now possible to specify the GC content of the input reads with ``--gc-content``. This does not change trimming results, only the number in the "expect" column of the report. Since this is probably not needed by many people, the option is not listed when running ``cutadapt --help``. * Issue #235: Adapter sequences are now required to contain only valid IUPAC codes (lowercase is also allowed, ``U`` is an alias for ``T``). This should help to catch hard-to-find bugs, especially in scripts. Use option ``-N`` to match characters literally (possibly useful for amino acid sequences). * Documentation updates and some refactoring of the code v1.12 (2016-11-28) ------------------ * Add read modification option ``--length`` (short: ``--l``), which will shorten each read to the given length. * Cutadapt will no longer complain that it has nothing to do when you do not give it any adapters. For example, you can use this to convert file formats: ``cutadapt -o output.fasta input.fastq.gz`` converts FASTQ to FASTA. * The ``xopen`` module for opening compressed files was moved to a `separate package on PyPI `_. v1.11 (2016-08-16) ------------------ * The ``--interleaved`` option no longer requires that both input and output is interleaved. It is now possible to have two-file input and interleaved output, and to have interleaved input and two-file output. * Fix issue #202: First and second FASTQ header could get out of sync when options modifying the read name were used. v1.10 (2016-05-19) ------------------ * Added a new “linked adapter” type, which can be used to search for a 5' and a 3' adapter at the same time. Use ``-a ADAPTER1...ADAPTER2`` to search for a linked adapter. ADAPTER1 is interpreted as an anchored 5' adapter, which is searched for first. Only if ADAPTER1 is found will ADAPTER2 be searched for, which is a regular 3' adapter. * Added experimental ``--nextseq-trim`` option for quality trimming of NextSeq data. This is necessary because that machine cannot distinguish between G and reaching the end of the fragment (it encodes G as 'black'). * Even when trimming FASTQ files, output can now be FASTA (quality values are simply dropped). Use the ``-o``/``-p`` options with a file name that ends in ``.fasta`` or ``.fa`` to enable this. * Cutadapt does not bundle pre-compiled C extension modules (``.so`` files) anymore. This affects only users that run cutadapt directly from an unpacked tarball. Install through ``pip`` or ``conda`` instead. * Fix issue #167: Option ``--quiet`` was not entirely quiet. * Fix issue #199: Be less strict when checking for properly-paired reads. * This is the last version of cutadapt to support Python 2.6. Future versions will require at least Python 2.7. v1.9.1 (2015-12-02) ------------------- * Added ``--pair-filter`` option, which :ref:`modifies how filtering criteria apply to paired-end reads ` * Add ``--too-short-paired-output`` and ``--too-long-paired-output`` options. * Fix incorrect number of trimmed bases reported if ``--times`` option was used. v1.9 (2015-10-29) ----------------- * Indels in the alignment can now be disabled for all adapter types (use ``--no-indels``). * Quality values are now printed in the info file (``--info-file``) when trimming FASTQ files. Fixes issue #144. * Options ``--prefix`` and ``--suffix``, which modify read names, now accept the placeholder ``{name}`` and will replace it with the name of the found adapter. Fixes issue #104. * Interleaved FASTQ files: With the ``--interleaved`` switch, paired-end reads will be read from and written to interleaved FASTQ files. Fixes issue #113. * Anchored 5' adapters can now be specified by writing ``-a SEQUENCE...`` (note the three dots). * Fix ``--discard-untrimmed`` and ``--discard-trimmed`` not working as expected in paired-end mode (issue #146). * The minimum overlap is now automatically reduced to the adapter length if it is too large. Fixes part of issue #153. * Thanks to Wolfgang Gerlach, there is now a Dockerfile. * The new ``--debug`` switch makes cutadapt print out the alignment matrix. v1.8.3 (2015-07-29) ------------------- * Fix issue #95: Untrimmed reads were not listed in the info file. * Fix issue #138: pip install cutadapt did not work with new setuptools versions. * Fix issue #137: Avoid a hang when writing to two or more gzip-compressed output files in Python 2.6. v1.8.2 (2015-07-24) ------------------- v1.8.1 (2015-04-09) ------------------- * Fix #110: Counts for 'too short' and 'too long' reads were swapped in statistics. * Fix #115: Make ``--trim-n`` work also on second read for paired-end data. v1.8 (2015-03-14) ----------------- * Support single-pass paired-end trimming with the new ``-A``/``-G``/``-B``/``-U`` parameters. These work just like their -a/-g/-b/-u counterparts, but they specify sequences that are removed from the *second read* in a pair. Also, if you start using one of those options, the read modification options such as ``-q`` (quality trimming) are applied to *both* reads. For backwards compatibility, read modifications are applied to the first read only if neither of ``-A``/``-G``/``-B``/``-U`` is used. See `the documentation `_ for details. This feature has not been extensively tested, so please give feedback if something does not work. * The report output has been re-worked in order to accomodate the new paired-end trimming mode. This also changes the way the report looks like in single-end mode. It is hopefully now more accessible. * Chris Mitchell contributed a patch adding two new options: ``--trim-n`` removes any ``N`` bases from the read ends, and the ``--max-n`` option can be used to filter out reads with too many ``N``. * Support notation for repeated bases in the adapter sequence: Write ``A{10}`` instead of ``AAAAAAAAAA``. Useful for poly-A trimming: Use ``-a A{100}`` to get the longest possible tail. * Quality trimming at the 5' end of reads is now supported. Use ``-q 15,10`` to trim the 5' end with a cutoff of 15 and the 3' end with a cutoff of 10. * Fix incorrectly reported statistics (> 100% trimmed bases) when ``--times`` set to a value greater than one. * Support .xz-compressed files (if running in Python 3.3 or later). * Started to use the GitHub issue tracker instead of Google Code. All old issues have been moved. v1.7 (2014-11-25) ----------------- * IUPAC characters are now supported. For example, use ``-a YACGT`` for an adapter that matches both ``CACGT`` and ``TACGT`` with zero errors. Disable with ``-N``. By default, IUPAC characters in the read are not interpreted in order to avoid matches in reads that consist of many (low-quality) ``N`` bases. Use ``--match-read-wildcards`` to enable them also in the read. * Support for demultiplexing was added. This means that reads can be written to different files depending on which adapter was found. See `the section in the documentation `_ for how to use it. This is currently only supported for single-end reads. * Add support for anchored 3' adapters. Append ``$`` to the adapter sequence to force the adapter to appear in the end of the read (as a suffix). Closes issue #81. * Option ``--cut`` (``-u``) can now be specified twice, once for each end of the read. Thanks to Rasmus Borup Hansen for the patch! * Options ``--minimum-length``/``--maximum-length`` (``-m``/``-M``) can be used standalone. That is, cutadapt can be used to filter reads by length without trimming adapters. * Fix bug: Adapters read from a FASTA file can now be anchored. v1.6 (2014-10-07) ----------------- * Fix bug: Ensure ``--format=...`` can be used even with paired-end input. * Fix bug: Sometimes output files would be incomplete because they were not closed correctly. * Alignment algorithm is a tiny bit faster. * Extensive work on the documentation. It's now available at https://cutadapt.readthedocs.org/ . * For 3' adapters, statistics about the bases preceding the trimmed adapter are collected and printed. If one of the bases is overrepresented, a warning is shown since this points to an incomplete adapter sequence. This happens, for example, when a TruSeq adapter is used but the A overhang is not taken into account when running cutadapt. * Due to code cleanup, there is a change in behavior: If you use ``--discard-trimmed`` or ``--discard-untrimmed`` in combination with ``--too-short-output`` or ``--too-long-output``, then cutadapt now writes also the discarded reads to the output files given by the ``--too-short`` or ``--too-long`` options. If anyone complains, I will consider reverting this. * Galaxy support files are now in `a separate repository `_. v1.5 (2014-08-05) ----------------- * Adapter sequences can now be read from a FASTA file. For example, write ``-a file:adapters.fasta`` to read 3' adapters from ``adapters.fasta``. This works also for ``-b`` and ``-g``. * Add the option ``--mask-adapter``, which can be used to not remove adapters, but to instead mask them with ``N`` characters. Thanks to Vittorio Zamboni for contributing this feature! * U characters in the adapter sequence are automatically converted to T. * Do not run Cython at installation time unless the --cython option is provided. * Add the option -u/--cut, which can be used to unconditionally remove a number of bases from the beginning or end of each read. * Make ``--zero-cap`` the default for colorspace reads. * When the new option ``--quiet`` is used, no report is printed after all reads have been processed. * When processing paired-end reads, cutadapt now checks whether the reads are properly paired. * To properly handle paired-end reads, an option --untrimmed-paired-output was added. v1.4 (2014-03-13) ----------------- * This release of cutadapt reduces the overhead of reading and writing files. On my test data set, a typical run of cutadapt (with a single adapter) takes 40% less time due to the following two changes. * Reading and writing of FASTQ files is faster (thanks to Cython). * Reading and writing of gzipped files is faster (up to 2x) on systems where the ``gzip`` program is available. * The quality trimming function is four times faster (also due to Cython). * Fix the statistics output for 3' colorspace adapters: The reported lengths were one too short. Thanks to Frank Wessely for reporting this. * Support the ``--no-indels`` option. This disallows insertions and deletions while aligning the adapter. Currently, the option is only available for anchored 5' adapters. This fixes issue 69. * As a sideeffect of implementing the --no-indels option: For colorspace, the length of a read (for ``--minimum-length`` and ``--maximum-length``) is now computed after primer base removal (when ``--trim-primer`` is specified). * Added one column to the info file that contains the name of the found adapter. * Add an explanation about colorspace ambiguity to the README v1.3 (2013-11-08) ----------------- * Preliminary paired-end support with the ``--paired-output`` option (contributed by James Casbon). See the README section on how to use it. * Improved statistics. * Fix incorrectly reported amount of quality-trimmed Mbp (issue 57, fix by Chris Penkett) * Add the ``--too-long-output`` option. * Add the ``--no-trim`` option, contributed by Dave Lawrence. * Port handwritten C alignment module to Cython. * Fix the ``--rest-file`` option (issue 56) * Slightly speed up alignment of 5' adapters. * Support bzip2-compressed files. v1.2 (2012-11-30) ----------------- * At least 25% faster processing of .csfasta/.qual files due to faster parser. * Between 10% and 30% faster writing of gzip-compressed output files. * Support 5' adapters in colorspace, even when no primer trimming is requested. * Add the ``--info-file`` option, which has a line for each found adapter. * Named adapters are possible. Usage: ``-a My_Adapter=ACCGTA`` assigns the name "My_adapter". * Improve alignment algorithm for better poly-A trimming when there are sequencing errors. Previously, not the longest possible poly-A tail would be trimmed. * James Casbon contributed the ``--discard-untrimmed`` option. v1.1 (2012-06-18) ----------------- * Allow to "anchor" 5' adapters (``-g``), forcing them to be a prefix of the read. To use this, add the special character ``^`` to the beginning of the adapter sequence. * Add the "-N" option, which allows 'N' characters within adapters to match literally. * Speedup of approx. 25% when reading from .gz files and using Python 2.7. * Allow to only trim qualities when no adapter is given on the command-line. * Add a patch by James Casbon: include read names (ids) in rest file * Use nosetest for testing. To run, install nose and run "nosetests". * When using cutadapt without installing it, you now need to run ``bin/cutadapt`` due to a new directory layout. * Allow to give a colorspace adapter in basespace (gets automatically converted). * Allow to search for 5' adapters (those specified with ``-g``) in colorspace. * Speed up the alignment by a factor of at least 3 by using Ukkonen's algorithm. The total runtime decreases by about 30% in the tested cases. * allow to deal with colorspace FASTQ files from the SRA that contain a fake additional quality in the beginning (use ``--format sra-fastq``) v1.0 (2011-11-04) ----------------- * ASCII-encoded quality values were assumed to be encoded as ascii(quality+33). With the new parameter ``--quality-base``, this can be changed to ascii(quality+64), as used in some versions of the Illumina pipeline. (Fixes issue 7.) * Allow to specify that adapters were ligated to the 5' end of reads. This change is based on a patch contributed by James Casbon. * Due to cutadapt being published in EMBnet.journal, I found it appropriate to call this release version 1.0. Please see http://journal.embnet.org/index.php/embnetjournal/article/view/200 for the article and I would be glad if you cite it. * Add Galaxy support, contributed by Lance Parsons. * Patch by James Casbon: Allow N wildcards in read or adapter or both. Wildcard matching of 'N's in the adapter is always done. If 'N's within reads should also match without counting as error, this needs to be explicitly requested via ``--match-read-wildcards``. v0.9.5 (2011-07-20) ------------------- * Fix issue 20: Make the report go to standard output when ``-o``/``--output`` is specified. * Recognize `.fq` as an extension for FASTQ files * many more unit tests * The alignment algorithm has changed. It will now find some adapters that previously were missed. Note that this will produce different output than older cutadapt versions! Before this change, finding an adapter would work as follows: - Find an alignment between adapter and read -- longer alignments are better. - If the number of errors in the alignment (divided by length) is above the maximum error rate, report the adapter as not being found. Sometimes, the long alignment that is found had too many errors, but a shorter alignment would not. The adapter was then incorrectly seen as "not found". The new alignment algorithm checks the error rate while aligning and only reports alignments that do not have too many errors. v0.9.4 (2011-05-20) ------------------- * now compatible with Python 3 * Add the ``--zero-cap`` option, which changes negative quality values to zero. This is a workaround to avoid segmentation faults in BWA. The option is now enabled by default when ``--bwa``/``--maq`` is used. * Lots of unit tests added. Run them with ``cd tests && ./tests.sh``. * Fix issue 16: ``--discard-trimmed`` did not work. * Allow to override auto-detection of input file format with the new ``-f``/``--format`` parameter. This mostly fixes issue 12. * Don't break when input file is empty. v0.9.2 (2011-03-16) ------------------- * Install a single ``cutadapt`` Python package instead of multiple Python modules. This avoids cluttering the global namespace and should lead to less problems with other Python modules. Thanks to Steve Lianoglou for pointing this out to me! * ignore case (ACGT vs acgt) when comparing the adapter with the read sequence * .FASTA/.QUAL files (not necessarily colorspace) can now be read (some 454 software uses this format) * Move some functions into their own modules * lots of refactoring: replace the fasta module with a much nicer seqio module. * allow to input FASTA/FASTQ on standard input (also FASTA/FASTQ is autodetected) v0.9 (2011-01-10) ----------------- * add ``--too-short-output`` and ``--untrimmed-output``, based on patch by Paul Ryvkin (thanks!) * add ``--maximum-length`` parameter: discard reads longer than a specified length * group options by category in ``--help`` output * add ``--length-tag`` option. allows to fix read length in FASTA/Q comment lines (e.g., ``length=123`` becomes ``length=58`` after trimming) (requested by Paul Ryvkin) * add ``-q``/``--quality-cutoff`` option for trimming low-quality ends (uses the same algorithm as BWA) * some refactoring * the filename ``-`` is now interpreted as standard in or standard output v0.8 (2010-12-08) ----------------- * Change default behavior of searching for an adapter: The adapter is now assumed to be an adapter that has been ligated to the 3' end. This should be the correct behavior for at least the SOLiD small RNA protocol (SREK) and also for the Illumina protocol. To get the old behavior, which uses a heuristic to determine whether the adapter was ligated to the 5' or 3' end and then trimmed the read accordingly, use the new ``-b`` (``--anywhere``) option. * Clear up how the statistics after processing all reads are printed. * Fix incorrect statistics. Adapters starting at pos. 0 were correctly trimmed, but not counted. * Modify scoring scheme: Improves trimming (some reads that should have been trimmed were not). Increases no. of trimmed reads in one of our SOLiD data sets from 36.5 to 37.6%. * Speed improvements (20% less runtime on my test data set). v0.7 (2010-12-03) ----------------- * Useful exit codes * Better error reporting when malformed files are encountered * Add ``--minimum-length`` parameter for discarding reads that are shorter than a specified length after trimming. * Generalize the alignment function a bit. This is preparation for supporting adapters that are specific to either the 5' or 3' end. * pure Python fallback for alignment function for when the C module cannot be used. v0.6 (2010-11-18) ----------------- * Support gzipped input and output. * Print timing information in statistics. v0.5 (2010-11-17) ----------------- * add ``--discard`` option which makes cutadapt discard reads in which an adapter occurs v0.4 (2010-11-17) ----------------- * (more) correctly deal with multiple adapters: If a long adapter matches with lots of errors, then this could lead to a a shorter adapter matching with few errors getting ignored. v0.3 (2010-09-27) ----------------- * fix huge memory usage (entire input file was unintentionally read into memory) v0.2 (2010-09-14) ----------------- * allow FASTQ input v0.1 (2010-09-14) ----------------- * initial release cutadapt-1.15/setup.py0000664000175000017500000000722513205526454015525 0ustar marcelmarcel00000000000000""" Build cutadapt. """ import sys import os.path from setuptools import setup, Extension, find_packages from distutils.version import LooseVersion from distutils.command.sdist import sdist as _sdist from distutils.command.build_ext import build_ext as _build_ext import versioneer MIN_CYTHON_VERSION = '0.24' if sys.version_info < (2, 7): sys.stdout.write("At least Python 2.7 is required.\n") sys.exit(1) def no_cythonize(extensions, **_ignore): """ Change file extensions from .pyx to .c or .cpp. Copied from Cython documentation """ for extension in extensions: sources = [] for sfile in extension.sources: path, ext = os.path.splitext(sfile) if ext in ('.pyx', '.py'): if extension.language == 'c++': ext = '.cpp' else: ext = '.c' sfile = path + ext sources.append(sfile) extension.sources[:] = sources def check_cython_version(): """Exit if Cython was not found or is too old""" try: from Cython import __version__ as cyversion except ImportError: sys.stdout.write( "ERROR: Cython is not installed. Install at least Cython version " + str(MIN_CYTHON_VERSION) + " to continue.\n") sys.exit(1) if LooseVersion(cyversion) < LooseVersion(MIN_CYTHON_VERSION): sys.stdout.write( "ERROR: Your Cython is at version '" + str(cyversion) + "', but at least version " + str(MIN_CYTHON_VERSION) + " is required.\n") sys.exit(1) extensions = [ Extension('cutadapt._align', sources=['src/cutadapt/_align.pyx']), Extension('cutadapt._qualtrim', sources=['src/cutadapt/_qualtrim.pyx']), Extension('cutadapt._seqio', sources=['src/cutadapt/_seqio.pyx']), ] cmdclass = versioneer.get_cmdclass() versioneer_build_ext = cmdclass.get('build_ext', _build_ext) versioneer_sdist = cmdclass.get('sdist', _sdist) class build_ext(versioneer_build_ext): def run(self): # If we encounter a PKG-INFO file, then this is likely a .tar.gz/.zip # file retrieved from PyPI that already includes the pre-cythonized # extension modules, and then we do not need to run cythonize(). if os.path.exists('PKG-INFO'): no_cythonize(extensions) else: # Otherwise, this is a 'developer copy' of the code, and then the # only sensible thing is to require Cython to be installed. check_cython_version() from Cython.Build import cythonize self.extensions = cythonize(self.extensions) versioneer_build_ext.run(self) class sdist(versioneer_sdist): def run(self): # Make sure the compiled Cython files in the distribution are up-to-date from Cython.Build import cythonize check_cython_version() cythonize(extensions) versioneer_sdist.run(self) cmdclass['build_ext'] = build_ext cmdclass['sdist'] = sdist encoding_arg = {'encoding': 'utf-8'} if sys.version > '3' else dict() with open('README.rst', **encoding_arg) as f: long_description = f.read() setup( name='cutadapt', version=versioneer.get_version(), author='Marcel Martin', author_email='marcel.martin@scilifelab.se', url='https://cutadapt.readthedocs.io/', description='trim adapters from high-throughput sequencing reads', long_description=long_description, license='MIT', cmdclass=cmdclass, ext_modules=extensions, package_dir={'': 'src'}, packages=find_packages('src'), install_requires=['xopen>=0.3.2'], entry_points={'console_scripts': ['cutadapt = cutadapt.__main__:main']}, classifiers=[ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Cython", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Scientific/Engineering :: Bio-Informatics" ] ) cutadapt-1.15/LICENSE0000664000175000017500000000210413205526454015007 0ustar marcelmarcel00000000000000Copyright (c) 2010-2017 Marcel Martin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.