findOS: Find descendants (or offsprings)

Description Usage Arguments Value Author(s) Examples

Description

findOS finds descendants of a node.

Usage

1
2
findOS(tree, ancestor, only.leaf = TRUE, self.include = TRUE,
  use.alias = FALSE, message = FALSE)

Arguments

tree

A phylo object.

ancestor

An internal node. It could be the node number or the node label.

only.leaf

A logical value, TRUE or FALSE. The default is TRUE. If default, only the leaf nodes in the descendant nodes would be returned.

self.include

A logical value, TRUE or FALSE. The default is TRUE. If default, the node specified in ancestor is included. The leaf node itself is returned as its descendant.

use.alias

A logical value, TRUE or FALSE. The default is FALSE, and the node label would be used to name the output; otherwise, the alias of node label would be used to name the output. The alias of node label is created by adding a prefix "Node_" to the node number if the node is an internal node or adding a prefix "Leaf_" if the node is a leaf node.

message

A logical value, TRUE or FALSE. The default is FALSE. It decides whether the running process should be shown.

Value

A vector of nodes. The numeric value is the node number, and the vector name is the corresponding node label. If a node has no label, it would have NA as name when use.alias = FALSE, and have the alias of node label as name when use.alias = TRUE.

Author(s)

Ruizhu Huang

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(tinyTree)

library(ggtree)
ggtree(tinyTree) +
geom_text2(aes(label = node), color = "darkblue",
               hjust = -0.5, vjust = 0.7) +
geom_hilight(node = 17, fill = 'steelblue', alpha = 0.5) +
geom_text2(aes(label = label), color = "darkorange",
           hjust = -0.1, vjust = -0.7)

(tips <- findOS(tree = tinyTree, ancestor = 17, only.leaf = TRUE))

markrobinsonuzh/treeAGG documentation built on May 26, 2019, 9:32 a.m.