您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

253 行
8.0 KiB

  1. import enum
  2. import re
  3. import sys
  4. from array import array
  5. from typing import Any, List, Optional, Dict, Tuple, Union, overload
  6. if sys.version_info < (3, 8):
  7. from typing_extensions import Literal
  8. else:
  9. from typing import Literal
  10. from pysam import AlignmentHeader # type: ignore
  11. CMATCH: int
  12. CINS: int
  13. CDEL: int
  14. CREF_SKIP: int
  15. CSOFT_CLIP: int
  16. CHARD_CLIP: int
  17. CPAD: int
  18. CEQUAL: int
  19. CDIFF: int
  20. CBACK: int
  21. FPAIRED: int
  22. FPROPER_PAIR: int
  23. FUNMAP: int
  24. FMUNMAP: int
  25. FREVERSE: int
  26. FMREVERSE: int
  27. FREAD1: int
  28. FREAD2: int
  29. FSECONDARY: int
  30. FQCFAIL: int
  31. FDUP: int
  32. FSUPPLEMENTARY: int
  33. CIGAR2CODE: Dict[int, str]
  34. CIGAR_REGEX: re.Pattern
  35. DATATYPE2FORMAT: Dict[int, Tuple[str, int]]
  36. KEY_NAMES: List[str]
  37. TagValue = Union[str, int, float, array]
  38. class CIGAR_OPS(enum.IntEnum):
  39. CBACK = ...
  40. CDEL = ...
  41. CDIFF = ...
  42. CEQUAL = ...
  43. CHARD_CLIP = ...
  44. CINS = ...
  45. CMATCH = ...
  46. CPAD = ...
  47. CREF_SKIP = ...
  48. CSOFT_CLIP = ...
  49. class SAM_FLAGS(enum.IntEnum):
  50. FDUP = ...
  51. FMREVERSE = ...
  52. FMUNMAP = ...
  53. FPAIRED = ...
  54. FPROPER_PAIR = ...
  55. FQCFAIL = ...
  56. FREAD1 = ...
  57. FREAD2 = ...
  58. FREVERSE = ...
  59. FSECONDARY = ...
  60. FSUPPLEMENTARY = ...
  61. FUNMAP = ...
  62. class AlignedSegment:
  63. header: AlignmentHeader
  64. query_name: Optional[str]
  65. flag: int
  66. reference_name: Optional[str]
  67. reference_id: int
  68. reference_start: int
  69. mapping_quality: int
  70. cigarstring: Optional[str]
  71. next_reference_id: int
  72. next_reference_name: Optional[str]
  73. next_reference_start: int
  74. template_length: int
  75. query_sequence: Optional[str]
  76. query_qualities: Optional[array]
  77. query_qualities_str: Optional[str]
  78. bin: int
  79. is_paired: bool
  80. is_proper_pair: bool
  81. is_unmapped: bool
  82. mate_is_unmapped: bool
  83. is_mapped: bool
  84. mate_is_mapped: bool
  85. is_reverse: bool
  86. mate_is_reverse: bool
  87. is_forward: bool
  88. mate_is_forward: bool
  89. is_read1: bool
  90. is_read2: bool
  91. is_secondary: bool
  92. is_qcfail: bool
  93. is_duplicate: bool
  94. is_supplementary: bool
  95. cigartuples: Optional[List[Tuple[int, int]]]
  96. def __init__(self, header: Optional[AlignmentHeader] = ...) -> None: ...
  97. def compare(self, other: Any) -> int: ...
  98. def to_string(self) -> str: ...
  99. @classmethod
  100. def fromstring(cls, sam: str, header: AlignmentHeader) -> AlignedSegment: ...
  101. def to_dict(self) -> Dict: ...
  102. @classmethod
  103. def from_dict(cls, sam_dict: Dict[str, Any], header: AlignmentHeader) -> Any: ...
  104. def get_reference_positions(self, full_length: bool = ...) -> List[int]: ...
  105. @property
  106. def query_length(self) -> int: ...
  107. @property
  108. def reference_end(self) -> Optional[int]: ...
  109. @property
  110. def reference_length(self) -> Optional[int]: ...
  111. @property
  112. def query_alignment_sequence(self) -> Optional[str]: ...
  113. @property
  114. def query_alignment_qualities(self) -> Optional[array]: ...
  115. @property
  116. def query_alignment_qualities_str(self) -> Optional[str]: ...
  117. @property
  118. def query_alignment_start(self) -> int: ...
  119. @property
  120. def query_alignment_end(self) -> int: ...
  121. @property
  122. def modified_bases(self) -> Optional[Dict[Tuple[str, int, str], List[Tuple[int, int]]]]: ...
  123. @property
  124. def modified_bases_forward(self) -> Optional[Dict[Tuple[str, int, str], List[Tuple[int, int]]]]: ...
  125. @property
  126. def query_alignment_length(self) -> int: ...
  127. def infer_query_length(self) -> Optional[int]: ...
  128. def infer_read_length(self) -> Optional[int]: ...
  129. def get_reference_sequence(self) -> str: ...
  130. def get_forward_sequence(self) -> Optional[str]: ...
  131. def get_forward_qualities(self) -> Optional[array]: ...
  132. @overload
  133. def get_aligned_pairs(self, matches_only: Literal[True], with_seq: Literal[False] = ..., with_cigar: Literal[False] = ...) -> List[Tuple[int, int]]: ...
  134. @overload
  135. def get_aligned_pairs(self, matches_only: Literal[True], with_seq: Literal[False], with_cigar: Literal[True]) -> List[Tuple[int, int, CIGAR_OPS]]: ...
  136. @overload
  137. def get_aligned_pairs(self, matches_only: Literal[True], with_seq: Literal[True], with_cigar: Literal[False] = ...) -> List[Tuple[int, int, str]]: ...
  138. @overload
  139. def get_aligned_pairs(self, matches_only: Literal[True], with_seq: Literal[True], with_cigar: Literal[True]) -> List[Tuple[int, int, str, CIGAR_OPS]]: ...
  140. @overload
  141. def get_aligned_pairs(self, matches_only: bool = ..., with_seq: Literal[False] = ..., with_cigar: Literal[False] = ...) -> List[Tuple[Optional[int], Optional[int]]]: ...
  142. @overload
  143. def get_aligned_pairs(self, matches_only: bool, with_seq: Literal[False], with_cigar: Literal[True]) -> List[Tuple[Optional[int], Optional[int], CIGAR_OPS]]: ...
  144. @overload
  145. def get_aligned_pairs(self, matches_only: bool, with_seq: Literal[True], with_cigar: Literal[False] = ...) -> List[Tuple[Optional[int], Optional[int], Optional[str]]]: ...
  146. @overload
  147. def get_aligned_pairs(self, matches_only: bool, with_seq: Literal[True], with_cigar: Literal[True]) -> List[Tuple[Optional[int], Optional[int], Optional[str], CIGAR_OPS]]: ...
  148. @overload
  149. def get_aligned_pairs(self, matches_only: bool = ..., with_seq: bool = ..., with_cigar: bool = ...) -> List[Tuple]: ...
  150. def get_blocks(self) -> List[Tuple[int, int]]: ...
  151. def get_overlap(self, start: int, end: int) -> Optional[int]: ...
  152. def get_cigar_stats(self) -> Tuple[array, array]: ...
  153. def set_tag(
  154. self,
  155. tag: str,
  156. value: Union[int, float, str, bytes, array, List, Tuple, None],
  157. value_type: Optional[
  158. Literal["A", "i", "f", "Z", "H", "B", "c", "C", "s", "S", "I"]
  159. ] = ...,
  160. replace: bool = ...,
  161. ) -> None: ...
  162. def has_tag(self, tag: str) -> bool: ...
  163. @overload
  164. def get_tag(self, tag: str, with_value_type: Literal[False] = ...) -> TagValue: ...
  165. @overload
  166. def get_tag(
  167. self, tag: str, with_value_type: Literal[True]
  168. ) -> Tuple[TagValue, str]: ...
  169. @overload
  170. def get_tag(
  171. self, tag: str, with_value_type: bool
  172. ) -> Union[TagValue, Tuple[TagValue, str]]: ...
  173. @overload
  174. def get_tags(
  175. self, with_value_type: Literal[False] = ...
  176. ) -> List[Tuple[str, TagValue]]: ...
  177. @overload
  178. def get_tags(
  179. self, with_value_type: Literal[True]
  180. ) -> List[Tuple[str, TagValue, str]]: ...
  181. @overload
  182. def get_tags(
  183. self, with_value_type: bool
  184. ) -> Union[List[Tuple[str, TagValue]], List[Tuple[str, TagValue, str]]]: ...
  185. @overload
  186. def get_tags(
  187. self, with_value_type: bool = ...
  188. ) -> Union[List[Tuple[str, TagValue, str]], List[Tuple[str, TagValue]]]: ...
  189. def set_tags(self, tags: Any) -> None: ...
  190. def __eq__(self, other): ...
  191. def __ge__(self, other): ...
  192. def __gt__(self, other): ...
  193. def __le__(self, other): ...
  194. def __lt__(self, other): ...
  195. def __ne__(self, other): ...
  196. class PileupRead:
  197. @property
  198. def alignment(self) -> AlignedSegment: ...
  199. @property
  200. def query_position(self) -> Optional[int]: ...
  201. @property
  202. def query_position_or_next(self) -> int: ...
  203. @property
  204. def indel(self) -> int: ...
  205. @property
  206. def level(self) -> int: ...
  207. @property
  208. def is_del(self) -> int: ...
  209. @property
  210. def is_head(self) -> int: ...
  211. @property
  212. def is_tail(self) -> int: ...
  213. @property
  214. def is_refskip(self) -> int: ...
  215. class PileupColumn:
  216. nsegments: int
  217. def set_min_base_quality(self, min_base_quality: int) -> None: ...
  218. def __len__(self) -> int: ...
  219. @property
  220. def reference_id(self) -> int: ...
  221. @property
  222. def reference_name(self) -> Optional[str]: ...
  223. @property
  224. def reference_pos(self) -> int: ...
  225. @property
  226. def pileups(self) -> List[PileupRead]: ...
  227. def get_num_aligned(self) -> int: ...
  228. def get_query_sequences(
  229. self,
  230. mark_matches: bool = ...,
  231. mark_ends: bool = ...,
  232. add_indels: bool = ...,
  233. ) -> List[str]: ...
  234. def get_query_qualities(self) -> List[int]: ...
  235. def get_mapping_qualities(self) -> List[int]: ...
  236. def get_query_positions(self) -> List[int]: ...
  237. def get_query_names(self) -> List[str]: ...