processLum: Process raw Luminex files

Description Usage Arguments Details Value

View source: R/processLum.R

Description

Process data for a single antigen: fit a standard curve, establish bounds, normalize samples, and save a plot showing the fit and the samples.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
processLum(antigen, fname, fdir = NULL, plotdir = NULL,
  xvar = "logConc", yvar = "logMFI", model = "sigmoid",
  Alow = NULL, asym = TRUE, trim.flat = TRUE, interactive = TRUE,
  monot.prompt = FALSE, rm.before = FALSE, rm.after = interactive,
  maxrm = 2, set.bounds = interactive, overwrite.bounds = FALSE,
  ifix = NULL, dtype = "Median", stdstr = "std|stand",
  bgstr = "blank|background", stddil = NULL, smpdil = 1000,
  optmethod = "Nelder-Mead", maxit = 5000, nwells = NULL, nsep = 2,
  ncolmax = 105, dformat = "%m/%d/%Y", width = 6, height = 6,
  ptcol = "firebrick3", rugcols = c("cadetblue", "purple", "red"), ...)

Arguments

antigen

character string.

fname

name of the file that contains raw data.

fdir

directory where the file is located (alternatively, full path can be included in fname).

plotdir

directory for the plots to be saved.

xvar, yvar

character strings for the variables used to fit a standard curve.

model

the model to be fit.

Alow

lower asymptote for the sigmoid model. If NULL, the lower asymptote will be estimated, adding an extra parameter to the model. To fix the asymptote at the level of background, specify "bg". Numeric value of Alow will force the asymptote to be fixed at the provided level.

asym

if TRUE, asymmetry in the fit is allowed, adding an extra parameter to the model.

trim.flat

logical value determining how the values of yvar are trimmed. If TRUE, they will be trimmed at the bounds where the curve starts to flatten out (automatically determined as maxima of the third derivative of the function). If FALSE, yvar will be trimmed at extrema, defined as the range of standards or asymptotes of the fit (whichever are less extreme).

interactive

logical value. If TRUE, the user is prompted to evaluate the standards (and/or the fit) and asked to remove outliers if needed. TRUE value takes precedence over rm.before and rm.after: if both are FALSE, rm.after is reset to TRUE.

monot.prompt

if TRUE, the user is prompted to evaluate the standards and possibly remove outliers if the standards are not monotonic (increasing). FALSE value is ignored if interactive is TRUE.

rm.before

logical value indicating if potential outliers should be removed before the model is fitted. Ignored if interactive is FALSE.

rm.after

logical value indicating if potential outliers should be removed after the model is fitted. Ignored if interactive is FALSE.

maxrm

maximum number of outliers to remove.

set.bounds

if TRUE, the user is given the option to manually set the bound that is not set automatically. In that case, the prompt appears even if interactive is FALSE.

overwrite.bounds

logical value indicating the option to overwrite automatically set bounds. Ignored if interactive is FALSE.

ifix

sorted integer vector of length 3 with indices of standards to be used for getting starting values for optimization.

dtype

character string for data type in the file.

stdstr

character string indicating standards in the file's "Sample" column. Not case sensitive. If "" (empty string), standards will be determined by the pattern "1/" only.

bgstr

character string indicating background in the file's "Sample" column. Not case sensitive.

stddil

a vector of standard dilutions. If NULL, dilutions are inferred from the file's "Sample" column. Non-null value can be used to exclude some dilutions from model fitting.

smpdil

dilution used for the samples.

optmethod

method to be used in optimization.

maxit

maximum number of iterations in optimization.

nwells

number of wells. If NULL, inferred from the file.

nsep

number of lines separating different data types in the file.

ncolmax

maximum number of columns in the file.

dformat

date format in the file.

width, height

optional parameters for the final saved plot.

ptcol

color of the standard points on the plot.

rugcols

vector of three colors for the rugplot, which indicates sample values (inside the bounds, between the bounds and extrema, and beyond extrema).

...

further graphical parameters.

Details

details to be added

Value

A list of length two. The first element is a data frame that contains the results; the second is a character string with a flag containing information about removed points, failure to fit the model, manually set bounds, and/or an optional custom note provided by the user during an interactive model-fitting procedure. ***optional return of the number of trimmed samples (then a list of length three)***


Greenhouse-Lab/lumfit documentation built on July 20, 2020, 8 p.m.