
Filter features based on their coefficient of variation
Source:R/method-filterFeatures.R
RsdFilter.RdThe RsdFilter class and methods enable users to filter features from an
XcmsExperiment or SummarizedExperiment object based on their relative
standard deviation (coefficient of variation) for a specified threshold.
This filter is part of the possible dispatch of the generic function
filterFeatures. Features above (>) the user-input threshold will be
removed from the entire dataset.
Usage
RsdFilter(threshold = 0.3, qcIndex = integer(), na.rm = TRUE, mad = FALSE)
# S4 method for class 'XcmsResult,RsdFilter'
filterFeatures(object, filter, ...)
# S4 method for class 'SummarizedExperiment,RsdFilter'
filterFeatures(object, filter, assay = 1)Arguments
- threshold
numericvalue representing the threshold. Features with a coefficient of variation strictly higher (>) than this will be removed from the entire dataset.- qcIndex
integer(orlogical) vector corresponding to the indices of QC samples.- na.rm
logicalindicates whether missing values (NA) should be removed prior to the calculations.- mad
logicalindicates whether the Median Absolute Deviation (MAD) should be used instead of the standard deviation. This is suggested for non-gaussian distributed data.- object
XcmsExperimentorSummarizedExperiment. For anXcmsExperimentobject, thefeatureValues(object)will be evaluated, and forSummarizedesxperimenttheassay(object, assay). The object will be filtered.- filter
The parameter object selecting and configuring the type of filtering. It can be one of the following classes:
RsdFilter,DratioFilter,PercentMissingFilterorBlankFlag.- ...
Optional parameters. For
objectbeing anXcmsExperiment: parameters for thefeatureValues()call.- assay
For filtering of
SummarizedExperimentobjects only. Indicates which assay the filtering will be based on. Note that the features for the entire object will be removed, but the computations are performed on a single assay. Default is 1, which means the first assay of theobjectwill be evaluated.
Value
For RsdFilter: a RsdFilter class. filterFeatures return the
input object minus the features that did not met the user input threshold.
Note
It is assumed that the abundance values are in natural scale. Abundances in log scale should be first transformed to natural scale before calculating the RSD.
See also
Other Filter features in xcms:
BlankFlag,
DratioFilter,
PercentMissingFilter