API Reference¶
Design¶
Core design modules.
For examples for how to use the design module, see the Usage Docs For a list of design parameters available, take a look at the BoulderIO Parameters
# a new task
design = Design()
# set template sequence
design.settings.template("AGGTTGCGTGTGTATGGTCGTGTAGTGTGT")
# set left primer sequence
design.settings.left_sequence("GTTGCGTGTGT)
# set as a cloning task
design.settings.as_cloning_task()
# run the design task
design.run()
-
class
primer3plus.design.Design[source]¶ Initialize a new design. Set parameters using.
Design.settings, which returns an instance ofDesignPresets.Alternatively, parameters can be accessed more directly using the name of the parameter descriptor. For a list of parameters available, see BoulderIO Parameters.
design = Design() design.settings.template("AGGCTGTAGTGCTTGTAGCTGGTTGCGTTACTGTG") design.settings.left_sequence("GTAGTGCTTGTA") design.SEQUENCE_ID.value = "MY ID" design.run()-
run()[source]¶ Design primers. Optionally provide additional parameters.
- Parameters
params –
- Return type
Tuple[List[Dict],List[Dict]]- Returns
results
-
run_and_optimize(max_iterations, params=None, gradient=None, pick_anyway=False)[source]¶ Design primers. If primer design is unsuccessful, relax parameters as defined in primer3plust.Design.DEFAULT_GRADIENT. Repeat for the specified number of max_iterations.
- Parameters
max_iterations – the max number of iterations to perform relaxation
params (
Optional[BoulderIO]) – optional parameters to providegradient (
Optional[Dict[str,Tuple[Union[float,int],Union[float,int],Union[float,int]]]]) – optional gradient to provide. If not provided, Design.DEFAULT_GRADIENT will be used. The gradient is a dictionary off 3 tuples, the step the min and the max.pick_anyway (
bool) – if set to True, if the optimization finds no pairs, pick a pair anyways.
- Return type
Tuple[List[dict],List[dict]]- Returns
results
-
property
settings¶ Return the
DesignPresetsinstance for this design.- Return type
-
-
class
primer3plus.design.DesignBase(gradient=None, params=None, quiet_runtime=False)[source]¶ Base design.
Initializes a new design.
- Parameters
gradient (
Optional[Dict[str,Tuple[Union[float,int],Union[float,int],Union[float,int]]]]) – the design gradient.quiet_runtime (
bool) – if True will siliently ignore any runtime errors.
-
DEFAULT_GRADIENT= {'PRIMER_MAX_HAIRPIN_TH': (1, 47.0, 60), 'PRIMER_MAX_SIZE': (1, 27, 36), 'PRIMER_MAX_TM': (1, 27, 80), 'PRIMER_MIN_SIZE': (-1, 16, 27), 'PRIMER_MIN_TM': (-1, 48, 57.0)}¶ the default gradient to use for the
Design.run_and_optimize()method.
-
DEFAULT_PARAMS= <primer3plus.params.BoulderIO object>¶ default parameters
-
run()[source]¶ Design primers. Optionally provide additional parameters.
- Parameters
params –
- Return type
Tuple[List[Dict],List[Dict]]- Returns
results
-
run_and_optimize(max_iterations, params=None, gradient=None, run_kwargs=None)[source]¶ Design primers and relax constraints. If primer design is unsuccessful, relax parameters as defined in primer3plust.Design.DEFAULT_GRADIENT. Repeat for the specified number of max_iterations.
- Parameters
max_iterations – the max number of iterations to perform relaxation
params (
Optional[BoulderIO]) – optional parameters to providegradient (
Optional[Dict[str,Tuple[Union[float,int],Union[float,int],Union[float,int]]]]) – optional gradient to provide. If not provided, Design.DEFAULT_GRADIENT will be used. The gradient is a dictionary off 3 tuples, the step the min and the max.
- Return type
Tuple[List[dict],List[dict]]- Returns
results
-
class
primer3plus.design.DesignPresets(design)[source]¶ Interface for setting design parameters. This is typically accessed from a
Designinstance’s.Designmethod. As in:design = Design() design.settings.left_sequence("AGGGAGATAGATA") design.run()Initializes a new interface from a.
- Parameters
design – The design
-
as_cloning_task()[source]¶ Set the design as a cloning task.
http://primer3.ut.ee/primer3web_help.htm#PRIMER_TASK
- Return type
- Returns
self
-
as_generic_task()[source]¶ Set the design as a generic task.
http://primer3.ut.ee/primer3web_help.htm#PRIMER_TASK
- Return type
- Returns
self
-
excluded(interval)[source]¶ Primers and oligos may not overlap any region specified in this tag. The associated value must be a space-separated list of <start>,<length> pairs where <start> is the index of the first base of the excluded region, and <length> is its length. This tag is useful for tasks such as excluding regions of low sequence quality or for excluding regions containing repetitive elements such as ALUs or LINEs.
http://primer3.ut.ee/primer3web_help.htm#SEQUENCE_TEMPLATE http://primer3.ut.ee/primer3web_help.htm#SEQUENCE_EXCLUDED_REGION
- Parameters
interval (
Union[str,Tuple[int,int],List[Tuple[int,int]]]) – One of the following: the sequence of the target region, a tuple of the interval of <start>,<length>, or a list of tuples of <start>,<length>- Return type
- Returns
self
-
included(interval)[source]¶ Specify interval from which primers must be selected. A sub-region of the given sequence in which to pick primers. For example, often the first dozen or so bases of a sequence are vector, and should be excluded from consideration. The value for this parameter has the form.
http://primer3.ut.ee/primer3web_help.htm#SEQUENCE_INCLUDED_REGION
<start>,<length> where <start> is the index of the first base to consider, and <length> is the number of subsequent bases in the primer-picking region.
- Parameters
interval (
Union[str,Tuple[int,int]]) – One of the following: the sequence of the target region, a tuple of the interval of <start>,<length> or a str- Return type
- Returns
self
-
internal_sequence(primer)[source]¶ The sequence of an internal oligo to check and around which to design left and right primers. Must be a substring of SEQUENCE_TEMPLATE.
http://primer3.ut.ee/primer3web_help.htm#SEQUENCE_INTERNAL_OLIGO http://primer3.ut.ee/primer3web_help.htm#PRIMER_PICK_INTERNAL_OLIGO
- Parameters
primer (
str) –- type primer
- return
- rtype
- Return type
-
left_overhang(overhang)[source]¶ Sets the left overhang sequence for the primer. This overhang will.
always be in the overhang sequence regardless of other parameters.
If using a primer that anneals with an overhang, this value will be appended to the 5’ end of the overhang.
- Parameters
overhang (
str) – overhang sequence- Return type
- Returns
self
-
left_sequence(primer)[source]¶ The sequence of a left primer to check and around which to design right primers and optional internal oligos. Must be a substring of SEQUENCE_TEMPLATE.
http://primer3.ut.ee/primer3web_help.htm#SEQUENCE_PRIMER http://primer3.ut.ee/primer3web_help.htm#PRIMER_PICK_RIGHT_PRIMER
- Parameters
primer (
str) – the primer sequence- Return type
- Returns
self
-
long_ok(b=True)[source]¶ Set the BoulderIO to process long primers.
- Parameters
b (
bool) – boolean to set- Return type
- Returns
self
-
pair_region_list(region_list)[source]¶ The list of regions from which to design primers.
http://primer3.ut.ee/primer3web_help.htm#SEQUENCE_PRIMER_PAIR_OK_REGION_LIST
- Parameters
region_list (
List[Tuple[int,int,int,int]]) – list of regions- Return type
- Returns
self
-
pick_anyway(b=1)[source]¶ If true use primer provided in SEQUENCE_PRIMER, SEQUENCE_PRIMER_REVCOMP, or SEQUENCE_INTERNAL_OLIGO even if it violates specific constraints.
http://primer3.ut.ee/primer3web_help.htm#PRIMER_PICK_ANYWAY
- Parameters
b – default True
:return self
- Return type
-
pick_left_only()[source]¶ Design only the left primer.
http://primer3.ut.ee/primer3web_help.htm#PRIMER_PICK_LEFT_PRIMER http://primer3.ut.ee/primer3web_help.htm#PRIMER_PICK_RIGHT_PRIMER
- Return type
- Returns
self
-
pick_right_only()[source]¶ Design only the right primer.
http://primer3.ut.ee/primer3web_help.htm#PRIMER_PICK_LEFT_PRIMER http://primer3.ut.ee/primer3web_help.htm#PRIMER_PICK_RIGHT_PRIMER
- Return type
- Returns
self
-
primer_num_return(n)[source]¶ Set the number of primers to return for the design task.
http://primer3.ut.ee/primer3web_help.htm#PRIMER_NUM_RETURN
- Parameters
n (
int) – number of primers to return- Return type
- Returns
self
-
primers(p1, p2)[source]¶ Set the left and right primer sequences.
http://primer3.ut.ee/primer3web_help.htm#SEQUENCE_PRIMER http://primer3.ut.ee/primer3web_help.htm#PRIMER_PICK_RIGHT_PRIMER http://primer3.ut.ee/primer3web_help.htm#SEQUENCE_PRIMER_REVCOMP http://primer3.ut.ee/primer3web_help.htm#PRIMER_PICK_LEFT_PRIMER
- Parameters
p1 (
str) –p2 (
str) –
- Return type
- Returns
-
product_size(interval, opt=None)[source]¶ Set the product size. Optionally include the optimal size.
http://primer3.ut.ee/primer3web_help.htm#PRIMER_PRODUCT_SIZE_RANGE http://primer3.ut.ee/primer3web_help.htm#PRIMER_PRODUCT_OPT_SIZE
- Parameters
interval (
Union[Tuple[int,int],List[Tuple[int,int]]]) – a tuple of <min>,<max> or a list of such tuplesopt – optional product size as an int.
- Return type
- Returns
self
-
right_overhang(overhang)[source]¶ Sets the right overhang sequence for the primer. This overhang will.
always be in the overhang sequence regardless of other parameters.
If using a primer that anneals with an overhang, this value will be appended to the 5’ end of the overhang.
- Parameters
overhang (
str) – overhang sequence- Return type
- Returns
self
-
right_sequence(primer)[source]¶ The sequence of a right primer to check and around which to design left primers and optional internal oligos. Must be a substring of the reverse strand of SEQUENCE_TEMPLATE.
http://primer3.ut.ee/primer3web_help.htm#SEQUENCE_PRIMER_REVCOMP http://primer3.ut.ee/primer3web_help.htm#PRIMER_PICK_LEFT_PRIMER
- Parameters
primer (
str) – the primer sequence- Return type
- Returns
self
-
target(interval)[source]¶ Specify the interval that designed primers must flank. If one or more targets is specified then a legal primer pair must flank at least one of them. A target might be a simple sequence repeat site (for example a CA repeat) or a single-base-pair polymorphism, or an exon for resequencing. The value should be a space-separated list of.
<start>,<length> pairs where <start> is the index of the first base of a target,and <length> is its length. See also PRIMER_INSIDE_PENALTY, PRIMER_OUTSIDE_PENALTY. PRIMER_TASK=pick_sequencing_primers. See PRIMER_TASK for more information.
http://primer3.ut.ee/primer3web_help.htm#SEQUENCE_TEMPLATE http://primer3.ut.ee/primer3web_help.htm#SEQUENCE_TARGET
- Parameters
interval (
Union[str,Tuple[int,int],List[Tuple[int,int]]]) – One of the following: the sequence of the target region, a tuple of the interval of <start>,<length>, or a list of tuples of <start>,<length>
:return self
- Return type
-
task(task)[source]¶ This tag tells primer3 what task to perform.
http://primer3.ut.ee/primer3web_help.htm#PRIMER_TASK
- Parameters
task (
str) – the task name
:return self
- Return type
-
template(template)[source]¶ Set the template sequence for the design. This sets the ‘SEQUENCE_TEMPLATE’ parameter.
http://primer3.ut.ee/primer3web_help.htm#SEQUENCE_TEMPLATE
- Parameters
template (
str) – the template sequence- Return type
- Returns
self
Parameter Interface¶
Design Parameters¶
-
class
primer3plus.params.BoulderIO[source]¶ Class that maintains and validates a list of Primer3 parameters.
Initializes a new BoulderIO instance.
-
EXTRA_TYPES= [<ParameterType SEQUENCE_PRIMER_OVERHANG <class 'str'> default=>, <ParameterType SEQUENCE_PRIMER_REVCOMP_OVERHANG <class 'str'> default=>, <ParameterType PRIMER_USE_OVERHANGS <class 'bool'> default=False>, <ParameterType PRIMER_LONG_OK <class 'bool'> default=False>, <ParameterType PRIMER_MIN_ANNEAL_CHECK <class 'int'> default=12>, <ParameterType _SEQUENCE_LONG_OVERHANG <class 'str'> default=>, <ParameterType _SEQUENCE_REVCOMP_LONG_OVERHANG <class 'str'> default=>]¶ extra parameter types
-
PRIMER_MAX_SIZE_HARD_LIM= 35¶ hard coded primer length limit for Primer3.
-
static
online_help(open=False, key=None)[source]¶ Display online help in a browser tab.
- Parameters
open – if True, open browser tab. Else return url.
key – optional parameter key
- Return type
str- Returns
-
-
class
primer3plus.params.ParamParser[source]¶ Reads the Primer3 documentation and creates the appropriate parameters.
-
class
primer3plus.params.ParamTypes[source]¶ Parameter types used in BoulderIO.
Only the Global and Sequence parameters are actually used in designs.
-
CATEGORY= 'category'¶ boulderIO that gets sent to primer3
-
EXTRA= 'extra'¶ extra parameter key. These do not show up in the final
-
GLOBAL= 'GLOBAL'¶ global parameter key
-
OTHER= 'OTHER'¶ other parameter key
-
PROGRAM= 'PROGRAM'¶ program parameter key
-
SEQUENCE= 'SEQUENCE'¶ sequence parameter key
-
-
class
primer3plus.params.Parameter(ptype, value=None, restore=None)[source]¶ An instance of a Primer3 parameter.
Internally validate its value using its :class:<ParameterType <primer3plus.params.ParameterType>`
Initialize a parameter from a.
- Parameters
ptype (
ParameterType) – parameter typevalue – value to set parameter
restore (
Optional[Any]) – optional restoration value
-
property
name¶ Return the name of the parameter.
- Returns
parameter name
-
property
value¶ Return the value of the parameter.
- Return type
Any- Returns
Any
-
class
primer3plus.params.ParameterType(name, description, type, default, category)[source]¶ Metatype for a Primer3 parameter.
Initialize a BoulderIO parameter type.
- Parameters
name – name of the parameter
description – description of the parameter
type – expected type of the parameter
default – default value of the parameter
category – parameter category (from ‘sequence’, ‘program’, ‘globals’, or ‘other’)
-
category¶ category. See
ParamTypes
-
default¶ default value
-
description¶ parameter description as a str
-
name¶ name of the parameter
-
type¶ expected python type of the parameter value
-
primer3plus.params.default_boulderio= <primer3plus.params.BoulderIO object>¶ default boulder IO parameters
BoulderIO Default Parameters¶
name |
type |
value |
|---|---|---|
<class ‘str’> |
||
<class ‘str’> |
||
<class ‘list’> |
[] |
|
<class ‘list’> |
[] |
|
<class ‘list’> |
[] |
|
<class ‘list’> |
[] |
|
<class ‘list’> |
[] |
|
<class ‘list’> |
[] |
|
<class ‘str’> |
||
<class ‘str’> |
||
<class ‘str’> |
||
<class ‘int’> |
-2000000 |
|
<class ‘list’> |
[] |
|
<class ‘int’> |
-1000000 |
|
<class ‘int’> |
-1000000 |
|
<class ‘int’> |
-1000000 |
|
<class ‘int’> |
-1000000 |
|
<class ‘str’> |
generic |
|
<class ‘bool’> |
True |
|
<class ‘bool’> |
False |
|
<class ‘bool’> |
True |
|
<class ‘int’> |
5 |
|
<class ‘int’> |
4 |
|
<class ‘int’> |
7 |
|
<class ‘str’> |
||
<class ‘str’> |
||
<class ‘str’> |
||
<class ‘str’> |
||
<class ‘list’> |
[100, 300] |
|
<class ‘int’> |
0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘int’> |
18 |
|
<class ‘int’> |
18 |
|
<class ‘int’> |
20 |
|
<class ‘int’> |
20 |
|
<class ‘int’> |
27 |
|
<class ‘int’> |
27 |
|
<class ‘float’> |
1.0 |
|
<class ‘float’> |
1.0 |
|
<class ‘float’> |
1.0 |
|
<class ‘float’> |
1.0 |
|
<class ‘float’> |
20.0 |
|
<class ‘float’> |
20.0 |
|
<class ‘float’> |
50.0 |
|
<class ‘float’> |
50.0 |
|
<class ‘float’> |
80.0 |
|
<class ‘float’> |
80.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘int’> |
0 |
|
<class ‘int’> |
5 |
|
<class ‘float’> |
57.0 |
|
<class ‘float’> |
57.0 |
|
<class ‘float’> |
60.0 |
|
<class ‘float’> |
60.0 |
|
<class ‘float’> |
63.0 |
|
<class ‘float’> |
63.0 |
|
<class ‘float’> |
100.0 |
|
<class ‘float’> |
1.0 |
|
<class ‘float’> |
1.0 |
|
<class ‘float’> |
1.0 |
|
<class ‘float’> |
1.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
-1000000.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
1000000.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘int’> |
1 |
|
<class ‘float’> |
50.0 |
|
<class ‘float’> |
50.0 |
|
<class ‘float’> |
1.5 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.6 |
|
<class ‘float’> |
0.0 |
|
<class ‘int’> |
1 |
|
<class ‘float’> |
50.0 |
|
<class ‘float’> |
50.0 |
|
<class ‘bool’> |
True |
|
<class ‘bool’> |
False |
|
<class ‘bool’> |
False |
|
<class ‘str’> |
./primer3_config |
|
<class ‘float’> |
8.0 |
|
<class ‘float’> |
47.0 |
|
<class ‘float’> |
12.0 |
|
<class ‘float’> |
47.0 |
|
<class ‘float’> |
8.0 |
|
<class ‘float’> |
47.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
3.0 |
|
<class ‘float’> |
47.0 |
|
<class ‘float’> |
12.0 |
|
<class ‘float’> |
47.0 |
|
<class ‘float’> |
3.0 |
|
<class ‘float’> |
47.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
47.0 |
|
<class ‘float’> |
47.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
100.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘int’> |
0 |
|
<class ‘int’> |
0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘int’> |
5 |
|
<class ‘int’> |
5 |
|
<class ‘int’> |
-1 |
|
<class ‘int’> |
-1 |
|
<class ‘int’> |
-1 |
|
<class ‘bool’> |
False |
|
<class ‘int’> |
0 |
|
<class ‘bool’> |
True |
|
<class ‘bool’> |
False |
|
<class ‘int’> |
0 |
|
<class ‘float’> |
-1.0 |
|
<class ‘float’> |
-1.0 |
|
<class ‘float’> |
-1.0 |
|
<class ‘float’> |
-1.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘str’> |
||
<class ‘str’> |
||
<class ‘bool’> |
False |
|
<class ‘float’> |
12.0 |
|
<class ‘float’> |
12.0 |
|
<class ‘float’> |
24.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘bool’> |
False |
|
<class ‘float’> |
0.1 |
|
<class ‘float’> |
0.0 |
|
<class ‘int’> |
1 |
|
<class ‘int’> |
0 |
|
<class ‘str’> |
../kmer_lists/ |
|
<class ‘str’> |
homo_sapiens |
|
<class ‘int’> |
0 |
|
<class ‘int’> |
0 |
|
<class ‘int’> |
0 |
|
<class ‘int’> |
0 |
|
<class ‘int’> |
100 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
1.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
-1.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
1.0 |
|
<class ‘int’> |
50 |
|
<class ‘int’> |
500 |
|
<class ‘int’> |
250 |
|
<class ‘int’> |
20 |
|
<class ‘float’> |
0.0 |
|
<class ‘float’> |
0.0 |
|
<class ‘str’> |
||
<class ‘str’> |
||
<class ‘bool’> |
False |
|
<class ‘bool’> |
False |
|
<class ‘int’> |
12 |
|
|
<class ‘str’> |
|
|
<class ‘str’> |
Extra/Special Parameters¶
-
class
primer3plus.params.ExtraTypes[source]¶ Extra Parameter types not included in standard Primer3 behavior.
-
PRIMER_LONG_OK= <ParameterType PRIMER_LONG_OK <class 'bool'> default=False>¶ specifies BoulderIO use long primers (>35bp).
-
PRIMER_MIN_ANNEAL_CHECK= <ParameterType PRIMER_MIN_ANNEAL_CHECK <class 'int'> default=12>¶ specifies min bases to check for mispriming during primer designs
-
PRIMER_USE_OVERHANGS= <ParameterType PRIMER_USE_OVERHANGS <class 'bool'> default=False>¶ extra parameter specifies to use primer overhangs in the design
-
SEQUENCE_PRIMER_OVERHANG= <ParameterType SEQUENCE_PRIMER_OVERHANG <class 'str'> default=>¶ extra parameter specifies the sequence of the left primer overhang
-
SEQUENCE_PRIMER_REVCOMP_OVERHANG= <ParameterType SEQUENCE_PRIMER_REVCOMP_OVERHANG <class 'str'> default=>¶ extra parameter specifies the sequence of the right primer overhang
-