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