Debian Codegraph @

pysam/libcalignedsegment.pxd

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