pydna 5.5.4__tar.gz → 5.5.5__tar.gz

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.
Files changed (53) hide show
  1. {pydna-5.5.4 → pydna-5.5.5}/PKG-INFO +8 -8
  2. {pydna-5.5.4 → pydna-5.5.5}/README.md +4 -6
  3. {pydna-5.5.4 → pydna-5.5.5}/pyproject.toml +8 -13
  4. pydna-5.5.5/src/pydna/__init__.py +229 -0
  5. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/_pretty.py +8 -8
  6. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/_thermodynamic_data.py +3 -3
  7. pydna-5.5.5/src/pydna/alphabet.py +995 -0
  8. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/amplicon.py +19 -24
  9. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/amplify.py +75 -95
  10. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/assembly.py +64 -81
  11. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/assembly2.py +283 -294
  12. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/codon.py +4 -4
  13. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/common_sub_strings.py +6 -8
  14. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/contig.py +203 -10
  15. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/design.py +176 -60
  16. pydna-5.5.5/src/pydna/download.py +23 -0
  17. pydna-5.5.5/src/pydna/dseq.py +2906 -0
  18. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/dseqrecord.py +170 -169
  19. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/gateway.py +6 -6
  20. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/gel.py +5 -5
  21. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/genbank.py +43 -46
  22. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/genbankfixer.py +89 -92
  23. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/ladders.py +11 -12
  24. pydna-5.5.5/src/pydna/oligonucleotide_hybridization.py +124 -0
  25. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/opencloning_models.py +187 -60
  26. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/parsers.py +45 -32
  27. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/primer.py +4 -4
  28. pydna-5.5.5/src/pydna/primer_screen.py +833 -0
  29. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/readers.py +14 -9
  30. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/seq.py +137 -47
  31. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/seqrecord.py +54 -62
  32. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/sequence_picker.py +2 -5
  33. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/sequence_regex.py +6 -6
  34. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/tm.py +17 -17
  35. pydna-5.5.5/src/pydna/types.py +44 -0
  36. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/utils.py +97 -75
  37. pydna-5.5.4/src/pydna/__init__.py +0 -398
  38. pydna-5.5.4/src/pydna/conftest.py +0 -42
  39. pydna-5.5.4/src/pydna/download.py +0 -32
  40. pydna-5.5.4/src/pydna/dseq.py +0 -1830
  41. pydna-5.5.4/src/pydna/genbankfile.py +0 -42
  42. pydna-5.5.4/src/pydna/genbankrecord.py +0 -168
  43. pydna-5.5.4/src/pydna/goldengate.py +0 -45
  44. pydna-5.5.4/src/pydna/ligate.py +0 -62
  45. pydna-5.5.4/src/pydna/types.py +0 -44
  46. pydna-5.5.4/src/pydna/user_cloning.py +0 -29
  47. {pydna-5.5.4 → pydna-5.5.5}/LICENSE.txt +0 -0
  48. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/all.py +0 -0
  49. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/cre_lox.py +0 -0
  50. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/crispr.py +0 -0
  51. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/fakeseq.py +0 -0
  52. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/fusionpcr.py +0 -0
  53. {pydna-5.5.4 → pydna-5.5.5}/src/pydna/threading_timer_decorator_exit.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pydna
3
- Version: 5.5.4
3
+ Version: 5.5.5
4
4
  Summary: Representing double stranded DNA and functions for simulating cloning and homologous recombination between DNA molecules.
5
5
  License: BSD
6
6
  License-File: LICENSE.txt
@@ -23,6 +23,7 @@ Provides-Extra: clipboard
23
23
  Provides-Extra: download
24
24
  Provides-Extra: express
25
25
  Provides-Extra: gel
26
+ Provides-Extra: primer-screen
26
27
  Requires-Dist: appdirs (>=1.4.4)
27
28
  Requires-Dist: biopython (==1.85)
28
29
  Requires-Dist: cai2 (>=1.0.5) ; extra == "express"
@@ -30,9 +31,10 @@ Requires-Dist: matplotlib (>=3.4.3) ; extra == "gel"
30
31
  Requires-Dist: networkx (>=2.8.8)
31
32
  Requires-Dist: numpy (>1.26) ; python_version < "3.12"
32
33
  Requires-Dist: numpy (>=2.3.0) ; python_version >= "3.12"
