Skip to main content
https://drone.io/bjorn/pydna/status.png

Pydna provide functions for molecular biology using python. Double stranded DNA sequence classes that make cut and paste cloning and PCR very simple is provided (see example below).

>>> 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!
>>>

Notably, homologous recombination and Gibson assembly between linear DNA fragments can be easily simulated.

Most 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.

Pydna was designed to provide a form of executable documentation describing a subcloning or DNA assembly experiment. The pydna code unambiguously describe a sub cloning experiment, and can be executed to yield the sequence of the of the resulting DNA molecule.

Pydna was designed to semantically imitate how sub cloning experiments are typically documented in Scientific literature. Pydna code describing a sub cloning is reasonably compact and meant to be easily readable.

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.

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 might also be useful to automate the simulation of sub cloning experiments using python. This could be helpful to generate examples for teaching purposes. Read the documentation or the cookbook with example files for further information.

An on-line shell running Python with pydna is available for experimentation.

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

Feedback in the form of questions, comments or criticism is very welcome!

version

date

comment

0.6.5

2014-07-31

bugfix: cutting an amplicon object now preserves features Changed requirement for NetworkX to 1.8.1

0.6.4

2014-07-09

The pcr function and Anneal class can now deal with primers with ambiguous codons like R = A or G. In the resulting PCR product, the ambiguous nucleotides are preserved in the tails i.e. the primer part not annealing. The annealing part will have the sequence corresponding to the template.

0.6.3

2014-07-06

Dseqrecord.add_feature can now take a string or some other sequence as input. The assembly primers function can now produce primers for a circular assembly.

0.6.2

2014-06-13

Dseqrecord gained three new methods:

isorf() method returning True or False.

list_features() method printa a lists all features in an ASCII table.

extract_feature() extracts a feature in the form os a new Dseqrecord object.

Changes to how the primer_design functions work, especially assembly primers.

0.6.1

2014-04-25

Fixed a bug in the Dseqrecord synced method and removed the utils synced function.

0.6.0

2014-04-18

Bugfixes and improvements in documentation.

0.5.0

2013-12-16

Changes to how the amplify and assembly modules work the Amplicon and Assembly classes are now subclasses of Dseqrecord.

0.2.2

2013-11-05

bugfix: changed the handling of compound features to fit with the new version of BioPython (1.62) which is now a requirement.

0.2.1

2013-08-18

0.1.8

2013-06-02

bugfix: changed the SeqFeatures added to PCR products in the amplify module to a dict of list of strings instead of a dict of strings.

0.1.7

2013-05-29

Changed the code in amplify.Amplicon to handle features spanning the origin of circular sequences.

0.1.6

2013-04-22

Changed the behaviour of the find method of the Dseq object to find substrings that span the origin. Slicing for circular Dseq objects now works slightly different.

0.1.5

2013-04-18

Changed the setup.py script to permit installation of the source installer without access to a c compiler.

0.1.4

2013-04-10

Cleaned up some docstrings Renamed Drecord -> Dseqrecord to be more consistent with Dseq and Biopython Seq/SeqRecord.

Changed name of keyword argument for read and parse. ds=True returns Dseqrecord(s) while ds=False returns SeqRecords.

0.1.3

2013-04-09

pydna created from Python-dna.

System Requirements

Python 2.x

This package was developed on and for Python 2.7. Other versions have not been tested.

Python 3.x

This code has not been tried with Python 3. If there is sufficient interest, there might be a Python 3 version in the future.

Installation

PIP

The best way of installing pydna is with pip. Pip is the officially recommended tool for installaion of Python packages from PyPi. Pip installs dependencies automatically.

Linux:

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

Windows:

C:\> pip install pydna

If you do not have pip, you can get it by following these instructions.

Source

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

python setup.py install

Binary distribution

Binary installers for 32 and 64 bit editions of MS Windows are provided.

The dependencies have to be installed separately. This can be done using the binary installers for Windows for those who are not comfortable at the command line:

Dependency

Hyperlink

Python (32,64)

<http://www.python.org/download/>

Biopython (32)

<http://biopython.org/wiki/Download>

Biopython (64)

<http://www.lfd.uci.edu/~gohlke/pythonlibs/#biopython>

networkx (32,64)

<http://www.lfd.uci.edu/~gohlke/pythonlibs/#networkx>

Source Code Repository

Pydna is hosted by google code: http://code.google.com/p/pydna/

Distribution Structure

