Skip to main content

GitHub starsGitHub issuesResearch software impactcodecovicon11icon3CircleCIicon1icon2

Planning genetic constructs with many parts and assembly steps, such as recombinant metabolic pathways are often difficult to properly document.

The Pydna python package provide a human-readable formal description of cloning and assembly strategies in Python which also allows for simulation and verification of cloning strategies. Pydna can be though of as executable documentation for molecular biology.

Pydna provides simulation of:

  • Restriction digestion

  • Ligation

  • PCR

  • Primer design

  • Gibson assembly

  • Homologous recombination

  • Gel electrophoresis of DNA (NEW Feature)

Any sub-cloning experiment can be described in pydna, and execution yield the sequence of the of the resulting DNA molecule and intermediate steps. A cloning strategy expressed in pydna is complete, unambiguous and stable. Pydna has been designed to be understandable for biologists with some basic understanding of Python.

Pydna can formalize planning and sharing of cloning strategies and is especially useful for complex or combinatorial DNA molecule constructions.

Look at some assembly strategies made in the Jupyter notebook format here.

There is an open access paper in BMC Bioinformatics describing pydna:

abstr

Please reference the above paper when using pydna.

Usage

Most pydna functionality is implemented as methods for the double stranded DNA sequence record classes Dseq and Dseqrecord, which are subclasses of the Biopython Seq and SeqRecord classes.

These classes make cut and paste cloning and PCR very simple:

>>> import pydna
>>> seq = pydna.Dseq("GGATCCAAA","TTTGGATCC",ovhg=0)
>>> seq
Dseq(-9)
GGATCCAAA
CCTAGGTTT
>>> from Bio.Restriction import BamHI
>>> a,b = seq.cut(BamHI)
>>> a
Dseq(-5)
G
CCTAG
>>> b
Dseq(-8)
GATCCAAA
    GTTT
>>> a+b
Dseq(-9)
GGATCCAAA
CCTAGGTTT
>>> b+a
Dseq(-13)
GATCCAAAG
    GTTTCCTAG
>>> b+a+b
Dseq(-17)
GATCCAAAGGATCCAAA
    GTTTCCTAGGTTT
>>> b+a+a
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/pydna/dsdna.py", line 217, in __add__
    raise TypeError("sticky ends not compatible!")
TypeError: sticky ends not compatible!
>>>

As the example above shows, pydna keeps track of sticky ends.

Notably, homologous recombination and Gibson assembly between linear DNA fragments can be easily simulated without any additional information besides the primary sequence of the fragments.

Gel electrophoresis of DNA fragments can be simulated using the included gel module by Bruno Silva:

simulated agarose gel

alt text

Look at an example notebook with a gel simulation here.

Pydna can be very compact. The nine lines of Python below, simulates the construction of a recombinant plasmid. DNA sequences are downloaded from Genbank by accession numbers that are guaranteed to be stable over time.

import pydna
gb = pydna.Genbank("myself@email.com") # Tell Genbank who you are!
gene = gb.nucleotide("X06997") # Kluyveromyces lactis LAC12 gene for lactose permease.
primer_f,primer_r = pydna.parse(''' >760_KlLAC12_rv (20-mer)
                                    ttaaacagattctgcctctg

                                    >759_KlLAC12_fw (19-mer)
                                    aaatggcagatcattcgag
                                    ''', ds=False)
pcr_prod = pydna.pcr(primer_f,primer_r, gene)
vector = gb.nucleotide("AJ001614") # pCAPs cloning vector
from Bio.Restriction import EcoRV
lin_vector = vector.linearize(EcoRV)
rec_vec =  ( lin_vector + pcr_prod ).looped()

Pydna can automate the simulation of sub cloning experiments using python. This is helpful to generate examples for teaching purposes.

Read the documentation or the cookbook with example files for further information.

Please post a message in the google group for pydna if you have problems, questions or comments.

Feedback is very welcome!

Documentation

Documentation is built using Sphinx from docstrings in the code and displayed at readthedocs Documentation Status

The numpy docstring format is used.

Installation using conda on Anaconda

The absolutely best way of installing and using pydna is to use the free Anaconda or Miniconda python distributions.

Anaconda is a large download (about 400 Mb) while Miniconda is about 40-50 Mb.

Once Anaconda (or Miniconda) is installed, the conda package manager can be used to install pydna. Pydna and its dependencies are available from the BjornFJohansson package channel ast Anaconda.org.

The first step is to add the channel by typing the command below followed by return:

conda config --append channels BjornFJohansson

Then pydna can be installed by typing the command below followed by return:

conda install pydna

This works on Windows, MacOSX and Linux, and installs all necessary and optional dependencies automatically (see below).

Installation using pip

The second best way of installing pydna is with pip, the officially recommended tool.

Pip is included in recent Python versions.

Pip installs the minimal installation requirements automatically, but not the optional requirements (see below). This will probably not work directly on windows, as biopython is not directly installable.

Linux:

bjorn@bjorn-UL30A:~/pydna$ sudo pip install pydna

Windows:

Installing biopython on Windows can be tricky. The biopython site has executable installers. Read here on how to install biopython requirements such as Numpy. Christoph Gohlke at University of California, Irvine has compiled many binary installers for Windows wich include most requirements.

When the requrements are installed you can pip install pydna from the Windows terminal:

C:\> pip install pydna

Installation from Source

If you install from source, you need to install all dependencies separately (listed above). Download one of the source installers from the pypi site or from Github and extract the file. Open the pydna source code directory (containing the setup.py file) in terminal and type:

python setup.py install

Source Code

Pydna is developed on Github.

Minimal installation requirements

