data_selection: Extracts samples information from a lum_export object or...

Description Usage Arguments Details Value Examples

View source: R/data_selection.R

Description

Extracts from a lum_export or data.frame object controls, dilutions points, background and samples to be calibrated. These files can be merged to an expected concentration and flag dataset.

Usage

1
2
3
4
5
data_selection(x, ecfile = NULL, flagsfile = NULL, backname = "Back",
    stanname = "Stan", posname = "Con", unkname = NULL,
    byvar.ecfile = c("analyte", "sample"), byvar.flagsfile = c("well",
    "analyte"), fsample = "sample", fanalyte = "analyte", fbatch = "plate",
    ...)

Arguments

x

a lum_export object or data.frame with samples information.

ecfile

a data.frame or CSV path file with the expected concentration in order to merge to x.

flagsfile

a data.frame or CSV path with the flags information in order to merge to x.

backname

character vector or list of the background samples identification of x.

stanname

character vector or list of the standard points identification of x.

posname

character vector or list of the positive controls identification of x.

unkname

character vector or list of the samples identification of x. Default NULL.

byvar.ecfile

character vector of the merging variable(s) of x and ecfile.

byvar.flagsfile

character vector of the merging variable(s) of x and flagsfile.

fsample

character vector of the name of the sample variable.

fanalyte

character vector of the name of the analyte variable.

fbatch

character vector of the name of the Batch variable.

...

other options. Ignored.

Details

Default method for identifying background, standard and positives samples is to define a character vector of length one and apply agrep functions in order to extract databases. Samples to be calibrated (unknowns) are identified as the remaining ones (default NULL).

If the arguments are defined as a list the function will subset exactly that information from x object.

The expected concentration file is merged based on byvar.ecfile. Only applies when ecfile is not NULL. Same applies for flags file. A variable named 'flag' must be in flags data in order to perform the merge.

Value

The name of the batch in a list format with the following components: background, standard, positive and unknowns datasets.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Load data
data(ecdata)
data(mfidata)

dat <- subset(mfidata,plate=="plate_1" & analyte=="FGF")

# Example 1
sdf <- data_selection(dat)

lapply(sdf$plate_1, function(x) head(x))

# Example 2 (merge ecdata)
sdf <- data_selection(dat, ecfile = ecdata,
             byvar.ecfile=c("analyte","sample"))

lapply(sdf$plate_1, function(x) head(x))

# Example 3 (extract specific samples names with list)
sdf <- data_selection(dat,
             stanname=list("Standard10"),
             backname = list("Background0"),
             posname = list("Control1","Control2"),
             unkname = list("B_sid_13_CSP"))

lapply(sdf$plate_1, function(x) head(x))

# Example 4 (extract aproximate names samples)
sdf <- data_selection(dat,
             stanname="Standard1",
             backname = "Background0",
             posname = "Control1",
             unkname = "B_sid_13_CSP")

lapply(sdf$plate_1, function(x) (x))

drLumi documentation built on May 2, 2019, 2:45 p.m.