annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/site-packages/pysam/libcfaidx.pxd @ 68:5028fdace37b

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 16:23:26 -0400
parents
children
rev   line source
jpayne@68 1 # cython: language_level=3
jpayne@68 2 from libc.stdint cimport int8_t, int16_t, int32_t, int64_t
jpayne@68 3 from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t
jpayne@68 4 from libc.stdlib cimport malloc, calloc, realloc, free
jpayne@68 5 from libc.string cimport memcpy, memcmp, strncpy, strlen, strdup
jpayne@68 6 from libc.stdio cimport FILE, printf
jpayne@68 7 cimport cython
jpayne@68 8
jpayne@68 9 from cpython cimport array
jpayne@68 10 from pysam.libchtslib cimport faidx_t, kstring_t, BGZF
jpayne@68 11
jpayne@68 12 # These functions are put here and not in chtslib.pxd in order
jpayne@68 13 # to avoid warnings for unused functions.
jpayne@68 14 cdef extern from "pysam_stream.h" nogil:
jpayne@68 15
jpayne@68 16 ctypedef struct kstream_t:
jpayne@68 17 pass
jpayne@68 18
jpayne@68 19 ctypedef struct kseq_t:
jpayne@68 20 kstring_t name
jpayne@68 21 kstring_t comment
jpayne@68 22 kstring_t seq
jpayne@68 23 kstring_t qual
jpayne@68 24
jpayne@68 25 kseq_t *kseq_init(BGZF *)
jpayne@68 26 int kseq_read(kseq_t *)
jpayne@68 27 void kseq_destroy(kseq_t *)
jpayne@68 28 kstream_t *ks_init(BGZF *)
jpayne@68 29 void ks_destroy(kstream_t *)
jpayne@68 30
jpayne@68 31 # Retrieve characters from stream until delimiter
jpayne@68 32 # is reached placing results in str.
jpayne@68 33 int ks_getuntil(kstream_t *,
jpayne@68 34 int delimiter,
jpayne@68 35 kstring_t * str,
jpayne@68 36 int * dret)
jpayne@68 37
jpayne@68 38 cdef class FastaFile:
jpayne@68 39 cdef bint is_remote
jpayne@68 40 cdef object _filename, _references, _lengths, reference2length
jpayne@68 41 cdef faidx_t* fastafile
jpayne@68 42 cdef char* _fetch(self, char* reference,
jpayne@68 43 int start, int end, int* length) except? NULL
jpayne@68 44
jpayne@68 45
jpayne@68 46 cdef class FastqProxy:
jpayne@68 47 cdef kseq_t * _delegate
jpayne@68 48 cdef cython.str to_string(self)
jpayne@68 49 cdef cython.str tostring(self)
jpayne@68 50 cpdef array.array get_quality_array(self, int offset=*)
jpayne@68 51
jpayne@68 52
jpayne@68 53 cdef class FastxRecord:
jpayne@68 54 """
jpayne@68 55 Python container for pysam.libcfaidx.FastqProxy with persistence.
jpayne@68 56 """
jpayne@68 57 cdef public str comment, quality, sequence, name
jpayne@68 58 cdef cython.str to_string(self)
jpayne@68 59 cdef cython.str tostring(self)
jpayne@68 60 cpdef array.array get_quality_array(self, int offset=*)
jpayne@68 61
jpayne@68 62 cdef class FastxFile:
jpayne@68 63 cdef object _filename
jpayne@68 64 cdef BGZF * fastqfile
jpayne@68 65 cdef kseq_t * entry
jpayne@68 66 cdef bint persist
jpayne@68 67 cdef bint is_remote
jpayne@68 68
jpayne@68 69 cdef kseq_t * getCurrent(self)
jpayne@68 70 cdef int cnext(self)
jpayne@68 71
jpayne@68 72
jpayne@68 73 # Compatibility Layer for pysam 0.8.1
jpayne@68 74 cdef class FastqFile(FastxFile):
jpayne@68 75 pass
jpayne@68 76
jpayne@68 77
jpayne@68 78 # Compatibility Layer for pysam < 0.8
jpayne@68 79 cdef class Fastafile(FastaFile):
jpayne@68 80 pass
jpayne@68 81