Pydna is currently developed on and for Python 3.5. Pydna versions before 1.0.0 were compatible with python 2.7 only. The list below is the minimal requirements for installing pydna. Biopython has c-extensions, but the other modules are pure python.

Optional Requirements

Pydna has been designed to be used from the Jupyter notebook. If IPython and Jupyter are installed, importing ipython notebooks as modules among are supported among other things.

If the modules listed below are installed, gel simulation functionality is available.

The pydna conda package installs the optional requirements listed above as well as:

Requirements for running tests

Requirements for analyzing code coverage

Automatic testing

The test suit is run automatically after each commit on:

  • Ubuntu 12.04 using drone.io

  • Ubuntu 14.04 using CircleCI

  • OSX-64 using TravisCI

  • Windows using AppveyorCI

See the badges at the top of this page.

Automatic builds

Conda packages are built on CircleCI(Linux), Drone.io(Linux), TravisCI(MacOS) and AppveyorCI(Windows). Source setuptools packages and wheels are built on Linux for all systems. Binary setuptools packages are built for Windows and MacOSX.

  • Conda packages Anaconda-Server Badge

  • Setuptools packages

Builds are controlled by Git tags. Tags like 1.0.2a4 are considered test builds and are uploaded to testpypi and to Anaconda.org with a “test” label. These are only meant to test the finished packages and are not meant to be used.

Tags like 1.0.3 are considered final builds and are built and uploaded to Anaconda.org under the “main” label and to the regular pypi server.

Changelog

See the change log for recent changes.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

pydna-1.1.5.zip (2.1 MB view details)

Uploaded Source

pydna-1.1.5.tar.gz (2.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pydna-1.1.5.win-amd64.exe (727.1 kB view details)

Uploaded Source

pydna-1.1.5-py3-none-any.whl (127.7 kB view details)

Uploaded Python 3

File details

Details for the file pydna-1.1.5.zip.

File metadata

  • Download URL: pydna-1.1.5.zip
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pydna-1.1.5.zip
Algorithm Hash digest
SHA256 9b2813791df81857aaaeed754a80d8a0e47056d3e7d3f3d2b1f030bd082ff553
MD5 83bb9da80f3619e9819255fdbf234756
BLAKE2b-256 a8cb14c7ce0ec694cbdf229b2b8e4af0fc3f7f828fbf671f5d716bf1a9f82a67

See more details on using hashes here.

File details

Details for the file pydna-1.1.5.tar.gz.

File metadata

  • Download URL: pydna-1.1.5.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pydna-1.1.5.tar.gz
Algorithm Hash digest
SHA256 7d904a543a5126904eac15c4b60b8258d6441139817f291c72906377cc5e42bd
MD5 0567211459c44098059f66049d74a59f
BLAKE2b-256 4a1badf244c527aafb84b7243dd2e72cbd4c6dca971ef3be58a88bea4aae167d

See more details on using hashes here.

File details

Details for the file pydna-1.1.5.win-amd64.exe.

File metadata

  • Download URL: pydna-1.1.5.win-amd64.exe
  • Upload date:
  • Size: 727.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pydna-1.1.5.win-amd64.exe
Algorithm Hash digest
SHA256 9e3360a9915493a48a89f153cdaa883840391ae19b831348791d9a2bafd5bbf4
MD5 2373432c3a1b350bc27fac4871f20f7b
BLAKE2b-256 71c8242b778dfc955cb9e0ba57bd05c8fa6bba1dddcbb9993b8a292e16d72cb2

See more details on using hashes here.

File details

Details for the file pydna-1.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for pydna-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1786b447c23d15dd032e4202e8e70f57fdb539e3154aafbadc12ba4a2a5e7e7f
MD5 b08466ad644991d95da2f862678129f3
BLAKE2b-256 afc562000bf8f03f8af58c77b3f2cab097b6175eb2671b31e51669d93ccd1b3f

See more details on using hashes here.

Release history Release notifications | RSS feed

5.5.16

2 files

5.5.15

2 files

5.5.14

2 files

5.5.13

2 files

5.5.12

2 files

5.5.11

2 files

5.5.10

2 files

5.5.9

2 files

5.5.8

2 files

5.5.7

2 files

5.5.6

2 files

5.5.5

2 files

5.5.4

2 files

5.5.3

2 files

5.5.2

2 files

5.5.1

2 files

5.5.0

2 files

5.4.0

2 files

5.3.0

2 files

5.2.0

2 files

5.0.1

2 files

5.0.0

2 files

4.0.7

1 file

4.0.6

1 file

4.0.5

1 file

4.0.4

1 file

4.0.2

1 file

4.0.1

1 file

4.0.0

1 file

3.1.3

1 file

3.1.2

1 file

3.1.1

1 file

3.1.0

1 file

3.0.2

1 file

3.0.1

1 file

3.0.0

1 file

2.0.3

4 files

2.0.2

4 files

2.0.1

3 files

2.0.0

1 file

1.2.0

3 files

This release

1.1.5 This release

4 files

1.1.4

4 files

1.1.3a3

1.1.1

3 files

1.1.0

2 files

1.0.2

3 files

1.0.1

3 files

1.0.0

3 files

0.9.9

3 files

0.9.8

3 files

0.9.4

3 files

0.9.3

3 files

0.9.2

3 files

0.9.1

3 files

0.9.0

3 files

0.8.4

3 files

0.8.3

3 files

0.8.1

3 files

0.8.0

2 files

0.7.2

4 files

0.6.5

6 files

0.6.4

6 files

0.6.3

6 files

0.6.2

6 files

0.6.1

6 files

0.6.0

6 files

0.2.1

4 files

0.2.0

2 files

0.1.7

3 files

0.1.6

3 files

0.1.5

4 files

0.1.4

4 files

0.1.3

4 files

0.0.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page