annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/lib/python3.8/site-packages/pysam/libcbcf.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 sys
jpayne@69 2 from typing import (
jpayne@69 3 Optional,
jpayne@69 4 Union,
jpayne@69 5 Any,
jpayne@69 6 Sequence,
jpayne@69 7 Tuple,
jpayne@69 8 Iterator,
jpayne@69 9 List,
jpayne@69 10 Iterable,
jpayne@69 11 Dict,
jpayne@69 12 overload,
jpayne@69 13 TypeVar,
jpayne@69 14 Mapping,
jpayne@69 15 Generic,
jpayne@69 16 )
jpayne@69 17
jpayne@69 18 if sys.version_info < (3, 8):
jpayne@69 19 from typing_extensions import Literal
jpayne@69 20 else:
jpayne@69 21 from typing import Literal
jpayne@69 22
jpayne@69 23 from pysam.libchtslib import HTSFile, _HasFileNo
jpayne@69 24
jpayne@69 25 _D = TypeVar("_D")
jpayne@69 26 _K = TypeVar("_K", str, Union[int, str])
jpayne@69 27 _V = TypeVar("_V")
jpayne@69 28
jpayne@69 29 class _Mapping(Generic[_K, _V]):
jpayne@69 30 def __len__(self) -> int: ...
jpayne@69 31 def __contains__(self, key: _K) -> bool: ...
jpayne@69 32 def __iter__(self) -> Iterator[_K]: ...
jpayne@69 33 def iterkeys(self) -> Iterator[_K]: ...
jpayne@69 34 def itervalues(self) -> Iterator[_V]: ...
jpayne@69 35 def iteritems(self) -> Iterator[Tuple[_K, _V]]: ...
jpayne@69 36 def keys(self) -> List[_K]: ...
jpayne@69 37 def items(self) -> List[Tuple[_K, _V]]: ...
jpayne@69 38 def values(self) -> List[_V]: ...
jpayne@69 39 def __bool__(self) -> bool: ...
jpayne@69 40 def __getitem__(self, key: _K) -> _V: ...
jpayne@69 41 def get(self, key: _K, default: _D = ...) -> Union[_D, _V]: ...
jpayne@69 42
jpayne@69 43 class VariantHeaderRecord(_Mapping[str, str]):
jpayne@69 44 @property
jpayne@69 45 def header(self) -> VariantHeader: ...
jpayne@69 46 @property
jpayne@69 47 def type(self) -> Optional[str]: ...
jpayne@69 48 @property
jpayne@69 49 def key(self) -> Optional[str]: ...
jpayne@69 50 @property
jpayne@69 51 def value(self) -> Optional[str]: ...
jpayne@69 52 @property
jpayne@69 53 def attrs(self) -> Sequence[Tuple[str, str]]: ...
jpayne@69 54 def update(self, items: Union[Iterable, Dict] = ..., **kwargs) -> None: ...
jpayne@69 55 def pop(self, key: str, default: str = ...) -> str: ...
jpayne@69 56 def remove(self) -> None: ... # crashes
jpayne@69 57
jpayne@69 58 class VariantHeaderRecords:
jpayne@69 59 @property
jpayne@69 60 def header(self) -> VariantHeader: ...
jpayne@69 61 def __len__(self) -> int: ...
jpayne@69 62 def __bool__(self) -> bool: ...
jpayne@69 63 def __getitem__(self, index) -> VariantHeaderRecord: ...
jpayne@69 64 def __iter__(self) -> Iterator[VariantHeaderRecord]: ...
jpayne@69 65
jpayne@69 66 class VariantMetadata:
jpayne@69 67 @property
jpayne@69 68 def header(self) -> VariantHeader: ...
jpayne@69 69 @property
jpayne@69 70 def name(self) -> str: ...
jpayne@69 71 # @property # should this be exposed?
jpayne@69 72 # def id(self) -> int: ...
jpayne@69 73 @property
jpayne@69 74 def number(self) -> Optional[str]: ...
jpayne@69 75 @property
jpayne@69 76 def type(self) -> Optional[str]: ...
jpayne@69 77 @property
jpayne@69 78 def description(self) -> Optional[str]: ...
jpayne@69 79 @property
jpayne@69 80 def record(self) -> Optional[VariantHeaderRecord]: ...
jpayne@69 81 def remove_header(self) -> None: ...
jpayne@69 82
jpayne@69 83 class VariantHeaderMetadata(_Mapping[str, VariantMetadata]):
jpayne@69 84 @property
jpayne@69 85 def header(self) -> VariantHeader: ...
jpayne@69 86 def add(
jpayne@69 87 self,
jpayne@69 88 id: str,
jpayne@69 89 number: Optional[Union[int, str]],
jpayne@69 90 type: Optional[str],
jpayne@69 91 description: str,
jpayne@69 92 **kwargs
jpayne@69 93 ) -> None: ...
jpayne@69 94 def remove_header(self, key: str) -> None: ...
jpayne@69 95 def clear_header(self) -> None: ...
jpayne@69 96
jpayne@69 97 class VariantContig:
jpayne@69 98 @property
jpayne@69 99 def header(self) -> VariantHeader: ...
jpayne@69 100 @property
jpayne@69 101 def name(self) -> str: ...
jpayne@69 102 @property
jpayne@69 103 def id(self) -> int: ...
jpayne@69 104 @property
jpayne@69 105 def length(self) -> Optional[int]: ...
jpayne@69 106 @property
jpayne@69 107 def header_record(self) -> VariantHeaderRecord: ...
jpayne@69 108 def remove_header(self) -> None: ...
jpayne@69 109
jpayne@69 110 class VariantHeaderContigs(_Mapping[Union[int, str], VariantContig]):
jpayne@69 111 @property
jpayne@69 112 def header(self) -> VariantHeader: ...
jpayne@69 113 def remove_header(self, key: Union[int, str]) -> None: ...
jpayne@69 114 def clear_header(self) -> None: ...
jpayne@69 115 def add(self, id: str, length: Optional[int] = ..., **kwargs) -> None: ...
jpayne@69 116
jpayne@69 117 class VariantHeaderSamples:
jpayne@69 118 @property
jpayne@69 119 def header(self) -> VariantHeader: ...
jpayne@69 120 def __len__(self) -> int: ...
jpayne@69 121 def __bool__(self) -> bool: ...
jpayne@69 122 def __getitem__(self, index: int) -> str: ...
jpayne@69 123 def __iter__(self) -> Iterator[str]: ...
jpayne@69 124 def __contains__(self, key: str) -> bool: ...
jpayne@69 125 def add(self, name: str) -> None: ...
jpayne@69 126
jpayne@69 127 class VariantHeader:
jpayne@69 128 def __init__(self) -> None: ...
jpayne@69 129 def __bool__(self) -> bool: ...
jpayne@69 130 def copy(self) -> VariantHeader: ...
jpayne@69 131 def merge(self, header: VariantHeader) -> None: ...
jpayne@69 132 @property
jpayne@69 133 def version(self) -> str: ...
jpayne@69 134 @property
jpayne@69 135 def samples(self) -> VariantHeaderSamples: ...
jpayne@69 136 @property
jpayne@69 137 def records(self) -> VariantHeaderRecords: ...
jpayne@69 138 @property
jpayne@69 139 def contigs(self) -> VariantHeaderContigs: ...
jpayne@69 140 @property
jpayne@69 141 def filters(self) -> VariantHeaderMetadata: ...
jpayne@69 142 @property
jpayne@69 143 def info(self) -> VariantHeaderMetadata: ...
jpayne@69 144 @property
jpayne@69 145 def formats(self) -> VariantHeaderMetadata: ...
jpayne@69 146 @property
jpayne@69 147 def alts(self) -> Dict[str, VariantHeaderRecord]: ...
jpayne@69 148 def new_record(
jpayne@69 149 self,
jpayne@69 150 contig: Optional[str] = ...,
jpayne@69 151 start: int = ...,
jpayne@69 152 stop: int = ...,
jpayne@69 153 alleles: Optional[Tuple[str, ...]] = ...,
jpayne@69 154 id: Optional[str] = ...,
jpayne@69 155 qual: Optional[float] = ...,
jpayne@69 156 filter: Optional[Any] = ...,
jpayne@69 157 info: Optional[Mapping[str, _InfoValue]] = ...,
jpayne@69 158 samples: Optional[Iterable[Optional[Mapping[str, _FormatValue]]]] = ...,
jpayne@69 159 **kwargs
jpayne@69 160 ) -> VariantRecord: ...
jpayne@69 161 def add_record(self, record: VariantHeaderRecord) -> None: ...
jpayne@69 162 def add_line(self, line: str) -> None: ...
jpayne@69 163 @overload
jpayne@69 164 def add_meta(
jpayne@69 165 self, key: str, value: None = ..., items: Iterable[Tuple[str, str]] = ...
jpayne@69 166 ) -> None: ...
jpayne@69 167 @overload
jpayne@69 168 def add_meta(self, key: str, value: str = ..., items: None = ...) -> None: ...
jpayne@69 169 def add_sample(self, name: str) -> None: ...
jpayne@69 170 def add_samples(self, *args: Union[str, Iterable[str]]) -> None: ...
jpayne@69 171
jpayne@69 172 class VariantRecordFilter(_Mapping[Union[int, str], VariantMetadata]):
jpayne@69 173 def add(self, key: str) -> None: ...
jpayne@69 174 def __delitem__(self, key: Union[int, str]) -> None: ...
jpayne@69 175 def clear(self) -> None: ...
jpayne@69 176 def __eq__(self, other) -> bool: ...
jpayne@69 177 def __ne__(self, other) -> bool: ...
jpayne@69 178
jpayne@69 179 class VariantRecordFormat(_Mapping[str, VariantMetadata]):
jpayne@69 180 def __delitem__(self, key: str) -> None: ...
jpayne@69 181 def clear(self) -> None: ...
jpayne@69 182
jpayne@69 183 _InfoValue = Any # TODO see bcf_info_get_value
jpayne@69 184
jpayne@69 185 class VariantRecordInfo(_Mapping[str, _InfoValue]):
jpayne@69 186 def __setitem__(self, key: str, object: _InfoValue) -> None: ...
jpayne@69 187 def __delitem__(self, key: str) -> None: ...
jpayne@69 188 def clear(self) -> None: ...
jpayne@69 189 def update(
jpayne@69 190 self, items: Optional[_Mapping[str, _InfoValue]] = ..., **kwargs
jpayne@69 191 ) -> None: ...
jpayne@69 192 def pop(self, key: str, default: _D = ...) -> Union[_D, _InfoValue]: ...
jpayne@69 193 def __eq__(self, other) -> bool: ...
jpayne@69 194 def __ne__(self, other) -> bool: ...
jpayne@69 195
jpayne@69 196 class VariantRecordSamples(_Mapping[Union[str, int], "VariantRecordSample"]):
jpayne@69 197 def __eq__(self, other) -> bool: ...
jpayne@69 198 def __ne__(self, other) -> bool: ...
jpayne@69 199 # TODO Do these work? Isn’t the container read only?
jpayne@69 200 def update(
jpayne@69 201 self,
jpayne@69 202 items: Optional[Mapping[Union[str, int], VariantRecordSample]] = ...,
jpayne@69 203 **kwargs
jpayne@69 204 ) -> None: ...
jpayne@69 205 def pop(
jpayne@69 206 self, key: Union[str, int], default: _D = ...
jpayne@69 207 ) -> Union[_D, VariantRecordSample]: ...
jpayne@69 208
jpayne@69 209 class VariantRecord:
jpayne@69 210 @property
jpayne@69 211 def header(self) -> VariantHeader: ...
jpayne@69 212 def copy(self) -> VariantRecord: ...
jpayne@69 213 def translate(self, dst_header: VariantHeader) -> None: ...
jpayne@69 214 rid: int
jpayne@69 215 chrom: str
jpayne@69 216 contig: str
jpayne@69 217 pos: int
jpayne@69 218 start: int
jpayne@69 219 stop: int
jpayne@69 220 rlen: int
jpayne@69 221 qual: Optional[float]
jpayne@69 222 id: Optional[str]
jpayne@69 223 ref: Optional[str]
jpayne@69 224 alleles: Optional[Tuple[str, ...]]
jpayne@69 225 alts: Optional[Tuple[str, ...]]
jpayne@69 226 @property
jpayne@69 227 def filter(self) -> VariantRecordFilter: ...
jpayne@69 228 @property
jpayne@69 229 def info(self) -> VariantRecordInfo: ...
jpayne@69 230 @property
jpayne@69 231 def format(self) -> VariantRecordFormat: ...
jpayne@69 232 @property
jpayne@69 233 def samples(self) -> VariantRecordSamples: ...
jpayne@69 234 def __eq__(self, other) -> bool: ...
jpayne@69 235 def __ne__(self, other) -> bool: ...
jpayne@69 236
jpayne@69 237 _FormatValue = Any # TODO see bcf_format_get_value
jpayne@69 238
jpayne@69 239 class VariantRecordSample(_Mapping[str, _FormatValue]):
jpayne@69 240 @property
jpayne@69 241 def index(self) -> int: ...
jpayne@69 242 @property
jpayne@69 243 def name(self) -> str: ...
jpayne@69 244 allele_indices: Optional[Tuple[Optional[int], ...]]
jpayne@69 245 alleles: Optional[Tuple[Optional[str], ...]]
jpayne@69 246 phased: bool
jpayne@69 247 def __setitem__(self, key: str, value: _FormatValue) -> None: ...
jpayne@69 248 def __delitem__(self, key: str) -> None: ...
jpayne@69 249 def clear(self) -> None: ...
jpayne@69 250 def update(
jpayne@69 251 self, items: Optional[Mapping[str, _FormatValue]] = ..., **kwargs
jpayne@69 252 ) -> None: ...
jpayne@69 253 def pop(self, key: str, default: _D = ...) -> Union[_D, _FormatValue]: ...
jpayne@69 254 def __eq__(self, other) -> Any: ...
jpayne@69 255 def __ne__(self, other) -> Any: ...
jpayne@69 256
jpayne@69 257 class BaseIndex(_Mapping[Union[int, str], str]):
jpayne@69 258 refs: Sequence[str]
jpayne@69 259 refmap: Dict[str, str]
jpayne@69 260 def __init__(self) -> None: ...
jpayne@69 261 # TODO Do these work? Isn’t the container read only?
jpayne@69 262 def update(self, items: Optional[Mapping[str, str]] = ..., **kwargs) -> None: ...
jpayne@69 263 def pop(self, key: str, default: _D = ...) -> Union[_D, str]: ...
jpayne@69 264
jpayne@69 265 class BCFIndex(BaseIndex):
jpayne@69 266 @property
jpayne@69 267 def header(self) -> VariantHeader: ...
jpayne@69 268 def __init__(self) -> None: ...
jpayne@69 269 def fetch(
jpayne@69 270 self,
jpayne@69 271 bcf: VariantFile,
jpayne@69 272 contig: str,
jpayne@69 273 start: Optional[int],
jpayne@69 274 stop: Optional[int],
jpayne@69 275 reopen: bool,
jpayne@69 276 ) -> BCFIterator: ...
jpayne@69 277
jpayne@69 278 class TabixIndex(BaseIndex):
jpayne@69 279 def __init__(self) -> None: ...
jpayne@69 280 def fetch(
jpayne@69 281 self,
jpayne@69 282 bcf: VariantFile,
jpayne@69 283 contig: str,
jpayne@69 284 start: Optional[int],
jpayne@69 285 stop: Optional[int],
jpayne@69 286 reopen: bool,
jpayne@69 287 ) -> TabixIterator: ...
jpayne@69 288
jpayne@69 289 class BaseIterator:
jpayne@69 290 def __init__(self) -> None: ...
jpayne@69 291
jpayne@69 292 class BCFIterator(BaseIterator):
jpayne@69 293 def __init__(
jpayne@69 294 self,
jpayne@69 295 bcf: VariantFile,
jpayne@69 296 contig: str,
jpayne@69 297 start: Optional[int] = ...,
jpayne@69 298 stop: Optional[int] = ...,
jpayne@69 299 reopen: bool = ...,
jpayne@69 300 ) -> None: ...
jpayne@69 301 def __iter__(self) -> BCFIterator: ...
jpayne@69 302 def __next__(self) -> VariantRecord: ...
jpayne@69 303
jpayne@69 304 class TabixIterator(BaseIterator):
jpayne@69 305 def __init__(
jpayne@69 306 self,
jpayne@69 307 bcf: VariantFile,
jpayne@69 308 contig: str,
jpayne@69 309 start: Optional[int] = ...,
jpayne@69 310 stop: Optional[int] = ...,
jpayne@69 311 reopen: bool = ...,
jpayne@69 312 ) -> None: ...
jpayne@69 313 def __iter__(self) -> TabixIterator: ...
jpayne@69 314 def __next__(self) -> VariantRecord: ...
jpayne@69 315
jpayne@69 316 class VariantFile(HTSFile):
jpayne@69 317 @property
jpayne@69 318 def header(self) -> VariantHeader: ...
jpayne@69 319 @property
jpayne@69 320 def index(self) -> BaseIndex: ...
jpayne@69 321 @property
jpayne@69 322 def drop_samples(self) -> bool: ...
jpayne@69 323 @property
jpayne@69 324 def is_reading(self) -> bool: ...
jpayne@69 325 @property
jpayne@69 326 def header_written(self) -> bool: ...
jpayne@69 327 def __init__(
jpayne@69 328 self,
jpayne@69 329 filename: Union[str, bytes, int, _HasFileNo],
jpayne@69 330 mode: Optional[Literal["r", "w", "wh", "rb", "wb", "wbu", "wb0"]] = ...,
jpayne@69 331 index_filename: Optional[str] = ...,
jpayne@69 332 header: Optional[VariantHeader] = ...,
jpayne@69 333 drop_samples: bool = ...,
jpayne@69 334 duplicate_filehandle: bool = ...,
jpayne@69 335 ignore_truncation: bool = ...,
jpayne@69 336 threads: int = ...,
jpayne@69 337 ) -> None: ...
jpayne@69 338 def close(self) -> None: ...
jpayne@69 339 def __iter__(self) -> VariantFile: ...
jpayne@69 340 def __next__(self) -> VariantRecord: ...
jpayne@69 341 def copy(self) -> VariantFile: ...
jpayne@69 342 def open(
jpayne@69 343 self,
jpayne@69 344 filename: Union[str, bytes, int, _HasFileNo],
jpayne@69 345 mode: Optional[Literal["r", "w", "wh", "rb", "wb", "wbu", "wb0"]] = ...,
jpayne@69 346 index_filename: Optional[str] = ...,
jpayne@69 347 header: Optional[VariantHeader] = ...,
jpayne@69 348 drop_samples: bool = ...,
jpayne@69 349 duplicate_filehandle: bool = ...,
jpayne@69 350 ignore_truncation: bool = ...,
jpayne@69 351 threads: int = ...,
jpayne@69 352 ) -> None: ...
jpayne@69 353 def reset(self) -> None: ...
jpayne@69 354 def is_valid_tid(self, tid: int) -> bool: ...
jpayne@69 355 def get_tid(self, reference: str) -> int: ...
jpayne@69 356 def get_reference_name(self, tid: int) -> str: ...
jpayne@69 357 def fetch(
jpayne@69 358 self,
jpayne@69 359 contig: Optional[str] = ...,
jpayne@69 360 start: Optional[int] = ...,
jpayne@69 361 stop: Optional[int] = ...,
jpayne@69 362 region: Optional[str] = ...,
jpayne@69 363 reopen: bool = ...,
jpayne@69 364 end: Optional[int] = ...,
jpayne@69 365 reference: Optional[str] = ...,
jpayne@69 366 ) -> Iterator[VariantRecord]: ...
jpayne@69 367 def new_record(self, *args, **kwargs) -> Any: ...
jpayne@69 368 def write(self, record: VariantRecord) -> int: ...
jpayne@69 369 def subset_samples(self, include_samples: Iterable[str]) -> None: ...