Learn R Programming

WES (version 1.0.0)

calc_n_copies: Calculate number of target copies

Description

This function calculates the quantitative value of the qPCR Ct value. Cycle threshold here is converted into the estimated number of gene target copies (e.g. viral load for a viral pathogen) by fitting a log linear model to the standard curve data and then using that model to find a point estimate for the provided Ct values.

Usage

calc_n_copies(ct_values, target_names, standard_curves)

Value

Vector

Arguments

ct_values

A numeric vector giving the Ct value for each observation.

target_names

A character vector giving the target names for each element in 'ct_values'.

standard_curves

A data.frame containing results from standard curve dilution experiment. Elements in 'target_names' must map to either 'target_name_unique' or 'target_name_concise'. See package data object template_WES_standard_curves for template.

Examples

Run this code

df <- template_WES_data[template_WES_data$target_name == 'target_1',]
sc <- template_WES_standard_curve[template_WES_standard_curve$target_name == 'target_1',]

tmp <- calc_n_copies(ct_values = df$ct_value,
                     target_names = df$target_name,
                     standard_curves = sc)

df$n_copies <- tmp
head(df)

Run the code above in your browser using DataLab