Calculates detectability for each target based on the aboveLOD matrix output of lod() function. Detectability is percent of samples above LOD for that target.

detectability(
  aboveLOD_matrix,
  sample_subset = NULL,
  sample_groups = NULL,
  exclude_targets = NULL
)

Arguments

aboveLOD_matrix

aboveLOD matrix output from lod() function. Rows are targets and columns are samples.

sample_subset

A vector of column names or numeric column indices that represent the sample subset that detectability will be calculated for. Default uses all columns. NCs and IPCs should probably be excluded.

sample_groups

A string vector defining sample types / identities that represent the sample type subsets that detectability should be calculated for. Default value NULL provides overall detectability assuming all samples are of the same type (e.g., plasma). NOTE that sample groups must be the same length and in the same order as sample_subset.

exclude_targets

A vector of row names or numeric row indices representing the targets that should be excluded from detectability calculation. For example, one might want to exclude internal controls. Default is NULL, which includes all targets in the aboveLOD_matrix.

Value

A nested list containing detectability information. The list has two high-level names: "all" and "sample_group". The "all" name corresponds to detectability information for all samples combined as a single unit. If the sample_groups parameter is not NULL, the "sample_group" name provides detectability data for unique sample groups. The nested list has three names to access detectability and sample information.

sampleNumber

The number of samples for each group.

detectability

A named vector of detectability values in percentages. The names correspond to target row names.

detectable

A named logical vector indicating whether detectability is above 50% for each target. The names correspond to target row names.