33
- Requires-Dist: opencloning-linkml (==0.4.5)
34
+ Requires-Dist: opencloning-linkml (>=0.4.9,<0.5.0)
34
35
  Requires-Dist: pillow (>=8.4.0) ; extra == "gel"
35
36
  Requires-Dist: prettytable (>=3.5.0)
37
+ Requires-Dist: pyahocorasick (>=2.2.0) ; extra == "primer-screen"
36
38
  Requires-Dist: pydivsufsort (>=0.0.14)
37
39
  Requires-Dist: pyfiglet (==0.8.post1)
38
40
  Requires-Dist: pyparsing (>=2.4.7) ; extra == "download"
@@ -506,7 +508,7 @@ poetry run pre-commit install
506
508
  > =================================== FAILURES ===================================
507
509
  > ___________________ [doctest] pydna.assembly2.blunt_overlap ____________________
508
510
  > ```
509
- > This means that the doctest of the function `blunt_overlap` failed. You can run the same test locally with `python -m doctest src/pydna/assembly2.py` (use the appropriate path to the module file). That will give you information of what's failing. Fix, and re-run until it passes!
511
+ > This means that the doctest of the function `blunt_overlap` failed. You can run the same test locally with `pytest src/pydna --doctest-modules` (use the appropriate path to the module file). That will give you information of what's failing. Fix, and re-run until it passes!
510
512
 
511
513
  ### Creating a PR 🔗
512
514
 
@@ -531,17 +533,15 @@ To work locally with the documentation, check the [documentation README](docs/RE
531
533
  See the [releases](https://github.com/pydna-group/pydna/releases) for changes and releases.
532
534
 
533
535
  The build workflow builds a PyPI packages using poetry. This workflow is triggered by publishing a Github release manually from the Github web interface.
536
+ We keep future release names [here](https://docs.google.com/document/d/1PrBYKzDh6QBcqfH9ksjpgArJo3ibDhMRNcibfXtYmCc/edit?tab=t.0). Please edit to
537
+ reflect used release names.
534
538
 
535
- ![----]( http://bit.ly/coloredline)
539
+ ![----](http://bit.ly/coloredline)
536
540
 
537
541
  ## History 📜
538
542
 
539
543
  Pydna was made public in 2012 on [Google code](https://code.google.com/archive/p/pydna).
540
544
 
541
- :microbe:
542
-
543
- :portugal:
544
-
545
545
  ## Who is using pydna? 🧪
546
546
 
547
547
  Taylor, L. J., & Strebel, K. (2017).
@@ -456,7 +456,7 @@ poetry run pre-commit install
456
456
  > =================================== FAILURES ===================================
457
457
  > ___________________ [doctest] pydna.assembly2.blunt_overlap ____________________
458
458
  > ```
459
- > This means that the doctest of the function `blunt_overlap` failed. You can run the same test locally with `python -m doctest src/pydna/assembly2.py` (use the appropriate path to the module file). That will give you information of what's failing. Fix, and re-run until it passes!
459
+ > This means that the doctest of the function `blunt_overlap` failed. You can run the same test locally with `pytest src/pydna --doctest-modules` (use the appropriate path to the module file). That will give you information of what's failing. Fix, and re-run until it passes!
460
460
 
461
461
  ### Creating a PR 🔗
462
462
 
