pydna
- copyright:
Copyright 2013-2023 by Björn Johansson. All rights reserved.
- license:
This code is part of the pydna package, governed by the license in LICENSE.txt that should be included as part of this package.
pydna
Pydna is a python package providing code for simulation of the creation of recombinant DNA molecules using molecular biology techniques. Development of pydna happens in this Github repository.
- Provided:
PCR simulation
Assembly simulation based on shared identical sequences
Primer design for amplification of a given sequence
Automatic design of primer tails for Gibson assembly or homologous recombination.
Restriction digestion and cut&paste cloning
Agarose gel simulation
Download sequences from Genbank
Parsing various sequence formats including the capacity to handle broken Genbank format
pydna package layout
The most important modules and how to import functions or classes from them are listed below. Class names starts with a capital letter, functions with a lowercase letter:
from pydna.module import function
from pydna.module import Class
Example: from pydna.gel import Gel
pydna
├── amplify
│ ├── Anneal
│ └── pcr
├── assembly
│ └── Assembly
├── design
│ ├── assembly_fragments
│ └── primer_design
├── download
│ └── download_text
├── dseqrecord
│ └── Dseqrecord
├── gel
│ └── Gel
├── genbank
│ ├── genbank
│ └── Genbank
├── parsers
│ ├── parse
│ └── parse_primers
└── readers
├── read
└── read_primers
How to use the documentation
Documentation is available as docstrings provided in the source code for each module. These docstrings can be inspected by reading the source code directly. See further below on how to obtain the code for pydna.
In the python shell, use the built-in help
function to view a
function’s docstring:
>>> from pydna import readers
>>> help(readers.read)
...
The doctrings are also used to provide an automaticly generated reference manual available online at read the docs.
Docstrings can be explored using IPython, an advanced Python shell with TAB-completion and introspection capabilities. To see which functions are available in pydna, type pydna.<TAB> (where <TAB> refers to the TAB key). Use pydna.open_config_folder?<ENTER>`to view the docstring or `pydna.open_config_folder??<ENTER> to view the source code.
In the Spyder IDE it is possible to place the cursor immediately before the name of a module,class or function and press ctrl+i to bring up docstrings in a separate window in Spyder
Code snippets are indicated by three greater-than signs:
>>> x=41
>>> x=x+1
>>> x
42
pydna source code
The pydna source code is available on Github.
How to get more help
Please join the Google group for pydna, this is the preferred location for help. If you find bugs in pydna itself, open an issue at the Github repository.
Examples of pydna in use
- See this repository for a collection of
- pydna.open_current_folder()[source]
Open the current working directory.
Opens in the default file manager. The location for this folder is given by the
os.getcwd()
function
- pydna.open_cache_folder()[source]
Open the pydna cache folder.
Opens in the default file manager. The location for this folder is stored in the pydna_data_dir environmental variable.
- pydna.open_config_folder()[source]
Open the pydna configuration folder.
Opens in the default file manager. The location for this folder is stored in the pydna_config_dir environmental variable.
The pydna.ini file can be edited to make pydna quicker to use. See the documentation of the :class:configparser.ConfigParser´ class.
Below is the content of a typical pydna.ini file on a Linux system.
[main] loglevel=30 email=myemail@example.org data_dir=/home/bjorn/.local/share/pydna log_dir=/home/bjorn/.cache/pydna/log ape=tclsh /home/bjorn/.ApE/AppMain.tcl cached_funcs=Genbank_nucleotide primers=/home/bjorn/Dropbox/wikidata/PRIMERS.txt enzymes=/home/bjorn/Dropbox/wikidata/RestrictionEnzymes.txt
The email address is set to someone@example.com by default. If you change this to you own address, the
pydna.genbank.genbank()
function can be used to download sequences from Genbank directly without having to explicitly add the email address.Pydna can cache results from the following functions or methods:
pydna.genbank.Genbank.nucleotide()
Genbank_nucleotidepydna.amplify.Anneal()
amplify_Annealpydna.assembly.Assembly()
assembly_Assemblypydna.download.download_text()
download.download_textpydna.dseqrecord.Dseqrecord.synced()
Dseqrecord_synced
These can be added separated by a comma to the cached_funcs entry in pydna.ini file or the pydna_cached_funcs environment variable.