pydna 6.0.0a3__tar.gz → 6.0.0a15__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 (40) hide show
  1. {pydna-6.0.0a3 → pydna-6.0.0a15}/PKG-INFO +108 -49
  2. {pydna-6.0.0a3 → pydna-6.0.0a15}/README.md +100 -44
  3. {pydna-6.0.0a3 → pydna-6.0.0a15}/pyproject.toml +15 -11
  4. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/__init__.py +25 -25
  5. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/design.py +1 -1
  6. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/download.py +6 -3
  7. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/dseq.py +81 -14
  8. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/gel.py +13 -11
  9. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/parsers.py +1 -0
  10. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/utils.py +1 -1
  11. {pydna-6.0.0a3 → pydna-6.0.0a15}/LICENSE.txt +0 -0
  12. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/_pretty.py +0 -0
  13. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/_thermodynamic_data.py +0 -0
  14. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/all.py +0 -0
  15. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/amplicon.py +0 -0
  16. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/amplify.py +0 -0
  17. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/assembly.py +0 -0
  18. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/codon.py +0 -0
  19. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/common_sub_strings.py +0 -0
  20. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/conftest.py +0 -0
  21. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/contig.py +0 -0
  22. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/dseqrecord.py +0 -0
  23. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/editor.py +0 -0
  24. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/fakeseq.py +0 -0
  25. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/gateway.py +0 -0
  26. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/genbank.py +0 -0
  27. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/genbankfile.py +0 -0
  28. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/genbankfixer.py +0 -0
  29. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/genbankrecord.py +0 -0
  30. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/goldengate.py +0 -0
  31. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/ladders.py +0 -0
  32. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/myenzymes.py +0 -0
  33. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/myprimers.py +0 -0
  34. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/primer.py +0 -0
  35. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/readers.py +0 -0
  36. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/seq.py +0 -0
  37. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/seqrecord.py +0 -0
  38. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/sequence_picker.py +0 -0
  39. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/threading_timer_decorator_exit.py +0 -0
  40. {pydna-6.0.0a3 → pydna-6.0.0a15}/src/pydna/tm.py +0 -0
@@ -1,7 +1,8 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pydna
3
- Version: 6.0.0a3
3
+ Version: 6.0.0a15
4
4
  Summary: Representing double stranded DNA and functions for simulating cloning and homologous recombination between DNA molecules.
5
+ Home-page: https://github.com/BjornFJohansson/pydna#-pydna
5
6
  License: BSD
6
7
  Author: BjornFJohansson
7
8
  Author-email: bjornjobb@gmail.com
@@ -12,11 +13,11 @@ Classifier: Programming Language :: Python :: 3.8
12
13
  Classifier: Programming Language :: Python :: 3.9
13
14
  Classifier: Programming Language :: Python :: 3.10
14
15
  Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
15
17
  Provides-Extra: clipboard
16
18
  Provides-Extra: download
17
19
  Provides-Extra: express
18
20
  Provides-Extra: gel
19
- Provides-Extra: gui
20
21
  Requires-Dist: appdirs (>=1.4.4)
21
22
  Requires-Dist: biopython (>=1.80)
22
23
  Requires-Dist: cai2 (>=1.0.5) ; extra == "express"
@@ -25,19 +26,21 @@ Requires-Dist: networkx (>=2.8.8)
25
26
  Requires-Dist: pillow (>=8.4.0) ; extra == "gel"
26
27
  Requires-Dist: prettytable (>=3.5.0)
27
28
  Requires-Dist: pydivsufsort (>=0.0.11)
28
- Requires-Dist: pyfiglet (>=0.8.post1)
29
+ Requires-Dist: pyfiglet (==0.8.post1)
29
30
  Requires-Dist: pyparsing (>=2.4.7) ; extra == "download"
30
31
  Requires-Dist: pyperclip (>=1.8.2) ; extra == "clipboard"
31
- Requires-Dist: pyqt5 (>=5.15.0) ; extra == "gui"
32
32
  Requires-Dist: requests (>=2.26.0) ; extra == "download"
33
- Requires-Dist: scipy (>=1.8.0) ; extra == "gel"
33
+ Requires-Dist: scipy (>=1.9.3) ; extra == "gel"
34
+ Project-URL: Changelog, https://github.com/BjornFJohansson/pydna/blob/master/docs/CHANGELOG.md#changelog
35
+ Project-URL: Documentation, https://pydna.readthedocs.io/?badge=latest
36
+ Project-URL: Repository, https://github.com/BjornFJohansson/pydna/tree/dev_bjorn
34
37
  Description-Content-Type: text/markdown
35
38
 
36
39
  # ![icon](https://raw.githubusercontent.com/bjornFJohansson/pydna/master/docs/pics/pydna.resized.png) pydna
37
40
 
