| 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 |
| 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 = ... |
| 47 |
CDEL = ... |
| 48 |
CDIFF = ... |
| 49 |
CEQUAL = ... |
| 50 |
CHARD_CLIP = ... |
| 51 |
CINS = ... |
| 52 |
CMATCH = ... |
| 53 |
CPAD = ... |
| 54 |
CREF_SKIP = ... |
| 55 |
CSOFT_CLIP = ... |
| 56 |
|
| 57 |
class SAM_FLAGS(enum.IntEnum): |
| 58 |
FDUP = ... |
| 59 |
FMREVERSE = ... |
| 60 |
FMUNMAP = ... |
| 61 |
FPAIRED = ... |
| 62 |
FPROPER_PAIR = ... |
| 63 |
FQCFAIL = ... |
| 64 |
FREAD1 = ... |
| 65 |
FREAD2 = ... |
| 66 |
FREVERSE = ... |
| 67 |
FSECONDARY = ... |
| 68 |
FSUPPLEMENTARY = ... |
| 69 |
FUNMAP = ... |
| 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 |
query_qualities_str: Optional[str] |
| 87 |
bin: int |
| 88 |
is_paired: bool |
| 89 |
is_proper_pair: bool |
| 90 |
is_unmapped: bool |
| 91 |
mate_is_unmapped: bool |
| 92 |
is_mapped: bool |
| 93 |
mate_is_mapped: bool |
| 94 |
is_reverse: bool |
| 95 |
mate_is_reverse: bool |
| 96 |
is_forward: bool |
| 97 |
mate_is_forward: bool |
| 98 |
is_read1: bool |
| 99 |
is_read2: bool |
| 100 |
is_secondary: bool |
| 101 |
is_qcfail: bool |
| 102 |
is_duplicate: bool |
| 103 |
is_supplementary: bool |
| 104 |
cigartuples: Optional[List[Tuple[int, int]]] |
| 105 |
def __init__(self, header: Optional[AlignmentHeader] = ...) -> None: ... |
| 106 |
def compare(self, other: Any) -> int: ... |
| 107 |
def to_string(self) -> str: ... |
| 108 |
@classmethod |
| 109 |
def fromstring(cls, sam: str, header: AlignmentHeader) -> AlignedSegment: ... |
| 110 |
def to_dict(self) -> Dict: ... |
| 111 |
@classmethod |
| 112 |
def from_dict(cls, sam_dict: Dict[str, Any], header: AlignmentHeader) -> Any: ... |
| 113 |
def get_reference_positions(self, full_length: bool = ...) -> List[int]: ... |
| 114 |
@property |
| 115 |
def query_length(self) -> int: ... |
| 116 |
@property |
| 117 |
def reference_end(self) -> Optional[int]: ... |
| 118 |
@property |
| 119 |
def reference_length(self) -> Optional[int]: ... |
| 120 |
@property |
| 121 |
def query_alignment_sequence(self) -> Optional[str]: ... |
| 122 |
@property |
| 123 |
def query_alignment_qualities(self) -> Optional[array]: ... |
| 124 |
@property |
| 125 |
def query_alignment_qualities_str(self) -> Optional[str]: ... |
| 126 |
@property |
| 127 |
def query_alignment_start(self) -> int: ... |
| 128 |
@property |
| 129 |
def query_alignment_end(self) -> int: ... |
| 130 |
@property |
| 131 |
def modified_bases(self) -> Optional[Dict[Tuple[str, int, str], List[Tuple[int, int]]]]: ... |
| 132 |
@property |
| 133 |
def modified_bases_forward(self) -> Optional[Dict[Tuple[str, int, str], List[Tuple[int, int]]]]: ... |
| 134 |
@property |
| 135 |
def query_alignment_length(self) -> int: ... |
| 136 |
def infer_query_length(self) -> Optional[int]: ... |
| 137 |
def infer_read_length(self) -> Optional[int]: ... |
| 138 |
def get_reference_sequence(self) -> str: ... |
| 139 |
def get_forward_sequence(self) -> Optional[str]: ... |
| 140 |
def get_forward_qualities(self) -> Optional[array]: ... |
| 141 |
|
| 142 |
@overload |
| 143 |
def get_aligned_pairs(self, matches_only: Literal[True], with_seq: Literal[False] = ..., with_cigar: Literal[False] = ...) -> List[Tuple[int, int]]: ... |
| 144 |
@overload |
| 145 |
def get_aligned_pairs(self, matches_only: Literal[True], with_seq: Literal[False], with_cigar: Literal[True]) -> List[Tuple[int, int, CIGAR_OPS]]: ... |
| 146 |
@overload |
| 147 |
def get_aligned_pairs(self, matches_only: Literal[True], with_seq: Literal[True], with_cigar: Literal[False] = ...) -> List[Tuple[int, int, str]]: ... |
| 148 |
@overload |
| 149 |
def get_aligned_pairs(self, matches_only: Literal[True], with_seq: Literal[True], with_cigar: Literal[True]) -> List[Tuple[int, int, str, CIGAR_OPS]]: ... |
| 150 |
|
| 151 |
@overload |
| 152 |
def get_aligned_pairs(self, matches_only: bool = ..., with_seq: Literal[False] = ..., with_cigar: Literal[False] = ...) -> List[Tuple[Optional[int], Optional[int]]]: ... |
| 153 |
@overload |
| 154 |
def get_aligned_pairs(self, matches_only: bool, with_seq: Literal[False], with_cigar: Literal[True]) -> List[Tuple[Optional[int], Optional[int], CIGAR_OPS]]: ... |
| 155 |
@overload |
| 156 |
def get_aligned_pairs(self, matches_only: bool, with_seq: Literal[True], with_cigar: Literal[False] = ...) -> List[Tuple[Optional[int], Optional[int], Optional[str]]]: ... |
| 157 |
@overload |
| 158 |
def get_aligned_pairs(self, matches_only: bool, with_seq: Literal[True], with_cigar: Literal[True]) -> List[Tuple[Optional[int], Optional[int], Optional[str], CIGAR_OPS]]: ... |
| 159 |
|
| 160 |
@overload |
| 161 |
def get_aligned_pairs(self, matches_only: bool = ..., with_seq: bool = ..., with_cigar: bool = ...) -> List[Tuple]: ... |
| 162 |
|
| 163 |
def get_blocks(self) -> List[Tuple[int, int]]: ... |
| 164 |
def get_overlap(self, start: int, end: int) -> Optional[int]: ... |
| 165 |
def get_cigar_stats(self) -> Tuple[array, array]: ... |
| 166 |
def set_tag( |
| 167 |
self, |
| 168 |
tag: str, |
| 169 |
value: Union[int, float, str, bytes, array, List, Tuple, None], |
| 170 |
value_type: Optional[ |
| 171 |
Literal["A", "i", "f", "Z", "H", "B", "c", "C", "s", "S", "I"] |
| 172 |
] = ..., |
| 173 |
replace: bool = ..., |
| 174 |
) -> None: ... |
| 175 |
def has_tag(self, tag: str) -> bool: ... |
| 176 |
@overload |
| 177 |
def get_tag(self, tag: str, with_value_type: Literal[False] = ...) -> TagValue: ... |
| 178 |
@overload |
| 179 |
def get_tag( |
| 180 |
self, tag: str, with_value_type: Literal[True] |
| 181 |
) -> Tuple[TagValue, str]: ... |
| 182 |
@overload |
| 183 |
def get_tag( |
| 184 |
self, tag: str, with_value_type: bool |
| 185 |
) -> Union[TagValue, Tuple[TagValue, str]]: ... |
| 186 |
@overload |
| 187 |
def get_tags( |
| 188 |
self, with_value_type: Literal[False] = ... |
| 189 |
) -> List[Tuple[str, TagValue]]: ... |
| 190 |
@overload |
| 191 |
def get_tags( |
| 192 |
self, with_value_type: Literal[True] |
| 193 |
) -> List[Tuple[str, TagValue, str]]: ... |
| 194 |
@overload |
| 195 |
def get_tags( |
| 196 |
self, with_value_type: bool |
| 197 |
) -> Union[List[Tuple[str, TagValue]], List[Tuple[str, TagValue, str]]]: ... |
| 198 |
@overload |
| 199 |
def get_tags( |
| 200 |
self, with_value_type: bool = ... |
| 201 |
) -> Union[List[Tuple[str, TagValue, str]], List[Tuple[str, TagValue]]]: ... |
| 202 |
def set_tags(self, tags: Any) -> None: ... |
| 203 |
def __eq__(self, other): ... |
| 204 |
def __ge__(self, other): ... |
| 205 |
def __gt__(self, other): ... |
| 206 |
def __le__(self, other): ... |
| 207 |
def __lt__(self, other): ... |
| 208 |
def __ne__(self, other): ... |
| 209 |
|
| 210 |
class PileupRead: |
| 211 |
@property |
| 212 |
def alignment(self) -> AlignedSegment: ... |
| 213 |
@property |
| 214 |
def query_position(self) -> Optional[int]: ... |
| 215 |
@property |
| 216 |
def query_position_or_next(self) -> int: ... |
| 217 |
@property |
| 218 |
def indel(self) -> int: ... |
| 219 |
@property |
| 220 |
def level(self) -> int: ... |
| 221 |
@property |
| 222 |
def is_del(self) -> int: ... |
| 223 |
@property |
| 224 |
def is_head(self) -> int: ... |
| 225 |
@property |
| 226 |
def is_tail(self) -> int: ... |
| 227 |
@property |
| 228 |
def is_refskip(self) -> int: ... |
| 229 |
|
| 230 |
class PileupColumn: |
| 231 |
nsegments: int |
| 232 |
def set_min_base_quality(self, min_base_quality: int) -> None: ... |
| 233 |
def __len__(self) -> int: ... |
| 234 |
@property |
| 235 |
def reference_id(self) -> int: ... |
| 236 |
@property |
| 237 |
def reference_name(self) -> Optional[str]: ... |
| 238 |
@property |
| 239 |
def reference_pos(self) -> int: ... |
| 240 |
@property |
| 241 |
def pileups(self) -> List[PileupRead]: ... |
| 242 |
def get_num_aligned(self) -> int: ... |
| 243 |
def get_query_sequences( |
| 244 |
self, |
| 245 |
mark_matches: bool = ..., |
| 246 |
mark_ends: bool = ..., |
| 247 |
add_indels: bool = ..., |
| 248 |
) -> List[str]: ... |
| 249 |
def get_query_qualities(self) -> List[int]: ... |
| 250 |
def get_mapping_qualities(self) -> List[int]: ... |
| 251 |
def get_query_positions(self) -> List[int]: ... |
| 252 |
def get_query_names(self) -> List[str]: ... |