annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/site-packages/pysam/libcalignmentfile.pyi @ 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 import array
jpayne@69 2 import sys
jpayne@69 3 from typing import (
jpayne@69 4 Any,
jpayne@69 5 Dict,
jpayne@69 6 Type,
jpayne@69 7 NamedTuple,
jpayne@69 8 Tuple,
jpayne@69 9 Optional,
jpayne@69 10 Sequence,
jpayne@69 11 Union,
jpayne@69 12 Callable,
jpayne@69 13 List,
jpayne@69 14 Iterable,
jpayne@69 15 )
jpayne@69 16
jpayne@69 17 if sys.version_info < (3, 8):
jpayne@69 18 from typing_extensions import Literal
jpayne@69 19 else:
jpayne@69 20 from typing import Literal
jpayne@69 21
jpayne@69 22 from pysam.libchtslib import HTSFile, _HasFileNo
jpayne@69 23 from pysam.libcalignedsegment import AlignedSegment, PileupColumn
jpayne@69 24 from pysam.libcfaidx import FastaFile
jpayne@69 25
jpayne@69 26 class IndexStats(NamedTuple):
jpayne@69 27 contig: str
jpayne@69 28 mapped: int
jpayne@69 29 unmapped: int
jpayne@69 30 total: int
jpayne@69 31
jpayne@69 32 VALID_HEADER_TYPES: Dict[str, Type]
jpayne@69 33 VALID_HEADERS: Tuple[str]
jpayne@69 34 KNOWN_HEADER_FIELDS: Dict[str, Dict[str, Type]]
jpayne@69 35 VALID_HEADER_ORDER: Dict[str, Tuple[str]]
jpayne@69 36
jpayne@69 37 def build_header_line(fields: Dict[str, str], record: str) -> str: ...
jpayne@69 38
jpayne@69 39 class AlignmentHeader:
jpayne@69 40 def __init__(self) -> None: ...
jpayne@69 41 @classmethod
jpayne@69 42 def _from_text_and_lengths(
jpayne@69 43 cls,
jpayne@69 44 text: Optional[str],
jpayne@69 45 reference_names: Optional[Sequence[str]],
jpayne@69 46 reference_lengths: Optional[Sequence[int]],
jpayne@69 47 ) -> AlignmentHeader: ...
jpayne@69 48 @classmethod
jpayne@69 49 def from_text(cls, text: str) -> AlignmentHeader: ...
jpayne@69 50 @classmethod
jpayne@69 51 def from_dict(cls, header_dict: Dict) -> AlignmentHeader: ...
jpayne@69 52 @classmethod
jpayne@69 53 def from_references(
jpayne@69 54 cls,
jpayne@69 55 reference_names: Sequence[str],
jpayne@69 56 reference_lengths: Sequence[int],
jpayne@69 57 text: Optional[str] = ...,
jpayne@69 58 add_sq_text: bool = ...,
jpayne@69 59 ) -> AlignmentHeader: ...
jpayne@69 60 def __bool__(self) -> bool: ...
jpayne@69 61 def copy(self) -> AlignmentHeader: ...
jpayne@69 62 @property
jpayne@69 63 def nreferences(self) -> int: ...
jpayne@69 64 @property
jpayne@69 65 def references(self) -> Tuple[str]: ...
jpayne@69 66 @property
jpayne@69 67 def lengths(self) -> Tuple[int]: ...
jpayne@69 68 def to_dict(self) -> Dict: ...
jpayne@69 69 def get_reference_name(self, tid: int) -> Optional[str]: ...
jpayne@69 70 def get_reference_length(self, reference: str) -> int: ...
jpayne@69 71 def is_valid_tid(self, tid: int) -> bool: ...
jpayne@69 72 def get_tid(self, reference: str) -> int: ...
jpayne@69 73
jpayne@69 74 # The iterator produced by AlignmentFile is currently itself, but this may
jpayne@69 75 # change in future and code should not make assumptions about this type.
jpayne@69 76 AlignmentFileIterator = AlignmentFile
jpayne@69 77
jpayne@69 78 class AlignmentFile(HTSFile):
jpayne@69 79 def __init__(
jpayne@69 80 self,
jpayne@69 81 filename: Union[str, bytes, int, _HasFileNo],
jpayne@69 82 mode: Optional[
jpayne@69 83 Literal["r", "w", "wh", "rb", "wb", "wbu", "wb0", "rc", "wc"]
jpayne@69 84 ] = ...,
jpayne@69 85 template: Optional[AlignmentFile] = ...,
jpayne@69 86 reference_names: Optional[Sequence[str]] = ...,
jpayne@69 87 reference_lengths: Optional[Sequence[int]] = ...,
jpayne@69 88 reference_filename: Optional[str] = ...,
jpayne@69 89 text: Optional[str] = ...,
jpayne@69 90 header: Union[None, Dict, AlignmentHeader] = ...,
jpayne@69 91 add_sq_text: bool = ...,
jpayne@69 92 add_sam_header: bool = ...,
jpayne@69 93 check_sq: bool = ...,
jpayne@69 94 index_filename: Optional[str] = ...,
jpayne@69 95 filepath_index: Optional[str] = ...,
jpayne@69 96 require_index: bool = ...,
jpayne@69 97 duplicate_filehandle: bool = ...,
jpayne@69 98 ignore_truncation: bool = ...,
jpayne@69 99 format_options: Optional[Sequence[str]] = ...,
jpayne@69 100 threads: int = ...,
jpayne@69 101 ) -> None: ...
jpayne@69 102 def has_index(self) -> bool: ...
jpayne@69 103 def check_index(self) -> bool: ...
jpayne@69 104 def fetch(
jpayne@69 105 self,
jpayne@69 106 contig: Optional[str] = ...,
jpayne@69 107 start: Optional[int] = ...,
jpayne@69 108 stop: Optional[int] = ...,
jpayne@69 109 region: Optional[str] = ...,
jpayne@69 110 tid: Optional[int] = ...,
jpayne@69 111 until_eof: bool = ...,
jpayne@69 112 multiple_iterators: bool = ...,
jpayne@69 113 reference: Optional[str] = ...,
jpayne@69 114 end: int = ...,
jpayne@69 115 ) -> IteratorRow: ...
jpayne@69 116 def head(self, n: int, multiple_iterators: bool = ...) -> IteratorRow: ...
jpayne@69 117 def mate(self, read: AlignedSegment) -> AlignedSegment: ...
jpayne@69 118 def pileup(
jpayne@69 119 self,
jpayne@69 120 contig: Optional[str] = ...,
jpayne@69 121 start: Optional[int] = ...,
jpayne@69 122 stop: Optional[int] = ...,
jpayne@69 123 region: Optional[str] = ...,
jpayne@69 124 reference: Optional[str] = ...,
jpayne@69 125 end: Optional[int] = ...,
jpayne@69 126 truncate: bool = ...,
jpayne@69 127 max_depth: int = ...,
jpayne@69 128 stepper: str = ...,
jpayne@69 129 fastafile: Optional[FastaFile] = ...,
jpayne@69 130 ignore_overlaps: bool = ...,
jpayne@69 131 flag_filter: int = ...,
jpayne@69 132 flag_require: int = ...,
jpayne@69 133 ignore_orphans: bool = ...,
jpayne@69 134 min_base_quality: int = ...,
jpayne@69 135 adjust_capq_threshold: int = ...,
jpayne@69 136 min_mapping_quality: int = ...,
jpayne@69 137 compute_baq: bool = ...,
jpayne@69 138 redo_baq: bool = ...,
jpayne@69 139 ) -> IteratorColumn: ...
jpayne@69 140 def count(
jpayne@69 141 self,
jpayne@69 142 contig: Optional[str] = ...,
jpayne@69 143 start: Optional[int] = ...,
jpayne@69 144 stop: Optional[int] = ...,
jpayne@69 145 region: Optional[str] = ...,
jpayne@69 146 until_eof: bool = ...,
jpayne@69 147 read_callback: Union[str, Callable[[AlignedSegment], bool]] = ...,
jpayne@69 148 reference: Optional[str] = ...,
jpayne@69 149 end: Optional[int] = ...,
jpayne@69 150 ) -> int: ...
jpayne@69 151 def count_coverage(
jpayne@69 152 self,
jpayne@69 153 contig: Optional[str] = ...,
jpayne@69 154 start: Optional[int] = ...,
jpayne@69 155 stop: Optional[int] = ...,
jpayne@69 156 region: Optional[str] = ...,
jpayne@69 157 quality_threshold: int = ...,
jpayne@69 158 read_callback: Union[str, Callable[[AlignedSegment], bool]] = ...,
jpayne@69 159 reference: Optional[str] = ...,
jpayne@69 160 end: Optional[int] = ...,
jpayne@69 161 ) -> Tuple[array.array, array.array, array.array, array.array]: ...
jpayne@69 162 def find_introns_slow(
jpayne@69 163 self, read_iterator: Iterable[AlignedSegment]
jpayne@69 164 ) -> Dict[Tuple[int, int], int]: ...
jpayne@69 165 def find_introns(
jpayne@69 166 self, read_iterator: Iterable[AlignedSegment]
jpayne@69 167 ) -> Dict[Tuple[int, int], int]: ...
jpayne@69 168 def close(self) -> None: ...
jpayne@69 169 def write(self, read: AlignedSegment) -> int: ...
jpayne@69 170 def __enter__(self) -> AlignmentFile: ...
jpayne@69 171 def __exit__(self, exc_type, exc_value, traceback): ...
jpayne@69 172 @property
jpayne@69 173 def mapped(self) -> int: ...
jpayne@69 174 @property
jpayne@69 175 def unmapped(self) -> int: ...
jpayne@69 176 @property
jpayne@69 177 def nocoordinate(self) -> int: ...
jpayne@69 178 def get_index_statistics(self) -> List[IndexStats]: ...
jpayne@69 179 def __iter__(self) -> AlignmentFileIterator: ...
jpayne@69 180 def __next__(self) -> AlignedSegment: ...
jpayne@69 181 def is_valid_tid(self, tid: int) -> bool: ...
jpayne@69 182 def get_tid(self, reference: str) -> int: ...
jpayne@69 183 def get_reference_name(self, tid: int) -> str: ...
jpayne@69 184 def get_reference_length(self, reference: str) -> int: ...
jpayne@69 185 @property
jpayne@69 186 def nreferences(self) -> int: ...
jpayne@69 187 @property
jpayne@69 188 def references(self) -> Tuple[str, ...]: ...
jpayne@69 189 @property
jpayne@69 190 def lengths(self) -> Tuple[int, ...]: ...
jpayne@69 191 @property
jpayne@69 192 def reference_filename(self) -> Optional[str]: ...
jpayne@69 193 @property
jpayne@69 194 def header(self) -> AlignmentHeader: ...
jpayne@69 195
jpayne@69 196 class IteratorRow:
jpayne@69 197 def __iter__(self) -> IteratorRow: ...
jpayne@69 198 def __next__(self) -> AlignedSegment: ...
jpayne@69 199
jpayne@69 200 class IteratorRowAll(IteratorRow): ...
jpayne@69 201 class IteratorRowAllRefs(IteratorRow): ...
jpayne@69 202 class IteratorRowHead(IteratorRow): ...
jpayne@69 203 class IteratorRowRegion(IteratorRow): ...
jpayne@69 204 class IteratorRowSelection(IteratorRow): ...
jpayne@69 205
jpayne@69 206 class IteratorColumn:
jpayne@69 207 def __iter__(self) -> IteratorColumn: ...
jpayne@69 208 def __next__(self) -> PileupColumn: ...
jpayne@69 209 @property
jpayne@69 210 def seq_len(self) -> int: ...
jpayne@69 211 def add_reference(self, fastafile: FastaFile) -> None: ...
jpayne@69 212 def has_reference(self) -> bool: ...
jpayne@69 213
jpayne@69 214 class IteratorColumnAll(IteratorColumn): ...
jpayne@69 215 class IteratorColumnAllRefs(IteratorColumn): ...
jpayne@69 216 class IteratorColumnRegion(IteratorColumn): ...
jpayne@69 217
jpayne@69 218 class SNPCall:
jpayne@69 219 @property
jpayne@69 220 def tid(self) -> int: ...
jpayne@69 221 @property
jpayne@69 222 def pos(self) -> int: ...
jpayne@69 223 @property
jpayne@69 224 def reference_base(self) -> str: ...
jpayne@69 225 @property
jpayne@69 226 def genotype(self) -> str: ...
jpayne@69 227 @property
jpayne@69 228 def consensus_quality(self) -> int: ...
jpayne@69 229 @property
jpayne@69 230 def snp_quality(self) -> int: ...
jpayne@69 231 @property
jpayne@69 232 def mapping_quality(self) -> int: ...
jpayne@69 233 @property
jpayne@69 234 def coverage(self) -> int: ...
jpayne@69 235
jpayne@69 236 class IndexedReads:
jpayne@69 237 def __init__(
jpayne@69 238 self, samfile: AlignmentFile, multiple_iterators: bool = ...
jpayne@69 239 ) -> None: ...
jpayne@69 240 def build(self) -> None: ...
jpayne@69 241 def find(self, query_name: str) -> IteratorRow: ...