calcOutlierMap: Calculate MAD Outlier Map

View source: R/calcOutlierMap.R

calcOutlierMapR Documentation

Calculate MAD Outlier Map

Description

Calculate the median absolute deviation (statistical) outliers measurements and fold-change criteria from an ADAT. Two values are required for the calculation: median absolute deviation (MAD) and fold-change (FC). Outliers are determined based on the result of both 6*MAD and x*FC , where x is the number of fold changes defined.

Usage

calcOutlierMap(
  data,
  anno_tbl = NULL,
  apt.order = c(NA, "dilution", "signal"),
  sample.order = NULL,
  fc.crit = 5
)

## S3 method for class 'outlier_map'
print(x, ...)

Arguments

data

A soma_adat object containing RFU feature data.

anno_tbl

An annotations table produced via getAnalyteInfo(). Used to calculate analyte dilutions for the matrix column ordering. If NULL, a table is generated internally from data (if possible), and the analytes are plotted in dilution order.

apt.order

Character. How should the columns/features be ordered? Options include: by dilution mix ("dilution"), by median overall signal ("signal"), or as-is in data (default).

sample.order

Either a character string indicating the column name with entries to be used to order the data frame rows, or a numeric vector representing the order of the data frame rows. The default (NULL) leaves the row ordering as it is in data.

fc.crit

Integer. The fold change criterion to evaluate. Defaults to 5x.

x

An object of class "outlier_map".

...

Arguments for S3 print methods.

Details

For the S3 plotting method, see plot.Map().

Value

A list of class c("outlier_map", "Map") containing:

matrix

A boolean matrix of TRUE/FALSE whether each sample is an outlier according the the stated criteria.

x.lab

A character string containing the plot x-axis label.

title

A character string containing the plot title.

rows.by.freq

A logical indicating if the samples are ordered by outlier frequency.

class.tab

A table containing the frequencies of each class if input sample.order is defined as a categorical variable.

sample.order

A numeric vector representing the order of the data frame rows.

legend.sub

A character string containing the plot legend subtitle.

Functions

  • print(outlier_map): There is a S3 print method for class "outlier_map".

Author(s)

Stu Field

See Also

Other Calc Map: getOutlierIds(), plot.Map()

Examples

dat <- example_data |> dplyr::filter(SampleType == "Sample")
om <- calcOutlierMap(dat)
class(om)

# S3 print method
om

# `sample.order = "frequency"` orders samples by outlier frequency
om <- calcOutlierMap(dat, sample.order = "frequency")
om$rows.by.freq
om$sample.order

# order samples field in Adat
om <- calcOutlierMap(dat, sample.order = "Sex")
om$sample.order

SomaDataIO documentation built on June 8, 2025, 10:13 a.m.