Learn R Programming

PvSTATEM (version 0.2.2)

process_plate: Process a plate and save output values to a CSV

Description

Depending on the normalisation_type argument, the function will compute the RAU or nMFI values for each analyte in the plate. RAU is the default normalisation type.

The behaviour of the function, in the case of RAU normalisation type, can be summarised as follows:

  1. Adjust blanks if not already done.

  2. Fit a model to each analyte using standard curve samples.

  3. Compute RAU values for each analyte using the corresponding model.

  4. Aggregate computed RAU values into a single data frame.

  5. Save the computed RAU values to a CSV file.

More info about the RAU normalisation can be found in create_standard_curve_model_analyte function documentation create_standard_curve_model_analyte or in the Model reference Model.

In case the normalisation type is nMFI, the function will:

  1. Adjust blanks if not already done.

  2. Compute nMFI values for each analyte using the target dilution.

  3. Aggregate computed nMFI values into a single data frame.

  4. Save the computed nMFI values to a CSV file.

More info about the nMFI normalisation can be found in get_nmfi function documentation get_nmfi.

Usage

process_plate(
  plate,
  filename = NULL,
  output_dir = "normalised_data",
  write_output = TRUE,
  normalisation_type = "RAU",
  data_type = "Median",
  include_raw_mfi = TRUE,
  adjust_blanks = FALSE,
  verbose = TRUE,
  reference_dilution = 1/400,
  ...
)

Value

a data frame with normalised values

Arguments

plate

(Plate()) a plate object

filename

(character(1)) The name of the output CSV file with normalised MFI values. If not provided or equals to NULL, the output filename will be based on the normalisation type and the plate name, precisely: {plate_name}_{normalisation_type}.csv. By default the plate_name is the filename of the input file that contains the plate data. For more details please refer to Plate.

If the passed filename does not contain .csv extension, the default extension .csv will be added. Filename can also be a path to a file, e.g. path/to/file.csv. In this case, the output_dir and filename will be joined together. However, if the passed filepath is an absolute path and the output_dir parameter is also provided, the output_dir parameter will be ignored. If a file already exists under a specified filepath, the function will overwrite it.

output_dir

(character(1)) The directory where the output CSV file should be saved. Please note that any directory path provided will create all necessary directories (including parent directories) if they do not exist. If it equals to NULL the current working directory will be used. Default is 'normalised_data'.

write_output

(logical(1)) whether or not to write the output to a file specified by filename parameter. The default is TRUE.

normalisation_type

(character(1)) type of normalisation to use. Available options are:
c(RAU, nMFI).

data_type

(character(1)) type of data to use for the computation. Median is the default

include_raw_mfi

(logical(1)) include raw MFI values in the output. The default is TRUE. In case this option is TRUE, the output dataframe contains two columns for each analyte: one for the normalised values and one for the raw MFI values. The normalised columns are named as AnalyteName and AnalyteName_raw, respectively.

adjust_blanks

(logical(1)) adjust blanks before computing RAU values. The default is FALSE

verbose

(logical(1)) print additional information. The default is TRUE

reference_dilution

(numeric(1)) target dilution to use as reference for the nMFI normalisation. Ignored in case of RAU normalisation. Default is 1/400. It should refer to a dilution of a standard curve sample in the given plate object. This parameter could be either a numeric value or a string. In case it is a character string, it should have the format 1/d+, where d+ is any positive integer.

...

Additional arguments to be passed to the fit model function (create_standard_curve_model_analyte)

Examples

Run this code

plate_file <- system.file("extdata", "CovidOISExPONTENT_CO_reduced.csv", package = "PvSTATEM")
# a plate file with reduced number of analytes to speed up the computation
layout_file <- system.file("extdata", "CovidOISExPONTENT_CO_layout.xlsx", package = "PvSTATEM")

plate <- read_luminex_data(plate_file, layout_file, verbose = FALSE)

example_dir <- tempdir(check = TRUE) # a temporary directory
# create and save dataframe with computed dilutions
process_plate(plate, output_dir = example_dir)

# process plate without adjusting blanks and save the output to a file with a custom name
process_plate(plate,
  filename = "plate_without_blanks_adjusted.csv",
  output_dir = example_dir, adjust_blanks = FALSE
)


# nMFI normalisation
process_plate(plate,
  output_dir = example_dir,
  normalisation_type = "nMFI", reference_dilution = 1 / 400
)

Run the code above in your browser using DataLab