#' Apply dCt calculation over rows
#'
#' A helper function to apply the \code{\link{dct}} function to each row of the data.frame containing the qPCR data
#'
#' @param data a data.frame containing the qPCR data with averaged technical replicates as generated by \code{\link{ct_avg_fun}}.
#' @param calibsample a character string with the name of the sample to be used as reference for dct calculation. This sample will have an
#' expression value of 1 for all targets and the rest of the samples will have values expressing their relative expression to this sample.
#' @param eff a data.frame containing the efficiency values for each primer pair as generated in \code{\link{qpcr_analysis}}
#'
#' @return a data.frame containing the qPCR data with an additional column containing the dCt values
#' @export
#'
#' @examples
dct_apply <- function (data, calibsample, eff) { # helper function to apply the dct function to each row
ctcalib <- data[data$sample == calibsample, "ctaverage"]
names(ctcalib) <- data[data$sample == calibsample, "primers"]
dct_values <- apply(data, 1, dct, calib = ctcalib, eff.matrix = eff)
new_data <- cbind(data, "dct" = dct_values)
new_data
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.