filter_peaks_by_fraction: Filter features by fraction of missing values

Description Usage Arguments Value Examples

View source: R/filters.R

Description

Metabolomics datasets often contain 'features' with irreproducible peak intensity values, or with large numbers of missing values. This tool facilitates the remove of such features from a data matrix, based upon the relative proportion (minimum fraction) of samples containing non-missing values.

Usage

1
2
3
4
5
6
7
8
filter_peaks_by_fraction(
  df,
  min_frac,
  classes = NULL,
  method = "QC",
  qc_label = "QC",
  remove_peaks = TRUE
)

Arguments

df

A matrix-like (e.g. an ordinary matrix, a data frame) or RangedSummarizedExperiment-class object with all values of class numeric() or integer() of peak intensities, areas or other quantitative characteristic.

min_frac

numeric(1), value between 0 and 1, a threshold of fraction of detection.

classes

character(), vector of class labels. Must be the same length as the number of sample in the input peak table. If input is SummarizedExperiment object, use SummarizedExperiment_object$meta_data_column_name.

method

character(1), method to use. QC - within QC samples, within - within each sample class or across - across all samples.

qc_label

character(1) or NULL, class label used to identify QC samples.

remove_peaks

logical(1), remove filtered features from peak matrix or not.

Value

Object of class SummarizedExperiment. If input data are a matrix-like (e.g. an ordinary matrix, a data frame) object, function returns numeric() matrix-like object of filtered data set. Function flags are added to the object attributes and is a DataFrame-class with five columns. The same DataFrame object containing flags is added to rowData() element of SummarizedExperiment object as well.

Columns in rowData() or flags element contain fractions of missing values per feature within QC samples (mehtod QC), across (method across) or within (mehtod within) each sample group.

Examples

1
2
3
4
5
6
7
8
9
df <- MTBLS79[ ,MTBLS79$Batch == 1]
out <- filter_peaks_by_fraction(df=df, min_frac=1, 
    classes=df$Class, method='QC', qc_label='QC')
    
out <- filter_peaks_by_fraction(df=df, min_frac=1, 
    classes=df$Class, method='across', qc_label='QC')

out <- filter_peaks_by_fraction(df=df, min_frac=1, 
    classes=df$Class, method='within', qc_label='QC')

pmp documentation built on April 1, 2021, 6:01 p.m.