# An example with the dog genus:
# It is currently not possible to get an OpenTree subtree of a taxon that is
# missing from the OpenTree synthetic tree.
# The dog genus is not monophyletic in the OpenTree synthetic tree, so in
# practice, it has no node to extract a subtree from.
tnrs <- tnrs_match("Canis")
if (FALSE) # This is a flag for package development. You are welcome to run the example.
rotl::tol_subtree(tnrs$ott_id[1])
#> Error: HTTP failure: 400
#> [/v3/tree_of_life/subtree] Error: node_id was not found (broken taxon).
# end dontrun
ids <- tnrs$ott_id[1]
names(ids) <- tnrs$unique_name
children <- get_ott_children(ott_ids = ids) # or
children <- get_ott_children(input = "Canis")
if (!is.na(children)) {
str(children)
ids <- children$Canis$ott_id
names(ids) <- rownames(children$Canis)
tree_children <- datelife::get_otol_synthetic_tree(ott_ids = ids)
plot(tree_children, cex = 0.3)
}
# An example with flowering plants:
if (FALSE) # This is a flag for package development. You are welcome to run the example.
oo <- get_ott_children(input = "magnoliophyta", ott_rank = "order")
# Get the number of orders of flowering plants that we have
sum(oo$Magnoliophyta$rank == "order")
# end dontrun
Run the code above in your browser using DataLab