Rebuild taxa_tree using only taxa that match selected labels at a chosen
taxonomy rank, without changing the abundance matrix.
Usage
filter_tree_by_rank(
object,
taxonomic_rank = c("Kingdom", "Phylum", "Class", "Order", "Family", "Genus", "Species"),
taxa,
keep = TRUE,
na_keep = FALSE
)Examples
data("global_patterns", package = "microbiomedataset")
x0 <- prune_taxa(global_patterns, variable_id = global_patterns@variable_info$variable_id[1:120])
x <- microbiomedataset::convert2microbiome_dataset(
microbiomedataset::convert2phyloseq(x0)
)
#> Found more than one class "phylo" in cache; using the first, from namespace 'phyloseq'
#> Also defined by ‘tidytree’
#> Found more than one class "phylo" in cache; using the first, from namespace 'phyloseq'
#> Also defined by ‘tidytree’
#> Found more than one class "phylo" in cache; using the first, from namespace 'phyloseq'
#> Also defined by ‘tidytree’
#> Found more than one class "phylo" in cache; using the first, from namespace 'phyloseq'
#> Also defined by ‘tidytree’
x <- filter_tree_by_rank(
x,
taxonomic_rank = "Phylum",
taxa = c("Bacteroidetes", "Firmicutes")
)
class(x@taxa_tree)
#> [1] "NULL"
