set_calc_concentrations: Calculate concentrations for the set using contained...

Description Usage Arguments Details Value See Also Examples

Description

If the data set is generated, for example by reading extinction rates or relative light units from a plate, these raw values can be converted to concentrations using data fields with known concentrations (calibrators).

Usage

1
2
3
4
set_calc_concentrations(data, cal_names, cal_values, col_names = name,
  col_values = value, col_target = conc, col_real = real,
  col_recov = recovery, model_func = fit_linear,
  interpolate_func = interpolate_linear)

Arguments

data

A tibble containing the data.

cal_names

A vector of strings containing the names of the samples used as calibrators.

cal_values

A numeric vector with the known concentrations of those samples (must be in the same order).

col_names

The name of the column where the cal_names can be found.

col_values

The name of the column holding the raw values.

col_target

The name of the column to created for the calculated concentration.

col_real

The name of the column to create for the known concentrations.

col_recov

The name of the column to create for the recovery of the calibrators.

model_func

A function generating a model to fit the calibrators, e.g. fit_linear(), fit_lnln().

interpolate_func

A function used to interpolate the concentrations of the other samples, based on the model, e.g. interpolate_linear(), interpolate_lnln().

Details

If the data set contains samples with known concentrations (calibrators) those can be used to interpolate the concentrations of the other samples.

Value

A tibble containing all original and additional columns.

See Also

Other set functions: set_calc_variability, set_read, sets_read

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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# generate data
library("tibble")

data <- tibble(
  name = c("CAL1", "CAL2", "CAL3", "A", "B", "C"),
  value = c(1, 5, 10, 2, 4, 6)
)

data

# the known concentration of the calibrators
cals <- c(1, 5, 10)
names(cals) <- c("CAL1", "CAL2", "CAL3")

set_calc_concentrations(
  data = data,
  cal_names = names(cals),
  cal_values = cals
)

# to set column names use notation like in dplyr / tidyverse
# set the name of the column holding the final concentration to "my_protein"
set_calc_concentrations(
  data = data,
  cal_names = names(cals),
  cal_values = cals,
  col_target = my_protein
)

## Not run: 
# notice that col_target is given a string
# this will fail
set_calc_concentrations(
  data = data,
  cal_names = names(cals),
  cal_values =  cals,
  col_target = "my_protein"
)

## End(Not run)

# simulate data which has to be transformed to get a good fit
cals <- exp(cals)
data$value <- exp(data$value)

# use ln-transformation on values and known concentrations prior to
# fitting a model

data <- set_calc_concentrations(
  data = data,
  cal_names = names(cals),
  cal_values = cals,
  model_func = fit_lnln,
  interpolate_func = interpolate_lnln
)

data

# inspect goodnes of fit
plot_lnln(data$real, data$value)

rm(cals, data)

bioset documentation built on May 2, 2019, 4 p.m.