You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

117 lines
3.2 KiB

  1. # cython: language_level=3
  2. from pysam.libchtslib cimport *
  3. cdef extern from "htslib_util.h":
  4. # add *nbytes* into the variable length data of *src* at *pos*
  5. bam1_t * pysam_bam_update(bam1_t * b,
  6. size_t nbytes_old,
  7. size_t nbytes_new,
  8. uint8_t * pos)
  9. # now: static
  10. int aux_type2size(int)
  11. char * pysam_bam_get_qname(bam1_t * b)
  12. uint32_t * pysam_bam_get_cigar(bam1_t * b)
  13. uint8_t * pysam_bam_get_seq(bam1_t * b)
  14. uint8_t * pysam_bam_get_qual(bam1_t * b)
  15. uint8_t * pysam_bam_get_aux(bam1_t * b)
  16. int pysam_bam_get_l_aux(bam1_t * b)
  17. char pysam_bam_seqi(uint8_t * s, int i)
  18. uint8_t pysam_get_qual(bam1_t * b)
  19. uint32_t pysam_get_n_cigar(bam1_t * b)
  20. void pysam_set_qual(bam1_t * b, uint8_t v)
  21. void pysam_set_n_cigar(bam1_t * b, uint32_t v)
  22. void pysam_update_flag(bam1_t * b, uint16_t v, uint16_t flag)
  23. from pysam.libcalignmentfile cimport AlignmentFile, AlignmentHeader
  24. ctypedef AlignmentFile AlignmentFile_t
  25. cdef class _AlignedSegment_Cache: # For internal use only
  26. cdef clear_query_sequences(self)
  27. cdef clear_query_qualities(self)
  28. cdef object query_sequence
  29. cdef object query_alignment_sequence
  30. cdef object query_qualities
  31. cdef object query_qualities_str
  32. cdef object query_alignment_qualities
  33. cdef object query_alignment_qualities_str
  34. # Note: need to declare all C fields and methods here
  35. cdef class AlignedSegment:
  36. # object that this AlignedSegment represents
  37. cdef bam1_t * _delegate
  38. # the header that a read is associated with
  39. cdef readonly AlignmentHeader header
  40. # caching of array properties for quick access
  41. cdef _AlignedSegment_Cache cache
  42. cdef object unused1
  43. cdef object unused2
  44. cdef object unused3
  45. # add an alignment tag with value to the AlignedSegment
  46. # an existing tag of the same name will be replaced.
  47. cpdef set_tag(self, tag, value, value_type=?, replace=?)
  48. # get an alignment tag from the AlignedSegment
  49. cpdef get_tag(self, tag, with_value_type=?)
  50. # return true if tag exists
  51. cpdef has_tag(self, tag)
  52. # returns a valid sam alignment string
  53. cpdef to_string(self)
  54. # returns a valid sam alignment string (deprecated)
  55. cpdef tostring(self, htsfile=*)
  56. cdef class PileupColumn:
  57. cdef const bam_pileup1_t ** plp
  58. cdef int tid
  59. cdef int pos
  60. cdef int n_pu
  61. cdef AlignmentHeader header
  62. cdef uint32_t min_base_quality
  63. cdef kstring_t buf
  64. cdef char * reference_sequence
  65. cdef class PileupRead:
  66. cdef int32_t _qpos
  67. cdef AlignedSegment _alignment
  68. cdef int _indel
  69. cdef int _level
  70. cdef uint32_t _is_del
  71. cdef uint32_t _is_head
  72. cdef uint32_t _is_tail
  73. cdef uint32_t _is_refskip
  74. # factory methods
  75. cdef AlignedSegment makeAlignedSegment(
  76. bam1_t * src,
  77. AlignmentHeader header)
  78. cdef PileupColumn makePileupColumn(
  79. const bam_pileup1_t ** plp,
  80. int tid,
  81. int pos,
  82. int n_pu,
  83. uint32_t min_base_quality,
  84. char * reference_sequence,
  85. AlignmentHeader header)
  86. cdef PileupRead makePileupRead(const bam_pileup1_t * src,
  87. AlignmentHeader header)
  88. cdef uint32_t get_alignment_length(bam1_t * src)