Filter an mmo object by samples, groups, and/or features
filter_mmo.RdSubset all components of an mmo object (feature tables, metadata, distance
matrices, and annotations) to a given set of samples, groups, and/or
feature IDs. Filtering is applied consistently across all slots present
in mmo.
Optionally, if an mgf_path is provided, a filtered MGF is written
containing only spectra for the retained features (using filter_mgf_to_mmo()).
Usage
filter_mmo(
mmo,
sample_list = NULL,
group_list = NULL,
id_list = NULL,
sample_col = "sample",
group_col = "group",
drop_empty_feat = TRUE,
empty_threshold = NULL,
mgf_path = NULL,
output_path = NULL
)Arguments
- mmo
A list-like mmo object as returned by
GetMZmineFeature().- sample_list
Optional character vector of sample IDs (matching
sample_colinmmo$metadata) to retain.- group_list
Optional character vector of group labels (matching
group_colinmmo$metadata) to retain. Mutually exclusive withsample_list.- id_list
Optional character vector of feature IDs to retain. If
NULL, features are determined fromfeature_dataand optionally filtered bydrop_empty_feat.- sample_col
Column name in
mmo$metadatacontaining sample IDs. Default is"sample".- group_col
Column name in
mmo$metadatacontaining group labels. Default is"group".- drop_empty_feat
Logical; if
TRUE(default) drop features with no non-zero values in the retained samples.- empty_threshold
Optional numeric threshold used to define “empty” features. If
NULL(default), the smallest positive, non-NA intensity in the retained samples is used. Features are kept if they have at least one value > threshold across retained samples.- mgf_path
Optional character. If provided, an MGF file will be filtered to retained features using
filter_mgf_to_mmo().- output_path
Character or NULL. Passed to
filter_mgf_to_mmo(). IfNULL(default), output is"<input>_filtered.mgf".