getBgnd: Determine Background Value to Define Positive Samples

View source: R/getBgnd.R

getBgndR Documentation

Determine Background Value to Define Positive Samples

Description

Determine the optimum background value between "positive" and "negative" values in the argument param. The group used to determine the background is specified with the argument by.

Usage

getBgnd(df, by, param = "mfi", mult = 2.5, log = TRUE)

Arguments

df

Annotated data.frame with fluorescent values to evaluate.

by

Character string identifying the grouping factor in df used to determine background values. Values of "row" or "column" will split the data by row or column before identifying background values. If by is "row" or "column" or if by is not provided, values associated with type == "control", moi == 0 or x == 0 will be used to determine the background. To override the search for control values in each row or column, change the variable name of interest to something other than "row" or "column."

param

Variable name in df as a character string to evaluate, typically "mfi" or "y".

mult

Multiplier constant passed to findBgnd.

log

logical flag passed to findBgnd to use log-transformed values.

Details

The value between positive and negative values in param will be determined according to by. If this value is "control" or is missing, all values identified as type == "control" or with x/moi == 0 will be treated as background. If this value is "row" or "column", any values with type == "control" or with x/moi == 0 in each row or column will be used to define the background for that row or column. If true zero moi values are not present, the background will be determined by Otsu's method for the groups defined with the variable by. Typically this would be "well" or "file" but can be any factor variable in the data.frame df. The background value will be determined by the logic in findBgnd.

The annotated data frame must have the variable identified in param and, if 'by' is missing, a variable named either "x" or "moi". If 'by' is provided, variable of this name must exist as a factor in the argument df.

Value

A named numeric vector of background values.

See Also

getZero

Examples

# Subset of data by_stack
  f <- system.file("extdata", "by_stack/file005.tif", package = "virustiter")
  img <- getImages(f)
  v <- parseImages(img)

# Get background value for grouping value of "file"
  getBgnd(v, by = "file")


ornelles/virustiter documentation built on March 29, 2024, 8:30 p.m.