pydna 5.5.1__tar.gz → 5.5.3__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 (49) hide show
  1. {pydna-5.5.1 → pydna-5.5.3}/PKG-INFO +22 -18
  2. {pydna-5.5.1 → pydna-5.5.3}/README.md +20 -17
  3. {pydna-5.5.1 → pydna-5.5.3}/pyproject.toml +11 -7
  4. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/__init__.py +116 -134
  5. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/_pretty.py +2 -14
  6. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/all.py +10 -20
  7. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/amplicon.py +25 -20
  8. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/amplify.py +46 -26
  9. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/assembly.py +50 -27
  10. pydna-5.5.3/src/pydna/assembly2.py +2627 -0
  11. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/common_sub_strings.py +2 -12
  12. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/contig.py +39 -22
  13. pydna-5.5.3/src/pydna/cre_lox.py +130 -0
  14. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/crispr.py +8 -13
  15. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/design.py +89 -59
  16. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/download.py +10 -18
  17. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/dseq.py +119 -59
  18. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/dseqrecord.py +88 -45
  19. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/fakeseq.py +0 -11
  20. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/fusionpcr.py +3 -1
  21. pydna-5.5.3/src/pydna/gateway.py +164 -0
  22. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/gel.py +8 -13
  23. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/genbank.py +33 -32
  24. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/genbankfile.py +8 -13
  25. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/genbankfixer.py +41 -28
  26. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/genbankrecord.py +11 -14
  27. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/goldengate.py +2 -2
  28. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/ladders.py +4 -11
  29. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/ligate.py +8 -14
  30. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/parsers.py +25 -9
  31. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/primer.py +3 -12
  32. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/readers.py +0 -11
  33. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/seq.py +21 -18
  34. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/seqrecord.py +20 -20
  35. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/sequence_picker.py +3 -12
  36. pydna-5.5.3/src/pydna/sequence_regex.py +44 -0
  37. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/tm.py +13 -15
  38. pydna-5.5.3/src/pydna/types.py +41 -0
  39. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/utils.py +173 -58
  40. pydna-5.5.1/src/pydna/editor.py +0 -119
  41. pydna-5.5.1/src/pydna/gateway.py +0 -162
  42. pydna-5.5.1/src/pydna/myenzymes.py +0 -51
  43. pydna-5.5.1/src/pydna/myprimers.py +0 -219
  44. {pydna-5.5.1 → pydna-5.5.3}/LICENSE.txt +0 -0
  45. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/_thermodynamic_data.py +0 -0
  46. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/codon.py +0 -0
  47. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/conftest.py +0 -0
  48. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/threading_timer_decorator_exit.py +0 -0
  49. {pydna-5.5.1 → pydna-5.5.3}/src/pydna/user_cloning.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pydna
3
- Version: 5.5.1
3
+ Version: 5.5.3
4
4
  Summary: Representing double stranded DNA and functions for simulating cloning and homologous recombination between DNA molecules.
5
5
  License: BSD
6
6
  Author: Björn F. Johansson
@@ -36,6 +36,7 @@ Requires-Dist: pydivsufsort (>=0.0.14)
36
36
  Requires-Dist: pyfiglet (==0.8.post1)
37
37
  Requires-Dist: pyparsing (>=2.4.7) ; extra == "download"
38
38
  Requires-Dist: pyperclip (>=1.8.2) ; extra == "clipboard"
39
+ Requires-Dist: regex (>=2024.11.6,<2025.0.0)
39
40
  Requires-Dist: requests (>=2.26.0) ; extra == "download"
40
41
  Requires-Dist: scipy (>=1.11.3) ; (python_version >= "3.12") and (extra == "gel")
41
42
  Requires-Dist: scipy (>=1.9.3) ; (python_version < "3.12") and (extra == "gel")
@@ -46,11 +47,11 @@ Project-URL: Homepage, https://github.com/pydna-group/pydna#-pydna
46
47
  Project-URL: Repository, https://github.com/pydna-group/pydna/tree/master
47
48
  Description-Content-Type: text/markdown
48
49
 
49
- # ![icon](https://github.com/pydna-group/pydna/blob/master/docs/_static/pydna.resized.png?raw=true) pydna
50
+ # ![icon](https://github.com/pydna-group/pydna/blob/master/docs/_static/banner.png?raw=true)
50
51
 
