-
Notifications
You must be signed in to change notification settings - Fork 2
/
haem.pyi
459 lines (378 loc) · 14.3 KB
/
haem.pyi
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
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
import typing
class StopTranslation(Exception):
"""StopTranslation is raised when a stop codon is encountered during
translation."""
...
class DNABase:
"""An enumeration of DNA bases, as defined by IUPAC.
DNABases may be instantiated either directly by their variant or by their
IUPAC code. For example:
>>> DNABase.THYMINE
>>> DNABase('T')
A ValueError is raised if the code is not valid."""
ADENINE: DNABase
CYTOSINE: DNABase
GUANINE: DNABase
THYMINE: DNABase
ADENINE_CYTOSINE: DNABase
ADENINE_GUANINE: DNABase
ADENINE_THYMINE: DNABase
CYTOSINE_GUANINE: DNABase
CYTOSINE_THYMINE: DNABase
GUANINE_THYMINE: DNABase
ADENINE_CYTOSINE_GUANINE: DNABase
ADENINE_CYTOSINE_THYMINE: DNABase
ADENINE_GUANINE_THYMINE: DNABase
CYTOSINE_GUANINE_THYMINE: DNABase
ANY: DNABase
GAP: DNABase
@classmethod
def __new__(cls, code: str) -> DNABase: ...
@property
def code(self) -> str:
"""One-letter IUPAC code of the DNA base."""
...
@property
def complement(self) -> DNABase:
"""The complementary DNA base."""
...
def transcribe(self) -> RNABase:
"""Transcription of the DNA base to a RNA base."""
...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __bool__(self) -> bool:
"""Casting to bool is False for DNABase.GAP and True otherwise."""
...
def __invert__(self) -> DNABase:
"""See `DNABase.complement`."""
def __add__(self, other: typing.Union[DNABase, DNASequence, str]) -> DNASequence:
"""Create a new sequence consisting of this base followed by the given
sequence member(s)."""
...
def __radd__(self, other: typing.Union[DNABase, DNASequence, str]) -> DNASequence:
"""Create a new sequence consisting of the given sequence member(s)
followed by this base."""
...
class RNABase:
"""An enumeration of RNA bases, as defined by IUPAC.
RNABases may be instantiated either directly by their variant or by their
IUPAC code. For example:
>>> RNABase.URACIL
>>> RNABase('U')
A ValueError is raised if the code is not valid."""
ADENINE: RNABase
CYTOSINE: RNABase
GUANINE: RNABase
URACIL: RNABase
ADENINE_CYTOSINE: RNABase
ADENINE_GUANINE: RNABase
ADENINE_URACIL: RNABase
CYTOSINE_GUANINE: RNABase
CYTOSINE_URACIL: RNABase
GUANINE_URACIL: RNABase
ADENINE_CYTOSINE_GUANINE: RNABase
ADENINE_CYTOSINE_URACIL: RNABase
ADENINE_GUANINE_URACIL: RNABase
CYTOSINE_GUANINE_URACIL: RNABase
ANY: RNABase
GAP: RNABase
@classmethod
def __new__(cls, code: str) -> RNABase: ...
@property
def code(self) -> str:
"""One-letter IUPAC code of the RNA base."""
...
@property
def complement(self) -> RNABase:
"""The complementary RNA base."""
...
def retro_transcribe(self) -> DNABase:
"""Reverse transcription of the RNA base to a DNA base."""
...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __bool__(self) -> bool:
"""Casting to bool is False for RNABase.GAP and True otherwise."""
...
def __invert__(self) -> RNABase:
"""See `RNABase.complement`."""
def __add__(self, other: typing.Union[RNABase, RNASequence, str]) -> RNASequence:
"""Create a new sequence consisting of this base followed by the given
sequence member(s)."""
...
def __radd__(self, other: typing.Union[RNABase, RNASequence, str]) -> RNASequence:
"""Create a new sequence consisting of the given sequence member(s)
followed by this base."""
...
class AminoAcid:
"""An enumeration of amino acids, as defined by IUPAC.
AminoAcids may be instantiated either directly by their variant, by their
IUPAC code, by a tuple of three RNABases or by a string containing three
RNABase IUPAC codes. For example:
>>> AminoAcid.SERINE
>>> AminoAcid('S')
>>> AminoAcid((RNABase.ADENINE, RNABase.GUANINE, RNABase.CYTOSINE))
>>> AminoAcid(('A', 'G', 'C'))
>>> AminoAcid('AGC')
AminoAcids may also be instantiated by ambiguous IUPAC RNA codes where
appropriate. For example:
>>> AminoAcid('AGY') # Serine
Invalid inputs or codons that result in ambiguous amino acids will raise a
ValueError.
Stop codons will cause a StopTranslation exception to be raised."""
ALANINE: AminoAcid
ASPARTIC_ACID_ASPARAGINE: AminoAcid
CYSTEINE: AminoAcid
ASPARTIC_ACID: AminoAcid
GLUTAMIC_ACID: AminoAcid
PHENYLALANINE: AminoAcid
GLYCINE: AminoAcid
HISTIDINE: AminoAcid
ISOLEUCINE: AminoAcid
LYSINE: AminoAcid
LEUCINE: AminoAcid
METHIONINE: AminoAcid
ASPARAGINE: AminoAcid
PROLINE: AminoAcid
GLUTAMINE: AminoAcid
ARGININE: AminoAcid
SERINE: AminoAcid
THREONINE: AminoAcid
VALINE: AminoAcid
TRYPTOPHAN: AminoAcid
ANY: AminoAcid
TYROSINE: AminoAcid
GLUTAMINE_GLUTAMIC_ACID: AminoAcid
@classmethod
def __new__(
cls,
code_or_codon: typing.Union[
str, typing.Tuple[RNABase, RNABase, RNABase], typing.Tuple[str, str, str]
],
) -> AminoAcid: ...
@property
def code(self) -> str:
"""One-letter IUPAC code of the amino acid."""
...
@property
def short_name(self) -> str:
"""Three-letter IUPAC code of the amino acid."""
...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __bool__(self) -> bool:
"""Always true."""
...
def __add__(
self, other: typing.Union[AminoAcid, AminoAcidSequence, str]
) -> AminoAcidSequence:
"""Create a new sequence consisting of this amino acid followed by the
given sequence member(s)."""
...
def __radd__(
self, other: typing.Union[AminoAcid, AminoAcidSequence, str]
) -> AminoAcidSequence:
"""Create a new sequence consisting of the given sequence member(s)
followed by this amino acid."""
...
class DNASequence:
@classmethod
def __new__(
cls,
bases: typing.Union[
str,
typing.Iterable[typing.Union[str, DNABase]],
typing.Sequence[typing.Union[str, DNABase]],
] = "",
) -> DNASequence:
"""A sequence of `DNABase`s.
`DNASequence` may be instantiated by a string of IUPAC DNA codes, or a
sequence or iterable of `DNABase`s or IUPAC DNA codes. For example:
>>> DNASequence("ACGT")
>>> DNASequence(["A", "C", "G", "T"])
>>> DNASequence(iter(["A", "C", "G", "T"]))
>>> DNASequence([DNABase.ADENINE, DNABase.CYTOSINE])
>>> DNASequence(iter([DNABase.ADENINE, DNABase.CYTOSINE]))
A ValueError is raised if any DNA code is not valid."""
...
@property
def complement(self) -> DNASequence:
"""The complementary DNA sequence."""
def transcribe(self) -> RNASequence:
"""Transcription of the DNA sequence to a RNA sequence."""
...
def __invert__(self) -> DNASequence:
"""See `DNASequence.complement`."""
...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __bool__(self) -> bool:
"""Casting to bool is False for empty sequences and True otherwise."""
...
def __add__(self, other: typing.Union[DNABase, DNASequence, str]) -> DNASequence:
"""Create a new sequence consisting of this sequence followed by the
given sequence member(s)."""
def __radd__(self, other: typing.Union[DNABase, DNASequence, str]) -> DNASequence:
"""Create a new sequence consisting of the given sequence member(s)
followed by this sequence."""
...
def __contains__(self, item: typing.Union[DNABase, DNASequence]) -> bool:
"""Return true if the given DNABase or DNASequence is contained within
this sequence."""
...
def __len__(self) -> int: ...
def __getitem__(
self, key: typing.Union[int, slice]
) -> typing.Union[DNABase, DNASequence]: ...
def __iter__(self) -> typing.Iterator[DNABase]: ...
def count(
self, item: typing.Union[DNABase, DNASequence, str], overlap: bool = True
) -> int:
"""Count the occurances of a DNABase in the sequence."""
...
def find(
self, target: typing.Union[DNASequence, DNABase, str]
) -> typing.Optional[int]:
"""Find the index of the first occurance of the given DNABase or
DNASequence."""
...
class RNASequence:
@classmethod
def __new__(
cls,
bases: typing.Union[
str,
typing.Iterable[typing.Union[str, RNABase]],
typing.Sequence[typing.Union[str, RNABase]],
] = "",
) -> RNASequence:
"""A sequence of `RNABase`s.
`RNASequence` may be instantiated by a string of IUPAC RNA codes, or a
sequence or iterable of `RNABase`s or IUPAC RNA codes. For example:
>>> RNASequence("ACGU")
>>> RNASequence(["A", "C", "G", "U"])
>>> RNASequence(iter(["A", "C", "G", "U"]))
>>> RNASequence([RNABase.ADENINE, RNABase.CYTOSINE])
>>> RNASequence(iter([RNABase.ADENINE, RNABase.CYTOSINE]))
A ValueError is raised if any RNA code is not valid."""
...
@property
def complement(self) -> RNASequence:
"""The complementary RNA sequence."""
def retro_transcribe(self) -> DNASequence:
"""Reverse transcription of the RNA sequence to a DNA sequence."""
...
def translate(self) -> AminoAcidSequence:
"""Translate the RNA sequence to an amino acid sequence.
Translation searches for the first Methionine (AUG) codon and
translates until it finds a stop codon.
A ValueError is raised if no start codon is found, or not stop codon is
found following the start codon."""
...
def __invert__(self) -> RNASequence:
"""See `RNASequence.complement`."""
...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __bool__(self) -> bool:
"""Casting to bool is False for empty sequences and True otherwise."""
...
def __add__(self, other: typing.Union[RNABase, RNASequence, str]) -> RNASequence:
"""Create a new sequence consisting of this sequence followed by the
given sequence member(s)."""
def __radd__(self, other: typing.Union[RNABase, RNASequence, str]) -> RNASequence:
"""Create a new sequence consisting of the given sequence member(s)
followed by this sequence."""
...
def __contains__(self, item: typing.Union[RNABase, RNASequence]) -> bool:
"""Return true if the given RNABase or RNASequence is contained within
this sequence."""
...
def __len__(self) -> int: ...
def __getitem__(
self, key: typing.Union[int, slice]
) -> typing.Union[RNABase, RNASequence]: ...
def __iter__(self) -> typing.Iterator[RNABase]: ...
def count(
self, item: typing.Union[RNABase, RNASequence, str], overlap: bool = True
) -> int:
"""Count the occurances of a RNABase in the sequence."""
...
def find(
self, target: typing.Union[RNASequence, RNABase, str]
) -> typing.Optional[int]:
"""Find the index of the first occurance of the given RNABase or
RNASequence."""
...
class AminoAcidSequence:
@classmethod
def __new__(
cls,
bases: typing.Union[
str,
typing.Iterable[typing.Union[str, AminoAcid]],
typing.Sequence[typing.Union[str, AminoAcid]],
] = "",
) -> AminoAcidSequence:
"""A sequence of `AminoAcid`s.
`AminoAcidSequence` may be instantiated by a string of IUPAC amino acid
codes, or a sequence or iterable of `AminoAcid`s or IUPAC amino acid
codes. For example:
>>> AminoAcidSequence("MVVR")
>>> AminoAcidSequence(["M", "V", "V", "R"])
>>> AminoAcidSequence(iter(["M", "V", "V", "R"]))
>>> AminoAcidSequence([AminoAcid.METHIONINE, AminoAcid.VALINE])
>>> AminoAcidSequence(iter([AminoAcid.METHIONINE, AminoAcid.VALINE]))
A ValueError is raised if any amino acid code is not valid."""
...
def __repr__(self) -> str: ...
def __str__(self) -> str: ...
def __eq__(self, other: object) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __bool__(self) -> bool:
"""Casting to bool is False for empty sequences and True otherwise."""
...
def __add__(
self, other: typing.Union[AminoAcid, AminoAcidSequence, str]
) -> AminoAcidSequence:
"""Create a new sequence consisting of this sequence followed by the
given sequence member(s)."""
def __radd__(
self, other: typing.Union[AminoAcidSequence, AminoAcid, str]
) -> AminoAcidSequence:
"""Create a new sequence consisting of the given sequence member(s)
followed by this sequence."""
...
def __contains__(self, item: typing.Union[AminoAcid, AminoAcidSequence]) -> bool:
"""Return true if the given AminoAcid or AminoAcidSequence is contained
within this sequence."""
...
def __len__(self) -> int: ...
def __getitem__(
self, key: typing.Union[int, slice]
) -> typing.Union[AminoAcid, AminoAcidSequence]: ...
def __iter__(self) -> typing.Iterator[AminoAcid]: ...
def count(
self,
item: typing.Union[AminoAcid, str, AminoAcidSequence],
overlap: bool = False,
) -> int:
"""Count the occurances of an AminoAcid in the sequence."""
...
def find(
self, target: typing.Union[AminoAcidSequence, AminoAcid, str]
) -> typing.Optional[int]:
"""Find the index of the first occurance of the given AminoAcid or
AminoAcidSequence."""
...