oligo
Oligo Class and Methods¶
This module contains a class and class methods to represent an oligo (e.g., designed by Primer3).
Oligos can represent single primer and/or internal probe designs.
Class attributes include the base sequence, melting temperature, and the score of the oligo. The mapping of the oligo to the genome is also stored.
Optional attributes include naming information and a tail sequence to attach to the 5' end of the oligo (if applicable). Optional attributes also include the thermodynamic results from Primer3.
Examples of interacting with the Oligo class¶
>>> from prymer.api.span import Span, Strand
>>> oligo_span = Span(refname="chr1", start=1, end=20)
>>> oligo = Oligo(tm=70.0, penalty=-123.0, span=oligo_span, bases="AGCT" * 5)
>>> oligo.longest_hp_length()
1
>>> oligo.length
20
>>> oligo.name is None
True
>>> oligo = Oligo(tm=70.0, penalty=-123.0, span=oligo_span, bases="GACGG"*4)
>>> oligo.longest_hp_length()
3
>>> oligo.untailed_length()
20
>>> oligo.tailed_length()
20
>>> primer = oligo.with_tail(tail="GATTACA")
>>> primer.untailed_length()
20
>>> primer.tailed_length()
27
>>> primer = primer.with_name(name="fwd_primer")
>>> primer.name
'fwd_primer'
Oligos may also be written to a file and subsequently read back in, as the Oligo class is an
fgpyo Metric class:
>>> from pathlib import Path
>>> left_span = Span(refname="chr1", start=1, end=20)
>>> left = Oligo(tm=70.0, penalty=-123.0, span=left_span, bases="G"*20)
>>> right_span = Span(refname="chr1", start=101, end=120)
>>> right = Oligo(tm=70.0, penalty=-123.0, span=right_span, bases="T"*20)
>>> path = Path("/tmp/path/to/primers.txt")
>>> Oligo.write(path, left, right) # doctest: +SKIP
>>> primers = Oligo.read(path) # doctest: +SKIP
>>> list(primers) # doctest: +SKIP
[
Oligo(tm=70.0, penalty=-123.0, span=amplicon_span, bases="G"*20),
Oligo(tm=70.0, penalty=-123.0, span=amplicon_span, bases="T"*20)
]
Attributes¶
Classes¶
Oligo
dataclass
¶
Bases: ,
Stores the properties of the designed oligo.
Oligos can include both single primer and internal probe designs. Primer3 emits information about the specific properties of a primer and/or probe, including the base sequence, melting temperature (tm), and score.
The penalty score of the design is emitted by Primer3 and controlled by the corresponding
design parameters. The penalty for a primer is set by the combination of
PrimerAndAmpliconParameters and PrimerWeights.
A probe penalty is set by ProbeParameters and ProbeWeights.
The span of an Oligo object represents the mapping of the oligo
to the genome. Oligo objects can optionally have a tail sequence to prepend to the 5' end
of the primer or probe, as well as a name for downstream record keeping.
Oligo objects can also store thermodynamic characteristics of primer and/or probe
design. These include the calculated melting temperatures of the most stable hairpin structure,
self-, and end- complementarity. These values can be emitted by Primer3.
These thermodynamic characteristics are meant to quantify how likely it is the primer or probe will bind to itself (e.g., instead of the target DNA). A melting temperature close to or greater than the intended melting temperature for target binding indicates the primer or probe is likely to form stable hairpins or dimers, leading to reduced efficiency of the reaction.
Attributes:
| Name | Type | Description |
|---|---|---|
|
|
the calculated melting temperature of the oligo |
|
|
the penalty or score for the oligo |
|
|
the mapping of the primer to the genome |
|
|
an optional name to use for the primer |
|
|
calculated melting temperature that represents the tendency of an oligo to bind to itself (self-complementarity) |
|
|
calculated melting temperature that represents the tendency of a primer to bind to the 3'-END of an identical primer |
|
|
calculated melting temperature of the oligo hairpin structure |
|
|
the base sequence of the oligo (excluding any tail) |
|
|
an optional tail sequence to put on the 5' end of the primer |
Source code in prymer/api/oligo.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
Attributes¶
Functions¶
__str__ ¶
Returns a string representation of this oligo
Source code in prymer/api/oligo.py
bases_with_tail ¶
Returns the sequence of the oligo prepended by the tail.
If tail is None, only return bases.
compare
staticmethod
¶
Compares this oligo to that oligo by their span, ordering references using the given sequence dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
this |
|
the first oligo |
required |
that |
|
the second oligo |
required |
seq_dict |
|
the sequence dictionary used to order references |
required |
Returns:
| Type | Description |
|---|---|
|
-1 if this oligo is less than the that oligo, 0 if equal, 1 otherwise |
Source code in prymer/api/oligo.py
longest_dinucleotide_run_length ¶
Number of bases in the longest dinucleotide run in a oligo.
A dinucleotide run is when length two repeat-unit is repeated. For example, TCTC (length = 4) or ACACACACAC (length = 10). If there are no such runs, returns 2 (or 0 if there are fewer than 2 bases).
Source code in prymer/api/oligo.py
longest_hp_length ¶
tailed_length ¶
to_bed12_row ¶
Returns the BED detail format view: https://genome.ucsc.edu/FAQ/FAQformat.html#format1.7