Contains classes and code for representing double stranded DNA and functions for simulating homologous recombination between DNA molecules.
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
- Primer design
- Gibson assembly
- Golden gate assembly
- Homologous recombination
- Gel electrophoresis of DNA with generation of gel images
Virtually any sub-cloning experiment can be described in pydna, and its execution yield the sequence of the of intermediate and final resulting DNA molecule(s). A cloning strategy expressed in pydna is complete, unambiguous and can be made stable. Pydna has been designed to be understandable for biologists with only 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:
Please reference the above paper when using pydna.
These classes make cut and paste cloning and PCR very simple:
>>> from pydna.dseq import Dseq >>> seq = 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:
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.
from pydna.genbank import Genbank gb = Genbank("firstname.lastname@example.org") # Tell Genbank who you are! gene = gb.nucleotide("X06997") # Kluyveromyces lactis LAC12 gene for lactose permease. from pydna.parsers import parse_primers primer_f,primer_r = parse_primers(''' >760_KlLAC12_rv (20-mer) ttaaacagattctgcctctg >759_KlLAC12_fw (19-mer) aaatggcagatcattcgag ''') from pydna.amplify import pcr pcr_prod = 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.
Please post a message in the google group for pydna if you have problems, questions or comments.
Feedback is very welcome! ## Who is using pydna?
Installation using conda on Anaconda
Anaconda is a large download (about 400 Mb) while Miniconda is about 40-50 Mb.
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.
bjorn@bjorn-UL30A:~/pydna$ sudo pip install pydna
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
Pydna is developed on Github.
Minimal installation requirements
Pydna is currently developed on and for Python 3.5 or 3.6. 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.
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
The test suit is run automatically after each commit on:
- Ubuntu 14.04 using Codeship
- OSX-64 using TravisCI
- Windows using AppveyorCI
See the badges at the top of this page.
Conda packages are built on Codeship(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.
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.
See the change log for recent changes.
Release history Release notifications
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash SHA256 hash help||File type||Python version||Upload date|
|pydna-2.0.3-py3.5.egg (135.8 kB) Copy SHA256 hash SHA256||Egg||3.5|
|pydna-2.0.3-py3.6.egg (135.8 kB) Copy SHA256 hash SHA256||Egg||3.6|
|pydna-2.0.3-py3-none-any.whl (131.2 kB) Copy SHA256 hash SHA256||Wheel||py3|
|pydna-2.0.3.zip (2.4 MB) Copy SHA256 hash SHA256||Source||None|