jpayne@68: import array jpayne@68: import sys jpayne@68: from typing import ( jpayne@68: Any, jpayne@68: Dict, jpayne@68: Type, jpayne@68: NamedTuple, jpayne@68: Tuple, jpayne@68: Optional, jpayne@68: Sequence, jpayne@68: Union, jpayne@68: Callable, jpayne@68: List, jpayne@68: Iterable, jpayne@68: ) jpayne@68: jpayne@68: if sys.version_info < (3, 8): jpayne@68: from typing_extensions import Literal jpayne@68: else: jpayne@68: from typing import Literal jpayne@68: jpayne@68: from pysam.libchtslib import HTSFile, _HasFileNo jpayne@68: from pysam.libcalignedsegment import AlignedSegment, PileupColumn jpayne@68: from pysam.libcfaidx import FastaFile jpayne@68: jpayne@68: class IndexStats(NamedTuple): jpayne@68: contig: str jpayne@68: mapped: int jpayne@68: unmapped: int jpayne@68: total: int jpayne@68: jpayne@68: VALID_HEADER_TYPES: Dict[str, Type] jpayne@68: VALID_HEADERS: Tuple[str] jpayne@68: KNOWN_HEADER_FIELDS: Dict[str, Dict[str, Type]] jpayne@68: VALID_HEADER_ORDER: Dict[str, Tuple[str]] jpayne@68: jpayne@68: def build_header_line(fields: Dict[str, str], record: str) -> str: ... jpayne@68: jpayne@68: class AlignmentHeader: jpayne@68: def __init__(self) -> None: ... jpayne@68: @classmethod jpayne@68: def _from_text_and_lengths( jpayne@68: cls, jpayne@68: text: Optional[str], jpayne@68: reference_names: Optional[Sequence[str]], jpayne@68: reference_lengths: Optional[Sequence[int]], jpayne@68: ) -> AlignmentHeader: ... jpayne@68: @classmethod jpayne@68: def from_text(cls, text: str) -> AlignmentHeader: ... jpayne@68: @classmethod jpayne@68: def from_dict(cls, header_dict: Dict) -> AlignmentHeader: ... jpayne@68: @classmethod jpayne@68: def from_references( jpayne@68: cls, jpayne@68: reference_names: Sequence[str], jpayne@68: reference_lengths: Sequence[int], jpayne@68: text: Optional[str] = ..., jpayne@68: add_sq_text: bool = ..., jpayne@68: ) -> AlignmentHeader: ... jpayne@68: def __bool__(self) -> bool: ... jpayne@68: def copy(self) -> AlignmentHeader: ... jpayne@68: @property jpayne@68: def nreferences(self) -> int: ... jpayne@68: @property jpayne@68: def references(self) -> Tuple[str]: ... jpayne@68: @property jpayne@68: def lengths(self) -> Tuple[int]: ... jpayne@68: def to_dict(self) -> Dict: ... jpayne@68: def get_reference_name(self, tid: int) -> Optional[str]: ... jpayne@68: def get_reference_length(self, reference: str) -> int: ... jpayne@68: def is_valid_tid(self, tid: int) -> bool: ... jpayne@68: def get_tid(self, reference: str) -> int: ... jpayne@68: jpayne@68: # The iterator produced by AlignmentFile is currently itself, but this may jpayne@68: # change in future and code should not make assumptions about this type. jpayne@68: AlignmentFileIterator = AlignmentFile jpayne@68: jpayne@68: class AlignmentFile(HTSFile): jpayne@68: def __init__( jpayne@68: self, jpayne@68: filename: Union[str, bytes, int, _HasFileNo], jpayne@68: mode: Optional[ jpayne@68: Literal["r", "w", "wh", "rb", "wb", "wbu", "wb0", "rc", "wc"] jpayne@68: ] = ..., jpayne@68: template: Optional[AlignmentFile] = ..., jpayne@68: reference_names: Optional[Sequence[str]] = ..., jpayne@68: reference_lengths: Optional[Sequence[int]] = ..., jpayne@68: reference_filename: Optional[str] = ..., jpayne@68: text: Optional[str] = ..., jpayne@68: header: Union[None, Dict, AlignmentHeader] = ..., jpayne@68: add_sq_text: bool = ..., jpayne@68: add_sam_header: bool = ..., jpayne@68: check_sq: bool = ..., jpayne@68: index_filename: Optional[str] = ..., jpayne@68: filepath_index: Optional[str] = ..., jpayne@68: require_index: bool = ..., jpayne@68: duplicate_filehandle: bool = ..., jpayne@68: ignore_truncation: bool = ..., jpayne@68: format_options: Optional[Sequence[str]] = ..., jpayne@68: threads: int = ..., jpayne@68: ) -> None: ... jpayne@68: def has_index(self) -> bool: ... jpayne@68: def check_index(self) -> bool: ... jpayne@68: def fetch( jpayne@68: self, jpayne@68: contig: Optional[str] = ..., jpayne@68: start: Optional[int] = ..., jpayne@68: stop: Optional[int] = ..., jpayne@68: region: Optional[str] = ..., jpayne@68: tid: Optional[int] = ..., jpayne@68: until_eof: bool = ..., jpayne@68: multiple_iterators: bool = ..., jpayne@68: reference: Optional[str] = ..., jpayne@68: end: int = ..., jpayne@68: ) -> IteratorRow: ... jpayne@68: def head(self, n: int, multiple_iterators: bool = ...) -> IteratorRow: ... jpayne@68: def mate(self, read: AlignedSegment) -> AlignedSegment: ... jpayne@68: def pileup( jpayne@68: self, jpayne@68: contig: Optional[str] = ..., jpayne@68: start: Optional[int] = ..., jpayne@68: stop: Optional[int] = ..., jpayne@68: region: Optional[str] = ..., jpayne@68: reference: Optional[str] = ..., jpayne@68: end: Optional[int] = ..., jpayne@68: truncate: bool = ..., jpayne@68: max_depth: int = ..., jpayne@68: stepper: str = ..., jpayne@68: fastafile: Optional[FastaFile] = ..., jpayne@68: ignore_overlaps: bool = ..., jpayne@68: flag_filter: int = ..., jpayne@68: flag_require: int = ..., jpayne@68: ignore_orphans: bool = ..., jpayne@68: min_base_quality: int = ..., jpayne@68: adjust_capq_threshold: int = ..., jpayne@68: min_mapping_quality: int = ..., jpayne@68: compute_baq: bool = ..., jpayne@68: redo_baq: bool = ..., jpayne@68: ) -> IteratorColumn: ... jpayne@68: def count( jpayne@68: self, jpayne@68: contig: Optional[str] = ..., jpayne@68: start: Optional[int] = ..., jpayne@68: stop: Optional[int] = ..., jpayne@68: region: Optional[str] = ..., jpayne@68: until_eof: bool = ..., jpayne@68: read_callback: Union[str, Callable[[AlignedSegment], bool]] = ..., jpayne@68: reference: Optional[str] = ..., jpayne@68: end: Optional[int] = ..., jpayne@68: ) -> int: ... jpayne@68: def count_coverage( jpayne@68: self, jpayne@68: contig: Optional[str] = ..., jpayne@68: start: Optional[int] = ..., jpayne@68: stop: Optional[int] = ..., jpayne@68: region: Optional[str] = ..., jpayne@68: quality_threshold: int = ..., jpayne@68: read_callback: Union[str, Callable[[AlignedSegment], bool]] = ..., jpayne@68: reference: Optional[str] = ..., jpayne@68: end: Optional[int] = ..., jpayne@68: ) -> Tuple[array.array, array.array, array.array, array.array]: ... jpayne@68: def find_introns_slow( jpayne@68: self, read_iterator: Iterable[AlignedSegment] jpayne@68: ) -> Dict[Tuple[int, int], int]: ... jpayne@68: def find_introns( jpayne@68: self, read_iterator: Iterable[AlignedSegment] jpayne@68: ) -> Dict[Tuple[int, int], int]: ... jpayne@68: def close(self) -> None: ... jpayne@68: def write(self, read: AlignedSegment) -> int: ... jpayne@68: def __enter__(self) -> AlignmentFile: ... jpayne@68: def __exit__(self, exc_type, exc_value, traceback): ... jpayne@68: @property jpayne@68: def mapped(self) -> int: ... jpayne@68: @property jpayne@68: def unmapped(self) -> int: ... jpayne@68: @property jpayne@68: def nocoordinate(self) -> int: ... jpayne@68: def get_index_statistics(self) -> List[IndexStats]: ... jpayne@68: def __iter__(self) -> AlignmentFileIterator: ... jpayne@68: def __next__(self) -> AlignedSegment: ... jpayne@68: def is_valid_tid(self, tid: int) -> bool: ... jpayne@68: def get_tid(self, reference: str) -> int: ... jpayne@68: def get_reference_name(self, tid: int) -> str: ... jpayne@68: def get_reference_length(self, reference: str) -> int: ... jpayne@68: @property jpayne@68: def nreferences(self) -> int: ... jpayne@68: @property jpayne@68: def references(self) -> Tuple[str, ...]: ... jpayne@68: @property jpayne@68: def lengths(self) -> Tuple[int, ...]: ... jpayne@68: @property jpayne@68: def reference_filename(self) -> Optional[str]: ... jpayne@68: @property jpayne@68: def header(self) -> AlignmentHeader: ... jpayne@68: jpayne@68: class IteratorRow: jpayne@68: def __iter__(self) -> IteratorRow: ... jpayne@68: def __next__(self) -> AlignedSegment: ... jpayne@68: jpayne@68: class IteratorRowAll(IteratorRow): ... jpayne@68: class IteratorRowAllRefs(IteratorRow): ... jpayne@68: class IteratorRowHead(IteratorRow): ... jpayne@68: class IteratorRowRegion(IteratorRow): ... jpayne@68: class IteratorRowSelection(IteratorRow): ... jpayne@68: jpayne@68: class IteratorColumn: jpayne@68: def __iter__(self) -> IteratorColumn: ... jpayne@68: def __next__(self) -> PileupColumn: ... jpayne@68: @property jpayne@68: def seq_len(self) -> int: ... jpayne@68: def add_reference(self, fastafile: FastaFile) -> None: ... jpayne@68: def has_reference(self) -> bool: ... jpayne@68: jpayne@68: class IteratorColumnAll(IteratorColumn): ... jpayne@68: class IteratorColumnAllRefs(IteratorColumn): ... jpayne@68: class IteratorColumnRegion(IteratorColumn): ... jpayne@68: jpayne@68: class SNPCall: jpayne@68: @property jpayne@68: def tid(self) -> int: ... jpayne@68: @property jpayne@68: def pos(self) -> int: ... jpayne@68: @property jpayne@68: def reference_base(self) -> str: ... jpayne@68: @property jpayne@68: def genotype(self) -> str: ... jpayne@68: @property jpayne@68: def consensus_quality(self) -> int: ... jpayne@68: @property jpayne@68: def snp_quality(self) -> int: ... jpayne@68: @property jpayne@68: def mapping_quality(self) -> int: ... jpayne@68: @property jpayne@68: def coverage(self) -> int: ... jpayne@68: jpayne@68: class IndexedReads: jpayne@68: def __init__( jpayne@68: self, samfile: AlignmentFile, multiple_iterators: bool = ... jpayne@68: ) -> None: ... jpayne@68: def build(self) -> None: ... jpayne@68: def find(self, query_name: str) -> IteratorRow: ...