Skip to content

Commit 2c103ec

Browse files
authored
Separated minimums between design and simulate (#447)
* Separated minimums between design and simulate * Added check on primer length when using simulate * Added CHANGELOG.md
1 parent 529ccc7 commit 2c103ec

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
10+
### Fixed
11+
- Made it possible to simulate primers shorter than design minimum.
12+
813
## [0.31.1] - 2024-01-31
914

1015
### Added

primers/pcr/pcr.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,24 @@ import (
3232
)
3333

3434
// https://doi.org/10.1089/dna.1994.13.75
35-
var minimalPrimerLength int = 15
35+
const minimalPrimerLength int = 7
36+
37+
// what we want for designs
38+
const designedMinimalPrimerLength int = 15
3639

3740
// DesignPrimersWithOverhangs designs two primers to amplify a target sequence,
3841
// adding on an overhang to the forward and reverse strand. This overhang can
3942
// contain additional DNA needed for assembly, like Gibson assembly overhangs
4043
// or GoldenGate restriction enzyme sites.
4144
func DesignPrimersWithOverhangs(sequence, forwardOverhang, reverseOverhang string, targetTm float64) (string, string) {
4245
sequence = strings.ToUpper(sequence)
43-
forwardPrimer := sequence[0:minimalPrimerLength]
46+
forwardPrimer := sequence[0:designedMinimalPrimerLength]
4447
for additionalNucleotides := 0; primers.MeltingTemp(forwardPrimer) < targetTm; additionalNucleotides++ {
45-
forwardPrimer = sequence[0 : minimalPrimerLength+additionalNucleotides]
48+
forwardPrimer = sequence[0 : designedMinimalPrimerLength+additionalNucleotides]
4649
}
47-
reversePrimer := transform.ReverseComplement(sequence[len(sequence)-minimalPrimerLength:])
50+
reversePrimer := transform.ReverseComplement(sequence[len(sequence)-designedMinimalPrimerLength:])
4851
for additionalNucleotides := 0; primers.MeltingTemp(reversePrimer) < targetTm; additionalNucleotides++ {
49-
reversePrimer = transform.ReverseComplement(sequence[len(sequence)-(minimalPrimerLength+additionalNucleotides):])
52+
reversePrimer = transform.ReverseComplement(sequence[len(sequence)-(designedMinimalPrimerLength+additionalNucleotides):])
5053
}
5154

5255
// Add overhangs to primer
@@ -168,6 +171,12 @@ func SimulateSimple(sequences []string, targetTm float64, circular bool, primerL
168171
// in your reaction, which can lead to confusing results. The variable
169172
// `circular` is for if the target template is circular, like a plasmid.
170173
func Simulate(sequences []string, targetTm float64, circular bool, primerList []string) ([]string, error) {
174+
// make sure no primers are too short
175+
for _, primer := range primerList {
176+
if len(primer) < minimalPrimerLength {
177+
return nil, errors.New("Primers are too short.")
178+
}
179+
}
171180
initialAmplification := SimulateSimple(sequences, targetTm, circular, primerList)
172181
subsequentAmplification := SimulateSimple(sequences, targetTm, circular, append(primerList, initialAmplification...))
173182
if len(initialAmplification) != len(subsequentAmplification) {

0 commit comments

Comments
 (0)