Defining settings

There's a lot of experience with performing PCRs and therefore we know which physicochemical properties of primers are favorable for amplification and which are not. In openPrimeR, the desired ranges of values of these properties are called constraints and they are stored in a DesignSettings object.

Let's define some constraints by loading one of the XML settings files that are shipped with the package by storing the result of read_settings() in the settings variable:

# Load the specified XML file into the 'settings' variable:
xml.file <- system.file("extdata", "settings", "B_Taq_PCR_evaluate.xml",
              package = "openPrimeR")
# Load the specified XML file into the 'settings' variable:
xml.file <- system.file("extdata", "settings", "B_Taq_PCR_evaluate.xml",
              package = "openPrimeR")
settings <- read_settings(xml.file)
xml.file <- system.file("extdata", "settings", "B_Taq_PCR_evaluate.xml",
              package = "openPrimeR")
settings <- read_settings(xml.file)

Let's take a look at the structure of settings:

print(settings)

As you can see, the DesignSettings object contains far more information than just the constraint settings, but let's focus on the constraints first.

Defining constraints on physicochemical properties

You can change which physicochemical properties are considered and the desired range of property values by using the constraints() function:

# View the constraints specified in 'settings':
constraints(settings)

The constraints() function returns a named list where the names provide the identifiers of the active constraints and the constraints are specified as named vectors containing the entries min and max where min indicates the smallest allowed value and max indicates the maximal allowed value of a property. If either min or max is missing, this indicates that the corresponding range is unlimited. For example, the extent of the GC clamp should be between r constraints(settings)$gc_clamp["min"] and r constraints(settings)$gc_clamp["max"], while the coverage of every primer should be at least r constraints(settings)$primer_coverage["min"] (there's no upper limit).

You can customize the constraint settings by using constraints() as a setter. Why don't you try to exclude the GC clamp property from consideration and increase the required number of coverage events per primer to 5? Note that you always have to provide named (min and/or max) numeric vectors when modifying constraints.

# Remove the GC clamp constraint and set the minimal primer coverage to 5
# Remove the GC clamp constraint and set the minimal primer coverage to 5
constraints(settings) <- constraints(settings)[names(constraints(settings)) != "gc_clamp"]
constraints(settings)$primer_coverage <- c("min" = 5)
constraints(settings)

Modifying the coverage constraints

xml.file <- system.file("extdata", "settings", "B_Taq_PCR_evaluate.xml",
              package = "openPrimeR")
settings <- read_settings(xml.file)
constraints(settings) <- constraints(settings)[names(constraints(settings)) != "gc_clamp"]
constraints(settings)$primer_coverage <- c("min" = 5)

The coverage constraints determine under which circumstances a primer is considered to cover a template, which means that the primer is likely to successfully amplify the corresponding template. Depending on the selected coverage constraints, the estimate of amplified templates can be more sensitive (e.g. free energy of annealing) or more specific (modeling terminal mismatches). You can modify the coverage conditions using cvg_constraints():

# View the active coverage constraints
# View the active coverage constraints
cvg_constraints(settings)

We see that the maximal false positive rate for calling coverage events is set to r paste0(round(cvg_constraints(settings)$coverage_model * 100, 2), "%"). This means that only coverage events whose estimated probability of being false positives is below r paste0(round(cvg_constraints(settings)$coverage_model * 100, 2), "%") are retained, while all other events are removed. stop_codon and substitution are codon design constraints, where 1 denominates coverage events inducing stop codons or substitutions and 0 indicates the absence of such events. Since the maxima of both constraints are set to 1, we do not filter coverage events according to these events at the moment. To learn about other possible coverage constraints, we refer to the openPrimeR manual or the output of viewing the DesignSettings object, which indicates the inactive constraints.

Modifying the constraint options

The constraint options define additional options for the computation of some constraints. Let us now review the active constraint options via conOptions():

# View the active constraint options
# View the active constraint options
conOptions(settings)

In the constraint options, allowed_mismatches provides the maximal number of mismatches between primers and templates, allowed_other_binding_ratio sets the maximal ratio of off-target binding events, and allowed_region_definition determines whether primers are required to bind within the specified binding region or may also only overlap with the target region.

Please specify the following settings now:

# Modify the constraint options as suggested
conOptions(settings)$allowed_mismatches <- 0
conOptions(settings)$allowed_other_binding_ratio <- 0
conOptions(settings)$allowed_region_definition <- "any"
conOptions(settings)
xml.file <- system.file("extdata", "settings", "B_Taq_PCR_evaluate.xml",
              package = "openPrimeR")
settings <- read_settings(xml.file)
constraints(settings) <- constraints(settings)[names(constraints(settings)) != "gc_clamp"]
constraints(settings)$primer_coverage <- c("min" = 5)
conOptions(settings)$allowed_mismatches <- 0
conOptions(settings)$allowed_other_binding_ratio <- 0
conOptions(settings)$allowed_region_definition <- "any"

Adjusting the PCR conditions

Last, we should take a look at the current PCR conditions using PCR():

# Investigate the PCR conditions
# Investigate the PCR conditions
PCR(settings)

When performing an analysis, please ensure that all ion concentrations (molar) and other PCR conditions (e.g. the annealing temperature) reflect your experimental setup correctly. We will retain the default settings and just note that the PCR settings can be adjusted analogously to the other settings.



matdoering/openPrimeR documentation built on Feb. 11, 2024, 9:22 p.m.