jpayne@69
|
1 import enum
|
jpayne@69
|
2 import re
|
jpayne@69
|
3 import sys
|
jpayne@69
|
4 from array import array
|
jpayne@69
|
5 from typing import Any, List, Optional, Dict, Tuple, Union, overload
|
jpayne@69
|
6
|
jpayne@69
|
7 if sys.version_info < (3, 8):
|
jpayne@69
|
8 from typing_extensions import Literal
|
jpayne@69
|
9 else:
|
jpayne@69
|
10 from typing import Literal
|
jpayne@69
|
11
|
jpayne@69
|
12 from pysam import AlignmentHeader # type: ignore
|
jpayne@69
|
13
|
jpayne@69
|
14 CMATCH: int
|
jpayne@69
|
15 CINS: int
|
jpayne@69
|
16 CDEL: int
|
jpayne@69
|
17 CREF_SKIP: int
|
jpayne@69
|
18 CSOFT_CLIP: int
|
jpayne@69
|
19 CHARD_CLIP: int
|
jpayne@69
|
20 CPAD: int
|
jpayne@69
|
21 CEQUAL: int
|
jpayne@69
|
22 CDIFF: int
|
jpayne@69
|
23 CBACK: int
|
jpayne@69
|
24
|
jpayne@69
|
25 FPAIRED: int
|
jpayne@69
|
26 FPROPER_PAIR: int
|
jpayne@69
|
27 FUNMAP: int
|
jpayne@69
|
28 FMUNMAP: int
|
jpayne@69
|
29 FREVERSE: int
|
jpayne@69
|
30 FMREVERSE: int
|
jpayne@69
|
31 FREAD1: int
|
jpayne@69
|
32 FREAD2: int
|
jpayne@69
|
33 FSECONDARY: int
|
jpayne@69
|
34 FQCFAIL: int
|
jpayne@69
|
35 FDUP: int
|
jpayne@69
|
36 FSUPPLEMENTARY: int
|
jpayne@69
|
37
|
jpayne@69
|
38 CIGAR2CODE: Dict[int, str]
|
jpayne@69
|
39 CIGAR_REGEX: re.Pattern
|
jpayne@69
|
40 DATATYPE2FORMAT: Dict[int, Tuple[str, int]]
|
jpayne@69
|
41 KEY_NAMES: List[str]
|
jpayne@69
|
42
|
jpayne@69
|
43 TagValue = Union[str, int, float, array]
|
jpayne@69
|
44
|
jpayne@69
|
45 class CIGAR_OPS(enum.IntEnum):
|
jpayne@69
|
46 CBACK = ...
|
jpayne@69
|
47 CDEL = ...
|
jpayne@69
|
48 CDIFF = ...
|
jpayne@69
|
49 CEQUAL = ...
|
jpayne@69
|
50 CHARD_CLIP = ...
|
jpayne@69
|
51 CINS = ...
|
jpayne@69
|
52 CMATCH = ...
|
jpayne@69
|
53 CPAD = ...
|
jpayne@69
|
54 CREF_SKIP = ...
|
jpayne@69
|
55 CSOFT_CLIP = ...
|
jpayne@69
|
56
|
jpayne@69
|
57 class SAM_FLAGS(enum.IntEnum):
|
jpayne@69
|
58 FDUP = ...
|
jpayne@69
|
59 FMREVERSE = ...
|
jpayne@69
|
60 FMUNMAP = ...
|
jpayne@69
|
61 FPAIRED = ...
|
jpayne@69
|
62 FPROPER_PAIR = ...
|
jpayne@69
|
63 FQCFAIL = ...
|
jpayne@69
|
64 FREAD1 = ...
|
jpayne@69
|
65 FREAD2 = ...
|
jpayne@69
|
66 FREVERSE = ...
|
jpayne@69
|
67 FSECONDARY = ...
|
jpayne@69
|
68 FSUPPLEMENTARY = ...
|
jpayne@69
|
69 FUNMAP = ...
|
jpayne@69
|
70
|
jpayne@69
|
71 class AlignedSegment:
|
jpayne@69
|
72 header: AlignmentHeader
|
jpayne@69
|
73 query_name: Optional[str]
|
jpayne@69
|
74 flag: int
|
jpayne@69
|
75 reference_name: Optional[str]
|
jpayne@69
|
76 reference_id: int
|
jpayne@69
|
77 reference_start: int
|
jpayne@69
|
78 mapping_quality: int
|
jpayne@69
|
79 cigarstring: Optional[str]
|
jpayne@69
|
80 next_reference_id: int
|
jpayne@69
|
81 next_reference_name: Optional[str]
|
jpayne@69
|
82 next_reference_start: int
|
jpayne@69
|
83 template_length: int
|
jpayne@69
|
84 query_sequence: Optional[str]
|
jpayne@69
|
85 query_qualities: Optional[array]
|
jpayne@69
|
86 bin: int
|
jpayne@69
|
87 is_paired: bool
|
jpayne@69
|
88 is_proper_pair: bool
|
jpayne@69
|
89 is_unmapped: bool
|
jpayne@69
|
90 mate_is_unmapped: bool
|
jpayne@69
|
91 is_mapped: bool
|
jpayne@69
|
92 mate_is_mapped: bool
|
jpayne@69
|
93 is_reverse: bool
|
jpayne@69
|
94 mate_is_reverse: bool
|
jpayne@69
|
95 is_forward: bool
|
jpayne@69
|
96 mate_is_forward: bool
|
jpayne@69
|
97 is_read1: bool
|
jpayne@69
|
98 is_read2: bool
|
jpayne@69
|
99 is_secondary: bool
|
jpayne@69
|
100 is_qcfail: bool
|
jpayne@69
|
101 is_duplicate: bool
|
jpayne@69
|
102 is_supplementary: bool
|
jpayne@69
|
103 cigartuples: Optional[List[Tuple[int, int]]]
|
jpayne@69
|
104 def __init__(self, header: Optional[AlignmentHeader] = ...) -> None: ...
|
jpayne@69
|
105 def compare(self, other: Any) -> int: ...
|
jpayne@69
|
106 def to_string(self) -> str: ...
|
jpayne@69
|
107 @classmethod
|
jpayne@69
|
108 def fromstring(cls, sam: str, header: AlignmentHeader) -> AlignedSegment: ...
|
jpayne@69
|
109 def to_dict(self) -> Dict: ...
|
jpayne@69
|
110 @classmethod
|
jpayne@69
|
111 def from_dict(cls, sam_dict: Dict[str, Any], header: AlignmentHeader) -> Any: ...
|
jpayne@69
|
112 def get_reference_positions(self, full_length: bool = ...) -> List[int]: ...
|
jpayne@69
|
113 @property
|
jpayne@69
|
114 def query_length(self) -> int: ...
|
jpayne@69
|
115 @property
|
jpayne@69
|
116 def reference_end(self) -> Optional[int]: ...
|
jpayne@69
|
117 @property
|
jpayne@69
|
118 def reference_length(self) -> Optional[int]: ...
|
jpayne@69
|
119 @property
|
jpayne@69
|
120 def query_alignment_sequence(self) -> Optional[str]: ...
|
jpayne@69
|
121 @property
|
jpayne@69
|
122 def query_alignment_qualities(self) -> Optional[array]: ...
|
jpayne@69
|
123 @property
|
jpayne@69
|
124 def query_alignment_start(self) -> int: ...
|
jpayne@69
|
125 @property
|
jpayne@69
|
126 def query_alignment_end(self) -> int: ...
|
jpayne@69
|
127 @property
|
jpayne@69
|
128 def modified_bases(self) -> Optional[Dict[Tuple[str, int, str], List[Tuple[int, int]]]]: ...
|
jpayne@69
|
129 @property
|
jpayne@69
|
130 def modified_bases_forward(self) -> Optional[Dict[Tuple[str, int, str], List[Tuple[int, int]]]]: ...
|
jpayne@69
|
131 @property
|
jpayne@69
|
132 def query_alignment_length(self) -> int: ...
|
jpayne@69
|
133 def infer_query_length(self) -> Optional[int]: ...
|
jpayne@69
|
134 def infer_read_length(self) -> Optional[int]: ...
|
jpayne@69
|
135 def get_reference_sequence(self) -> str: ...
|
jpayne@69
|
136 def get_forward_sequence(self) -> Optional[str]: ...
|
jpayne@69
|
137 def get_forward_qualities(self) -> Optional[array]: ...
|
jpayne@69
|
138 def get_aligned_pairs(
|
jpayne@69
|
139 self, matches_only: bool = ..., with_seq: bool = ..., with_cigar: bool = ...
|
jpayne@69
|
140 ) -> List[Tuple[int, int]]: ...
|
jpayne@69
|
141 def get_blocks(self) -> List[Tuple[int, int]]: ...
|
jpayne@69
|
142 def get_overlap(self, start: int, end: int) -> Optional[int]: ...
|
jpayne@69
|
143 def get_cigar_stats(self) -> Tuple[array, array]: ...
|
jpayne@69
|
144 def set_tag(
|
jpayne@69
|
145 self,
|
jpayne@69
|
146 tag: str,
|
jpayne@69
|
147 value: Union[int, float, str, bytes, array, List, Tuple, None],
|
jpayne@69
|
148 value_type: Optional[
|
jpayne@69
|
149 Literal["A", "i", "f", "Z", "H", "B", "c", "C", "s", "S", "I"]
|
jpayne@69
|
150 ] = ...,
|
jpayne@69
|
151 replace: bool = ...,
|
jpayne@69
|
152 ) -> None: ...
|
jpayne@69
|
153 def has_tag(self, tag: str) -> bool: ...
|
jpayne@69
|
154 @overload
|
jpayne@69
|
155 def get_tag(self, tag: str, with_value_type: Literal[False] = ...) -> TagValue: ...
|
jpayne@69
|
156 @overload
|
jpayne@69
|
157 def get_tag(
|
jpayne@69
|
158 self, tag: str, with_value_type: Literal[True]
|
jpayne@69
|
159 ) -> Tuple[TagValue, str]: ...
|
jpayne@69
|
160 @overload
|
jpayne@69
|
161 def get_tag(
|
jpayne@69
|
162 self, tag: str, with_value_type: bool
|
jpayne@69
|
163 ) -> Union[TagValue, Tuple[TagValue, str]]: ...
|
jpayne@69
|
164 @overload
|
jpayne@69
|
165 def get_tags(
|
jpayne@69
|
166 self, with_value_type: Literal[False] = ...
|
jpayne@69
|
167 ) -> List[Tuple[str, TagValue]]: ...
|
jpayne@69
|
168 @overload
|
jpayne@69
|
169 def get_tags(
|
jpayne@69
|
170 self, with_value_type: Literal[True]
|
jpayne@69
|
171 ) -> List[Tuple[str, TagValue, str]]: ...
|
jpayne@69
|
172 @overload
|
jpayne@69
|
173 def get_tags(
|
jpayne@69
|
174 self, with_value_type: bool
|
jpayne@69
|
175 ) -> Union[List[Tuple[str, TagValue]], List[Tuple[str, TagValue, str]]]: ...
|
jpayne@69
|
176 @overload
|
jpayne@69
|
177 def get_tags(
|
jpayne@69
|
178 self, with_value_type: bool = ...
|
jpayne@69
|
179 ) -> Union[List[Tuple[str, TagValue, str]], List[Tuple[str, TagValue]]]: ...
|
jpayne@69
|
180 def set_tags(self, tags: Any) -> None: ...
|
jpayne@69
|
181 def __eq__(self, other): ...
|
jpayne@69
|
182 def __ge__(self, other): ...
|
jpayne@69
|
183 def __gt__(self, other): ...
|
jpayne@69
|
184 def __le__(self, other): ...
|
jpayne@69
|
185 def __lt__(self, other): ...
|
jpayne@69
|
186 def __ne__(self, other): ...
|
jpayne@69
|
187
|
jpayne@69
|
188 class PileupRead:
|
jpayne@69
|
189 @property
|
jpayne@69
|
190 def alignment(self) -> AlignedSegment: ...
|
jpayne@69
|
191 @property
|
jpayne@69
|
192 def query_position(self) -> Optional[int]: ...
|
jpayne@69
|
193 @property
|
jpayne@69
|
194 def query_position_or_next(self) -> int: ...
|
jpayne@69
|
195 @property
|
jpayne@69
|
196 def indel(self) -> int: ...
|
jpayne@69
|
197 @property
|
jpayne@69
|
198 def level(self) -> int: ...
|
jpayne@69
|
199 @property
|
jpayne@69
|
200 def is_del(self) -> int: ...
|
jpayne@69
|
201 @property
|
jpayne@69
|
202 def is_head(self) -> int: ...
|
jpayne@69
|
203 @property
|
jpayne@69
|
204 def is_tail(self) -> int: ...
|
jpayne@69
|
205 @property
|
jpayne@69
|
206 def is_refskip(self) -> int: ...
|
jpayne@69
|
207
|
jpayne@69
|
208 class PileupColumn:
|
jpayne@69
|
209 nsegments: int
|
jpayne@69
|
210 def set_min_base_quality(self, min_base_quality: int) -> None: ...
|
jpayne@69
|
211 def __len__(self) -> int: ...
|
jpayne@69
|
212 @property
|
jpayne@69
|
213 def reference_id(self) -> int: ...
|
jpayne@69
|
214 @property
|
jpayne@69
|
215 def reference_name(self) -> Optional[str]: ...
|
jpayne@69
|
216 @property
|
jpayne@69
|
217 def reference_pos(self) -> int: ...
|
jpayne@69
|
218 @property
|
jpayne@69
|
219 def pileups(self) -> List[PileupRead]: ...
|
jpayne@69
|
220 def get_num_aligned(self) -> int: ...
|
jpayne@69
|
221 def get_query_sequences(
|
jpayne@69
|
222 self,
|
jpayne@69
|
223 mark_matches: bool = ...,
|
jpayne@69
|
224 mark_ends: bool = ...,
|
jpayne@69
|
225 add_indels: bool = ...,
|
jpayne@69
|
226 ) -> List[str]: ...
|
jpayne@69
|
227 def get_query_qualities(self) -> List[int]: ...
|
jpayne@69
|
228 def get_mapping_qualities(self) -> List[int]: ...
|
jpayne@69
|
229 def get_query_positions(self) -> List[int]: ...
|
jpayne@69
|
230 def get_query_names(self) -> List[str]: ...
|