filterPhyloseq | R Documentation |
Filter Phyloseq Object
filterSampleData(x, ...)
filterTaxaData(x, ...)
filterTaxaByNames(x, ids = NULL, keep = TRUE)
filterSampleByNames(x, ids = NULL, keep = TRUE)
x |
|
... |
Option to pass on to |
ids |
A list of sample ids or taxa ids to filter. Only when using
|
keep |
Logical. Default is TRUE. Only when using
|
These are alternative to subset and prune functions in
phyloseq
.
The filterSampleData
does subsetting similar to
phyloseq::subset_samples
.
The filterTaxaData
does subsetting similar to
phyloseq::subset_taxa
.
The filterSampleByNames
does pruning similar to
phyloseq::prune_samples
.
The filterTaxaByNames
does pruning similar to
phyloseq::prune_taxa
.
The naming is using filter because it uses the dplyr::filter
function.
Note:
filterSampleData
will additionally remove any taxa that are
zero across all samples i.e. not present is any remaining samples
after filtering.
filterTaxaData
will additionally remove samples that do not
have any of the selected taxa, i.e. samples that sum to zero.
filterSampleByNames
will additionally remove any taxa that are not
present is any remaining samples
after filtering.
filterTaxaByNames
will additionally remove samples that do not
have any of the selected taxa, i.e. samples that sum to zero.
Either filtered phyloseq
Sudarshan A. Shetty
Shetty SA (2020). Utilities for microbiome analytics. https://github.com/RIVM-IIV-Microbiome/biomeUtils
library(biomeUtils)
data("FuentesIliGutData")
# Filter from tables subset_*
ps.filtered.samples <- filterSampleData(FuentesIliGutData,
ILI == "C" & BMI < 26)
ps.filtered.samples
ps.filtered.taxa <- filterTaxaData(FuentesIliGutData,
Phylum=="Firmicutes")
ps.filtered.taxa
# Filter by names like prune_*
sams.select <- sample_names(FuentesIliGutData)[1:10]
ps.filter.by.sam.names <- filterSampleByNames(FuentesIliGutData,
ids = sams.select,
keep = TRUE)
tax.select <- taxa_names(FuentesIliGutData)[1:10]
ps.filter.by.tax.names <- filterTaxaByNames(FuentesIliGutData,
ids = tax.select,
keep = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.