annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/site-packages/pysam/libcalignedsegment.pxd @ 69:33d812a61356

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