Module M08: Thermodynamic Primer Design
Module M08 integrates with the PrimerLab engine to design primers and probes within the target regions identified by Module M07. It applies thermodynamic folding validations to prevent primer-dimer and hairpin structures at reaction temperatures.The Primer3 Design Logic
The module feeds the IUPAC-aware consensus sequences from M07 into Primer3, applying specific parameters based on the reaction type:- Isothermal (RAA/RPA):
- Primer Length: 30–35 bp (optimal 32 bp)
- Optimal Temperature: 37–42 °C (optimal 39 °C)
- GC Content: 30%–70%
- Probe Length: 45–53 bp (requires an internal abasic site, flanked by a fluorophore and quencher — see below)
- PCR:
- Primer Length: 18–22 bp
- Optimal Temperature: 55–60 °C
RAA Probe Geometry (Abasic Site Placement)
An RAA probe is only useful if the kit’s repair enzyme can actually cleave it. PrimerLab places the abasic residue according to the TwistAmp Assay Design Manual, and screens probe candidates for a legal placement before ranking them thermodynamically:
The same geometry applies whether the kit uses Exonuclease III (
exo probes) or Endonuclease IV (nfo/fpg probes); the probe type changes how the signal is read, not where the abasic residue goes.
!!! warning “Corrected in this revision”
Two defects in the previous placement logic were found by checking it against the manual’s worked example and have been fixed:
- The abasic residue could land 28–29 bases from the 5’ end — a case the manual lists verbatim as a “Poor probe design”. There was no upper bound either.
- The label logic was inverted. The old code anchored the abasic residue onto the nearest
T— consuming the one base that could have carried a label — and let both dT labels fall on whatever happened to be adjacent. Every probe could therefore silently carry two unnecessary probe–target mismatches.
When no ideal site exists
Placement degrades in the order the manual itself prescribes, and every relaxation is reported rather than applied silently:- Pair of thymines inside the 30–38 window → compliant, no mismatch.
- Pair of thymines beyond 38 → used, with a warning.
- Only one usable thymine → one label mismatch. The manual explicitly sanctions this: “one can simply ignore the mismatch of one of the thymines… There may be a reduction in the efficiency of the probe, the extent to which cannot be predicted.”
- No usable thymine → two label mismatches, warned.
- No legal geometry at all → the probe is rejected, not annotated at a clamped position.
probe_label_mismatches alongside thf_index and probe_compliant, so downstream validation counts them as design properties rather than as target variation.
Degeneracy & Multiplier Bounds
To ensure designed primers cover circulating variants without losing analytical sensitivity, the pipeline supports degenerate base design:- Variable positions exceeding
degenerate.maf_threshold(default0.10or 10% Minor Allele Frequency) are replaced with the corresponding IUPAC degenerate code (e.g.,R,Y,W). - The degeneracy multiplier () represents the total number of unique sequence combinations in the degenerate pool:
- Pipeline Constraint: The pipeline enforces a maximum degeneracy limit of (defined via
max_multiplierin config). - Scientific Rationale: Limiting degeneracy prevents the primer dilution effect (where matching primer concentration drops too low) and reduces non-specific amplification or primer-dimer competition.
ViennaRNA Secondary Structure Validation
Every candidate primer and probe is evaluated for secondary structure thermodynamics at the target reaction temperature (e.g., 39°C for RAA) using the ViennaRNA package (RNAfold/RNAduplex):- Hairpins: Calculates the minimum free energy () of self-folding. Hairpins with are flagged as high-risk.
- Self-Dimers (Homodimers): Simulates binding between two molecules of the same primer. Excludes candidates with homodimerization .
- Cross-Dimers (Heterodimers): Simulates binding between the forward primer, reverse primer, and probe. Any combinations with cross-hybridization are filtered out.
How to Read the Output Files
Module M08 generates two primary JSON outputs underresults/{BUILD}/m08/{mode}/{region}/:
1. summary.json
Contains a ranked list of the top designed candidate primer sets that passed all thermodynamic and degeneracy filters.
2. alternatives.json
Contains the complete details of all evaluated candidate sets, including their thermodynamic parameters, GC contents, and folding energies. Useful for auditing rejected candidates.
alternatives.json:
multiplier: The product of the forward, reverse, and probe degeneracy multipliers. Here, , which is well below themax_multiplier: 16cap.heterodimer_*_dg: Ensure none of the heterodimer binding energies exceed the threshold (e.g., must be kcal/mol). Values like-4.2are stable.vienna_score: A normalized value representing the thermodynamic suitability. Candidates are sorted in descending order of this score.