@@ -481,17 +481,15 @@ To work locally with the documentation, check the [documentation README](docs/RE
481
481
  See the [releases](https://github.com/pydna-group/pydna/releases) for changes and releases.
482
482
 
483
483
  The build workflow builds a PyPI packages using poetry. This workflow is triggered by publishing a Github release manually from the Github web interface.
484
+ We keep future release names [here](https://docs.google.com/document/d/1PrBYKzDh6QBcqfH9ksjpgArJo3ibDhMRNcibfXtYmCc/edit?tab=t.0). Please edit to
485
+ reflect used release names.
484
486
 
485
- ![----]( http://bit.ly/coloredline)
487
+ ![----](http://bit.ly/coloredline)
486
488
 
487
489
  ## History 📜
488
490
 
489
491
  Pydna was made public in 2012 on [Google code](https://code.google.com/archive/p/pydna).
490
492
 
491
- :microbe:
492
-
493
- :portugal:
494
-
495
493
  ## Who is using pydna? 🧪
496
494
 
497
495
  Taylor, L. J., & Strebel, K. (2017).
@@ -35,7 +35,7 @@ license = "BSD"
35
35
  name = "pydna"
36
36
  readme = "README.md"
37
37
  repository = "https://github.com/pydna-group/pydna/tree/master"
38
- version = "5.5.4"
38
+ version = "5.5.5"
39
39
  [tool.poetry.dependencies]
40
40
  appdirs = ">=1.4.4"
41
41
  biopython = "1.85"
@@ -54,18 +54,20 @@ pyparsing = { version = ">=2.4.7", optional = true }
54
54
  pyperclip = { version = ">=1.8.2", optional = true }
55
55
  python = ">=3.10,<4.0"
56
56
  requests = { version = ">=2.26.0", optional = true }
57
+ pyahocorasick = { version = ">=2.2.0", optional = true }
57
58
  scipy = [
58
59
  { version = ">=1.11.3", python = ">=3.12", optional = true },
59
60
  { version = ">=1.9.3", python = "<3.12", optional = true },
60
61
  ]
61
62
  seguid = ">=0.0.5"
62
63
  regex = "^2024.11.6"
63
- opencloning-linkml = "0.4.5"
64
+ opencloning-linkml = "^0.4.9"
64
65
  [tool.poetry.extras]
65
66
  clipboard = ["pyperclip"]
66
67
  download = ["pyparsing", "requests"]
67
68
  express = ["cai2"]
68
69
  gel = ["scipy", "matplotlib", "pillow"]
70
+ primer_screen = ["pyahocorasick"]
69
71
  [build-system]
70
72
  build-backend = "poetry_dynamic_versioning.backend"
71
73
  requires = ["poetry-core", "poetry-dynamic-versioning"]
@@ -102,26 +104,19 @@ pandas = "*"
102
104
  autopep8 = "^2.1.0"
103
105
  black = "^25.1.0"
104
106
  pre-commit = ">3.6"
105
- nbstripout = "^0.7.1"
107
+ nbstripout = "^0.9"
106
108
  flake8-bugbear = "^24.12.12"
107
109
 
108
110
  [tool.pytest.ini_options]
109
111
  minversion = "6.0.2"
110
112
  python_files = "test_*.py"
111
- testpaths = ["tests", "src"]
113
+ testpaths = ["tests", "src/pydna"]
114
+ norecursedirs = ["*"]
115
+
112
116
  [tool.black]
113
117
  include = '\.pyi?$'
114
118
  line-length = 88
115
119
  target-version = ["py38", "py39", "py310", "py311", "py312"]
116
- # 'extend-exclude' excludes files or directories in addition to the defaults
117
- extend-exclude = '''
118
- (
119
- ^/foo.py # exclude a file named foo.py in the root of the project
120
- | .*_pb2.py # exclude autogenerated Protocol Buffer files anywhere in the project
121
- | ^docs/ # exclude all files in the docs/ directory
122
- | ^tests/ # exclude all files in the tests/ directory
123
- )
124
- '''
125
120
 
126
121
  [tool.poetry.requires-plugins]
127
122
  poetry-plugin-export = ">=1.9"
@@ -0,0 +1,229 @@
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
+ :copyright: Copyright 2013-2023 by Björn Johansson. All rights reserved.
11
+ :license: This code is part of the pydna package, governed by the
12
+ license in LICENSE.txt that should be included as part
13
+ of this package.
14
+
15
+ pydna
16
+ =====
17
+ Pydna is a python package providing code for simulation of the creation of
18
+ recombinant DNA molecules using
19
+ `molecular biology <https://en.wikipedia.org/wiki/Molecular_biology>`_
20
+ techniques. Development of pydna happens in this Github `repository <https://github.com/pydna-group/pydna>`_.
21
+
22
+ Provided:
23
+ 1. PCR simulation
24
+ 2. Assembly simulation based on shared identical sequences
25
+ 3. Primer design for amplification of a given sequence
26
+ 4. Automatic design of primer tails for Gibson assembly
27
+ or homologous recombination.
28
+ 5. Restriction digestion and cut&paste cloning
29
+ 6. Agarose gel simulation
30
+ 7. Download sequences from Genbank
31
+ 8. Parsing various sequence formats including the capacity to
32
+ handle broken Genbank format
33
+
34
+ pydna package layout
35
+ --------------------
36
+
37
+ The most important modules and how to import functions or classes from
38
+ them are listed below. Class names starts with a capital letter,
39
+ functions with a lowercase letter:
40
+
41
+ ::
42
+
43
+ from pydna.module import function
44
+ from pydna.module import Class
45
+
46
+ Example: from pydna.gel import Gel
47
+
48
+ pydna
49
+ ├── amplify
50
+ │ ├── Anneal
51
+ │ └── pcr
52
+ ├── assembly
53
+ │ └── Assembly
54
+ ├── design
55
+ │ ├── assembly_fragments
56
+ │ └── primer_design
57
+ ├── download
58
+ │ └── download_text
59
+ ├── dseqrecord
60
+ │ └── Dseqrecord
61
+ ├── gel
62
+ │ └── Gel
63
+ ├── genbank
64
+ │ ├── genbank
65
+ │ └── Genbank
66
+ ├── parsers
67
+ │ ├── parse
68
+ │ └── parse_primers
69
+ └── readers
70
+ ├── read
71
+ └── read_primers
72
+
73
+
74
+
75
+ How to use the documentation
76
+ ----------------------------
77
+ Documentation is available as docstrings provided in the source code for
78
+ each module.
79
+ These docstrings can be inspected by reading the source code directly.
80
+ See further below on how to obtain the code for pydna.
81
+
82
+ In the python shell, use the built-in ``help`` function to view a
83
+ function's docstring::
84
+
85
+ >>> from pydna import readers
86
+ >>> help(readers.read)
87
+ ... # doctest: +SKIP
88
+
89
+ The doctrings are also used to provide an automaticly generated reference
90
+ manual available online at
91
+ `read the docs <https://pydna-group.github.io/pydna>`_.
92
+
93
+ Docstrings can be explored using `IPython <http://ipython.org/>`_, an
94
+ advanced Python shell with
95
+ TAB-completion and introspection capabilities. To see which functions
96
+ are available in `pydna`,
97
+ type `pydna.<TAB>` (where `<TAB>` refers to the TAB key).
98
+ Use `pydna.open_config_folder?<ENTER>`to view the docstring or
99
+ `pydna.open_config_folder??<ENTER>` to view the source code.
100
+
101
+ In the `Spyder IDE <https://github.com/spyder-ide/spyder>`_ it is possible
102
+ to place the cursor immediately before the name of a module,class or
103
+ function and press ctrl+i to bring up docstrings in a separate window in Spyder
104
+
105
+ Code snippets are indicated by three greater-than signs::
106
+
107
+ >>> x=41
108
+ >>> x=x+1
109
+ >>> x
110
+ 42
111
+
112
+ pydna source code
113
+ -----------------
114
+
115
+ The pydna source code is
116
+ `available on Github <https://github.com/pydna-group/pydna>`_.
117
+
118
+ How to get more help
119
+ --------------------
120
+
121
+ Please join the
122
+ `Google group <https://groups.google.com/forum/#!forum/pydna>`_
123
+ for pydna, this is the preferred location for help. If you find bugs
124
+ in pydna itself, open an issue at the
125
+ `Github repository <https://github.com/pydna-group/pydna/issues>`_.
126
+
127
+ Examples of pydna in use
128
+ ------------------------
129
+
130
+ See this repository for a collection of
131
+ `examples <https://github.com/MetabolicEngineeringGroupCBMA/pydna-examples?tab=readme-ov-file#pydna-examples>`_.
132
+
133
+ """
134
+
135
+ from pydna._pretty import PrettyTable
136
+ from Bio.Restriction import FormattedSeq
137
+ import os
138
+
139
+ __author__ = "Björn Johansson"
140
+ __copyright__ = "Copyright 2013 - 2023 Björn Johansson"
141
+ __credits__ = ["Björn Johansson", "Mark Budde"]
142
+ __license__ = "BSD"
143
+ __maintainer__ = "Björn Johansson"
144
+ __email__ = "bjorn_johansson@bio.uminho.pt"
145
+ __status__ = "Development" # "Production" #"Prototype"
146
+ __version__ = "5.5.5"
147
+
148
+
149
+ class _PydnaWarning(Warning):
150
+ """Pydna warning.
151
+
152
+ Pydna uses this warning (or subclasses of it), to make it easy to
153
+ silence all warning messages:
154
+
155
+ >>> import warnings
156
+ >>> from pydna import _PydnaWarning
157
+ >>> warnings.simplefilter('ignore', _PydnaWarning)
158
+
159
+ Consult the warnings module documentation for more details.
160
+ """
161
+
162
+ pass
163
+
164
+
165
+ class _PydnaDeprecationWarning(_PydnaWarning):
166
+ """pydna deprecation warning.
167
+
168
+ Pydna uses this warning instead of the built in DeprecationWarning
169
+ since those are ignored by default since Python 2.7.
170
+
171
+ To silence all our deprecation warning messages, use:
172
+
173
+ >>> import warnings
174
+ >>> from pydna import _PydnaDeprecationWarning
175
+ >>> warnings.simplefilter('ignore', _PydnaDeprecationWarning)
176
+
177
+ Code marked as deprecated will be removed in a future version
178
+ of Pydna. This can be discussed in the Pydna google group:
179
+ https://groups.google.com/forum/#!forum/pydna
180
+
181
+ """
182
+
183
+ pass
184
+
185
+
186
+ def get_env():
187
+ """Print a an ascii table containing all environmental variables.
188
+
189
+ Pydna related variables have names that starts with `pydna_`
190
+ """
191
+ _table = PrettyTable(["Variable", "Value"])
192
+ # _table.set_style(_prettytable.DEFAULT)
193
+ _table.align["Variable"] = "l" # Left align
194
+ _table.align["Value"] = "l" # Left align
195
+ _table.padding_width = 1 # One space between column edges and contents
196
+ for k, v in sorted(os.environ.items()):
197
+ if k.lower().startswith("pydna"):
198
+ _table.add_row([k, v])
199
+ return _table
200
+
201
+
202
+ def logo():
203
+ """Ascii-art logotype of pydna."""
204
+ from pydna._pretty import pretty_str
205
+
206
+ message = f"pydna {__version__}"
207
+ try:
208
+ from pyfiglet import Figlet
209
+ except ModuleNotFoundError:
210
+ pass
211
+ else:
212
+ f = Figlet()
213
+ message = f.renderText(message)
214
+ return pretty_str(message)
215
+
216
+
217
+ ## Override Bio.Restriction.FormattedSeq._table
218
+
219
+
220
+ def _make_FormattedSeq_table() -> bytes:
221
+ table = bytearray(256)
222
+ upper_to_lower = ord("A") - ord("a")
223
+ for c in b"ABCDEFGHIJKLMNOPQRSTUVWXYZ": # Only allow IUPAC letters
224
+ table[c] = c # map uppercase to uppercase
225
+ table[c - upper_to_lower] = c # map lowercase to uppercase
226
+ return bytes(table)
227
+
228
+
229
+ FormattedSeq._table = _make_FormattedSeq_table()
@@ -6,10 +6,10 @@ The pretty_str class is similar to str but has a _repr_pretty_ method
6
6
  for for nicer string output in the IPython shell and Jupyter notebook.
7
7
  """
8
8
 
9
- from prettytable import PrettyTable as _Pt
10
- from prettytable import TableStyle as _TableStyle
11
- from copy import copy as _copy
12
- from typing import List as _List
9
+ from prettytable import PrettyTable as Pt
10
+ from prettytable import TableStyle
11
+ from copy import copy
12
+ from typing import List
13
13
 
14
14
 
15
15
  class pretty_str(str):
@@ -19,10 +19,10 @@ class pretty_str(str):
19
19
  p.text(self)
20
20
 
21
21
 
22
- class PrettyTable(_Pt):
22
+ class PrettyTable(Pt):
23
23
  """docstring."""
24
24
 
25
- def lol(self) -> _List[list]:
25
+ def lol(self) -> List[list]:
26
26
  """docstring."""
27
27
  return [self._field_names] + self._rows
28
28
 
@@ -31,6 +31,6 @@ class PrettyTable(_Pt):
31
31
  return self.get_string()
32
32
 
33
33
  def _repr_markdown_(self) -> pretty_str:
34
- c = _copy(self)
35
- c.set_style(_TableStyle.MARKDOWN)
34
+ c = copy(self)
35
+ c.set_style(TableStyle.MARKDOWN)
36
36
  return pretty_str(c.get_string())
@@ -5,10 +5,10 @@
5
5
  # license. Please see the LICENSE.txt file that should have been included
6
6
  # as part of this package.
7
7
 
8
- import collections as _collections
8
+ import collections
9
9
 
10
- dHBr = _collections.defaultdict(dict)
11
- dSBr = _collections.defaultdict(dict)
10
+ dHBr = collections.defaultdict(dict)
11
+ dSBr = collections.defaultdict(dict)
12
12
 
13
13
  dHBr[0][0] = -9100
14
14
  dSBr[0][0] = -24