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