Remove Zeros

removeZeros(x)

Arguments

x

A phyloseq object or a data.frame with only numerical or matrix

Value

If input is phyloseq, returns phyloseq with taxa that have zeros in all samples. If input is matrix or data frame, returned object is without rows and cloumns that sum to zero.

Details

In phyloseq based analysis, prune_samples or subset_samples does not remove taxa that have zero abundances in remaining samples. In such cases user may want to exclude these taxa.

Author

Sudarshan A. Shetty

Examples

library(biomeUtils)
data("FuentesIliGutData")
ps1 <- subset_samples(FuentesIliGutData, ILI != "L2")
ps1
#> phyloseq-class experiment-level object
#> otu_table()   OTU Table:         [ 905 taxa and 397 samples ]
#> sample_data() Sample Data:       [ 397 samples by 61 sample variables ]
#> tax_table()   Taxonomy Table:    [ 905 taxa by 7 taxonomic ranks ]
#> phy_tree()    Phylogenetic Tree: [ 905 tips and 904 internal nodes ]
ps2 <- removeZeros(ps1)
ps2
#> phyloseq-class experiment-level object
#> otu_table()   OTU Table:         [ 902 taxa and 397 samples ]
#> sample_data() Sample Data:       [ 397 samples by 61 sample variables ]
#> tax_table()   Taxonomy Table:    [ 902 taxa by 7 taxonomic ranks ]
#> phy_tree()    Phylogenetic Tree: [ 902 tips and 901 internal nodes ]