Creates adpcr and dpcr objects from data.

create_dpcr(data, n, exper = "Experiment 1", replicate = NULL,
  assay = "Unknown", type, v = 1, uv = 0, threshold = NULL, adpcr,
  col_names = NULL, row_names = NULL, panel_id = NULL)

Arguments

data
a numeric vector or matrix of data from dPCR experiments. Data frames will be converted to matrices.
n
integer equal to number of partitions.
exper
The id of experiments.
replicate
The id of technical replicates.
assay
The name or id of assays.
type
Object of class "character" defining type of data. Could be "nm" (number of molecules per partition), "tnp" (total number of positive wells in the panel), "fluo" (fluorescence), "np" (status (positive (1) or negative(0)) of each droplet) or"ct" (threshold cycle).
v
The volume of partitions [nL].
uv
The volume uncertainty of partitions [nl].
threshold
numeric value giving the threshold above which droplet is counted as positive. Ignored if adpcr is TRUE.
adpcr
logical. If TRUE, function creates adpcr object. If FALSE, function creates dpcr object.
col_names
character vector of column names in array. Ignored if not adcpr.
row_names
character vector of row names in array. Ignored if not adcpr.
panel_id
factor vector of panel IDs (or names). Ignored if not adcpr.

Value

An adpcr or dpcr object.

Details

This constructor function assists in creation of objects used by other functions of the package. It is also responsible for checking the correctness of arguments.

A warning is prompted whenever any of arguments is converted to other type.

Note

create_dpcr is a preferred to calling directly new.

Currently only end-point measurements are supported.

See also

Streamlined, but more limited version: df2dpcr

Examples

# Droplet digital PCR example sample_runs <- matrix(rpois(60, lambda = 1.5), ncol = 2) ddpcr1 <- create_dpcr(sample_runs[,1], n = 30L, threshold = 1, type = "nm", adpcr = FALSE) ddpcr2 <- create_dpcr(sample_runs[,2], n = 30L, threshold = 1, type = "nm", adpcr = FALSE) plot_vic_fam(ddpcr1, ddpcr2)
# Array digital PCR example sample_adpcr <- create_dpcr(rpois(765, lambda = 0.8), n = 765L, type = "nm", adpcr = TRUE) plot_panel(sample_adpcr, 45, 17)