Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

82 строки
2.2 KiB

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