Process experimental data (normalise, correct and calibrate)
Source:R/process_plate.R
process_plate.Rd
Processes experimental (fluorescence and absorbance) data from microplate
readers. Expects 'parsed' data that is tidy and attached to appropriate
metadata. Numerous arguments offer options to customise how and whether
normalisation, correction and/or calibration is carried out. Data can be
timecourse (kinetic) data or single timepoint (endpoint) data, and can
contain fluorescence data only or include absorbance (OD) data to enumerate
cell density. Originally based on flopr::process_plate()
but with numerous
changes. First, the function normalises optical density readings (if present)
to media/buffer wells, and fluorescence readings, either to media/buffer
wells or to cellular autofluorescence. Fluorescence channels must be
specified in flu_channels
, the blank wells in blank_wells
, and the
reading to be used for optical density in od_name
. The cellular
autofluorescence model can be set with af_model
on the negative
(neg_well
) wells, or set to NULL
. Second, if do_quench_correction
is
TRUE, the 'quenching' or attenuation of fluorescence measurements by cells is
corrected for according to the cell density measured. This requires the
specification of od_type
as "OD600" or "OD700". Third, if do_calibrate
is
TRUE, normalised values for both fluorescence and optical density are
converted into meaningful units. Here, the paths to conversion factor CSV
files must be provided as od_coeffs_csv
for OD and fluor_coeffs_csv
for
fluorescence. For fluorescence measurements, each calibration must be
specified by flu_slugs
to represent the FP used, flu_gains
to provide the
gain, and flu_labels
to specify how the relevant plots should be labelled,
(e.g. flu_slugs = c("mcherry", "mtagbfp2")
, flu_gains = c(60,80)
,
flu_labels = c("RFP, BFP")
).
Usage
process_plate(
data_csv,
blank_well = "A1",
timecourse = TRUE,
od_name = "OD",
flu_channels = c("green1green2"),
flu_channels_rename = NULL,
af_model = "spline",
neg_well = "A2",
do_quench_correction = FALSE,
od_type,
do_calibrate = FALSE,
instr,
flu_slugs = c(),
flu_gains = c(),
flu_labels = c(),
od_coeffs_csv,
fluor_coeffs_csv,
outfolder = ".",
csv_only = FALSE
)
Arguments
- data_csv
path to a CSV file containing parsed plate reader data
- blank_well
the well coordinates of one or more media blanks. Defaults to "A1".
- timecourse
logical. Is the data timecourse/kinetic data and does it include a variable called 'time'?
- od_name
the column name for the optical density data. Defaults to "OD". If no OD measurements were taken, use
NULL
.- flu_channels
the column names for the fluorescence data. Defaults to "green1green2".
- flu_channels_rename
if specified, what to change the flu_channels column names to, before computing normalisations and calibrations. Can be useful if the channel_name in the calibration file is named differently from the columns in the data file. Needs to be same length as flu_channels, if not all require changing, specify them anyway to allow positional replacement (first element in flu_channels_rename replaces first in flu_channels, etc.). Defaults to NULL.
- af_model
model used to fit negative control autofluorescence. For now these include "polynomial", "inverse_poly", "exponential", "spline" and "loess". If set to NULL, no model is used, and fluorescence is normalised akin to OD: by subtracting the value for the blanks. Defaults to "spline".
- neg_well
the well coordinates of a non-fluorescent control. Defaults to "A2".
- do_quench_correction
logical. Should function correct for anticipated quenching of fluorescence, depending on the cell density?
- od_type
Which OD-type was used? Required for quench correction. "OD600" or "OD700".
- do_calibrate
logical. Should function convert OD and fluorescence data to calibrated units? Defaults to FALSE.
- instr
character string to represent instrument. If do_calibrate = TRUE, used for filtering
od_coeffs_csv
andfluor_coeffs_csv
files for conversion factors of the relevant instrument.- flu_slugs
character array representing fluorescent proteins (format = FPbase slug). If do_calibrate = TRUE, used for filtering
fluor_coeffs_csv
for conversion factors of the relevant FP.- flu_gains
numeric array representing gains of each fluorescent channel. If do_calibrate = TRUE, used for filtering
fluor_coeffs_csv
for conversion factors of the relevant gain.- flu_labels
If do_calibrate = TRUE, the column names to be given to each calibration. May be identical to flu_slug or flu_channel, but recommended is to make it obvious which FP is being calibrated, e.g. "mCherry", as channel names may be non-specifically named e.g. "red1red1". Needs to be same length as flu_slugs and flu_gains.
- od_coeffs_csv
if do_calibrate = TRUE, path of the CSV file containing conversion factors for optical density
- fluor_coeffs_csv
if do_calibrate = TRUE, path of the CSV file containing predicted conversion factors for the fluorescent channels
- outfolder
path to folder where output files should be saved. Defaults to current working directory.
- csv_only
logical. Saves only CSV files as outputs when
TRUE
. Defaults toFALSE
.
Value
a data.frame with columns for raw plate reader data, normalised data and, if do_calibrate = TRUE, calibrated OD and FP data
Examples
if (FALSE) {
processed_data <- process_plate(
data_csv = "mcherry_parsed.csv",
blank_well = c("A11"),
od_name = "OD600", flu_channels = c("red1"), flu_channels_rename = c("red1red1"),
af_model = NULL,
do_quench_correction = TRUE, od_type = "OD700",
do_calibrate = TRUE, instr = "spark1",
flu_slugs = c("mcherry"), flu_gains = c(80), flu_labels = c("mcherry"),
od_coeffs_csv = "od_coeffs.csv", fluor_coeffs_csv = "flu_coeffs.csv",
outfolder = file.path("data_processed")
)
}