您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

81 行
2.1 KiB

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