Skip to contents

Synchronize otu_tree or taxa_tree with the current variable_info.

Usage

align_tree(object, tree = c("otu_tree", "taxa_tree"), drop_unmatched = TRUE)

Arguments

object

A microbiome_dataset object.

tree

Tree slot to align, either "otu_tree" or "taxa_tree".

drop_unmatched

Should unmatched OTU tips be dropped when aligning the OTU tree?

Value

A microbiome_dataset object.

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’
x <- align_tree(x, tree = "taxa_tree")
class(x@taxa_tree)
#> [1] "treedata"
#> attr(,"package")
#> [1] "tidytree"