annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/site-packages/pysam/libcalignmentfile.pyi @ 68:5028fdace37b

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