Skip to contents

Processes raw absorbance spectrum data, collected as a dilution series. Expects 'parsed' data that is tidy and attached to appropriate metadata. Corrects raw data to path length of 1cm by a user-defined method, and normalises to the blanks. Plots spectra and returns processed data.

Usage

process_absorbance_spectrum(
  spectrum_csv,
  subset_rows = FALSE,
  rows_to_keep = c("C", "D"),
  columns_to_keep = c(1, 12),
  xrange = c(200, 1000),
  pl_method = "calc_blanks",
  buffer_used = "water",
  concentration_used = 0,
  temperature_used = 25,
  outfolder = ".",
  csv_only = FALSE
)

Arguments

spectrum_csv

path of a CSV file of your spectrum data

subset_rows

logical. should script take a subset of the rows (or whole table)? Defaults to FALSE.

rows_to_keep

character array. If subset_rows is TRUE, script will choose rows to keep from this list. Defaults to c("C","D").

columns_to_keep

numeric array. If subset_rows is TRUE, script will choose rows to keep from this list. Defaults to c(1,12). Note that blanks are required for normalisation, so if blanks are in column12, it is necessary to include 12 in this list.

xrange

numerical lower and upper bounds of wavelengths, between which the is subset for plotting. This can be useful for clear plates, which have high background <300nm, so can set the xrange as c(300,800) or similar.

pl_method

string denoting which method of path length normalisation to use. Options are calc_each, calc_blanks and volume. All three are always calculated (and compared in one of the output plots), but only the chosen method is used. The calc_each method uses the path length calculated from each well separately using the A900 and A975 measurements and the k-factor of the buffer used. The calc_blanks method uses the path length calculated from the blanks for all wells. Finally, the volume method uses the path length expected from the given volume, using internal path length data measured with water via the internal fpcountr::get_pathlength() function. Defaults to calc_blanks.

buffer_used

string corresponding to buffer used for assay, for use in path length determination. Must be in table used by fpcountr::get_kfactor(). To look at table, use fpcountr::view_kfactors(). Defaults to "water".

concentration_used

numeric value corresponding to concentration of buffer, for use in path length determination. Must be in the same units as used by table in fpcountr::get_kfactor(). To look at table, use fpcountr::view_kfactors(). Defaults to 0, which effectively means water. Needs changing if using different buffer!

temperature_used

numeric value corresponding to temperature of assay, for use in path length determination. Defaults to 25.

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 to FALSE.

Examples

if (FALSE) {
  spectrum <- process_absorbance_spectrum(
    spectrum_csv = "spectrum_parsed.csv",
    subset_rows = TRUE, rows_to_keep = c("C","D"), columns_to_keep = c(1:12),
    pl_method = "calc_blanks",
    buffer_used = "TBS", concentration_used = 0.005, temperature_used = 30,
    xrange = c(250,1000),
    outfolder = "spectrum"
  )
}