Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separated minimums between design and simulate #447

Merged
merged 4 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed
- Made it possible to simulate primers shorter than design minimum.

## [0.31.1] - 2024-01-31

### Added
Expand Down
19 changes: 14 additions & 5 deletions primers/pcr/pcr.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,24 @@ import (
)

// https://doi.org/10.1089/dna.1994.13.75
var minimalPrimerLength int = 15
const minimalPrimerLength int = 7

// what we want for designs
const designedMinimalPrimerLength int = 15

// DesignPrimersWithOverhangs designs two primers to amplify a target sequence,
// adding on an overhang to the forward and reverse strand. This overhang can
// contain additional DNA needed for assembly, like Gibson assembly overhangs
// or GoldenGate restriction enzyme sites.
func DesignPrimersWithOverhangs(sequence, forwardOverhang, reverseOverhang string, targetTm float64) (string, string) {
sequence = strings.ToUpper(sequence)
forwardPrimer := sequence[0:minimalPrimerLength]
forwardPrimer := sequence[0:designedMinimalPrimerLength]
for additionalNucleotides := 0; primers.MeltingTemp(forwardPrimer) < targetTm; additionalNucleotides++ {
forwardPrimer = sequence[0 : minimalPrimerLength+additionalNucleotides]
forwardPrimer = sequence[0 : designedMinimalPrimerLength+additionalNucleotides]
}
reversePrimer := transform.ReverseComplement(sequence[len(sequence)-minimalPrimerLength:])
reversePrimer := transform.ReverseComplement(sequence[len(sequence)-designedMinimalPrimerLength:])
for additionalNucleotides := 0; primers.MeltingTemp(reversePrimer) < targetTm; additionalNucleotides++ {
reversePrimer = transform.ReverseComplement(sequence[len(sequence)-(minimalPrimerLength+additionalNucleotides):])
reversePrimer = transform.ReverseComplement(sequence[len(sequence)-(designedMinimalPrimerLength+additionalNucleotides):])
}

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