filter_abundance: Filtering feature who is low relative abundance or...

View source: R/process_filter_abundance.R

filter_abundanceR Documentation

Filtering feature who is low relative abundance or unclassified

Description

whether to filter the low relative abundance or unclassified feature by the threshold. Here, we choose the following criterion:

  1. Feature more than Mean absolute or relative abundance across all samples;

  2. Feature more than Minimum absolute or relative abundance at least one sample.

Usage

filter_abundance(
   object,
   level = c(NULL, "Kingdom", "Phylum", "Class",
           "Order", "Family", "Genus",
           "Species", "Strain", "unique"),
   cutoff_mean = c(100, 1e-04, 2),
   cutoff_one = c(1000, 1e-03, 3),
   unclass = TRUE)

Arguments

object

(Required). a phyloseq::phyloseq or SummarizedExperiment::SummarizedExperiment object.

level

(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).

cutoff_mean

(Optional). numeric. Threshold for Mean absolute (integer) or relative (float) abundance all samples (default, 0).

cutoff_one

(Optional). numeric. Threshold for Minimum absolute (integer) or relative (float) abundance at least one sample (default, 0).

unclass

(Optional). logical. whether to filter the unclassified taxa (default TRUE).

Value

a phyloseq::phyloseq or SummarizedExperiment::SummarizedExperiment object, where each row represents a feature and each col represents the feature abundance of each sample.

Author(s)

Created by Hua Zou (11/30/2021 Shenzhen China)

References

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.

Examples


## Not run: 
# 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)

## End(Not run)


HuaZou/MicrobiomeAnalysis documentation built on May 13, 2024, 11:10 a.m.