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