pydna 5.5.3__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.3 → pydna-5.5.5}/PKG-INFO +14 -46
  2. {pydna-5.5.3 → pydna-5.5.5}/README.md +6 -41
  3. {pydna-5.5.3 → pydna-5.5.5}/pyproject.toml +20 -22
  4. pydna-5.5.5/src/pydna/__init__.py +229 -0
  5. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/_pretty.py +8 -8
  6. {pydna-5.5.3 → 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.3 → pydna-5.5.5}/src/pydna/amplicon.py +19 -24
  9. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/amplify.py +75 -95
  10. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/assembly.py +64 -81
  11. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/assembly2.py +650 -405
  12. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/codon.py +4 -4
  13. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/common_sub_strings.py +6 -8
  14. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/contig.py +203 -10
  15. {pydna-5.5.3 → 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.3 → pydna-5.5.5}/src/pydna/dseqrecord.py +220 -171
  19. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/gateway.py +6 -6
  20. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/gel.py +5 -5
  21. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/genbank.py +43 -46
  22. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/genbankfixer.py +89 -92
  23. {pydna-5.5.3 → 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.5/src/pydna/opencloning_models.py +680 -0
  26. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/parsers.py +45 -32
  27. {pydna-5.5.3 → 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.3 → pydna-5.5.5}/src/pydna/readers.py +14 -9
  30. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/seq.py +137 -47
  31. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/seqrecord.py +54 -62
  32. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/sequence_picker.py +2 -5
  33. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/sequence_regex.py +6 -6
  34. {pydna-5.5.3 → 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.3 → pydna-5.5.5}/src/pydna/utils.py +97 -75
  37. pydna-5.5.3/src/pydna/__init__.py +0 -398
  38. pydna-5.5.3/src/pydna/conftest.py +0 -42
  39. pydna-5.5.3/src/pydna/download.py +0 -32
  40. pydna-5.5.3/src/pydna/dseq.py +0 -1830
  41. pydna-5.5.3/src/pydna/genbankfile.py +0 -42
  42. pydna-5.5.3/src/pydna/genbankrecord.py +0 -168
  43. pydna-5.5.3/src/pydna/goldengate.py +0 -45
  44. pydna-5.5.3/src/pydna/ligate.py +0 -62
  45. pydna-5.5.3/src/pydna/types.py +0 -41
  46. pydna-5.5.3/src/pydna/user_cloning.py +0 -29
  47. {pydna-5.5.3 → pydna-5.5.5}/LICENSE.txt +0 -0
  48. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/all.py +0 -0
  49. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/cre_lox.py +0 -0
  50. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/crispr.py +0 -0
  51. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/fakeseq.py +0 -0
  52. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/fusionpcr.py +0 -0
  53. {pydna-5.5.3 → pydna-5.5.5}/src/pydna/threading_timer_decorator_exit.py +0 -0
@@ -1,11 +1,12 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: pydna
3
- Version: 5.5.3
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
+ License-File: LICENSE.txt
6
7
  Author: Björn F. Johansson
7
8
  Author-email: bjornjobb@gmail.com
8
- Requires-Python: >=3.9,<4.0
9
+ Requires-Python: >=3.10,<4.0
9
10
  Classifier: Development Status :: 4 - Beta
10
11
  Classifier: Environment :: Console
11
12
  Classifier: Intended Audience :: Education
@@ -13,7 +14,6 @@ Classifier: Intended Audience :: Developers
13
14
  Classifier: Intended Audience :: Science/Research
14
15
  Classifier: License :: OSI Approved :: BSD License
15
16
  Classifier: Operating System :: OS Independent
16
- Classifier: Programming Language :: Python :: 3.9
17
17
  Classifier: Programming Language :: Python :: 3.10
18
18
  Classifier: Programming Language :: Python :: 3.11
19
19
  Classifier: Programming Language :: Python :: 3.12
@@ -23,15 +23,18 @@ 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
- Requires-Dist: biopython (>=1.85)
28
+ Requires-Dist: biopython (==1.85)
28
29
  Requires-Dist: cai2 (>=1.0.5) ; extra == "express"
29
30
  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"
34
+ Requires-Dist: opencloning-linkml (>=0.4.9,<0.5.0)
33
35
  Requires-Dist: pillow (>=8.4.0) ; extra == "gel"
34
36
  Requires-Dist: prettytable (>=3.5.0)
37
+ Requires-Dist: pyahocorasick (>=2.2.0) ; extra == "primer-screen"
35
38
  Requires-Dist: pydivsufsort (>=0.0.14)
36
39
  Requires-Dist: pyfiglet (==0.8.post1)
37
40
  Requires-Dist: pyparsing (>=2.4.7) ; extra == "download"
@@ -484,27 +487,6 @@ poetry shell
484
487
  poetry run pre-commit install
485
488
  ```
486
489
 
487
- #### Alternative method (using `pip`) 🐍
488
-
489
- Use this for a small contribution or if you don't manage to set up the dev environment.
490
-
491
- ```bash
492
- # Create a new virtual environment
493
- python -m venv .venv
494
-
495
- # Activate the virtual environment
496
- source .venv/bin/activate
497
-
498
- # Install all dependencies (library deps + dev and test requirements)
499
- pip install -r requirements.txt
500
-
501
- # Install the project as editable dependency
502
- pip install -e .
503
-
504
- # Install the pre-commit hooks
505
- pre-commit install
506
- ```
507
-
508
490
  #### Contributing code 💻
509
491
 
510
492
  1. Make your changes.
@@ -526,7 +508,7 @@ pre-commit install
526
508
  > =================================== FAILURES ===================================
527
509
  > ___________________ [doctest] pydna.assembly2.blunt_overlap ____________________
528
510
  > ```
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!
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!
530
512
 
531
513
  ### Creating a PR 🔗
532
514
 
@@ -541,39 +523,25 @@ supported python versions.
541
523
 
542
524
  ### Building the documentation locally 📚
543
525
 
544
- Documentation is built using [Sphinx](http://www.sphinx-doc.org/) from [docstrings](https://www.python.org/dev/peps/pep-0257/)
545
- using a GitHub [action](https://github.com/pydna-group/pydna/actions/workflows/publish-docs.yml).
526
+ Documentation is built using [Sphinx](http://www.sphinx-doc.org/) from [docstrings](https://www.python.org/dev/peps/pep-0257/) using a GitHub [action](https://github.com/pydna-group/pydna/actions/workflows/publish-docs.yml) and also built in readthedocs.
546
527
  The [numpy](https://www.numpy.org) [docstring format](https://numpy.org/doc/stable/dev/howto-docs.html#docstring-intro) is used.
547
528
 
548
- Below the commands to run a local sphinx server that auto-updated when files are changed.
549
-
550
- ```bash
551
- # Install docs dependency group
552
- poetry install --with docs
553
-
554
- # Start the sphinx server to see docs live by default at http://127.0.0.1:8000/
555
- sphinx-autobuild --watch src/ docs docs/_build/html
556
-
557
- ```
558
-
559
- More info about how to contribute to the documentation can be found [here](docs/README.md)
529
+ To work locally with the documentation, check the [documentation README](docs/README.md) for instructions.
560
530
 
561
531
  ## Release process 🚀
562
532
 
563
533
  See the [releases](https://github.com/pydna-group/pydna/releases) for changes and releases.
564
534
 
565
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.
566
538
 
567
- ![----]( http://bit.ly/coloredline)
539
+ ![----](http://bit.ly/coloredline)
568
540
 
569
541
  ## History 📜
570
542
 
571
543
  Pydna was made public in 2012 on [Google code](https://code.google.com/archive/p/pydna).
572
544
 
573
- :microbe:
574
-
575
- :portugal:
576
-
577
545
  ## Who is using pydna? 🧪
578
546
 
579
547
  Taylor, L. J., & Strebel, K. (2017).
@@ -435,27 +435,6 @@ poetry shell
435
435
  poetry run pre-commit install
436
436
  ```
437
437
 
438
- #### Alternative method (using `pip`) 🐍
439
-
440
- Use this for a small contribution or if you don't manage to set up the dev environment.
441
-
442
- ```bash
443
- # Create a new virtual environment
444
- python -m venv .venv
445
-
446
- # Activate the virtual environment
447
- source .venv/bin/activate
448
-
449
- # Install all dependencies (library deps + dev and test requirements)
450
- pip install -r requirements.txt
451
-
452
- # Install the project as editable dependency
453
- pip install -e .
454
-
455
- # Install the pre-commit hooks
456
- pre-commit install
457
- ```
458
-
459
438
  #### Contributing code 💻
460
439
 
461
440
  1. Make your changes.
@@ -477,7 +456,7 @@ pre-commit install
477
456
  > =================================== FAILURES ===================================
478
457
  > ___________________ [doctest] pydna.assembly2.blunt_overlap ____________________
479
458
  > ```
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!
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!
481
460
 
482
461
  ### Creating a PR 🔗
483
462
 
@@ -492,39 +471,25 @@ supported python versions.
492
471
 
493
472
  ### Building the documentation locally 📚
494
473
 
495
- Documentation is built using [Sphinx](http://www.sphinx-doc.org/) from [docstrings](https://www.python.org/dev/peps/pep-0257/)
496
- using a GitHub [action](https://github.com/pydna-group/pydna/actions/workflows/publish-docs.yml).
474
+ Documentation is built using [Sphinx](http://www.sphinx-doc.org/) from [docstrings](https://www.python.org/dev/peps/pep-0257/) using a GitHub [action](https://github.com/pydna-group/pydna/actions/workflows/publish-docs.yml) and also built in readthedocs.
497
475
  The [numpy](https://www.numpy.org) [docstring format](https://numpy.org/doc/stable/dev/howto-docs.html#docstring-intro) is used.
498
476
 
499
- Below the commands to run a local sphinx server that auto-updated when files are changed.
500
-
501
- ```bash
502
- # Install docs dependency group
503
- poetry install --with docs
504
-
505
- # Start the sphinx server to see docs live by default at http://127.0.0.1:8000/
506
- sphinx-autobuild --watch src/ docs docs/_build/html
507
-
508
- ```
509
-
510
- More info about how to contribute to the documentation can be found [here](docs/README.md)
477
+ To work locally with the documentation, check the [documentation README](docs/README.md) for instructions.
511
478
 
512
479
  ## Release process 🚀
513
480
 
514
481
  See the [releases](https://github.com/pydna-group/pydna/releases) for changes and releases.
515
482
 
516
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.
517
486
 
518
- ![----]( http://bit.ly/coloredline)
487
+ ![----](http://bit.ly/coloredline)
519
488
 
520
489
  ## History 📜
521
490
 
522
491
  Pydna was made public in 2012 on [Google code](https://code.google.com/archive/p/pydna).
523
492
 
524
- :microbe:
525
-
526
- :portugal:
527
-
528
493
  ## Who is using pydna? 🧪
529
494
 
530
495
  Taylor, L. J., & Strebel, K. (2017).
@@ -11,7 +11,6 @@ classifiers = [
11
11
  "Intended Audience :: Science/Research",
12
12
  "License :: OSI Approved :: BSD License",
13
13
  "Operating System :: OS Independent",
14
- "Programming Language :: Python :: 3.9",
15
14
  "Programming Language :: Python :: 3.10",
16
15
  "Programming Language :: Python :: 3.11",
17
16
  "Programming Language :: Python :: 3.12",
@@ -36,10 +35,10 @@ license = "BSD"
36
35
  name = "pydna"
37
36
  readme = "README.md"
38
37
  repository = "https://github.com/pydna-group/pydna/tree/master"
39
- version = "5.5.3"
38
+ version = "5.5.5"
40
39
  [tool.poetry.dependencies]
41
40
  appdirs = ">=1.4.4"
42
- biopython = ">=1.85"
41
+ biopython = "1.85"
43
42
  cai2 = { version = ">=1.0.5", optional = true }
44
43
  matplotlib = { version = ">=3.4.3", optional = true }
45
44
  networkx = ">=2.8.8"
@@ -53,19 +52,22 @@ pydivsufsort = ">=0.0.14"
53
52
  pyfiglet = "0.8.post1"
54
53
  pyparsing = { version = ">=2.4.7", optional = true }
55
54
  pyperclip = { version = ">=1.8.2", optional = true }
56
- python = ">=3.9,<4.0"
55
+ python = ">=3.10,<4.0"
57
56
  requests = { version = ">=2.26.0", optional = true }
57
+ pyahocorasick = { version = ">=2.2.0", optional = true }
58
58
  scipy = [
59
59
  { version = ">=1.11.3", python = ">=3.12", optional = true },
60
60
  { version = ">=1.9.3", python = "<3.12", optional = true },
61
61
  ]
62
62
  seguid = ">=0.0.5"
63
63
  regex = "^2024.11.6"
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"]
@@ -87,38 +89,34 @@ requests-mock = ">=1.10.0"
87
89
 
88
90
  [tool.poetry.group.docs.dependencies]
89
91
  numpydoc = "^1.6.0"
90
- sphinx-autobuild = "^2021.3.14"
91
- sphinx-rtd-theme = ">=1.3,<4.0"
92
- nbconvert = "^7.16.4"
93
- myst-parser = [
94
- { version = ">3.0.0", python = "<3.10" },
95
- { version = ">=4.0.0", python = ">=3.10" },
96
- ]
92
+ sphinx = "*"
93
+ # sphinx-rtd-theme = ">=1.3,<4.0"
94
+ # nbconvert = "^7.16.4"
95
+ # myst-parser = [
96
+ # { version = ">3.0.0", python = "<3.10" },
97
+ # { version = ">=4.0.0", python = ">=3.10" },
98
+ # ]
99
+ myst-nb = "*"
100
+ sphinx-book-theme = "*"
101
+ pandas = "*"
97
102
 
98
103
  [tool.poetry.group.dev.dependencies]
99
104
  autopep8 = "^2.1.0"
100
105
  black = "^25.1.0"
101
106
  pre-commit = ">3.6"
102
- nbstripout = "^0.7.1"
107
+ nbstripout = "^0.9"
103
108
  flake8-bugbear = "^24.12.12"
104
109
 
105
110
  [tool.pytest.ini_options]
106
111
  minversion = "6.0.2"
107
112
  python_files = "test_*.py"
108
- testpaths = ["tests", "src"]
113
+ testpaths = ["tests", "src/pydna"]
114
+ norecursedirs = ["*"]
115
+
109
116
  [tool.black]
110
117
  include = '\.pyi?$'
111
118
  line-length = 88
112
119
  target-version = ["py38", "py39", "py310", "py311", "py312"]
113
- # 'extend-exclude' excludes files or directories in addition to the defaults
114
- extend-exclude = '''
115
- (
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
120
- )
121
- '''
122
120
 
123
121
  [tool.poetry.requires-plugins]
124
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