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