README.txt – This file.

LICENSE.txt – What you can do with the code.

setup.py – Installation file.

run_tests.py – run tests by “python run_tests.py”<enter>

pydna/ – The code.

docs/ – Documentation and cookbook.

scripts/ – Miscellaneous and perhaps useful scripts and examples.

tests/ – Testing code.

Todo

  • fix Dseq & Dseqrecord lower() methods so they return Dseq & Dseqrecord objects

  • inverse PCR on circular templates does not seem to preserve features of Dseqrecord objects

  • Add identification of each fragment in the Contig.small_figure method.

Download files

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

Source Distributions

pydna-0.6.5.zip (79.7 kB view details)

Uploaded Source

pydna-0.6.5.tar.gz (68.3 kB view details)

Uploaded Source

Built Distributions

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

pydna-0.6.5.win-amd64.exe (340.8 kB view details)

Uploaded Source

pydna-0.6.5.win32.exe (313.2 kB view details)

Uploaded Source

pydna-0.6.5-py2.7.egg (228.3 kB view details)

Uploaded Egg

pydna-0.6.5-py2-none-any.whl (111.1 kB view details)

Uploaded Python 2

File details

Details for the file pydna-0.6.5.zip.

File metadata

  • Download URL: pydna-0.6.5.zip
  • Upload date:
  • Size: 79.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pydna-0.6.5.zip
Algorithm Hash digest
SHA256 cc7322414485911810a35d609855ec9f68dd7f8215c1f648d65bf6aa98de8e8e
MD5 335a8bec8fc7a63cb77d9002a2e4f604
BLAKE2b-256 a01a1dfa2e6ed4402263f2adf54c89e86ac23d2bdb236841c45f3f8db18f919c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pydna-0.6.5.tar.gz
  • Upload date:
  • Size: 68.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pydna-0.6.5.tar.gz
Algorithm Hash digest
SHA256 bc3c65fca9eafc5ccc88c31ce3111045ee6cd9f1ff17495cfb97ffe0f6944b50
MD5 5b6ef1295ea31fb89710142bc80ba77c
BLAKE2b-256 2d47d541d72e20750bff727109733ef05579b9381fafb6dc85394c2a98f36329

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pydna-0.6.5.win-amd64.exe
Algorithm Hash digest
SHA256 8a37a75da1d76c1af71d28fb76e4c6e2efe5efe9ac133305c742ab74870886db
MD5 d6fa247ebdb8208f28de1aa3e64cf458
BLAKE2b-256 4ac10a1aa41e5f423d606a1913975ed559c5a34af67ea2f8ce00b50ea39af46e

See more details on using hashes here.

File details

Details for the file pydna-0.6.5.win32.exe.

File metadata

  • Download URL: pydna-0.6.5.win32.exe
  • Upload date:
  • Size: 313.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pydna-0.6.5.win32.exe
Algorithm Hash digest
SHA256 43712802fa293801568d358af75a8ebd0548a5d37e6042746bb22292dfadf3f7
MD5 ac7fc25750aa8c43355913d3817532d7
BLAKE2b-256 e1214283acb233dfa6c9eec72ba4a1c5ef1ed0b8542849b5a99955d2b3dff9dd

See more details on using hashes here.

File details

Details for the file pydna-0.6.5-py2.7.egg.

File metadata

  • Download URL: pydna-0.6.5-py2.7.egg
  • Upload date:
  • Size: 228.3 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pydna-0.6.5-py2.7.egg
Algorithm Hash digest
SHA256 1d0c1dbc0369a713dca8e8ef335baaffdeaf5998348eb69585f0162b0991b025
MD5 43e3c5c6db4760c78c62c81d07d87f1a
BLAKE2b-256 01e8cfcd535a8ca1420e22cbc29b98a435aebbf276affdcaa95e5b85b93e54dc

See more details on using hashes here.

File details

Details for the file pydna-0.6.5-py2-none-any.whl.

File metadata

File hashes

Hashes for pydna-0.6.5-py2-none-any.whl
Algorithm Hash digest
SHA256 676fff7bdf3a893c667dd55aebd1412c31ca0f73d3a9d9c80eba1e20710b0782
MD5 c5b7f2dd283fcc580ded7d8fcf673730
BLAKE2b-256 f0376a7247393dd0166db354aa6fffaab595a34621cf751b02e9c2dd6befc4ae

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

1.1.5

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

This release

0.6.5 This release

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