## only target sample and control,
## no reference, 4 replicates each
## individual efficiencies for error
## calculation
DAT <- pcrbatch(reps, 2:9, l4)
GROUP <- c("gs", "gs", "gs", "gs", "gc", "gc", "gc", "gc")
res <- ratiocalc(DAT, GROUP, which.eff = "sli", type.eff = "individual",
which.cp = "cpD2", perm = "cp", pval = "up")
## Typical for using individual efficiencies,
## this inflates the error. 95\% confidence intervals
## include 1 (no differential regulation) and errors are
## also extremely high (over 100\%).
res$conf.Sim
res$conf.Perm
res$error.Prop/res$eval.Prop
## Gets better using averaged efficiencies
## over all replicates
res2 <- ratiocalc(DAT, GROUP, which.eff = "sli", type.eff = "mean.single",
which.cp = "cpD2", perm = "cp", pval = "up")
res2$conf.Sim
res2$conf.Perm
res2$error.Prop/res$eval.Prop
## p-value indicates significant upregulation
## in comparison to randomly reallocated
## threshold cycles (similar to REST software)
res2$pval.Perm
## using reference data.
## toy example is same data as above
## but replicated as reference such
## that the ratio should be 1.
DAT2 <- pcrbatch(reps, c(2:9, 2:9), l4)
GROUP2 <- c("gs", "gs", "gs", "gs",
"gc", "gc", "gc", "gc",
"rs", "rs", "rs", "rs",
"rc", "rc", "rc", "rc")
res2 <- ratiocalc(DAT2, GROUP2, which.eff = "sli", type.eff = "mean.single",
which.cp = "cpD2", perm = "cp", pval = "up")
res2$conf.Sim
res2$conf.Perm
res2$error.Prop/res$eval.Prop
res2$pval.Perm
## same as above, but reference data
## is mirrored such that the ratio
## is squared.
DAT3 <- pcrbatch(reps, c(2:9, 9:2), l4)
GROUP3 <- c("gs", "gs", "gs", "gs",
"gc", "gc", "gc", "gc",
"rs", "rs", "rs", "rs",
"rc", "rc", "rc", "rc")
res3 <- ratiocalc(DAT3, GROUP3, which.eff = "sli", type.eff = "mean.single",
which.cp = "cpD2", perm = "cp", pval = "up")
res3$conf.Sim
res3$conf.Perm
res3$error.Prop/res$eval.Prop
res3$pval.Perm
## compare 'propagate' to REST software
## using the data from the REST 2008
## manual (http://rest.gene-quantification.info/),
## have to create dataframe with values as we do
## not use 'pcrbatch', but external cp's & eff's!
## ties define random reallocation of crossing points
## between control and sample.
## See help for 'propagate'.
EXPR <- expression((2.01^(cp.gc - cp.gs)/1.97^(cp.rc - cp.rs)))
cp.rc <- c(26.74, 26.85, 26.83, 26.68, 27.39, 27.03, 26.78, 27.32, NA, NA)
cp.rs <- c(26.77, 26.47, 27.03, 26.92, 26.97, 26.97, 26.07, 26.3, 26.14, 26.81)
cp.gc <- c(27.57, 27.61, 27.82, 27.12, 27.76, 27.74, 26.91, 27.49, NA, NA)
cp.gs <- c(24.54, 24.95, 24.57, 24.63, 24.66, 24.89, 24.71, 24.9, 24.26, 24.44)
DAT <- cbind(cp.rc, cp.rs, cp.gc, cp.gs)
res <- propagate(EXPR, DAT, do.sim = TRUE, do.perm = TRUE, ties = c(1, 1, 2, 2))
res$conf.Sim
res$conf.Perm
res$eval.Prop
res$error.Prop
## Does error propagation in qPCR quantitation make sense?
## In ratio calculations based on (E1^cp1)/(E2^cp2),
## only 2\% error in each of the variables result in
## over 50\% propagated error!
x <- NULL
y <- NULL
for (i in seq(0, 0.1, by = 0.01)) {
E1 <- c(1.7, 1.7 * i)
cp1 <- c(15, 15 * i)
E2 <- c(1.7, 1.7 * i)
cp2 <- c(18, 18 * i)
DF <- cbind(E1, cp1, E2, cp2)
res <- propagate(expression((E1^cp1)/(E2^cp2)), DF, type = "stat", plot = FALSE)
x <- c(x, i * 100)
y <- c(y, (res$error.Prop/res$eval.Prop) * 100)
}
plot(x, y, xlim = c(0, 10), lwd = 2, xlab = "c.v. [%]", ylab = "c.v. (prop) [%]")
Run the code above in your browser using DataLab