51
- | [![Tests & Coverage](https://github.com/pydna-group/pydna/actions/workflows/pydna_test_and_coverage_workflow.yml/badge.svg?branch=dev_bjorn)](https://github.com/pydna-group/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) |
52
+ | [![Tests & Coverage](https://github.com/pydna-group/pydna/actions/workflows/pydna_test_and_coverage_workflow.yml/badge.svg?branch=master)](https://github.com/pydna-group/pydna/actions/workflows/pydna_test_and_coverage_workflow.yml) | [![codecov](https://codecov.io/gh/pydna-group/pydna/branch/master/graph/badge.svg)](https://codecov.io/gh/pydna-group/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) |
52
53
  | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
53
- | [![Documentation Status](https://github.com/pydna-group/pydna/actions/workflows/publish-docs.yml/badge.svg)](https://github.com/pydna-group/pydna/actions/workflows/publish-docs.yml) | [![GitHub issues](https://img.shields.io/github/issues/BjornFJohansson/pydna.svg)](https://github.com/pydna-group/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/pydna-group/pydna/stargazers) |
54
+ | [![Documentation Status](https://github.com/pydna-group/pydna/actions/workflows/publish-docs.yml/badge.svg)](https://github.com/pydna-group/pydna/actions/workflows/publish-docs.yml) | [![GitHub issues](https://img.shields.io/github/issues/pydna-group/pydna.svg)](https://github.com/pydna-group/pydna/issues) | [![GitHub stars](https://img.shields.io/github/stars/pydna-group/pydna.svg)](https://github.com/pydna-group/pydna/stargazers) | |
54
55
 
55
56
  <!-- docs/index.rst-start -->
56
57
 
@@ -437,15 +438,11 @@ Feedback & suggestions are very welcome! Please create an issue with your questi
437
438
 
438
439
  If you don't have a github account, you can get in touch through the [google group](https://groups.google.com/d/forum/pydna) for pydna.
439
440
 
440
- Below are the instructions for developers who want to contribute to pydna. Please direct pull requests towards the `dev_bjorn` branch.
441
+ Below are the instructions for developers who want to contribute to pydna. Please direct pull requests towards the `master` branch.
441
442
 
442
443
  ### Fork the repository and set up a dev branch 🍴
443
444
 
444
- Fork the entire repository (not just the `master` branch by unticking the "Copy the `master` branch only" box)
445
-
446
- ![Fork](https://github.com/pydna-group/pydna/blob/master/docs/_static/create-fork.png?raw=true)
447
-
448
- Create your branch starting from `dev_bjorn`, and if your changes are related to an issue, call the branch `issue_<number>`.
445
+ Fork the repository. Create your branch starting from `master`, and if your changes are related to an issue, call the branch `issue_<number>`.
449
446
 
450
447
  ```bash
451
448
  # Clone the repository
@@ -454,12 +451,6 @@ git clone https://github.com/<your-username>/pydna.git
454
451
  # Change to the repository directory
455
452
  cd pydna
456
453
 
457
- # Go to the dev_bjorn branch
458
- git checkout -b dev_bjorn
459
-
460
- # Pull the current version of dev_bjorn
461
- git pull origin dev_bjorn
462
-
463
454
  # Create your own branch
464
455
  git checkout -b issue_<number>
465
456
  ```
@@ -524,9 +515,22 @@ pre-commit install
524
515
  > **TIP:** The hooks are a series of checks that will be run before you commit your code. If any of the checks fail, the commit will not be allowed. Some of them auto-fix the code (e.g., `black` formatting), so you can simply do `git add .` and commit again. Others like `flake8` will prevent the commit to happen until the code is compliant. For instance, if you import a module in a file and not use it, `flake8` will complain. For a full list of checks, see `.pre-commit-config.yaml`.
525
516
  5. Push the changes to your fork
526
517
 
518
+ > **TIP:** The continuous integration pipeline also runs doctests. These are tests that validate that the docstring examples are correct. For example, the docstring of the function `pydna.utils.smallest_rotation` looks like this:
519
+ > ```python
520
+ > >>> from pydna.utils import smallest_rotation
521
+ > >>> smallest_rotation("taaa")
522
+ > 'aaat'
523
+ > ```
524
+ > doctest will fail if `smallest_rotation("taaa")` does not return `'aaat'`. If you make changes to some function, you may break the doctests, and this can be a bit hard to understand. If this happens, the CI tests will fail, with a message similar to this:
525
+ > ```
526
+ > =================================== FAILURES ===================================
527
+ > ___________________ [doctest] pydna.assembly2.blunt_overlap ____________________
528
+ > ```
529
+ > 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!
530
+
527
531
  ### Creating a PR 🔗
528
532
 
529
- * From your fork, make a PR towards the branch `dev_bjorn` in the original repository.
533
+ * From your fork, make a PR towards the branch `master` in the original repository.
530
534
  * Mention the issue number in the PR description (e.g., `Closes #123`).
531
535
  * Remember to click the "Allow edits from maintainers" checkbox so that we can make some changes to the PR if necessary.
532
536
 
@@ -582,7 +586,7 @@ Wang, Y., Xue, H., Pourcel, C., Du, Y., & Gautheret, D. (2021).
582
586
  In Cold Spring Harbor Laboratory (p. 2021.01.17.427048). [DOI](https://doi.org/10.1101/2021.01.17.427048)
583
587
  [PubMed](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8180056)
584
588
 
585
- [ShareYourCloning](https://shareyourcloning.org), a web application for designing and documenting DNA cloning strategies.
589
+ [OpenCloning](https://opencloning.org), a web application for designing and documenting DNA cloning strategies.
586
590
 
587
591
  [An Automated Protein Synthesis Pipeline with Transcriptic and Snakemake](http://blog.booleanbiotech.com/transcriptic_protein_synthesis_pipeline.html)
588
592
 
@@ -1,8 +1,8 @@
1
- # ![icon](https://github.com/pydna-group/pydna/blob/master/docs/_static/pydna.resized.png?raw=true) pydna
1
+ # ![icon](https://github.com/pydna-group/pydna/blob/master/docs/_static/banner.png?raw=true)
2
2
 
3
- | [![Tests & Coverage](https://github.com/pydna-group/pydna/actions/workflows/pydna_test_and_coverage_workflow.yml/badge.svg?branch=dev_bjorn)](https://github.com/pydna-group/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) |
3
+ | [![Tests & Coverage](https://github.com/pydna-group/pydna/actions/workflows/pydna_test_and_coverage_workflow.yml/badge.svg?branch=master)](https://github.com/pydna-group/pydna/actions/workflows/pydna_test_and_coverage_workflow.yml) | [![codecov](https://codecov.io/gh/pydna-group/pydna/branch/master/graph/badge.svg)](https://codecov.io/gh/pydna-group/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
4
  | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
5
- | [![Documentation Status](https://github.com/pydna-group/pydna/actions/workflows/publish-docs.yml/badge.svg)](https://github.com/pydna-group/pydna/actions/workflows/publish-docs.yml) | [![GitHub issues](https://img.shields.io/github/issues/BjornFJohansson/pydna.svg)](https://github.com/pydna-group/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/pydna-group/pydna/stargazers) |
5
+ | [![Documentation Status](https://github.com/pydna-group/pydna/actions/workflows/publish-docs.yml/badge.svg)](https://github.com/pydna-group/pydna/actions/workflows/publish-docs.yml) | [![GitHub issues](https://img.shields.io/github/issues/pydna-group/pydna.svg)](https://github.com/pydna-group/pydna/issues) | [![GitHub stars](https://img.shields.io/github/stars/pydna-group/pydna.svg)](https://github.com/pydna-group/pydna/stargazers) | |
6
6
 
7
7
  <!-- docs/index.rst-start -->
8
8
 
@@ -389,15 +389,11 @@ Feedback & suggestions are very welcome! Please create an issue with your questi
389
389
 
390
390
  If you don't have a github account, you can get in touch through the [google group](https://groups.google.com/d/forum/pydna) for pydna.
391
391
 
392
- Below are the instructions for developers who want to contribute to pydna. Please direct pull requests towards the `dev_bjorn` branch.
392
+ Below are the instructions for developers who want to contribute to pydna. Please direct pull requests towards the `master` branch.
393
393
 
394
394
  ### Fork the repository and set up a dev branch 🍴
395
395
 
396
- Fork the entire repository (not just the `master` branch by unticking the "Copy the `master` branch only" box)
397
-
398
- ![Fork](https://github.com/pydna-group/pydna/blob/master/docs/_static/create-fork.png?raw=true)
399
-
400
- Create your branch starting from `dev_bjorn`, and if your changes are related to an issue, call the branch `issue_<number>`.
396
+ Fork the repository. Create your branch starting from `master`, and if your changes are related to an issue, call the branch `issue_<number>`.
401
397
 
402
398
  ```bash
403
399
  # Clone the repository
@@ -406,12 +402,6 @@ git clone https://github.com/<your-username>/pydna.git
406
402
  # Change to the repository directory
407
403
  cd pydna
408
404
 
409
- # Go to the dev_bjorn branch
410
- git checkout -b dev_bjorn
411
-
412
- # Pull the current version of dev_bjorn
413
- git pull origin dev_bjorn
414
-
415
405
  # Create your own branch
416
406
  git checkout -b issue_<number>
417
407
  ```
@@ -476,9 +466,22 @@ pre-commit install
476
466
  > **TIP:** The hooks are a series of checks that will be run before you commit your code. If any of the checks fail, the commit will not be allowed. Some of them auto-fix the code (e.g., `black` formatting), so you can simply do `git add .` and commit again. Others like `flake8` will prevent the commit to happen until the code is compliant. For instance, if you import a module in a file and not use it, `flake8` will complain. For a full list of checks, see `.pre-commit-config.yaml`.
477
467
  5. Push the changes to your fork
478
468
 
469
+ > **TIP:** The continuous integration pipeline also runs doctests. These are tests that validate that the docstring examples are correct. For example, the docstring of the function `pydna.utils.smallest_rotation` looks like this:
470
+ > ```python
471
+ > >>> from pydna.utils import smallest_rotation
472
+ > >>> smallest_rotation("taaa")
473
+ > 'aaat'
474
+ > ```
475
+ > doctest will fail if `smallest_rotation("taaa")` does not return `'aaat'`. If you make changes to some function, you may break the doctests, and this can be a bit hard to understand. If this happens, the CI tests will fail, with a message similar to this:
476
+ > ```
477
+ > =================================== FAILURES ===================================
478
+ > ___________________ [doctest] pydna.assembly2.blunt_overlap ____________________
479
+ > ```
480
+ > 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!
481
+
479
482
  ### Creating a PR 🔗
480
483
 
481
- * From your fork, make a PR towards the branch `dev_bjorn` in the original repository.
484
+ * From your fork, make a PR towards the branch `master` in the original repository.
482
485
  * Mention the issue number in the PR description (e.g., `Closes #123`).
483
486
  * Remember to click the "Allow edits from maintainers" checkbox so that we can make some changes to the PR if necessary.
484
487
 
@@ -534,7 +537,7 @@ Wang, Y., Xue, H., Pourcel, C., Du, Y., & Gautheret, D. (2021).
534
537
  In Cold Spring Harbor Laboratory (p. 2021.01.17.427048). [DOI](https://doi.org/10.1101/2021.01.17.427048)
535
538
  [PubMed](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8180056)
536
539
 
537
- [ShareYourCloning](https://shareyourcloning.org), a web application for designing and documenting DNA cloning strategies.
540
+ [OpenCloning](https://opencloning.org), a web application for designing and documenting DNA cloning strategies.
538
541
 
539
542
  [An Automated Protein Synthesis Pipeline with Transcriptic and Snakemake](http://blog.booleanbiotech.com/transcriptic_protein_synthesis_pipeline.html)
540
543
 
@@ -36,7 +36,7 @@ license = "BSD"
36
36
  name = "pydna"
37
37
  readme = "README.md"
38
38
  repository = "https://github.com/pydna-group/pydna/tree/master"
39
- version = "5.5.1"
39
+ version = "5.5.3"
40
40
  [tool.poetry.dependencies]
41
41
  appdirs = ">=1.4.4"
42
42
  biopython = ">=1.85"
@@ -60,6 +60,7 @@ scipy = [
60
60
  { version = ">=1.9.3", python = "<3.12", optional = true },
61
61
  ]
62
62
  seguid = ">=0.0.5"
63
+ regex = "^2024.11.6"
63
64
  [tool.poetry.extras]
64
65
  clipboard = ["pyperclip"]
65
66
  download = ["pyparsing", "requests"]
@@ -96,7 +97,7 @@ myst-parser = [
96
97
 
97
98
  [tool.poetry.group.dev.dependencies]
98
99
  autopep8 = "^2.1.0"
99
- black = "^24.4.2"
100
+ black = "^25.1.0"
100
101
  pre-commit = ">3.6"
101
102
  nbstripout = "^0.7.1"
102
103
  flake8-bugbear = "^24.12.12"
@@ -107,14 +108,17 @@ python_files = "test_*.py"
107
108
  testpaths = ["tests", "src"]
108
109
  [tool.black]
109
110
  include = '\.pyi?$'
110
- line-length = 119
111
+ line-length = 88
111
112
  target-version = ["py38", "py39", "py310", "py311", "py312"]
112
113
  # 'extend-exclude' excludes files or directories in addition to the defaults
113
114
  extend-exclude = '''
114
- # A regex preceded with ^/ will apply only to files and directories
115
- # in the root of the project.
116
115
  (
117
- ^/foo.py # exclude a file named foo.py in the root of the project
118
- | .*_pb2.py # exclude autogenerated Protocol Buffer files anywhere in the project
116
+ ^/foo.py # exclude a file named foo.py in the root of the project
117
+ | .*_pb2.py # exclude autogenerated Protocol Buffer files anywhere in the project
118
+ | ^docs/ # exclude all files in the docs/ directory
119
+ | ^tests/ # exclude all files in the tests/ directory
119
120
  )
120
121
  '''
122
+
123
+ [tool.poetry.requires-plugins]
124
+ poetry-plugin-export = ">=1.9"
@@ -132,111 +132,104 @@ See this repository for a collection of
132
132
  """
133
133
 
134
134
 
135
- from pydna.utils import open_folder as _open_folder
136
- from pathlib import Path as _Path
135
+ # from pydna.utils import open_folder as _open_folder
136
+ # from pathlib import Path as _Path
137
137
  import os as _os
138
- import logging as _logging
139
- import logging.handlers as _handlers
140
- import appdirs as _appdirs
141
- import configparser as _configparser
142
- import tempfile as _tempfile
138
+
139
+ # import logging as _logging
140
+ # import logging.handlers as _handlers
141
+ # import appdirs as _appdirs
142
+ # import configparser as _configparser
143
+ # import tempfile as _tempfile
143
144
  from pydna._pretty import PrettyTable as _PrettyTable
144
145
 
145
146
 
146
147
  __author__ = "Björn Johansson"
147
- __copyright__ = "Copyright 2013 - 2021 Björn Johansson"
148
+ __copyright__ = "Copyright 2013 - 2023 Björn Johansson"
148
149
  __credits__ = ["Björn Johansson", "Mark Budde"]
149
150
  __license__ = "BSD"
150
151
  __maintainer__ = "Björn Johansson"
151
152
  __email__ = "bjorn_johansson@bio.uminho.pt"
152
153
  __status__ = "Development" # "Production" #"Prototype"
153
- __version__ = "5.5.1"
154
+ __version__ = "5.5.3"
154
155
 
155
156
 
156
- # create config directory
157
- _os.environ["pydna_config_dir"] = _os.getenv("pydna_config_dir", _appdirs.user_config_dir("pydna"))
158
- config_dir = _Path(_os.environ["pydna_config_dir"])
159
- config_dir.mkdir(parents=True, exist_ok=True)
157
+ # obtain config directory from env or appdirs
158
+ # _os.environ["pydna_config_dir"] = _os.getenv("pydna_config_dir", _appdirs.user_config_dir("pydna"))
159
+ # config_dir = _Path(_os.environ["pydna_config_dir"])
160
+ # config_dir.mkdir(parents=True, exist_ok=True)
160
161
 
161
162
  # set path for the pydna.ini file
162
- _ini_path = config_dir / "pydna.ini"
163
+ # _ini_path = config_dir / "pydna.ini"
163
164
 
164
165
  # define user_data_dir
165
- user_data_dir = _Path(_appdirs.user_data_dir("pydna"))
166
-
167
- default_ini = {
168
- "ape": "put/path/to/ape/here",
169
- "cached_funcs": "pydna.genbank.genbank.nucleotide",
170
- "data_dir": str(user_data_dir),
171
- "email": "someone@example.com",
172
- "enzymes": str(user_data_dir / "enzymes.md"),
173
- "log_dir": _appdirs.user_log_dir("pydna"),
174
- "loglevel": str(_logging.WARNING),
175
- "primers": str(user_data_dir / "primers.md"),
176
- "assembly_limit": str(10),
177
- }
166
+ # user_data_dir = _Path(_appdirs.user_data_dir("pydna"))
167
+
168
+ # default_ini = {
169
+ # "ape": "put/path/to/ape/here",
170
+ # "cached_funcs": "pydna.genbank.genbank.nucleotide",
171
+ # "data_dir": str(user_data_dir),
172
+ # "email": "someone@example.com",
173
+ # "enzymes": str(user_data_dir / "enzymes.md"),
174
+ # "log_dir": _appdirs.user_log_dir("pydna"),
175
+ # "loglevel": str(_logging.WARNING),
176
+ # "primers": str(user_data_dir / "primers.md"),
177
+ # "assembly_limit": str(10),
178
+ # }
179
+
180
+ # ini = default_ini.copy()
178
181
 
179
182
  # initiate a config parser instance
180
- _parser = _configparser.ConfigParser()
183
+ # _parser = _configparser.ConfigParser()
181
184
 
182
185
  # if a pydna.ini exists, it is read
183
- if _ini_path.exists():
184
- _parser.read(_ini_path)
185
- else: # otherwise it is created with default settings
186
- _parser["main"] = default_ini
187
- _temp_ini_file = _tempfile.NamedTemporaryFile(dir=_ini_path.parent, delete=False)
188
- _temp_ini_path = _Path(_temp_ini_file.name)
189
- try:
190
- _temp_ini_file.close()
191
- with _temp_ini_path.open("w", encoding="utf-8") as f: # TODO needs encoding?
192
- _parser.write(f)
193
- _temp_ini_path.replace(_ini_path)
194
- finally:
195
- _temp_ini_path.unlink(missing_ok=True)
196
-
186
+ # if _ini_path.exists():
187
+ # _parser.read(_ini_path)
197
188
  # pydna related environmental variables are set
198
189
  # from pydna.ini if they are not set already
199
- _main = _parser["main"]
190
+ # _main = _parser["main"]
191
+ # ini.update(_main)
200
192
 
201
- for key in default_ini:
202
- _os.environ[f"pydna_{key}"] = _os.getenv(f"pydna_{key}", _main.get(key, default_ini[key]))
203
193
 
204
- logdir = _Path(_os.environ["pydna_log_dir"])
194
+ # for key, value in ini.items():
195
+ # _os.environ[f"pydna_{key}"] = _os.getenv(f"pydna_{key}", value)
196
+
197
+ # logdir = _Path(_os.environ["pydna_log_dir"])
205
198
 
206
199
  # create log directory if not present
207
- logdir.mkdir(parents=True, exist_ok=True)
208
- _logmsg = "Log directory {}".format(logdir)
200
+ # logdir.mkdir(parents=True, exist_ok=True)
201
+ # _logmsg = "Log directory {}".format(logdir)
209
202
 
210
203
  # create logger
211
- _logger = _logging.getLogger("pydna")
212
- _logger.setLevel(int(_os.environ["pydna_loglevel"]))
213
- _hdlr = _handlers.RotatingFileHandler(
214
- logdir / "pydna.log",
215
- mode="a",
216
- maxBytes=10 * 1024 * 1024,
217
- backupCount=10,
218
- encoding="utf-8",
219
- )
220
-
221
- _formatter = _logging.Formatter(("%(asctime)s %(levelname)s" " %(funcName)s %(message)s"))
222
- _hdlr.setFormatter(_formatter)
223
- _logger.addHandler(_hdlr)
224
- _logger.info(_logmsg)
225
- _logger.info("Environmental variable pydna_ape = %s", _os.environ["pydna_ape"])
226
- _logger.info("Environmental variable pydna_cached_funcs = %s", _os.environ["pydna_cached_funcs"])
227
- _logger.info("Environmental variable pydna_data_dir = %s", _os.environ["pydna_data_dir"])
228
- _logger.info("Environmental variable pydna_email = %s", _os.environ["pydna_email"])
229
- _logger.info("Environmental variable pydna_log_dir = %s", _os.environ["pydna_log_dir"])
230
- _logger.info("Environmental variable pydna_loglevel = %s", _os.environ["pydna_loglevel"])
231
- _logger.info("Environmental variable pydna_primers = %s", _os.environ["pydna_primers"])
232
- _logger.info(
233
- "Environmental variable pydna_assembly_limit = %s",
234
- _os.environ["pydna_assembly_limit"],
235
- )
204
+ # _logger = _logging.getLogger("pydna")
205
+ # _logger.setLevel(int(_os.environ["pydna_loglevel"]))
206
+ # _hdlr = _handlers.RotatingFileHandler(
207
+ # logdir / "pydna.log",
208
+ # mode="a",
209
+ # maxBytes=10 * 1024 * 1024,
210
+ # backupCount=10,
211
+ # encoding="utf-8",
212
+ # )
213
+
214
+ # _formatter = _logging.Formatter(("%(asctime)s %(levelname)s" " %(funcName)s %(message)s"))
215
+ # _hdlr.setFormatter(_formatter)
216
+ # _logger.addHandler(_hdlr)
217
+ # _logger.info(_logmsg)
218
+ # _logger.info("Environmental variable pydna_ape = %s", _os.environ["pydna_ape"])
219
+ # _logger.info("Environmental variable pydna_cached_funcs = %s", _os.environ["pydna_cached_funcs"])
220
+ # _logger.info("Environmental variable pydna_data_dir = %s", _os.environ["pydna_data_dir"])
221
+ # _logger.info("Environmental variable pydna_email = %s", _os.environ["pydna_email"])
222
+ # _logger.info("Environmental variable pydna_log_dir = %s", _os.environ["pydna_log_dir"])
223
+ # _logger.info("Environmental variable pydna_loglevel = %s", _os.environ["pydna_loglevel"])
224
+ # _logger.info("Environmental variable pydna_primers = %s", _os.environ["pydna_primers"])
225
+ # _logger.info(
226
+ # "Environmental variable pydna_assembly_limit = %s",
227
+ # _os.environ["pydna_assembly_limit"],
228
+ # )
236
229
 
237
230
  # create cache directory if not present
238
231
 
239
- _Path(_os.environ["pydna_data_dir"]).mkdir(parents=True, exist_ok=True)
232
+ # _Path(_os.environ["pydna_data_dir"]).mkdir(parents=True, exist_ok=True)
240
233
 
241
234
  # find out if optional dependecies for gel module are in place
242
235
  #
@@ -264,7 +257,7 @@ _Path(_os.environ["pydna_data_dir"]).mkdir(parents=True, exist_ok=True)
264
257
  # _logger.info("gel simulation is available," " optional dependencies were found.")
265
258
  #
266
259
 
267
- _logger.info("__version__ = %s", __version__)
260
+ # _logger.info("__version__ = %s", __version__)
268
261
 
269
262
 
270
263
  class _PydnaWarning(Warning):
@@ -304,74 +297,74 @@ class _PydnaDeprecationWarning(_PydnaWarning):
304
297
  pass
305
298
 
306
299
 
307
- def open_current_folder():
308
- """Open the current working directory.
300
+ # def open_current_folder():
301
+ # """Open the current working directory.
309
302
 
310
- Opens in the default file manager. The location for this folder is
311
- given by the :func:`os.getcwd` function
312
- """
313
- return _open_folder(_os.getcwd())
303
+ # Opens in the default file manager. The location for this folder is
304
+ # given by the :func:`os.getcwd` function
305
+ # """
306
+ # return _open_folder(_os.getcwd())
314
307
 
315
308
 
316
- _logger.info("Current working directory = os.getcwd() = %s", _os.getcwd())
309
+ # _logger.info("Current working directory = os.getcwd() = %s", _os.getcwd())
317
310
 
318
311
 
319
- def open_cache_folder():
320
- """Open the pydna cache folder.
312
+ # def open_cache_folder():
313
+ # """Open the pydna cache folder.
321
314
 
322
- Opens in the default file manager. The location for this folder is stored
323
- in the *pydna_data_dir* environmental variable.
324
- """
325
- return _open_folder(_os.environ["pydna_data_dir"])
315
+ # Opens in the default file manager. The location for this folder is stored
316
+ # in the *pydna_data_dir* environmental variable.
317
+ # """
318
+ # return _open_folder(_os.environ["pydna_data_dir"])
326
319
 
327
320
 
328
- def open_config_folder():
329
- """Open the pydna configuration folder.
321
+ # def open_config_folder():
322
+ # """Open the pydna configuration folder.
330
323
 
331
- Opens in the default file manager. The location for this folder is stored
332
- in the *pydna_config_dir* environmental variable.
324
+ # Opens in the default file manager. The location for this folder is stored
325
+ # in the *pydna_config_dir* environmental variable.
333
326
 
334
- The `pydna.ini` file can be edited to make pydna quicker to use.
335
- See the documentation of the :class:configparser.ConfigParser´ class.
327
+ # The `pydna.ini` file can be edited to make pydna quicker to use.
328
+ # See the documentation of the :class:configparser.ConfigParser´ class.
336
329
 
337
- Below is the content of a typical `pydna.ini` file on a Linux
338
- system.
330
+ # Below is the content of a typical `pydna.ini` file on a Linux
331
+ # system.
339
332
 
340
- ::
333
+ # ::
341
334
 
342
- [main]
343
- loglevel=30
344
- email=myemail@example.org
345
- data_dir=/home/bjorn/.local/share/pydna
346
- log_dir=/home/bjorn/.cache/pydna/log
347
- ape=tclsh /home/bjorn/.ApE/AppMain.tcl
348
- cached_funcs=Genbank_nucleotide
349
- primers=/home/bjorn/Dropbox/wikidata/PRIMERS.txt
350
- enzymes=/home/bjorn/Dropbox/wikidata/RestrictionEnzymes.txt
335
+ # [main]
336
+ # loglevel=30
337
+ # email=myemail@example.org
338
+ # data_dir=/home/user/.local/share/pydna
339
+ # log_dir=/home/user/.cache/pydna/log
340
+ # ape=tclsh /path/to/ape/AppMain.tcl
341
+ # cached_funcs=Genbank_nucleotide
342
+ # primers=/path/to/primers/PRIMERS.txt
343
+ # enzymes=/path/to/enzymes/RestrictionEnzymes.txt
351
344
 
352
- The email address is set to someone@example.com by default. If you change
353
- this to you own address, the :func:`pydna.genbank.genbank` function can be
354
- used to download sequences from Genbank directly without having to
355
- explicitly add the email address.
345
+ # The email address is set to someone@example.com by default. If you change
346
+ # this to you own address, the :func:`pydna.genbank.genbank` function can be
347
+ # used to download sequences from Genbank directly without having to
348
+ # explicitly add the email address.
356
349
 
357
- Pydna can cache results from the following functions or methods:
350
+ # Pydna can cache results from the following functions or methods:
358
351
 
359
- - :func:`pydna.genbank.Genbank.nucleotide` Genbank_nucleotide
360
- - :func:`pydna.amplify.Anneal` amplify_Anneal
361
- - :func:`pydna.assembly.Assembly` assembly_Assembly
362
- - :func:`pydna.download.download_text` download.download_text
363
- - :func:`pydna.dseqrecord.Dseqrecord.synced` Dseqrecord_synced
352
+ # - :func:`pydna.genbank.Genbank.nucleotide` Genbank_nucleotide
353
+ # - :func:`pydna.amplify.Anneal` amplify_Anneal
354
+ # - :func:`pydna.assembly.Assembly` assembly_Assembly
355
+ # - :func:`pydna.download.download_text` download.download_text
356
+ # - :func:`pydna.dseqrecord.Dseqrecord.synced` Dseqrecord_synced
364
357
 
365
- These can be added separated by a comma to the cached_funcs entry
366
- in **pydna.ini** file or the pydna_cached_funcs environment variable.
358
+ # These can be added separated by a comma to the cached_funcs entry
359
+ # in **pydna.ini** file or the pydna_cached_funcs environment variable.
367
360
 
368
- """
369
- return _open_folder(_os.environ["pydna_config_dir"])
361
+ # """
362
+ # return _open_folder(_os.environ["pydna_config_dir"])
370
363
 
371
364
 
372
- def open_log_folder():
373
- """docstring."""
374
- return _open_folder(_os.environ["pydna_log_dir"])
365
+ # def open_log_folder():
366
+ # """docstring."""
367
+ # return _open_folder(_os.environ["pydna_log_dir"])
375
368
 
376
369
 
377
370
  def get_env():
@@ -403,14 +396,3 @@ def logo():
403
396
  f = Figlet()
404
397
  message = f.renderText(message)
405
398
  return _pretty_str(message)
406
-
407
-
408
- if __name__ == "__main__":
409
- import os as _os
410
-
411
- cached = _os.getenv("pydna_cached_funcs", "")
412
- _os.environ["pydna_cached_funcs"] = ""
413
- import doctest
414
-
415
- doctest.testmod(verbose=True, optionflags=doctest.ELLIPSIS)
416
- _os.environ["pydna_cached_funcs"] = cached
@@ -7,8 +7,7 @@ for for nicer string output in the IPython shell and Jupyter notebook.
7
7
  """
8
8
 
9
9
  from prettytable import PrettyTable as _Pt
10
- from prettytable import MARKDOWN as _md
11
-
10
+ from prettytable import TableStyle as _TableStyle
12
11
  from copy import copy as _copy
13
12
  from typing import List as _List
14
13
 
@@ -33,16 +32,5 @@ class PrettyTable(_Pt):
33
32
 
34
33
  def _repr_markdown_(self) -> pretty_str:
35
34
  c = _copy(self)
36
- c.set_style(_md)
35
+ c.set_style(_TableStyle.MARKDOWN)
37
36
  return pretty_str(c.get_string())
38
-
39
-
40
- if __name__ == "__main__":
41
- import os as _os
42
-
43
- cached = _os.getenv("pydna_cached_funcs", "")
44
- _os.environ["pydna_cached_funcs"] = ""
45
- import doctest
46
-
47
- doctest.testmod(verbose=True, optionflags=doctest.ELLIPSIS)
48
- _os.environ["pydna_cached_funcs"] = cached
@@ -18,10 +18,8 @@ ttt
18
18
  Dseqrecord(-3)
19
19
  >>> from pydna.all import __all__
20
20
  >>> __all__
21
- ['Anneal', 'pcr', 'Assembly', 'genbank', 'Genbank', 'download_text\
22
- ', 'Dseqrecord', 'Dseq', 'read', 'read_primer', 'parse', 'parse_primers\
23
- ', 'ape', 'primer_design', 'assembly_fragments', 'circular_assembly_fragments\
24
- ', 'eq', 'gbtext_clean', 'PrimerList']
21
+ ['Anneal', 'pcr', 'Assembly', 'genbank', 'Genbank', 'download_text', 'Dseqrecord',
22
+ 'Dseq', 'read', 'read_primer', 'parse', 'parse_primers', 'primer_design', 'assembly_fragments', 'eq', 'gbtext_clean']
25
23
  >>>
26
24
  """
27
25
 
@@ -39,13 +37,13 @@ __all__ = [
39
37
  "read_primer",
40
38
  "parse",
41
39
  "parse_primers",
42
- "ape",
40
+ # "ape",
43
41
  "primer_design",
44
42
  "assembly_fragments",
45
- "circular_assembly_fragments",
43
+ # "circular_assembly_fragments",
46
44
  "eq",
47
45
  "gbtext_clean",
48
- "PrimerList",
46
+ # "PrimerList",
49
47
  ]
50
48
 
51
49
 
@@ -61,21 +59,13 @@ from pydna.readers import read
61
59
  from pydna.readers import read_primer
62
60
  from pydna.parsers import parse
63
61
  from pydna.parsers import parse_primers
64
- from pydna.editor import ape
62
+
63
+ # from pydna.editor import ape
65
64
  from pydna.design import primer_design
66
65
  from pydna.design import assembly_fragments
67
- from pydna.design import circular_assembly_fragments
66
+
67
+ # from pydna.design import circular_assembly_fragments
68
68
  from pydna.utils import eq
69
69
  from pydna.genbankfixer import gbtext_clean
70
- from pydna.myprimers import PrimerList
71
-
72
-
73
- if __name__ == "__main__":
74
- import os as _os
75
-
76
- cached = _os.getenv("pydna_cached_funcs", "")
77
- _os.environ["pydna_cached_funcs"] = ""
78
- import doctest
79
70
 
80
- doctest.testmod(verbose=True, optionflags=doctest.ELLIPSIS)
81
- _os.environ["pydna_cached_funcs"] = cached
71
+ # from pydna.myprimers import PrimerList