1. Dimerization model

1.1. Dimerization model in equilibration


1.2. Kinetic model of dimerization


require(reshape2); require(ggplot2); require(grid)
knitr::opts_chunk$set(fig.height = 4, fig.width = 4)
require(pldfit)

2. Simulation & plotting:

# simulate the data use the following parameters
# simulate the data use the following parameters
par = list(kon    = 2e2, 
           koff   = 1e-2, 
           rmax   = 1,
           concs  = 1e-5 * (2^(0:5)),
           time   = seq(0, 300, length.out = 2501),
           t2     = 150)

# simulation
model = "dimer"
xySimulated <- kinsim(par = par, model = model, noise = 0.01) 

# plot the simulation
# ySimulated$Time = time; 
xy <-reshape2::melt(data = xySimulated, 
                     id.vars = "Time", 
                     measure.vars = rev(1:6), 
                     variable.name = "Conc")

g <- ggplot()  + xlab("Time (sec)") + ylab("Response (nm)") +
    labs(linetype= 'title') + 
    ylim(-0.025,1) + 
    theme_classic() + 
    theme(legend.position=c(0.9, 0.65),
          legend.text=element_text(size = rel(1)),
          legend.key.size=unit(0.9,"line"));
g <- g + geom_line(data = xy, aes(x = Time, y = value, color = Conc));
print(g)

3. Fitting & plotting:

# init
initPar_test = list(kon =1,     koff = 1,   rmax = 1) 
lower        = list(kon =1e-04, koff=1e-04, rmax = 0.01);
upper        = list(kon =1e04,  koff=1e04,  rmax = 10);
concs = par$concs
t2    = par$t2 # t2 is the beginning of the diassociation.
dat   = xySimulated

# Fit
model = "dimer"
fit <- kinfit(par = initPar_test, 
              dat = dat, 
              concs = concs, 
              t2 = t2, 
              lower = lower,
              upper = upper,
              model = "dimer")
names(fit)
cbind(simulation= par, init = initPar_test, fitting = fit$par)

#prodict and plot

predFit = kinsim(par = fit$par, model = model, noise = 0) 
predFit <- reshape2::melt(predFit, id.vars = "Time")
g + geom_line(data=predFit, aes(x = Time, y = value, group = variable) ) 


huangrenhuai/pldfit documentation built on May 17, 2019, 9:10 p.m.