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