38
- | [![Tests & Coverage](https://github.com/BjornFJohansson/pydna/actions/workflows/pydna_test_and_coverage_workflow.yml/badge.svg?branch=dev_bjorn)](https://github.com/BjornFJohansson/pydna/actions/workflows/pydna_test_and_coverage_workflow.yml) | [![codecov](https://codecov.io/gh/BjornFJohansson/pydna/branch/master/graph/badge.svg)](https://codecov.io/gh/BjornFJohansson/pydna/branch/master) | [![PyPI version](https://badge.fury.io/py/pydna.svg)](https://badge.fury.io/py/pydna) | [![Google group : pydna](https://img.shields.io/badge/Google%20Group-pydna-blue.svg)](https://groups.google.com/g/pydna) |
39
- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
40
- | [![Documentation Status](https://readthedocs.org/projects/pydna/badge/?version=latest)](http://pydna.readthedocs.io/?badge=latest) | [![GitHub issues](https://img.shields.io/github/issues/BjornFJohansson/pydna.svg)](https://github.com/BjornFJohansson/pydna/issues) | [![Anaconda-Server Badge2](https://anaconda.org/bjornfjohansson/pydna/badges/license.svg)](https://anaconda.org/bjornfjohansson/pydna) | [![GitHub stars](https://img.shields.io/github/stars/BjornFJohansson/pydna.svg)](https://github.com/BjornFJohansson/pydna/stargazers) |
41
+ | [![Tests & Coverage](https://github.com/BjornFJohansson/pydna/actions/workflows/pydna_test_and_coverage_workflow.yml/badge.svg?branch=dev_bjorn)](https://github.com/BjornFJohansson/pydna/actions/workflows/pydna_test_and_coverage_workflow.yml) | [![codecov](https://codecov.io/gh/BjornFJohansson/pydna/branch/master/graph/badge.svg)](https://codecov.io/gh/BjornFJohansson/pydna/branch/master) | [![PyPI version](https://badge.fury.io/py/pydna.svg)](https://badge.fury.io/py/pydna) | [![Google group : pydna](https://img.shields.io/badge/Google%20Group-pydna-blue.svg)](https://groups.google.com/g/pydna) |
42
+ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
43
+ | [![Documentation Status](https://readthedocs.org/projects/pydna/badge/?version=latest)](http://pydna.readthedocs.io/?badge=latest) | [![GitHub issues](https://img.shields.io/github/issues/BjornFJohansson/pydna.svg)](https://github.com/BjornFJohansson/pydna/issues) | [![Anaconda-Server Badge2](https://anaconda.org/bjornfjohansson/pydna/badges/license.svg)](https://anaconda.org/bjornfjohansson/pydna) | [![GitHub stars](https://img.shields.io/github/stars/BjornFJohansson/pydna.svg)](https://github.com/BjornFJohansson/pydna/stargazers) |
41
44
 
42
45
 
43
46
 
@@ -62,7 +65,7 @@ Pydna provides simulation of:
62
65
  - Gel electrophoresis of DNA with generation of gel images
63
66
  - Homologous recombination
64
67
  - Gibson assembly
65
- - Golden gate assembly
68
+ - Golden gate assembly (in progress)
66
69
 
67
70
 
68
71
  Virtually any sub-cloning experiment can be described in pydna, and its execution yield
@@ -73,12 +76,13 @@ Pydna has been designed with the goal of being understandable for biologists wit
73
76
  Pydna can formalize planning and sharing of cloning strategies and is especially useful for complex or combinatorial
74
77
  DNA molecule constructions.
75
78
 
76
- To get started, I have compiled some [simple examples](https://github.com/MetabolicEngineeringGroupCBMA/pydna-examples#pydna-examples).
77
- For more elaborate use, look at some assembly strategies of D-xylose metabolic pathways [MetabolicEngineeringGroupCBMA/ypk-xylose-pathways](https://github.com/MetabolicEngineeringGroupCBMA/ypk-xylose-pathways#pereira-et-al-2016).
78
-
79
+ Start by looking at the [cookbook](https://github.com/BjornFJohansson/pydna/blob/master/docs/cookbook/cookbook.ipynb).
79
80
 
81
+ Some simple examples can be found [here](https://github.com/MetabolicEngineeringGroupCBMA/pydna-examples#pydna-examples).
80
82
 
83
+ For more elaborate use, look at some assembly strategies of D-xylose metabolic pathways [MetabolicEngineeringGroupCBMA/ypk-xylose-pathways](https://github.com/MetabolicEngineeringGroupCBMA/ypk-xylose-pathways#pereira-et-al-2016).
81
84
 
85
+ See below for documentation.
82
86
 
83
87
  ![----]( http://bit.ly/coloredline)
84
88
 
@@ -115,11 +119,7 @@ DNA sequences are downloaded from Genbank by accession numbers that are guarante
115
119
  lin_vector = vector.linearize(EcoRV)
116
120
  rec_vec = ( lin_vector + pcr_prod ).looped()
117
121
 
118
- Pydna can automate the simulation of [sub cloning](http://en.wikipedia.org/wiki/Subcloning) experiments using
119
- python. This is helpful to generate examples for teaching purposes.
120
-
121
- Read the documentation (below) or the [cookbook](https://github.com/BjornFJohansson/pydna/blob/master/docs/cookbook/cookbook.ipynb) with example files
122
- for further information.
122
+ Another use case for pydna in the automatic generation of [sub cloning](http://en.wikipedia.org/wiki/Subcloning) examples for teaching purposes. These examples
123
123
 
124
124
  Feedback & suggestions are very welcome! Please post a message in the [google group](https://groups.google.com/d/forum/pydna) for pydna if you need help or have problems, questions or comments :sos:.
125
125
 
@@ -161,11 +161,10 @@ When using pydna.
161
161
 
162
162
  ![----]( http://bit.ly/coloredline)
163
163
 
164
- ## Documentation
164
+ ## Documentation :page_with_curl:
165
165
 
166
166
  Documentation is built using [Sphinx](http://www.sphinx-doc.org/) from [docstrings](https://www.python.org/dev/peps/pep-0257/)
167
- in the code and displayed at readthedocs [![Documentation Status](https://readthedocs.org/projects/pydna/badge/?version=latest)](http://pydna.readthedocs.io/?badge=latest)
168
-
167
+ in the code and displayed at readthedocs [![Documentation Status](https://readthedocs.org/projects/pydna/badge/?version=latest)](http://pydna.readthedocs.io/?badge=latest).
169
168
  The [numpy](www.numpy.org) [docstring format](https://github.com/numpy/numpy/blob/release/doc/HOWTO_DOCUMENT.rst.txt) is used.
170
169
 
171
170
  ![----]( http://bit.ly/coloredline)
@@ -185,7 +184,7 @@ or use the --pre switch to get the latest version of pydna.
185
184
 
186
185
  for optional functionality do:
187
186
 
188
- pip install pydna[gel,download,express,gui]
187
+ pip install pydna[clipboard,download,express,gel]
189
188
 
190
189
  Remove options inside the square brackets as required, but be sure not to leave spaces as pip will not recognize the options. See below under "Optional dependencies".
191
190
 
@@ -213,32 +212,65 @@ I am happy to collaborate on new features or bugfixes.
213
212
  The list below is the minimal requirements for installing pydna.
214
213
  Biopython and pydivsufsort has c-extensions, but the other modules are pure python.
215
214
 
216
- - [Python 3.8, 3.9, 3.10 or 3.11](http://www.python.org)
215
+ - [Python 3.8, 3.9, 3.10, 3.11 or 3.12](http://www.python.org)
217
216
  - [appdirs](https://pypi.python.org/pypi/appdirs)
218
217
  - [biopython](http://pypi.python.org/pypi/biopython)
219
218
  - [networkx](http://pypi.python.org/pypi/networkx)
220
219
  - [prettytable](https://pypi.python.org/pypi/PrettyTable)
221
220
  - [pydivsufsort](https://pypi.python.org/pypi/pydivsufsort)
221
+ - [pyfiglet](https://pypi.python.org/pypi/pyfiglet)
222
222
 
223
- The above modules are installed as well as pyperclip and pyfiglet.
224
- Pydna is importable even without these two modules.
223
+ Pydna is importable even without pyfiglet.
225
224
 
226
225
  ## Optional dependencies
227
226
 
228
- If the modules listed below in the first column are installed, they will provide the functionality listed in the second column.
227
+ These can be installed `pip install pydna[clipboard,gel,download,express]`
228
+ where `[clipboard,gel,download,express]` is the list of options available. Any
229
+ combination of the words inside the square brackets are allowed, but no white space.
230
+
231
+
232
+ ### `clipboard`
233
+
234
+ Enables the `pydna.dseqrecord.Dseqrecord.copy_gb_to_clipboard()` and `pydna.dseqrecord.Dseqrecord.copy_fasta_to_clipboard()`
235
+
236
+ These methods will put a copy the sequence on the clipboard in either Genbank (gb) or fasta format.
237
+
229
238
 
230
239
  | Dependency | Function in pydna |
231
- |-----------------------------------------------------|--------------------------------------------------------|
232
- | [scipy](https://www.scipy.org) | gel simulation with pydna.gel |
233
- | [matplotlib](http://matplotlib.org) | “ |
234
- | [pillow](https://github.com/python-pillow/Pillow) | “ |
235
- | [numpy](http://www.numpy.org) | " |
240
+ | --------------------------------------------------- | ------------------------------------------------------ |
241
+ | [pyperclip](https://pypi.python.org/pypi/pyperclip) | copy sequence to clipboard |
242
+
243
+ ### download
244
+
245
+ Pyparsing enables the `pydna.genbankfixer.gbtext_clean()` function that can automatically
246
+ correct malformed sequence files in Genbank format. These are often found online, so this option also installs requests to enable the `pydna.genbankfixer.download.download_text()` function which can be used to get cleaned up text from a URL.
247
+
248
+
249
+ | Dependency | Function in pydna |
250
+ | --------------------------------------------------- | ------------------------------------------------------ |
236
251
  | [pyparsing](https://pypi.python.org/pypi/pyparsing) | fix corrupt Genbank files with pydna.genbankfixer |
237
252
  | [requests](https://pypi.org/project/requests) | download sequences with pydna.download |
253
+
254
+ ### express
255
+
256
+ This option enables the `pydna.utils.cai()` function and the `cai()` method
257
+ available from subclasses of `pydna.seqrecord.SeqRecord`, such as
258
+ `pydna.dseqrecord.Dseqrecord`.
259
+
238
260
  | [cai2](https://pypi.python.org/pypi/cai2) | codon adaptation index calculations in several modules |
239
- | [pyqt5](https://pypi.python.org/pypi/pyqt5) | future plan for gui |
240
- | [pyperclip](https://pypi.python.org/pypi/pyperclip) | copy sequence to clipboard |
241
- | [pyfiglet](https://pypi.python.org/pypi/pyfiglet) | print nice logotype (pydna.logo() |
261
+
262
+ ### gel
263
+
264
+ Scipy, matplotlib and pillow (PIL) enable the generation of gel images. Numpy is also
265
+ needed, but usually installed as a dependency of biopython.
266
+
267
+
268
+ | Dependency | Function in pydna |
269
+ | --------------------------------------------------- | ------------------------------------------------------ |
270
+ | [scipy](https://www.scipy.org) | gel simulation with pydna.gel |
271
+ | [matplotlib](http://matplotlib.org) | “ |
272
+ | [pillow](https://github.com/python-pillow/Pillow) | “ |
273
+
242
274
 
243
275
  ## Requirements for running tests, coverage and profiling
244
276
 
@@ -252,7 +284,7 @@ If the modules listed below in the first column are installed, they will provide
252
284
 
253
285
  for instance by `pip install pytest pytest-cov pytest-doctestplus pytest-profiling coverage nbval requests-mock`
254
286
 
255
- Running the antire test suite also require:
287
+ Running the entire test suite also require:
256
288
 
257
289
  - scipy
258
290
  - matplotlib
@@ -260,35 +292,64 @@ Running the antire test suite also require:
260
292
  - pyparsing
261
293
  - requests
262
294
  - cai2
263
- - pyqt5
264
295
 
265
- That can be installed by `pip install pydna[gel,gui,download,express]`
296
+ That can be installed by `pip install pydna[clipboard,gel,download,express]`
266
297
 
267
- or by `pip install scipy matplotlib pillow pyparsing requests cai2 pyqt5`
298
+ or by `pip install pyparsing requests cai2 scipy matplotlib pillow`
268
299
 
269
300
 
270
301
  ![----]( http://bit.ly/coloredline)
271
302
 
272
- ## Releases
303
+ ## Contributing
273
304
 
274
- See the [releases](https://github.com/BjornFJohansson/pydna/releases) for changes and releases.
305
+ Please direct pull requests towards the `develop` branch.
275
306
 
276
- ![----]( http://bit.ly/coloredline)
307
+
308
+ ### Local development
309
+
310
+ 1. Use [Poetry](https://pypi.org/project/poetry) to install dependencies and activate virtual environment.
311
+
312
+ ```bash
313
+ # If you want the virtual environment to be created in this folder
314
+ poetry config virtualenvs.in-project true
315
+
316
+ # Install dependencies (extras are required for tests to pass)
317
+ poetry install --all-extras
318
+
319
+ # Activate virtual environment
320
+ poetry shell
321
+ ```
322
+
323
+ 2. Make your changes.
324
+ 3. Add the necessary tests in `tests/`.
325
+ 4. Run the tests from the root directory with `python run_test.py`.
326
+
327
+ #### Building the documentation locally
328
+
329
+ Below the commands to run a local sphinx server that auto-updated when files are changed.
330
+
331
+ ```
332
+ # Install docs dependency group
333
+ poetry install --with docs
334
+
335
+ # Start the sphinx server to see docs live by default at http://127.0.0.1:8000/
336
+ sphinx-autobuild --watch src/ docs docs/_build/html
337
+
338
+ ```
277
339
 
278
340
  ## Automatic testing & Release process
279
341
 
342
+ See the [releases](https://github.com/BjornFJohansson/pydna/releases) for changes and releases.
343
+
280
344
  There are two github actions for this package:
281
345
 
282
- - `pydna_test_and_coverage_workflow.yml`
283
- - `pydna_pypi_build_workflow.yml`
346
+ - `.github/workflows/pydna_test_and_coverage_workflow.yml`
347
+ - `.github/workflows/pydna_pypi_build_workflow.yml`
284
348
 
285
- The `pydna_test_and_coverage_workflow.yml` is triggered on all pushed commits for all branches.
286
- This workflow run tests, doctests and a series of Jupyter notebooks using pytest on Linux, Windows and macOS and all
349
+ The test_and_coverage workflow is triggered on all pushed commits for all branches except the `master` branch. This workflow run tests, doctests and a series of Jupyter notebooks using pytest on Linux, Windows and macOS with all
287
350
  supported python versions.
288
351
 
289
- The other workflow builds a PyPI packages using poetry on
290
-
291
- These are triggered by publishing a github release manually from the github interface.
352
+ The build workflow builds a PyPI packages using poetry. This workflow is triggered by publishing a Github release manually from the Github web interface.
292
353
 
293
354
  ![----]( http://bit.ly/coloredline)
294
355
 
@@ -323,9 +384,7 @@ These are triggered by publishing a github release manually from the github inte
323
384
 
324
385
  Pydna was made public in 2012 on [Google code](https://code.google.com/archive/p/pydna).
325
386
 
326
-
327
387
  :microbe:
328
388
 
329
-
330
389
  :portugal:
331
390
 
@@ -1,8 +1,8 @@
1
1
  # ![icon](https://raw.githubusercontent.com/bjornFJohansson/pydna/master/docs/pics/pydna.resized.png) pydna
2
2
 
3
- | [![Tests & Coverage](https://github.com/BjornFJohansson/pydna/actions/workflows/pydna_test_and_coverage_workflow.yml/badge.svg?branch=dev_bjorn)](https://github.com/BjornFJohansson/pydna/actions/workflows/pydna_test_and_coverage_workflow.yml) | [![codecov](https://codecov.io/gh/BjornFJohansson/pydna/branch/master/graph/badge.svg)](https://codecov.io/gh/BjornFJohansson/pydna/branch/master) | [![PyPI version](https://badge.fury.io/py/pydna.svg)](https://badge.fury.io/py/pydna) | [![Google group : pydna](https://img.shields.io/badge/Google%20Group-pydna-blue.svg)](https://groups.google.com/g/pydna) |
4
- |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
5
- | [![Documentation Status](https://readthedocs.org/projects/pydna/badge/?version=latest)](http://pydna.readthedocs.io/?badge=latest) | [![GitHub issues](https://img.shields.io/github/issues/BjornFJohansson/pydna.svg)](https://github.com/BjornFJohansson/pydna/issues) | [![Anaconda-Server Badge2](https://anaconda.org/bjornfjohansson/pydna/badges/license.svg)](https://anaconda.org/bjornfjohansson/pydna) | [![GitHub stars](https://img.shields.io/github/stars/BjornFJohansson/pydna.svg)](https://github.com/BjornFJohansson/pydna/stargazers) |
3
+ | [![Tests & Coverage](https://github.com/BjornFJohansson/pydna/actions/workflows/pydna_test_and_coverage_workflow.yml/badge.svg?branch=dev_bjorn)](https://github.com/BjornFJohansson/pydna/actions/workflows/pydna_test_and_coverage_workflow.yml) | [![codecov](https://codecov.io/gh/BjornFJohansson/pydna/branch/master/graph/badge.svg)](https://codecov.io/gh/BjornFJohansson/pydna/branch/master) | [![PyPI version](https://badge.fury.io/py/pydna.svg)](https://badge.fury.io/py/pydna) | [![Google group : pydna](https://img.shields.io/badge/Google%20Group-pydna-blue.svg)](https://groups.google.com/g/pydna) |
4
+ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
5
+ | [![Documentation Status](https://readthedocs.org/projects/pydna/badge/?version=latest)](http://pydna.readthedocs.io/?badge=latest) | [![GitHub issues](https://img.shields.io/github/issues/BjornFJohansson/pydna.svg)](https://github.com/BjornFJohansson/pydna/issues) | [![Anaconda-Server Badge2](https://anaconda.org/bjornfjohansson/pydna/badges/license.svg)](https://anaconda.org/bjornfjohansson/pydna) | [![GitHub stars](https://img.shields.io/github/stars/BjornFJohansson/pydna.svg)](https://github.com/BjornFJohansson/pydna/stargazers) |
6
6
 
7
7
 
8
8
 
@@ -27,7 +27,7 @@ Pydna provides simulation of:
27
27
  - Gel electrophoresis of DNA with generation of gel images
28
28
  - Homologous recombination
29
29
  - Gibson assembly
30
- - Golden gate assembly
30
+ - Golden gate assembly (in progress)
31
31
 
32
32
 
33
33
  Virtually any sub-cloning experiment can be described in pydna, and its execution yield
@@ -38,12 +38,13 @@ Pydna has been designed with the goal of being understandable for biologists wit
38
38
  Pydna can formalize planning and sharing of cloning strategies and is especially useful for complex or combinatorial
39
39
  DNA molecule constructions.
40
40
 
41
- To get started, I have compiled some [simple examples](https://github.com/MetabolicEngineeringGroupCBMA/pydna-examples#pydna-examples).
42
- For more elaborate use, look at some assembly strategies of D-xylose metabolic pathways [MetabolicEngineeringGroupCBMA/ypk-xylose-pathways](https://github.com/MetabolicEngineeringGroupCBMA/ypk-xylose-pathways#pereira-et-al-2016).
43
-
41
+ Start by looking at the [cookbook](https://github.com/BjornFJohansson/pydna/blob/master/docs/cookbook/cookbook.ipynb).
44
42
 
43
+ Some simple examples can be found [here](https://github.com/MetabolicEngineeringGroupCBMA/pydna-examples#pydna-examples).
45
44
 
45
+ For more elaborate use, look at some assembly strategies of D-xylose metabolic pathways [MetabolicEngineeringGroupCBMA/ypk-xylose-pathways](https://github.com/MetabolicEngineeringGroupCBMA/ypk-xylose-pathways#pereira-et-al-2016).
46
46
 
47
+ See below for documentation.
47
48
 
48
49
  ![----]( http://bit.ly/coloredline)
49
50
 
@@ -80,11 +81,7 @@ DNA sequences are downloaded from Genbank by accession numbers that are guarante
80
81
  lin_vector = vector.linearize(EcoRV)
81
82
  rec_vec = ( lin_vector + pcr_prod ).looped()
82
83
 
83
- Pydna can automate the simulation of [sub cloning](http://en.wikipedia.org/wiki/Subcloning) experiments using
84
- python. This is helpful to generate examples for teaching purposes.
85
-
86
- Read the documentation (below) or the [cookbook](https://github.com/BjornFJohansson/pydna/blob/master/docs/cookbook/cookbook.ipynb) with example files
87
- for further information.
84
+ Another use case for pydna in the automatic generation of [sub cloning](http://en.wikipedia.org/wiki/Subcloning) examples for teaching purposes. These examples
88
85
 
89
86
  Feedback & suggestions are very welcome! Please post a message in the [google group](https://groups.google.com/d/forum/pydna) for pydna if you need help or have problems, questions or comments :sos:.
90
87
 
@@ -126,11 +123,10 @@ When using pydna.
126
123
 
127
124
  ![----]( http://bit.ly/coloredline)
128
125
 
129
- ## Documentation
126
+ ## Documentation :page_with_curl:
130
127
 
131
128
  Documentation is built using [Sphinx](http://www.sphinx-doc.org/) from [docstrings](https://www.python.org/dev/peps/pep-0257/)
132
- in the code and displayed at readthedocs [![Documentation Status](https://readthedocs.org/projects/pydna/badge/?version=latest)](http://pydna.readthedocs.io/?badge=latest)
133
-
129
+ in the code and displayed at readthedocs [![Documentation Status](https://readthedocs.org/projects/pydna/badge/?version=latest)](http://pydna.readthedocs.io/?badge=latest).
134
130
  The [numpy](www.numpy.org) [docstring format](https://github.com/numpy/numpy/blob/release/doc/HOWTO_DOCUMENT.rst.txt) is used.
135
131
 
136
132
  ![----]( http://bit.ly/coloredline)
@@ -150,7 +146,7 @@ or use the --pre switch to get the latest version of pydna.
150
146
 
151
147
  for optional functionality do:
152
148
 
153
- pip install pydna[gel,download,express,gui]
149
+ pip install pydna[clipboard,download,express,gel]
154
150
 
155
151
  Remove options inside the square brackets as required, but be sure not to leave spaces as pip will not recognize the options. See below under "Optional dependencies".
156
152
 
@@ -178,32 +174,65 @@ I am happy to collaborate on new features or bugfixes.
178
174
  The list below is the minimal requirements for installing pydna.
179
175
  Biopython and pydivsufsort has c-extensions, but the other modules are pure python.
180
176
 
181
- - [Python 3.8, 3.9, 3.10 or 3.11](http://www.python.org)
177
+ - [Python 3.8, 3.9, 3.10, 3.11 or 3.12](http://www.python.org)
182
178
  - [appdirs](https://pypi.python.org/pypi/appdirs)
183
179
  - [biopython](http://pypi.python.org/pypi/biopython)
184
180
  - [networkx](http://pypi.python.org/pypi/networkx)
185
181
  - [prettytable](https://pypi.python.org/pypi/PrettyTable)
186
182
  - [pydivsufsort](https://pypi.python.org/pypi/pydivsufsort)
183
+ - [pyfiglet](https://pypi.python.org/pypi/pyfiglet)
187
184
 
188
- The above modules are installed as well as pyperclip and pyfiglet.
189
- Pydna is importable even without these two modules.
185
+ Pydna is importable even without pyfiglet.
190
186
 
191
187
  ## Optional dependencies
192
188
 
193
- If the modules listed below in the first column are installed, they will provide the functionality listed in the second column.
189
+ These can be installed `pip install pydna[clipboard,gel,download,express]`
190
+ where `[clipboard,gel,download,express]` is the list of options available. Any
191
+ combination of the words inside the square brackets are allowed, but no white space.
192
+
193
+
194
+ ### `clipboard`
195
+
196
+ Enables the `pydna.dseqrecord.Dseqrecord.copy_gb_to_clipboard()` and `pydna.dseqrecord.Dseqrecord.copy_fasta_to_clipboard()`
197
+
198
+ These methods will put a copy the sequence on the clipboard in either Genbank (gb) or fasta format.
199
+
194
200
 
195
201
  | Dependency | Function in pydna |
196
- |-----------------------------------------------------|--------------------------------------------------------|
197
- | [scipy](https://www.scipy.org) | gel simulation with pydna.gel |
198
- | [matplotlib](http://matplotlib.org) | “ |
199
- | [pillow](https://github.com/python-pillow/Pillow) | “ |
200
- | [numpy](http://www.numpy.org) | " |
202
+ | --------------------------------------------------- | ------------------------------------------------------ |
203
+ | [pyperclip](https://pypi.python.org/pypi/pyperclip) | copy sequence to clipboard |
204
+
205
+ ### download
206
+
207
+ Pyparsing enables the `pydna.genbankfixer.gbtext_clean()` function that can automatically
208
+ correct malformed sequence files in Genbank format. These are often found online, so this option also installs requests to enable the `pydna.genbankfixer.download.download_text()` function which can be used to get cleaned up text from a URL.
209
+
210
+
211
+ | Dependency | Function in pydna |
212
+ | --------------------------------------------------- | ------------------------------------------------------ |
201
213
  | [pyparsing](https://pypi.python.org/pypi/pyparsing) | fix corrupt Genbank files with pydna.genbankfixer |
202
214
  | [requests](https://pypi.org/project/requests) | download sequences with pydna.download |
215
+
216
+ ### express
217
+
218
+ This option enables the `pydna.utils.cai()` function and the `cai()` method
219
+ available from subclasses of `pydna.seqrecord.SeqRecord`, such as
220
+ `pydna.dseqrecord.Dseqrecord`.
221
+
203
222
  | [cai2](https://pypi.python.org/pypi/cai2) | codon adaptation index calculations in several modules |
204
- | [pyqt5](https://pypi.python.org/pypi/pyqt5) | future plan for gui |
205
- | [pyperclip](https://pypi.python.org/pypi/pyperclip) | copy sequence to clipboard |
206
- | [pyfiglet](https://pypi.python.org/pypi/pyfiglet) | print nice logotype (pydna.logo() |
223
+
224
+ ### gel
225
+
226
+ Scipy, matplotlib and pillow (PIL) enable the generation of gel images. Numpy is also
227
+ needed, but usually installed as a dependency of biopython.
228
+
229
+
230
+ | Dependency | Function in pydna |
231
+ | --------------------------------------------------- | ------------------------------------------------------ |
232
+ | [scipy](https://www.scipy.org) | gel simulation with pydna.gel |
233
+ | [matplotlib](http://matplotlib.org) | “ |
234
+ | [pillow](https://github.com/python-pillow/Pillow) | “ |
235
+
207
236
 
208
237
  ## Requirements for running tests, coverage and profiling
209
238
 
@@ -217,7 +246,7 @@ If the modules listed below in the first column are installed, they will provide
217
246
 
218
247
  for instance by `pip install pytest pytest-cov pytest-doctestplus pytest-profiling coverage nbval requests-mock`
219
248
 
220
- Running the antire test suite also require:
249
+ Running the entire test suite also require:
221
250
 
222
251
  - scipy
223
252
  - matplotlib
@@ -225,35 +254,64 @@ Running the antire test suite also require:
225
254
  - pyparsing
226
255
  - requests
227
256
  - cai2
228
- - pyqt5
229
257
 
230
- That can be installed by `pip install pydna[gel,gui,download,express]`
258
+ That can be installed by `pip install pydna[clipboard,gel,download,express]`
231
259
 
232
- or by `pip install scipy matplotlib pillow pyparsing requests cai2 pyqt5`
260
+ or by `pip install pyparsing requests cai2 scipy matplotlib pillow`
233
261
 
234
262
 
235
263
  ![----]( http://bit.ly/coloredline)
236
264
 
237
- ## Releases
265
+ ## Contributing
238
266
 
239
- See the [releases](https://github.com/BjornFJohansson/pydna/releases) for changes and releases.
267
+ Please direct pull requests towards the `develop` branch.
240
268
 
241
- ![----]( http://bit.ly/coloredline)
269
+
270
+ ### Local development
271
+
272
+ 1. Use [Poetry](https://pypi.org/project/poetry) to install dependencies and activate virtual environment.
273
+
274
+ ```bash
275
+ # If you want the virtual environment to be created in this folder
276
+ poetry config virtualenvs.in-project true
277
+
278
+ # Install dependencies (extras are required for tests to pass)
279
+ poetry install --all-extras
280
+
281
+ # Activate virtual environment
282
+ poetry shell
283
+ ```
284
+
285
+ 2. Make your changes.
286
+ 3. Add the necessary tests in `tests/`.
287
+ 4. Run the tests from the root directory with `python run_test.py`.
288
+
289
+ #### Building the documentation locally
290
+
291
+ Below the commands to run a local sphinx server that auto-updated when files are changed.
292
+
293
+ ```
294
+ # Install docs dependency group
295
+ poetry install --with docs
296
+
297
+ # Start the sphinx server to see docs live by default at http://127.0.0.1:8000/
298
+ sphinx-autobuild --watch src/ docs docs/_build/html
299
+
300
+ ```
242
301
 
243
302
  ## Automatic testing & Release process
244
303
 
304
+ See the [releases](https://github.com/BjornFJohansson/pydna/releases) for changes and releases.
305
+
245
306
  There are two github actions for this package:
246
307
 
247
- - `pydna_test_and_coverage_workflow.yml`
248
- - `pydna_pypi_build_workflow.yml`
308
+ - `.github/workflows/pydna_test_and_coverage_workflow.yml`
309
+ - `.github/workflows/pydna_pypi_build_workflow.yml`
249
310
 
250
- The `pydna_test_and_coverage_workflow.yml` is triggered on all pushed commits for all branches.
251
- This workflow run tests, doctests and a series of Jupyter notebooks using pytest on Linux, Windows and macOS and all
311
+ The test_and_coverage workflow is triggered on all pushed commits for all branches except the `master` branch. This workflow run tests, doctests and a series of Jupyter notebooks using pytest on Linux, Windows and macOS with all
252
312
  supported python versions.
253
313
 
254
- The other workflow builds a PyPI packages using poetry on
255
-
256
- These are triggered by publishing a github release manually from the github interface.
314
+ The build workflow builds a PyPI packages using poetry. This workflow is triggered by publishing a Github release manually from the Github web interface.
257
315
 
258
316
  ![----]( http://bit.ly/coloredline)
259
317
 
@@ -288,8 +346,6 @@ These are triggered by publishing a github release manually from the github inte
288
346
 
289
347
  Pydna was made public in 2012 on [Google code](https://code.google.com/archive/p/pydna).
290
348
 
291
-
292
349
  :microbe:
293
350
 
294
-
295
351
  :portugal:
@@ -11,25 +11,25 @@ classifiers=["Development Status :: 4 - Beta",
11
11
  "Intended Audience :: Science/Research",
12
12
  "License :: OSI Approved :: BSD License",
13
13
  "Operating System :: OS Independent",
14
- "Programming Language :: Python :: 3.7",
15
14
  "Programming Language :: Python :: 3.8",
16
15
  "Programming Language :: Python :: 3.9",
17
16
  "Programming Language :: Python :: 3.10",
18
17
  "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
19
  "Topic :: Education",
20
20
  "Topic :: Scientific/Engineering :: Bio-Informatics", ]
21
- [project.urls]
22
- homepage = "https://github.com/BjornFJohansson/pydna#-pydna"
23
- documentation = "https://pydna.readthedocs.io/?badge=latest"
24
- repository = "https://github.com/BjornFJohansson/pydna/tree/dev_bjorn"
25
- changelog = "https://github.com/BjornFJohansson/pydna/blob/master/docs/CHANGELOG.md#changelog"
21
+ [tool.poetry.urls]
22
+ Changelog = "https://github.com/BjornFJohansson/pydna/blob/master/docs/CHANGELOG.md#changelog"
26
23
  [tool.poetry]
27
24
  name = "pydna"
28
- version = "6.0.0-a.3"
25
+ version = "6.0.0-a.15"
29
26
  description = "Representing double stranded DNA and functions for simulating cloning and homologous recombination between DNA molecules."
30
27
  authors = ["BjornFJohansson <bjornjobb@gmail.com>"]
31
28
  license = "BSD"
32
29
  readme = "README.md"
30
+ homepage = "https://github.com/BjornFJohansson/pydna#-pydna"
31
+ documentation = "https://pydna.readthedocs.io/?badge=latest"
32
+ repository = "https://github.com/BjornFJohansson/pydna/tree/dev_bjorn"
33
33
  [tool.poetry.dependencies]
34
34
  python = ">=3.8"
35
35
  appdirs = ">=1.4.4"
@@ -37,20 +37,18 @@ biopython = ">=1.80"
37
37
  networkx = ">=2.8.8"
38
38
  pydivsufsort = ">=0.0.11"
39
39
  prettytable = ">=3.5.0"
40
- pyfiglet = ">=0.8.post1"
40
+ pyfiglet = "0.8.post1"
41
41
  pyperclip = { version = ">=1.8.2", optional = true }
42
- scipy = { version = ">=1.8.0", optional = true }
42
+ scipy = { version = ">=1.9.3", optional = true }
43
43
  matplotlib = { version = ">=3.4.3", optional = true }
44
44
  pillow = { version = ">=8.4.0", optional = true }
45
45
  pyparsing = { version = ">=2.4.7", optional = true }
46
46
  requests = { version = ">=2.26.0", optional = true }
47
47
  cai2 = { version = ">=1.0.5", optional = true }
48
- pyqt5 = { version = ">=5.15.0", optional = true }
49
48
  [tool.poetry.extras]
50
49
  clipboard = ["pyperclip"]
51
50
  gel = ["scipy", "matplotlib", "pillow"]
52
51
  download = ["pyparsing", "requests"]
53
- gui = ["pyqt5"]
54
52
  express = ["cai2"]
55
53
  [build-system]
56
54
  requires = ["poetry-core",
@@ -73,6 +71,12 @@ pytest-profiling = ">=1.7.0"
73
71
  coverage = ">=7.1.0"
74
72
  nbval = ">=0.9.6"
75
73
  requests-mock = ">=1.10.0"
74
+
75
+ [tool.poetry.group.docs.dependencies]
76
+ sphinx-autobuild = "^2021.3.14"
77
+ numpydoc = "^1.6.0"
78
+ sphinx-rtd-theme = "^1.3.0"
79
+
76
80
  [tool.pytest.ini_options]
77
81
  minversion = "6.0.2"
78
82
  python_files = "test_*.py"
@@ -149,7 +149,7 @@ __license__ = "BSD"
149
149
  __maintainer__ = "Björn Johansson"
150
150
  __email__ = "bjorn_johansson@bio.uminho.pt"
151
151
  __status__ = "Development" # "Production" #"Prototype"
152
- __version__ = "6.0.0-a.3"
152
+ __version__ = "6.0.0-a.15"
153
153
 
154
154
  # create config directory
155
155
  _os.environ["pydna_config_dir"] = _os.getenv("pydna_config_dir", _appdirs.user_config_dir("pydna"))
@@ -230,30 +230,30 @@ _logger.info(
230
230
  _Path(_os.environ["pydna_data_dir"]).mkdir(parents=True, exist_ok=True)
231
231
 
232
232
  # find out if optional dependecies for gel module are in place
233
-
234
-
235
- def _missing_modules_for_gel():
236
- import importlib
237
- from importlib import util
238
-
239
- _missing = []
240
- for _optm in ["scipy", "PIL", "numpy", "pyparsing", "requests"]:
241
- _missing.extend([_optm] if not util.find_spec(_optm) else [])
242
- del importlib
243
- del util
244
- return _missing
245
-
246
-
247
- _missing = _missing_modules_for_gel()
248
-
249
- if _missing:
250
- _logger.warning(
251
- "gel simulation will NOT be available." " Missing modules: %s",
252
- ", ".join(_missing),
253
- )
254
- else:
255
- _logger.info("gel simulation is available," " optional dependencies were found.")
256
-
233
+ #
234
+ #
235
+ # def _missing_modules_for_gel():
236
+ # import importlib
237
+ # from importlib import util
238
+ #
239
+ # _missing = []
240
+ # for _optm in ["scipy", "PIL", "numpy", "pyparsing", "requests"]:
241
+ # _missing.extend([_optm] if not util.find_spec(_optm) else [])
242
+ # del importlib
243
+ # del util
244
+ # return _missing
245
+ #
246
+ #
247
+ # _missing = _missing_modules_for_gel()
248
+ #
249
+ # if _missing:
250
+ # _logger.warning(
251
+ # "gel simulation will NOT be available." " Missing modules: %s",
252
+ # ", ".join(_missing),
253
+ # )
254
+ # else:
255
+ # _logger.info("gel simulation is available," " optional dependencies were found.")
256
+ #
257
257
 
258
258
  _logger.info("__version__ = %s", __version__)
259
259
 
@@ -700,7 +700,7 @@ def circular_assembly_fragments(f, overlap=35, maxlink=40):
700
700
  fragments = assembly_fragments(f + f[0:1], overlap=overlap, maxlink=maxlink)
701
701
 
702
702
  if hasattr(fragments[0], "template"):
703
- fragments[0] = _pcr((fragments[-1].forward_primer, fragments[0].reverse_primer), fragments[0])
703
+ fragments[0] = _pcr((fragments[-1].forward_primer, fragments[0].reverse_primer), fragments[0].template)
704
704
  return fragments[:-1]
705
705
 
706
706
 
@@ -4,10 +4,10 @@
4
4
  # This code is part of the Python-dna distribution and governed by its
5
5
  # license. Please see the LICENSE.txt file that should have been included
6
6
  # as part of this package.
7
- """Provides a function for downloading online text files"""
7
+ """Provides a function for downloading online text files."""
8
8
 
9
9
  import textwrap as _textwrap
10
- import requests as _requests
10
+
11
11
  import os as _os
12
12
  from pydna._pretty import pretty_str as _pretty_str
13
13
  from pydna.utils import memorize as _memorize
@@ -18,9 +18,12 @@ _module_logger = _logging.getLogger("pydna." + __name__)
18
18
 
19
19
  @_memorize("pydna.download.download_text")
20
20
  def download_text(url):
21
+ """docstring."""
22
+ import requests
23
+
21
24
  _module_logger.info("#### DOWNLOAD TEXT ####")
22
25
  _module_logger.info("url = %s", url)
23
- req = _requests.get(url)
26
+ req = requests.get(url)
24
27
  _module_logger.info("url = %s", str(req))
25
28
  result = _textwrap.dedent(req.text).strip()
26
29
  result = result.replace("\r\n", "\n").replace("\r", "\n")
@@ -74,7 +74,8 @@ class Dseq(_Seq):
74
74
  The most common usage is probably to create a Dseq object as a
75
75
  part of a Dseqrecord object (see :class:`pydna.dseqrecord.Dseqrecord`).
76
76
 
77
- There are three ways of creating a Dseq object directly:
77
+ There are three ways of creating a Dseq object directly listed below, but you can also
78
+ use the function Dseq.from_full_sequence_and_overhangs() to create a Dseq:
78
79
 
79
80
  Only one argument (string):
80
81
 
@@ -109,22 +110,22 @@ class Dseq(_Seq):
109
110
 
110
111
  The ovhg parameter controls the stagger at the five prime end::
111
112
 
112
- dsDNA ovhg
113
+ dsDNA overhang
113
114
 
114
- XXX 2
115
- XXXXX
115
+ nnn... 2
116
+ nnnnn...
116
117
 
117
- XXXX 1
118
- XXXXX
118
+ nnnn... 1
119
+ nnnnn...
119
120
 
120
- XXXXX 0
121
- XXXXX
121
+ nnnnn... 0
122
+ nnnnn...
122
123
 
123
- XXXXX -1
124
- XXXX
124
+ nnnnn... -1
125
+ nnnn...
125
126
 
126
- XXXXX -2
127
- XXX
127
+ nnnnn... -2
128
+ nnn...
128
129
 
129
130
  Example of creating Dseq objects with different amounts of stagger:
130
131
 
@@ -428,6 +429,69 @@ class Dseq(_Seq):
428
429
  obj._data = _rc(cb[-max(0, ovhg) or len(cb) :]) + wb + _rc(cb[: max(0, len(cb) - ovhg - len(wb))])
429
430
  return obj
430
431
 
432
+ @classmethod
433
+ def from_full_sequence_and_overhangs(cls, full_sequence: str, crick_ovhg: int, watson_ovhg: int):
434
+ """Create a linear Dseq object from a full sequence and the 3' overhangs of each strand.
435
+
436
+ The order of the parameters is like this because the 3' overhang of the crick strand is the one
437
+ on the left side of the sequence.
438
+
439
+
440
+ Parameters
441
+ ----------
442
+ full_sequence: str
443
+ The full sequence of the Dseq object.
444
+
445
+ crick_ovhg: int
446
+ The overhang of the crick strand in the 3' end. Equivalent to Dseq.ovhg.
447
+
448
+ watson_ovhg: int
449
+ The overhang of the watson strand in the 5' end.
450
+
451
+ Returns
452
+ -------
453
+ Dseq
454
+ A Dseq object.
455
+
456
+ Examples
457
+ --------
458
+
459
+ >>> Dseq.from_full_sequence_and_overhangs('AAAAAA', crick_ovhg=2, watson_ovhg=2)
460
+ Dseq(-6)
461
+ AAAA
462
+ TTTT
463
+ >>> Dseq.from_full_sequence_and_overhangs('AAAAAA', crick_ovhg=-2, watson_ovhg=2)
464
+ Dseq(-6)
465
+ AAAAAA
466
+ TT
467
+ >>> Dseq.from_full_sequence_and_overhangs('AAAAAA', crick_ovhg=2, watson_ovhg=-2)
468
+ Dseq(-6)
469
+ AA
470
+ TTTTTT
471
+ >>> Dseq.from_full_sequence_and_overhangs('AAAAAA', crick_ovhg=-2, watson_ovhg=-2)
472
+ Dseq(-6)
473
+ AAAA
474
+ TTTT
475
+
476
+ """
477
+ full_sequence_rev = str(Dseq(full_sequence).reverse_complement())
478
+ watson = full_sequence
479
+ crick = full_sequence_rev
480
+
481
+ # If necessary, we trim the left side
482
+ if crick_ovhg < 0:
483
+ crick = crick[:crick_ovhg]
484
+ elif crick_ovhg > 0:
485
+ watson = watson[crick_ovhg:]
486
+
487
+ # If necessary, we trim the right side
488
+ if watson_ovhg < 0:
489
+ watson = watson[:watson_ovhg]
490
+ elif watson_ovhg > 0:
491
+ crick = crick[watson_ovhg:]
492
+
493
+ return Dseq(watson, crick=crick, ovhg=crick_ovhg)
494
+
431
495
  # @property
432
496
  # def ovhg(self):
433
497
  # """The ovhg property. This cannot be set directly, but is a
@@ -942,6 +1006,10 @@ class Dseq(_Seq):
942
1006
  type_ = "blunt"
943
1007
  return type_, sticky
944
1008
 
1009
+ def watson_ovhg(self):
1010
+ """Returns the overhang of the watson strand at the three prime."""
1011
+ return len(self.watson) - len(self.crick) + self.ovhg
1012
+
945
1013
  def __add__(self, other):
946
1014
  """Simulates ligation between two DNA fragments.
947
1015
 
@@ -1244,8 +1312,7 @@ class Dseq(_Seq):
1244
1312
  return self.n_cutters(n=2, batch=batch)
1245
1313
 
1246
1314
  def n_cutters(self, n=3, batch: _RestrictionBatch = None):
1247
- """Returns the enzymes in a RestrictionBatch that cut the sequence
1248
- n times."""
1315
+ """Enzymes in a RestrictionBatch cutting n times."""
1249
1316
  if not batch:
1250
1317
  batch = CommOnly
1251
1318
  ana = batch.search(self)
@@ -9,17 +9,15 @@
9
9
 
10
10
  """docstring."""
11
11
 
12
- from PIL import Image as _Image
13
- from PIL import ImageDraw as _ImageDraw
14
- import numpy as _np
15
12
  import math as _math
16
- from scipy.interpolate import CubicSpline as _CubicSpline
17
13
  from pydna.ladders import GeneRuler_1kb_plus as _mwstd
18
14
 
19
15
 
20
16
  def interpolator(mwstd):
21
17
  """docstring."""
22
- interpolator = _CubicSpline(
18
+ from scipy.interpolate import CubicSpline
19
+
20
+ interpolator = CubicSpline(
23
21
  [len(fr) for fr in mwstd[::-1]],
24
22
  [fr.rf for fr in mwstd[::-1]],
25
23
  bc_type="natural",
@@ -30,6 +28,10 @@ def interpolator(mwstd):
30
28
 
31
29
 
32
30
  def gel(samples=None, gel_length=600, margin=50, interpolator=interpolator(mwstd=_mwstd)):
31
+ import numpy as np
32
+ from PIL import Image as Image
33
+ from PIL import ImageDraw as ImageDraw
34
+
33
35
  """docstring."""
34
36
  max_intensity = 256
35
37
  lane_width = 50
@@ -37,9 +39,9 @@ def gel(samples=None, gel_length=600, margin=50, interpolator=interpolator(mwstd
37
39
  start = 10
38
40
  samples = samples or [interpolator.mwstd]
39
41
  width = int(60 + (lane_width + lanesep) * len(samples))
40
- lanes = _np.zeros((len(samples), gel_length), dtype=int)
41
- image = _Image.new("RGB", (width, gel_length), "#ddd")
42
- draw = _ImageDraw.Draw(image)
42
+ lanes = np.zeros((len(samples), gel_length), dtype=int)
43
+ image = Image.new("RGB", (width, gel_length), "#ddd")
44
+ draw = ImageDraw.Draw(image)
43
45
  draw.rectangle((0, 0, (width, gel_length)), fill=(0, 0, 0))
44
46
  scale = (gel_length - margin) / interpolator(min(interpolator.x))
45
47
 
@@ -72,10 +74,10 @@ def gel(samples=None, gel_length=600, margin=50, interpolator=interpolator(mwstd
72
74
  pass
73
75
 
74
76
  for i, lane in enumerate(lanes):
75
- max_intensity = _np.amax(lanes[i])
77
+ max_intensity = np.amax(lanes[i])
76
78
  if max_intensity > 256:
77
- lanes[i] = _np.multiply(lanes[i], 256)
78
- lanes[i] = _np.divide(lanes[i], max_intensity)
79
+ lanes[i] = np.multiply(lanes[i], 256)
80
+ lanes[i] = np.divide(lanes[i], max_intensity)
79
81
 
80
82
  for i, lane in enumerate(lanes):
81
83
  x1 = 50 + i * (lane_width + lanesep)
@@ -24,6 +24,7 @@ import xml.etree.ElementTree as _et
24
24
  def embl_gb_fasta(raw, ds, path=None):
25
25
  # regex = r"^>.+?^(?=$|LOCUS|ID|>|\#)|^(?:LOCUS|ID).+?^//"
26
26
  regex = r"(?:>.+\n^(?:^[^>]+?)(?=\n\n|>|" r"LOCUS|ID))|(?:(?:LOCUS|ID)(?:(?:.|\n)+?)^//)"
27
+ "(?:^>.+\n^(?:^[^>]+?)(?=\n\n|>|^LOCUS|ID))|(?:(?:^LOCUS|ID)(?:(?:.|\n)+?)^//)"
27
28
 
28
29
  result_list = []
29
30
 
@@ -129,7 +129,7 @@ def smallest_rotation(s):
129
129
  """
130
130
  from pydivsufsort import min_rotation
131
131
 
132
- k = min_rotation(s)
132
+ k = min_rotation(bytes(s, "ascii"))
133
133
  return s[k:] + s[:k]
134
134
 
135
135
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes