Skip to contents

For each sample group (`group` in xcms sample metadata, also referred to as `sample.group` in MSdev sample sheets), computes the relative standard deviation (RSD = SD / mean) of feature intensities across biological replicates within that group, then plots the RSD distribution across features.

Usage

plot_TRACE_RSD(
  object,
  i.pol = 0,
  sample.groups = NULL,
  exclude.blank = TRUE,
  min.replicates = 2,
  binwidth = 0.05,
  rsd.max = 1,
  return.data = FALSE
)

Arguments

object

MSdev object with processed xcms data in `object@xcmsData`.

i.pol

Polarity index. `0` for negative and `1` for positive.

sample.groups

Character vector of sample groups to include. Default uses all `group` levels with at least `min.replicates` samples, optionally excluding `Blank` and `QC`.

exclude.blank

Logical. If `TRUE`, exclude `Blank` and `QC` groups when `sample.groups` is `NULL`.

min.replicates

Minimum number of samples required in a group to calculate RSD.

binwidth

Histogram bin width for the RSD histogram.

rsd.max

Upper x-axis limit for RSD plots.

return.data

Logical. If `TRUE`, return a list with `plot` and `data`.

Value

A patchwork object combining the histogram and ECDF plots, or a list with `plot`, `p1`, `p2`, and `data` when `return.data = TRUE`.