pydna 5.5.4__py3-none-any.whl → 5.5.6__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/conftest.py DELETED
@@ -1,42 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- """conftest.py"""
3
-
4
- # import pathlib
5
- # import os
6
-
7
- # cwd = pathlib.Path(__file__).parent
8
-
9
- # def pytest_runtest_setup(item):
10
- # # called for running each test in 'a' directory
11
- # #os.chdir(cwd)
12
- # pass
13
-
14
-
15
- # def pytest_configure(config):
16
- # """
17
- # Allows plugins and conftest files to perform initial configuration.
18
- # This hook is called for every plugin and initial conftest
19
- # file after command line options have been parsed.
20
- # """
21
- # os.chdir(cwd)
22
- # print(f"cwd set to {cwd} in {__file__}")
23
-
24
-
25
- # def pytest_sessionstart(session):
26
- # """
27
- # Called after the Session object has been created and
28
- # before performing collection and entering the run test loop.
29
- # """
30
-
31
-
32
- # def pytest_sessionfinish(session, exitstatus):
33
- # """
34
- # Called after whole test run finished, right before
35
- # returning the exit status to the system.
36
- # """
37
-
38
-
39
- # def pytest_unconfigure(config):
40
- # """
41
- # called before test process is exited.
42
- # """
pydna/download.py DELETED
@@ -1,32 +0,0 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
- # Copyright 2013-2023 by Björn Johansson. All rights reserved.
4
- # This code is part of the Python-dna distribution and governed by its
5
- # license. Please see the LICENSE.txt file that should have been included
6
- # as part of this package.
7
- """Provides a function for downloading online text files."""
8
-
9
- import textwrap as _textwrap
10
-
11
- # import os as _os
12
- from pydna._pretty import pretty_str as _pretty_str
13
-
14
- # from pydna.utils import memorize as _memorize
15
- # import logging as _logging
16
-
17
- # _module_logger = _logging.getLogger("pydna." + __name__)
18
-
19
-
20
- # @_memorize("pydna.download.download_text")
21
- def download_text(url):
22
- """docstring."""
23
- import requests
24
-
25
- # _module_logger.info("#### DOWNLOAD TEXT ####")
26
- # _module_logger.info("url = %s", url)
27
- req = requests.get(url)
28
- # _module_logger.info("url = %s", str(req))
29
- result = _textwrap.dedent(req.text).strip()
30
- result = result.replace("\r\n", "\n").replace("\r", "\n")
31
- # _module_logger.info("result[:160] = %s", result[:160])
32
- return _pretty_str(result)
pydna/genbankfile.py DELETED
@@ -1,42 +0,0 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
- # Copyright 2013-2023 by Björn Johansson. All rights reserved.
4
- # This code is part of the Python-dna distribution and governed by its
5
- # license. Please see the LICENSE.txt file that should have been included
6
- # as part of this package.
7
- from pydna.dseqrecord import Dseqrecord as _Dseqrecord
8
-
9
-
10
- class GenbankFile(_Dseqrecord):
11
- def __init__(self, record, *args, path=None, **kwargs):
12
- super().__init__(record, *args, **kwargs)
13
- self.path = path
14
-
15
- @classmethod
16
- def from_SeqRecord(cls, record, *args, path=None, **kwargs):
17
- obj = super().from_SeqRecord(record, *args, **kwargs)
18
- obj.path = path
19
- return obj
20
-
21
- def __repr__(self):
22
- """returns a short string representation of the object"""
23
- return "File({})({}{})".format(
24
- self.id, {True: "-", False: "o"}[not self.circular], len(self)
25
- )
26
-
27
- def _repr_pretty_(self, p, cycle):
28
- """returns a short string representation of the object"""
29
- p.text(
30
- "File({})({}{})".format(
31
- self.id, {True: "-", False: "o"}[not self.circular], len(self)
32
- )
33
- )
34
-
35
- def _repr_html_(self):
36
- return "<a href='{path}' target='_blank'>{path}</a><br>".format(path=self.path)
37
-
38
- def reverse_complement(self):
39
- answer = type(self)(super().reverse_complement(), path=self.path)
40
- return answer
41
-
42
- rc = reverse_complement
pydna/genbankrecord.py DELETED
@@ -1,168 +0,0 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
- # Copyright 2013-2023 by Björn Johansson. All rights reserved.
4
- # This code is part of the Python-dna distribution and governed by its
5
- # license. Please see the LICENSE.txt file that should have been included
6
- # as part of this package.
7
-
8
- from pydna.dseqrecord import Dseqrecord as _Dseqrecord
9
- from pydna._pretty import pretty_str as _ps
10
- import os as _os
11
-
12
-
13
- class GenbankRecord(_Dseqrecord):
14
- def __init__(
15
- self, record, *args, item="accession", start=None, stop=None, strand=1, **kwargs
16
- ):
17
- super().__init__(record, *args, **kwargs)
18
- self.item = item
19
- self.start = start
20
- self.stop = stop
21
- self.strand = strand
22
- self._repr = item
23
- if self.start is not None and self.stop is not None:
24
- self._repr += " {}-{}".format(self.start, self.stop)
25
- self._linktemplate = "<a href='https://www.ncbi.nlm.nih.gov/nuccore/{item}?from={start}&to={stop}&strand={strand}' target='_blank'>{text}</a>"
26
- self.hyperlink = _ps(
27
- self._linktemplate.format(
28
- item=self.item,
29
- start=self.start or "",
30
- stop=self.stop or "",
31
- strand=self.strand,
32
- text=self._repr,
33
- )
34
- )
35
-
36
- @classmethod
37
- def from_string(
38
- cls,
39
- record: str = "",
40
- *args,
41
- item="accession",
42
- start=None,
43
- stop=None,
44
- strand=1,
45
- **kwargs,
46
- ):
47
- """docstring."""
48
- obj = super().from_string(record, *args, **kwargs)
49
- obj.item = item
50
- obj.start = start
51
- obj.stop = stop
52
- obj.strand = strand
53
- obj._repr = item
54
- if obj.start is not None and obj.stop is not None:
55
- obj._repr += " {}-{}".format(obj.start, obj.stop)
56
- obj._linktemplate = "<a href='https://www.ncbi.nlm.nih.gov/nuccore/{item}?from={start}&to={stop}&strand={strand}' target='_blank'>{text}</a>"
57
- obj.hyperlink = _ps(
58
- obj._linktemplate.format(
59
- item=obj.item,
60
- start=obj.start or "",
61
- stop=obj.stop or "",
62
- strand=obj.strand,
63
- text=obj._repr,
64
- )
65
- )
66
- return obj
67
-
68
- @classmethod
69
- def from_SeqRecord(
70
- cls, record, *args, item="accession", start=None, stop=None, strand=1, **kwargs
71
- ):
72
- obj = super().from_SeqRecord(record, *args, **kwargs)
73
- obj.item = item
74
- obj.start = start
75
- obj.stop = stop
76
- obj.strand = strand
77
- obj._repr = item
78
- if obj.start is not None and obj.stop is not None:
79
- obj._repr += " {}-{}".format(obj.start, obj.stop)
80
- obj._linktemplate = "<a href='https://www.ncbi.nlm.nih.gov/nuccore/{item}?from={start}&to={stop}&strand={strand}' target='_blank'>{text}</a>"
81
- obj.hyperlink = _ps(
82
- obj._linktemplate.format(
83
- item=obj.item,
84
- start=obj.start or "",
85
- stop=obj.stop or "",
86
- strand=obj.strand,
87
- text=obj._repr,
88
- )
89
- )
90
- return obj
91
-
92
- def __getitem__(self, sl):
93
- answer = super().__getitem__(sl)
94
- answer.item = self.item
95
- answer.start = (self.start or 0) + (sl.start or 0)
96
- answer.stop = (self.start or 0) + (sl.stop or 0)
97
- answer.strand = self.strand
98
- return answer
99
-
100
- def __repr__(self):
101
- """returns a short string representation of the object"""
102
- return "Gbnk({}{} {})".format(
103
- {True: "-", False: "o"}[not self.circular], len(self), self._repr
104
- )
105
-
106
- def _repr_pretty_(self, p, cycle):
107
- """returns a short string representation of the object"""
108
- p.text(self.__repr__())
109
-
110
- def _repr_html_(self):
111
- return self.hyperlink
112
-
113
- def reverse_complement(self):
114
- answer = type(self)(
115
- super().reverse_complement(),
116
- item=self.item,
117
- start=self.start,
118
- stop=self.stop,
119
- strand={1: 2, 2: 1}[self.strand],
120
- )
121
- return answer
122
-
123
- rc = reverse_complement
124
-
125
- def pydna_code(self):
126
- """docstring.""" # FIXME
127
-
128
- code = (
129
- "from pydna.genbank import Genbank\n"
130
- f"gb = Genbank('{_os.getenv('pydna_email')}')\n"
131
- f"seq = gb.nucleotide('{self.item}'"
132
- )
133
- if self.start and self.start:
134
- code += (
135
- ",\n"
136
- f" seq_start={self.start},\n"
137
- f" seq_stop={self.stop},\n"
138
- f" strand={self.strand})"
139
- )
140
- else:
141
- code += ")"
142
-
143
- return _ps(code)
144
-
145
- def biopython_code(self):
146
- """docstring.""" # FIXME
147
-
148
- code = (
149
- "from Bio import Entrez, SeqIO\n"
150
- f"Entrez.email = '{_os.getenv('pydna_email')}'\n"
151
- "handle = Entrez.efetch(db='nuccore',\n"
152
- f" id='{self.item}',\n"
153
- " rettype='gbwithparts',\n"
154
- " retmode='text',"
155
- )
156
- if self.start and self.stop:
157
- code += (
158
- "\n"
159
- f" seq_start={self.start},\n"
160
- f" seq_stop={self.stop},\n"
161
- f" strand={self.strand})\n"
162
- )
163
- else:
164
- code += ")\n"
165
-
166
- code += "record = SeqIO.read(handle, 'genbank')"
167
-
168
- return _ps(code)
pydna/goldengate.py DELETED
@@ -1,45 +0,0 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
- # Copyright 2013-2023 by Björn Johansson. All rights reserved.
4
- # This code is part of the Python-dna distribution and governed by its
5
- # license. Please see the LICENSE.txt file that should have been included
6
- # as part of this package.
7
-
8
- # ^^
9
- # ^^ .. ..
10
- # [] []
11
- # .:[]:_ ^^ ,:[]:.
12
- # .: :[]: :-. ,-: :[]: :.
13
- # .: : :[]: : :`._ ,.': : :[]: : :.
14
- # .: : : :[]: : : : :-._ _,-: : : : :[]: : : :.
15
- # _..: : : : :[]: : : : : : :-._________.-: : : : : : :[]: : : : :-._
16
- # _:_:_:_:_:_:[]:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:[]:_:_:_:_:_:_
17
- # !!!!!!!!!!!![]!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!![]!!!!!!!!!!!!!
18
- # ^^^^^^^^^^^^[]^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^[]^^^^^^^^^^^^^
19
- # [] []
20
- # [] []
21
- # [] []
22
- # ~~^-~^_~^~/ \~^-~^~_~^-~_^~-^~_^~~-^~_~^~-~_~-^~_^/ \~^-~_~^-~~-
23
- # ~ _~~- ~^-^~-^~~- ^~_^-^~~_ -~^_ -~_-~~^- _~~_~-^_ ~^-^~~-_^-~ ~^
24
-
25
- """Assembly of sequences by GoldenGate ligation assembly."""
26
- from Bio.Restriction import BsaI, BsmBI, BbsI, FokI
27
- from pydna.dseqrecord import Dseqrecord as _Dseqrecord
28
-
29
- # from copy import deepcopy as _deepcopy
30
- # import logging as _logging
31
-
32
- # _module_logger = _logging.getLogger("pydna." + __name__)
33
-
34
- BsaI, BsmBI, BbsI, FokI
35
-
36
- DNA = _Dseqrecord("gatcGAAGACtagagtctgattcg")
37
-
38
- a, b = DNA.cut(BbsI)
39
-
40
- assert a + b == DNA
41
-
42
-
43
- # MoClo
44
-
45
- # https://edinburgh-genome-foundry.github.io/GoldenHinges
pydna/ligate.py DELETED
@@ -1,62 +0,0 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
- # Copyright 2013-2023 by Björn Johansson. All rights reserved.
4
- # This code is part of the Python-dna distribution and governed by its
5
- # license. Please see the LICENSE.txt file that should have been included
6
- # as part of this package.
7
- """docstring."""
8
- from operator import add
9
- from functools import reduce
10
- import networkx as _nx
11
- from itertools import permutations
12
-
13
- # import logging as _logging
14
-
15
- # _module_logger = _logging.getLogger("pydna." + __name__)
16
-
17
-
18
- def ligate(fragments: list):
19
- """docstring."""
20
- G = _nx.DiGraph()
21
- G.add_nodes_from(["begin", "end"])
22
- fragments = fragments[:]
23
-
24
- fragments.extend(f.rc() for f in fragments[1:])
25
-
26
- for node in fragments:
27
- G.add_edge("begin", node)
28
- G.add_edge(node, "end")
29
-
30
- for seq1, seq2 in permutations(fragments, 2):
31
- try:
32
- seq1 + seq2
33
- except TypeError as err:
34
- if str(err) != "sticky ends not compatible!":
35
- raise
36
- else:
37
- if seq1.seq.three_prime_end() != (
38
- "blunt",
39
- "",
40
- ) and seq2.seq.five_prime_end() != ("blunt", ""):
41
- G.add_edge(seq1, seq2)
42
- try:
43
- G.remove_edge("begin", seq2)
44
- except _nx.NetworkXError as err:
45
- if "not in graph" not in str(err):
46
- raise
47
- try:
48
- G.remove_edge(seq1, "end")
49
- except _nx.NetworkXError as err:
50
- if "not in graph" not in str(err):
51
- raise
52
-
53
- cpaths = [p for p in sorted(_nx.simple_cycles(G), key=len) if len(p) > 1]
54
- csequences = [reduce(add, x).looped() for x in cpaths]
55
- lpaths = [
56
- p
57
- for p in sorted(_nx.all_simple_paths(G, "begin", "end"), key=len)
58
- if len(p) > 3
59
- ]
60
- lsequences = [reduce(add, lp[1:-1]) for lp in lpaths]
61
-
62
- return csequences, lsequences
pydna/user_cloning.py DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
-
4
- # Copyright 2013-2023 by Björn Johansson. All rights reserved.
5
- # This code is part of the Python-dna distribution and governed by its
6
- # license. Please see the LICENSE.txt file that should have been included
7
- # as part of this package.
8
-
9
-
10
- # from abc import ABC, abstractmethod
11
- # import re
12
- # from pydna.utils import rc
13
-
14
-
15
- """
16
- Nicking & USER cloning
17
-
18
-
19
- CGAuGTCGACTTAGATCTCACAGGCTTTTTTCAAGaCGGCCTTGAATTCAGTCATTTGGATCCGGCCGATC
20
- GCTACAGCTGAATCTAGAGTGTCCGAAAAAAGTTCTGCCGGAACTTAAGTCAGTAAACCTAGGCCGGCuAG
21
-
22
- 1. Digest both strands
23
- 2. Collect all linear ssDNA
24
- 3. Anneal all combinations
25
- 4. Keep ones present in original molecule
26
- 5. Rank by stability
27
- 6.
28
-
29
- """
@@ -1,46 +0,0 @@
1
- pydna/__init__.py,sha256=Fb-8yiWHmQwChAGIXW38c0iWfPw4Cm3tQLHTiBOU9pc,12867
2
- pydna/_pretty.py,sha256=foRAxdL3Jiupuz7l38THBQZ7tu-5vQvLm1cKdDa7n6A,923
3
- pydna/_thermodynamic_data.py,sha256=9_w-97DpkbsWbJGHVijscMvUS_SFt7GxzrxspMRPZSg,10903
4
- pydna/all.py,sha256=xwkbR5Hn52xVfgLAXaEfIgtNwaBiGDbJFTQfa3Zi6HQ,1781
5
- pydna/amplicon.py,sha256=X4rCSanhlx1sPN0eAtcdAWg4Lw0WKrGQhv-cgZKtM3s,5343
6
- pydna/amplify.py,sha256=XRwmSMQ2d8Y379zcl56yU6rt1xWbSulWWHLqp-HRDc0,19260
7
- pydna/assembly.py,sha256=LM3-s3YysFvvkl1oooxoBjYLt0iMc3E1YLoqE05i8bs,19936
8
- pydna/assembly2.py,sha256=A_agqF57amqquwaYuEJmzhU8qn6XjGiNh1vHeDNcpC4,106017
9
- pydna/codon.py,sha256=Nxa_03n2wxXKACkzi55bUN1t5xUU_DBRRwh_ZLIb9_o,2568
10
- pydna/common_sub_strings.py,sha256=A-gJeA2cEyxKKGQSFoC0BKvcXUGJZcnTUU7x2xlAovc,11574
11
- pydna/conftest.py,sha256=T5-WmHWLZH3U3ifxnbxd_oOiIFibIrkYpwNacCHlvsY,999
12
- pydna/contig.py,sha256=m0XV0LO2AbArPZkjyNCf8c7_b1EkXFtYwXHJVG4eTY8,8168
13
- pydna/cre_lox.py,sha256=sOj9R8_oFPGWs68vc4jf6LqWOXjMsVSwtJaeKl6ZF2M,4476
14
- pydna/crispr.py,sha256=iwu0Cjskzdb2r-In9633QIxQYKGmSNVOEM_dLK6lC54,3619
15
- pydna/design.py,sha256=BAoPb4M47yMkF1p4gGmbomZPFyTl0WuXkv8sLSY_Tg0,29067
16
- pydna/download.py,sha256=7tT8LAEy2Vg05spGfbCea_sol6pUOOBVbxOtyk2mnlQ,1085
17
- pydna/dseq.py,sha256=2N_dXX36niJItQzN61PoVweee0xxP04_amJ3cSExAtU,54232
18
- pydna/dseqrecord.py,sha256=MMc6nWUqFfc8KmnDWKDeb2bze8qv9X2rSbZXSS-AXrU,49885
19
- pydna/fakeseq.py,sha256=uxyu1PXF-sVasEqhmyhMcsbpTy84uUtubDiZuxHNb9c,1174
20
- pydna/fusionpcr.py,sha256=tfIfGGkNoZjg_dodcEx9wTc12aLRnC7J3g-Vg3Jg1uA,2821
21
- pydna/gateway.py,sha256=iwNHrDIOqKl6_3Rdz7z7c8n_kcLQZuuu72oxNIjyyL8,8686
22
- pydna/gel.py,sha256=QE1uhnjWXLl2nXgbLs_1TWbPixgUa0-z_UR8jZaByS4,3371
23
- pydna/genbank.py,sha256=rH677VRklVKBpPoFRsl7Az8fZvrC8TD2lNrNoHO1wU8,8856
24
- pydna/genbankfile.py,sha256=ii0_RjNGnsfUThTN01c5PRLSZkQT3WlYDvoC6R6ozAA,1451
25
- pydna/genbankfixer.py,sha256=rJ7qMODx19aha6g8eHC28UfaCsRM983XbTMZXNRdE8w,20510
26
- pydna/genbankrecord.py,sha256=u9RNBifT0j8rrA2bSdWajodtwm42P52_VlXsxKeOvq0,5566
27
- pydna/goldengate.py,sha256=LvUWAzhG9OhN1wil7osJIkjfqwBLh355a18wCZO1TvI,1778
28
- pydna/ladders.py,sha256=fKfWwezxQpX4qon9YCMIwchMBkGVOu8-C02xXk90J-E,3310
29
- pydna/ligate.py,sha256=ap8xgS4aL9cH4w38e-kpw1Ixa7DtpYF_ipezrVXiHG0,1965
30
- pydna/opencloning_models.py,sha256=DOvoaG4eQSslguZQDWBsfYhKX1xxy4fYHQUqrdfMhmA,19535
31
- pydna/parsers.py,sha256=FW2RhZrxWX9wUYJcmt0qi1n7DZP0RfsNaXHhG0eVTWg,7319
32
- pydna/primer.py,sha256=k9Z_fHfBcY_rGnOtfys806rQBDtvyKwKl2ceSx3_w9A,2272
33
- pydna/readers.py,sha256=tKoonGlIB9ACeOMnzjhbCya1ooqhFMQIO_G36azN81E,1575
34
- pydna/seq.py,sha256=82gR1g2D8jfPy1So1pSJvlXYk4zkcKx_qmgvcydxth4,7579
35
- pydna/seqrecord.py,sha256=haLp1316KQkROkQ0HkJp-RfgWN-eDyLPzTGFLjgXwHk,23363
36
- pydna/sequence_picker.py,sha256=Pco9IrUwNSiS0wQ5hp5FMfE9kIN9XOwXasKLF9OA6DM,1402
37
- pydna/sequence_regex.py,sha256=DYuAJkWm_GqEGMpd0pE-Mad_B6POUP8gwjSCFR8RfXw,1259
38
- pydna/threading_timer_decorator_exit.py,sha256=D91kqjKSavWDnXyc1Fo-CwPYtbmR2DjTXnBYSRXKmSA,2793
39
- pydna/tm.py,sha256=0r4Aqjt_qanfqR8GNvqNh8us7AKM6JvaQKqHYsswAz4,11143
40
- pydna/types.py,sha256=Y9HxQ0wd-1AGuBzCSIU9JwZhGSrAIZBAFYjmEdOyL3M,1490
41
- pydna/user_cloning.py,sha256=VSpYX1tdbcD_PzEt69Jz6Lud-yAkYMVXnzVd4v2usnE,692
42
- pydna/utils.py,sha256=BwBOcr2HyLAPAVdpXEEDiwJ5MeWW096EOekvfyXxbDM,25227
43
- pydna-5.5.4.dist-info/METADATA,sha256=01RQRwIOoehyk7LNVpLSmQGgFynAyTZ97Di4juPnm0w,24379
44
- pydna-5.5.4.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
45
- pydna-5.5.4.dist-info/licenses/LICENSE.txt,sha256=u8QfcsnNXZM0UCexerK_MvyA2lPWgeGyUtSYXvLG6Oc,6119
46
- pydna-5.5.4.dist-info/RECORD,,