R/process_filter_abundance.R
filter_abundance.Rdwhether to filter the low relative abundance or unclassified feature by the threshold. Here, we choose the following criterion:
Feature more than Mean absolute or relative abundance across all samples;
Feature more than Minimum absolute or relative abundance at least one sample.
(Required). a phyloseq::phyloseq or
SummarizedExperiment::SummarizedExperiment object.
(Optional). character. taxonomic level to summarize,
default the top level rank of the ps. taxonomic level(Kingdom, Phylum,
Class, Order, Family, Genus, Species, Strains; default: NULL).
(Optional). numeric. Threshold for Mean
absolute (integer) or relative (float) abundance all samples (default, 0).
(Optional). numeric. Threshold for Minimum
absolute (integer) or relative (float) abundance at least one sample (default, 0).
(Optional). logical. whether to filter the unclassified taxa (default TRUE).
a phyloseq::phyloseq or
SummarizedExperiment::SummarizedExperiment object,
where each row represents a feature and each col represents the
feature abundance of each sample.
Thingholm, Louise B., et al. "Obese individuals with and without type 2 diabetes show different gut microbial functional capacity and composition." Cell host & microbe 26.2 (2019): 252-264.
if (FALSE) {
# phyloseq object
data("Zeybel_2022_gut")
Zeybel_2022_gut_counts <- phyloseq::transform_sample_counts(
Zeybel_2022_gut, function(x) {round(x * 10^7)})
# absolute abundance
ps <- filter_abundance(
object = Zeybel_2022_gut_counts,
level = NULL,
cutoff_mean = 100,
cutoff_one = 1000,
unclass = FALSE)
# relative abundance
ps <- filter_abundance(
object = Zeybel_2022_gut,
level = "Phylum",
cutoff_mean = 1e-04,
cutoff_one = 1e-03,
unclass = TRUE)
# SummarizedExperiment object
data("Zeybel_2022_protein")
filter_abundance(
object = Zeybel_2022_protein,
cutoff_mean = 5,
cutoff_one = 8)
}