_pyrodigal.pyi 8 KB
Newer Older
1
import threading
2
import typing
3
4
5
6
from typing import Iterable, Iterator, Optional, Set, TextIO, Tuple, Union

# --- Globals ----------------------------------------------------------------

7
8
9
10
11
12
13
14
15
16
_TARGET_CPU           : str
_AVX2_RUNTIME_SUPPORT : bool
_NEON_RUNTIME_SUPPORT : bool
_SSE2_RUNTIME_SUPPORT : bool
_AVX2_BUILD_SUPPORT   : bool
_NEON_BUILD_SUPPORT   : bool
_SSE2_BUILD_SUPPORT   : bool

_TRANSLATION_TABLES   : Set[int]
METAGENOMIC_BINS      : Tuple[MetagenomicBin]
17

18
19
20
21
22
23
24
25
26
27

# --- Sequence mask ----------------------------------------------------------

class Mask:
    @property
    def begin(self) -> int: ...
    @property
    def end(self) -> int: ...

class Masks(typing.Sequence[Mask]):
28
    def __init__(self) -> None: ...
29
30
31
32
33
34
35
36
    def __sizeof__(self) -> int: ...
    def __len__(self) -> int: ...
    def __getitem__(self, index: int) -> Mask: ...
    def __iter__(self) -> Iterator[Mask]: ...
    def __reversed__(self) -> Iterator[Mask]: ...
    def clear(self) -> None: ...
    def copy(self) -> Masks: ...

37
38
39
40
41
42
43
44
45
# --- Input sequence ---------------------------------------------------------

class Sequence(typing.Sized):
    gc: float
    @classmethod
    def from_bytes(cls, sequence: Union[bytes, bytearray]) -> Sequence: ...
    @classmethod
    def from_string(cls, sequence: str) -> Sequence: ...
    def __len__(self) -> int: ...
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
    def __sizeof__(self) -> int: ...
    def __str__(self) -> str: ...
    def shine_dalgarno(
        self,
        pos: int,
        start: int,
        training_info: TrainingInfo,
        strand: int = 1,
        exact: bool = True
    ) -> int: ...

# --- Connection Scorer ------------------------------------------------------

class ConnectionScorer:
    def __init__(self, backend: str = "detect") -> None: ...
    def index(self, nodes: Nodes) -> None: ...
    def compute_skippable(self, min: int, i: int) -> None: ...
    def score_connections(self, nodes: Nodes, min: int, i: int, tinf: TrainingInfo, final: bool = False) -> None: ...
64
65
66
67
68

# --- Nodes ------------------------------------------------------------------

class Node:
    owner: Nodes
69
70
71
72
73
    def __repr__(self) -> str: ...
    @property
    def index(self) -> int: ...
    @property
    def strand(self) -> int: ...
74
    @property
75
76
77
78
79
80
81
82
83
84
    def type(self) -> str: ...
    @property
    def edge(self) -> bool: ...
    @property
    def gc_bias(self) -> int: ...
    @property
    def cscore(self) -> float: ...
    @property
    def gc_cont(self) -> float: ...
    @property
85
    def score(self) -> float: ...
86
87
88
89
90
91
    @property
    def rscore(self) -> float: ...
    @property
    def sscore(self) -> float: ...
    @property
    def tscore(self) -> float: ...
92
93

class Nodes(typing.Sequence[Node]):
94
    def __init__(self) -> None: ...
95
    def __copy__(self) -> Nodes: ...
96
97
98
    def __sizeof__(self) -> int: ...
    def __len__(self) -> int: ...
    def __getitem__(self, index: int) -> Node: ...
99
100
    def __iter__(self) -> Iterator[Node]: ...
    def __reversed__(self) -> Iterator[Node]: ...
101
    def copy(self) -> Nodes: ...
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
    def clear(self) -> None: ...
    def extract(
        self,
        sequence: Sequence,
        *,
        closed: bool = False,
        min_gene: int = 90,
        min_edge_gene: int = 60,
        translation_table: int = 11,
    ) -> int: ...
    def reset_scores(self) -> None: ...
    def score(
        self,
        sequence: Sequence,
        training_info: TrainingInfo,
        *,
        closed: bool = False,
        is_meta: bool = False,
    ) -> None: ...
121
122
123
124
125
    def sort(self) -> None: ...

# --- Genes ------------------------------------------------------------------

class Gene:
126
    def __repr__(self) -> str: ...
127
128
129
130
131
    @property
    def begin(self) -> int: ...
    @property
    def end(self) -> int: ...
    @property
132
133
134
135
136
137
138
139
140
    def start_node(self) -> None: ...
    @property
    def stop_node(self) -> None: ...
    @property
    def _gene_data(self) -> str: ...
    @property
    def _score_data(self) -> str: ...
    @property
    def strand(self) -> int: ...
