sets_read {bioset}R Documentation

Read sets and calculate concentrations and variability.

Description

Basically a wrapper around set_read(), set_calc_concentrations() and set_calc_variability().

For a gentler introduction see examples and Vignette "Introduction".

May write the processed data into two files: data_samples.csv, data_all.csv.

Usage

sets_read(sets, cal_names, cal_values, exclude_cals = list(),
  additional_vars = c("name"), additional_sep = "_", sep = ",",
  dec = ".", path = ".", file_name = "set_#NUM#.csv",
  model_func = fit_linear, plot_func = plot_linear,
  interpolate_func = interpolate_linear, write_data = TRUE,
  use_written_data = FALSE)

Arguments

sets

The number of sets (e.g. 3`` attempts to readset_1.csv,set_2.csv,set_3.csv), seefile_name'.

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).

exclude_cals

A list of calibrators to exclude, e.g.: list(set1 = c("CAL1")).

additional_vars

Vector of strings containing the names for the additional columns.

additional_sep

String / RegExp that separates additional vars, e.g.: "ID_blue_cold" with additional_sep = "_" will be separated into three columns containing "ID", "blue" and "cold". If the separated data would exceed the columns in additional_vars the last column will contain a string with separator (e.g.: "blue_cold"). If data is missing NA is inserted.

sep

Separator used in the csv-file, either "," or ";" (see utils::read.csv()).

dec

The character used for decimal points (see utils::read.csv()). "AUTO" will result in "." if sep is "," and "," for ";".

path

The path to the file (no trailing "/" or "\" !).

file_name

Name of the file from which to read the data. May contain "#NUM#" as a placeholder if you have multiple files.

model_func

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

plot_func

Function used to display the fitted line.

interpolate_func

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

write_data

Write the calculated data into data_all.csv and data_samples.csv?

use_written_data

Try to read data_all.csv and data_read.csv instead of raw data. Useful if you have to re-run the script, but the raw data does not change.

Value

A list:

See Also

Other set functions: set_calc_concentrations, set_calc_variability, set_read

Examples

# files "set_1.csv" and "set_2.csv" containing raw values and the
# corresponding lables (consisting of ID and point in time like
# "ID_TIME")
read.csv(
  file = system.file("extdata", "set_1.csv", package = "bioset"),
  header = FALSE,
  colClasses = "character"
)
read.csv(
  file = system.file("extdata", "set_2.csv", package = "bioset"),
  header = FALSE,
  colClasses = "character"
)

# the known concentration of the calibrators contained in these plates
cals <- c(10, 20, 30, 40)      # ng / ml
names(cals) <- c("CAL1", "CAL2", "CAL3", "CAL4")

# read both files into a tibble
# columns "ID" and "time" separated by "_"
# and calculate concentrations using the calibrators
result <- sets_read(
  sets = 2,                      # expect 2 plates
  path = system.file("extdata", package = "bioset"),
  additional_vars = c("ID", "time"),  # expect the labels to contain ID and
                                      # point in time
  additional_sep = "_",               # separated by "_"
  cal_names = names(cals),       # that's what they're called in the files
  cal_values = cals,             # the concentration has to be known
  write_data = FALSE             # do not store the results in csv-files
)

# inspect results (all values contained in the two original files)
result$all
# (all values except CAL1-4)
result$samples
# inspect goodness of fit
# for plate 1
result$set_1$plot
result$set_1$model
# for plate 2
result$set_2$plot
result$set_2$model

[Package bioset version 0.2.3 Index]