| check_monophyly | R Documentation |
Tests whether all tips belonging to a specified taxonomic group form a monophyletic clade in the tree.
check_monophyly(
tree,
group,
rank,
format = "auto",
custom_patterns = NULL,
quiet = FALSE,
delimiter_mode = "reverse",
taxonomy_levels = NULL
)
tree |
A |
group |
Character. The name of the taxonomic group to check
(e.g., |
rank |
Character. Taxonomic rank of the group. One of |
format |
Character. Taxonomy label format. One of |
custom_patterns |
Named list of regex patterns for custom format.
Required when |
quiet |
Logical. If |
delimiter_mode |
Character. Embedded (Format A) parsing strategy:
|
taxonomy_levels |
Custom taxonomy level configuration (list with codes and names).
Default: |
A list with components:
Logical. Whether the group is monophyletic.
Character. The group name.
Integer. Number of tips belonging to the group.
Integer or NULL. The MRCA node number, or NULL if the group has fewer than 2 tips.
Character vector. Tips in the MRCA clade that do not belong to the group (empty if monophyletic).
Group matching is case-insensitive. The query group and every
parsed Group label are lower-cased with tolower() at
comparison time (not during parsing) before matching, so
"Proteobacteria" and "proteobacteria" match the same clade.
parse_taxonomy itself preserves the original case of parsed
labels; the lower-casing applied here is local to this comparison and keeps
the two modules consistent about what a group name refers to.
data(example_tree)
# Check if phylum P1 is monophyletic
result <- check_monophyly(example_tree, "P1",
rank = "phylum", format = "GTDB")
if (result$is_monophyletic) {
message("P1 is monophyletic!")
} else {
message("P1 is NOT monophyletic.")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.