141
    @property
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
    def partial_begin(self) -> bool: ...
    @property
    def partial_end(self) -> bool: ...
    @property
    def start_type(self) -> str: ...
    @property
    def rbs_motif(self) -> Optional[str]: ...
    @property
    def rbs_spacer(self) -> Optional[str]: ...
    @property
    def gc_cont(self) -> float: ...
    @property
    def translation_table(self) -> int: ...
    @property
    def cscore(self) -> float: ...
    @property
    def rscore(self) -> float: ...
    @property
    def sscore(self) -> float: ...
    @property
    def tscore(self) -> float: ...
    @property
    def uscore(self) -> float: ...
165
166
    @property
    def score(self) -> float: ...
167
168
169
    def confidence(self) -> float: ...
    def sequence(self) -> str: ...
    def translate(self, translation_table: Optional[int] = None, unknown_residue: str = "X") -> str: ...
170
171

class Genes(typing.Sequence[Gene]):
172
    def __bool__(self) -> int: ...
173
174
175
176
177
    def __len__(self) -> int: ...
    def __getitem__(self, index: int) -> Gene: ...
    def __iter__(self) -> Iterator[Gene]: ...
    def __reversed__(self) -> Iterator[Gene]: ...
    def clear(self) -> None: ...
178
179
180
181
182
    def write_gff(self, file: TextIO, prefix: str = "gene_") -> int: ...
    def write_genes(self, file: TextIO, prefix: str ="gene_", width: typing.Optional[int] = 70) -> int: ...
    def write_translations(self, file: TextIO, prefix: str = "gene_", width: typing.Optional[int] = 60, translation_table: typing.Optional[int] = None) -> int: ...
    def write_scores(self, file: TextIO, header: bool = True) -> int: ...

183
184
185

# --- Training Info ----------------------------------------------------------

186
class TrainingInfo:
187
188
    @classmethod
    def load(cls, fp: typing.BinaryIO) -> TrainingInfo: ...
189
190
    def __init__(self, gc: float, start_weight: float = 4.35, translation_table: int = 11) -> None: ...
    def __repr__(self) -> str: ...
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
    @property
    def translation_table(self) -> int: ...
    @translation_table.setter
    def translation_table(self, table: int) -> None: ...
    @property
    def gc(self) -> float: ...
    @gc.setter
    def gc(self, gc: float) -> None: ...
    @property
    def bias(self) -> Tuple[float, float, float]: ...
    @bias.setter
    def bias(self, bias: Iterable[float]) -> None: ...
    @property
    def type_weights(self) -> Tuple[float, float, float]: ...
    @type_weights.setter
    def type_weights(self, type_weights: Iterable[float]) -> None: ...
    @property
    def uses_sd(self) -> bool: ...
    @uses_sd.setter
    def uses_sd(self, uses_sd: bool) -> None: ...
211
212
213
214
    @property
    def start_weight(self) -> float: ...
    @start_weight.setter
    def start_weight(self, st_wt: float) -> None: ...
215
    def dump(self, fp: typing.BinaryIO) -> None: ...
216

217

218
219
220
# --- Metagenomic Bins -------------------------------------------------------

class MetagenomicBin:
221
    training_info: TrainingInfo
222
    def __repr__(self) -> str: ...
223
    @property
224
225
226
227
    def index(self) -> int: ...
    @property
    def description(self) -> str: ...

228

229
# --- Pyrodigal --------------------------------------------------------------
230

231
class OrfFinder:
232
    lock: threading.Lock
233
    _num_seq: int
234
235
236
237
238
239
240
241
242
243
244
    def __init__(
        self,
        training_info: Optional[TrainingInfo] = None,
        *,
        meta: bool = False,
        closed: bool = False,
        mask: bool = False,
        min_gene: int = 90,
        min_edge_gene: int = 60,
        max_overlap: int = 60,
    ) -> None: ...
245
    def __repr__(self) -> str: ...
246
247
    @property
    def training_info(self) -> Optional[TrainingInfo]: ...
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
    @property
    def meta(self) -> bool: ...
    @property
    def closed(self) -> bool: ...
    @property
    def mask(self) -> bool: ...
    @property
    def min_gene(self) -> int: ...
    @property
    def min_edge_gene(self) -> int: ...
    @property
    def max_overlap(self) -> int: ...
    def find_genes(
        self,
        sequence: Union[Sequence, str, bytes, bytearray]
    ) -> Genes: ...
264
265
    def train(
        self,
266
267
        sequence: Union[Sequence, str, bytes, bytearray],
        *,
268
        force_nonsd: bool = False,
269
        start_weight: float = 4.35,
270
        translation_table: int = 11,
271
    ) -> TrainingInfo: ...