Keep or remove selected tips from otu_tree or taxa_tree without changing
the abundance matrix.
Usage
prune_tree(object, tree = c("otu_tree", "taxa_tree"), tip_label, keep = TRUE)Examples
data("global_patterns", package = "microbiomedataset")
x <- prune_taxa(global_patterns, variable_id = global_patterns@variable_info$variable_id[1:120])
x <- microbiomedataset::convert2microbiome_dataset(
microbiomedataset::convert2phyloseq(x)
)
#> 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’
keep_tips <- x@variable_info$variable_id[1:5]
x <- prune_tree(x, tree = "otu_tree", tip_label = keep_tips)
class(x@otu_tree)
#> [1] "treedata"
#> attr(,"package")
#> [1] "tidytree"
