react_4domain: Translate a formal CRN into a set of DNA based reactions...

View source: R/4domain_reactor.R

react_4domainR Documentation

Translate a formal CRN into a set of DNA based reactions according to the approach described by Soloveichik D et al. [1]

Description

This function is used to simulate a chemical circuit based on DNA made to behavior as expected from a CRN specified by the parameters. In another words, given the CRN^* passed through the parameters, another CRN_2 is created based on reactions between strands of DNA. CRN_2 is simulated using react(). The matrix behavior of CRN_2 is returned but only of the species specified in the species parameter, the behavior of the auxiliary ones are not returned. The parameters of these functions follows the same pattern of react(), only with some additions required by this approach [1] (here named as 4-domain).

Usage

react_4domain(species, ci, reactions, ki, qmax, cmax, alpha, beta, t,
  auto_buffer = TRUE, verbose = FALSE, ...)

Arguments

species

A vector with the species of the reaction. The order of this vector is important because it will define the column order of the returned behavior. The species names L[0-9]*, H[0-9]*, W[0-9]*, O[0-9]*, T[0-9]*, G[0-9]*, LS[0-9]*, HS[0-9]*, WS[0-9]* are not supported. For more information about this, see the Section of Known limitations.

ci

A vector specifying the initial concentrations of the species specified, in order.

reactions

A vector with the reactions of the CRN^*.

ki

A vector defining the constant rate of each reaction in reactions, in order.

qmax

Maximum rate constant for the auxiliary reactions.

cmax

Maximum initial concentration for the auxiliary species.

alpha, beta

Rescaling parameters.

t

A vector specifying the time interval. Each value would be a specific time point.

auto_buffer

With the default value of TRUE, this specifies if buffer modules should be generated automatically.

verbose

Be verbose and print information about the integration process with deSolve::diagnostics.deSolve(). Default value is FALSE

...

Parameters passed to deSolve::ode().

Value

A list with the attributes behavior, species, ci, reactions and ki. These attributes are:

  • behavior: A matrix with each line being a specific point in the time and each column but the first being the concentration of a species. The first column is the time interval. The behavior of the auxiliary species are also returned.

  • species : A vector with all the species used in the reactions.

  • ci : The initial concentration of each species.

  • reactions: All the reactions computed, including the ones generated according to the 4-domain approach.

  • ki : The rate constants of the reactions.

Known limitations

  • It only support uni or bimolecular reactions;

  • Because of react() known limitation, this function also doesn't support bidirectional reactions;

  • The species names L, H, W, O, T, G, LS, HS, WS with or without numbers after it are not supported because these are the reserved for the auxiliary ones. Ex.: L2 and LS2 are not supported but LT and LT2 are.

References

  • [1] \insertRefsoloveichik2010dnaDNAr

Examples

library(DNAr)

#
# 4-domain Examples
#

run_ApBeC_4d <- function() {
    result <- react_4domain(
        species   = c('A', 'B', 'C'),
        ci        = c(1e3, 1e3, 0),
        reactions = c('A + B -> C'),
        ki        = c(1e-7),
        qmax      = 1e-3,
        cmax      = 1e5,
        alpha     = 1,
        beta      = 1,
        t         = seq(0, 72000, 10)
    )
    behavior <- result$behavior[,1:(3 + 1)]
}

run_AeB_4d <- function() {
    result <- react_4domain(
        species   = c('A', 'B'),
        ci        = c(1e4, 0),
        reactions = c('A -> B'),
        ki        = c(5e-5 / 1e5),
        qmax      = 1e-5,
        cmax      = 1e5,
        alpha     = 1,
        beta      = 1,
        t         = seq(0, 72000, 10)
    )
    behavior <- result$behavior[,1:(2 + 1)]
}

run_Lotka_4d <- function() {
    result <- react_4domain(
        species   = c('X1', 'X2'),
        ci        = c(20e-9, 10e-9),
        reactions = c('X1 + X2 -> 2X2',
                      'X1 -> 2X1',
                      'X2 -> 0'),
        ki        = c(5e5,
                      1/300,
                      1/300),
        qmax      = 1e6,
        cmax      = 10e-6,
        alpha     = 1,
        beta      = 1,
        t         = seq(0, 12600, 1)
    )
    behavior <- result$behavior[,1:(2 + 1)]
}

run_consensus_4d <- function() {
    result <- react_4domain(
        species   = c('X', 'Y', 'B'),
        ci        = c(0.7 * 80e-9, 0.3 * 80e-9, 0.0),
        reactions = c('X + Y -> 2B',
                      'B + X -> 2X',
                      'B + Y -> 2Y'),
        ki        = c(2e3, 2e3, 2e3),
        qmax      = 1e6,
        cmax      = 10e-6,
        alpha     = 1,
        beta      = 1,
        t         = seq(0, 54000, 5)
    )

    # save_behavior_csv(result$behavior, '../consensus')
    #
    # save_reactions_txt(
    #     species   = result$species,
    #     cis       = result$ci,
    #     reactions = result$reactions,
    #     kis       = result$ki,
    #     filename  = '../consensus'
    # )
    #
    # save_dsd_script(
    #     species   = c('X', 'Y', 'B'),
    #     ci        = c(0.7 * 80e-9, 0.3 * 80e-9, 0.0),
    #     reactions = c('X + Y -> 2B',
    #                   'B + X -> 2X',
    #                   'B + Y -> 2Y'),
    #     ki        = c(2e3, 2e3, 2e3),
    #     qmax      = 1e6,
    #     cmax      = 10e-6,
    #     alpha     = 1,
    #     beta      = 1,
    #     t         = seq(0, 54000, 5),
    #     filename  = '../consensus.dsd'
    # )

    behavior <- result$behavior[,1:(3 + 1)]
    return(behavior)
}

#behavior <- run_ApBeC_4d()
#behavior <- run_AeB_4d()
#behavior <- run_Lotka_4d()
behavior <- run_consensus_4d()

plot_behavior(behavior)

DanielKneipp/DNAr documentation built on Jan. 7, 2023, 12:42 p.m.