pydna 5.5.1__py3-none-any.whl → 5.5.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pydna/__init__.py +116 -134
- pydna/_pretty.py +2 -14
- pydna/all.py +10 -20
- pydna/amplicon.py +25 -20
- pydna/amplify.py +46 -26
- pydna/assembly.py +50 -27
- pydna/assembly2.py +2627 -0
- pydna/common_sub_strings.py +2 -12
- pydna/contig.py +39 -22
- pydna/cre_lox.py +130 -0
- pydna/crispr.py +8 -13
- pydna/design.py +89 -59
- pydna/download.py +10 -18
- pydna/dseq.py +119 -59
- pydna/dseqrecord.py +88 -45
- pydna/fakeseq.py +0 -11
- pydna/fusionpcr.py +3 -1
- pydna/gateway.py +154 -152
- pydna/gel.py +8 -13
- pydna/genbank.py +33 -32
- pydna/genbankfile.py +8 -13
- pydna/genbankfixer.py +41 -28
- pydna/genbankrecord.py +11 -14
- pydna/goldengate.py +2 -2
- pydna/ladders.py +4 -11
- pydna/ligate.py +8 -14
- pydna/parsers.py +25 -9
- pydna/primer.py +3 -12
- pydna/readers.py +0 -11
- pydna/seq.py +21 -18
- pydna/seqrecord.py +20 -20
- pydna/sequence_picker.py +3 -12
- pydna/sequence_regex.py +44 -0
- pydna/tm.py +13 -15
- pydna/types.py +41 -0
- pydna/utils.py +173 -58
- {pydna-5.5.1.dist-info → pydna-5.5.3.dist-info}/METADATA +22 -18
- pydna-5.5.3.dist-info/RECORD +45 -0
- pydna/editor.py +0 -119
- pydna/myenzymes.py +0 -51
- pydna/myprimers.py +0 -219
- pydna-5.5.1.dist-info/RECORD +0 -44
- {pydna-5.5.1.dist-info → pydna-5.5.3.dist-info}/LICENSE.txt +0 -0
- {pydna-5.5.1.dist-info → pydna-5.5.3.dist-info}/WHEEL +0 -0
pydna/assembly.py
CHANGED
|
@@ -66,13 +66,14 @@ from typing import (
|
|
|
66
66
|
TypedDict as _TypedDict,
|
|
67
67
|
)
|
|
68
68
|
import itertools as _itertools
|
|
69
|
-
|
|
69
|
+
|
|
70
|
+
# import logging as _logging
|
|
70
71
|
|
|
71
72
|
# from func_timeout import func_set_timeout
|
|
72
73
|
# from wrapt_timeout_decorator import timeout
|
|
73
74
|
from pydna.threading_timer_decorator_exit import exit_after
|
|
74
75
|
|
|
75
|
-
_module_logger = _logging.getLogger("pydna." + __name__)
|
|
76
|
+
# _module_logger = _logging.getLogger("pydna." + __name__)
|
|
76
77
|
|
|
77
78
|
|
|
78
79
|
class Assembly(object): # , metaclass=_Memoize):
|
|
@@ -239,7 +240,9 @@ class Assembly(object): # , metaclass=_Memoize):
|
|
|
239
240
|
before = G.order()
|
|
240
241
|
G.add_nodes_from(
|
|
241
242
|
(node, {"order": order + od, "length": length})
|
|
242
|
-
for od, (start, length, node) in enumerate(
|
|
243
|
+
for od, (start, length, node) in enumerate(
|
|
244
|
+
n for n in f["nodes"] if n[2] not in G
|
|
245
|
+
)
|
|
243
246
|
)
|
|
244
247
|
order += G.order() - before
|
|
245
248
|
|
|
@@ -251,7 +254,8 @@ class Assembly(object): # , metaclass=_Memoize):
|
|
|
251
254
|
feats = [
|
|
252
255
|
ft
|
|
253
256
|
for ft in f["features"]
|
|
254
|
-
if start1 <= ft.location.start
|
|
257
|
+
if start1 <= ft.location.start
|
|
258
|
+
and start2 + G.nodes[node2]["length"] >= ft.location.end
|
|
255
259
|
]
|
|
256
260
|
|
|
257
261
|
# for feat in feats:
|
|
@@ -267,7 +271,11 @@ class Assembly(object): # , metaclass=_Memoize):
|
|
|
267
271
|
) # string
|
|
268
272
|
|
|
269
273
|
self.G = _nx.create_empty_copy(G)
|
|
270
|
-
self.G.add_edges_from(
|
|
274
|
+
self.G.add_edges_from(
|
|
275
|
+
sorted(
|
|
276
|
+
G.edges(data=True), key=lambda t: len(t[2].get("seq", 1)), reverse=True
|
|
277
|
+
)
|
|
278
|
+
)
|
|
271
279
|
self.nodemap = {**nodemap, **{nodemap[i]: i for i in nodemap}}
|
|
272
280
|
self.limit = limit
|
|
273
281
|
self.fragments = fragments
|
|
@@ -288,7 +296,11 @@ class Assembly(object): # , metaclass=_Memoize):
|
|
|
288
296
|
"begin",
|
|
289
297
|
node,
|
|
290
298
|
piece=slice(0, start),
|
|
291
|
-
features=[
|
|
299
|
+
features=[
|
|
300
|
+
f
|
|
301
|
+
for f in firstfragment["features"]
|
|
302
|
+
if start + length >= f.location.end
|
|
303
|
+
],
|
|
292
304
|
seq=firstfragment["mixed"],
|
|
293
305
|
name=firstfragment["name"],
|
|
294
306
|
)
|
|
@@ -301,7 +313,11 @@ class Assembly(object): # , metaclass=_Memoize):
|
|
|
301
313
|
"begin_rc",
|
|
302
314
|
node,
|
|
303
315
|
piece=slice(0, start),
|
|
304
|
-
features=[
|
|
316
|
+
features=[
|
|
317
|
+
f
|
|
318
|
+
for f in firstfragmentrc["features"]
|
|
319
|
+
if start + length >= f.location.end
|
|
320
|
+
],
|
|
305
321
|
seq=firstfragmentrc["mixed"],
|
|
306
322
|
name=firstfragmentrc["name"],
|
|
307
323
|
)
|
|
@@ -313,7 +329,9 @@ class Assembly(object): # , metaclass=_Memoize):
|
|
|
313
329
|
node,
|
|
314
330
|
"end",
|
|
315
331
|
piece=slice(start, len(lastfragment["mixed"])),
|
|
316
|
-
features=[
|
|
332
|
+
features=[
|
|
333
|
+
f for f in lastfragment["features"] if start <= f.location.start
|
|
334
|
+
],
|
|
317
335
|
seq=lastfragment["mixed"],
|
|
318
336
|
name=lastfragment["name"],
|
|
319
337
|
)
|
|
@@ -326,7 +344,9 @@ class Assembly(object): # , metaclass=_Memoize):
|
|
|
326
344
|
node,
|
|
327
345
|
"end_rc",
|
|
328
346
|
piece=slice(start, len(lastfragmentrc["mixed"])),
|
|
329
|
-
features=[
|
|
347
|
+
features=[
|
|
348
|
+
f for f in lastfragmentrc["features"] if start <= f.location.start
|
|
349
|
+
],
|
|
330
350
|
seq=lastfragmentrc["mixed"],
|
|
331
351
|
name=lastfragmentrc["name"],
|
|
332
352
|
)
|
|
@@ -336,9 +356,15 @@ class Assembly(object): # , metaclass=_Memoize):
|
|
|
336
356
|
linearpaths = list(
|
|
337
357
|
_itertools.chain(
|
|
338
358
|
_nx.all_simple_paths(_nx.DiGraph(G), "begin", "end", cutoff=max_nodes),
|
|
339
|
-
_nx.all_simple_paths(
|
|
340
|
-
|
|
341
|
-
|
|
359
|
+
_nx.all_simple_paths(
|
|
360
|
+
_nx.DiGraph(G), "begin", "end_rc", cutoff=max_nodes
|
|
361
|
+
),
|
|
362
|
+
_nx.all_simple_paths(
|
|
363
|
+
_nx.DiGraph(G), "begin_rc", "end", cutoff=max_nodes
|
|
364
|
+
),
|
|
365
|
+
_nx.all_simple_paths(
|
|
366
|
+
_nx.DiGraph(G), "begin_rc", "end_rc", cutoff=max_nodes
|
|
367
|
+
),
|
|
342
368
|
)
|
|
343
369
|
)
|
|
344
370
|
|
|
@@ -412,7 +438,9 @@ class Assembly(object): # , metaclass=_Memoize):
|
|
|
412
438
|
for (
|
|
413
439
|
_,
|
|
414
440
|
cp,
|
|
415
|
-
) in
|
|
441
|
+
) in (
|
|
442
|
+
cpaths_sorted
|
|
443
|
+
): # cpaths is a list of nodes representing a circular assembly
|
|
416
444
|
edgelol = [] # edgelol is a list of lists of all edges along cp
|
|
417
445
|
cp += cp[0:1]
|
|
418
446
|
for u, v in zip(cp, cp[1:]):
|
|
@@ -452,8 +480,12 @@ class Assembly(object): # , metaclass=_Memoize):
|
|
|
452
480
|
elif f.location.end > len(ct):
|
|
453
481
|
f.location = _CompoundLocation(
|
|
454
482
|
(
|
|
455
|
-
_SimpleLocation(
|
|
456
|
-
|
|
483
|
+
_SimpleLocation(
|
|
484
|
+
f.location.start, _ExactPosition(len(ct))
|
|
485
|
+
),
|
|
486
|
+
_SimpleLocation(
|
|
487
|
+
_ExactPosition(0), f.location.end - len(ct)
|
|
488
|
+
),
|
|
457
489
|
)
|
|
458
490
|
)
|
|
459
491
|
|
|
@@ -489,7 +521,9 @@ class Assembly(object): # , metaclass=_Memoize):
|
|
|
489
521
|
"limit(bp)..: {limit}\n"
|
|
490
522
|
"G.nodes....: {nodes}\n"
|
|
491
523
|
"algorithm..: {al}".format(
|
|
492
|
-
sequences=" ".join(
|
|
524
|
+
sequences=" ".join(
|
|
525
|
+
"{}bp".format(len(x["mixed"])) for x in self.fragments
|
|
526
|
+
),
|
|
493
527
|
limit=self.limit,
|
|
494
528
|
nodes=self.G.order(),
|
|
495
529
|
al=self.algorithm.__name__,
|
|
@@ -529,14 +563,3 @@ class _FragmentDict(_TypedDict):
|
|
|
529
563
|
name: str
|
|
530
564
|
features: _List[_SeqFeature]
|
|
531
565
|
nodes: _List[_NodeTuple]
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
if __name__ == "__main__":
|
|
535
|
-
import os as _os
|
|
536
|
-
|
|
537
|
-
cached = _os.getenv("pydna_cached_funcs", "")
|
|
538
|
-
_os.environ["pydna_cached_funcs"] = ""
|
|
539
|
-
import doctest
|
|
540
|
-
|
|
541
|
-
doctest.testmod(verbose=True, optionflags=doctest.ELLIPSIS)
|
|
542
|
-
_os.environ["pydna_cached_funcs"] = cached
|