Description Usage Arguments Details Value See Also Examples
Functions for describing relationships among phylogenetic nodes (i.e. internal nodes or tips).
1 2 3 4 5 6 7 8 9 |
phy |
a phylo4 object (or one inheriting from phylo4, e.g. a phylo4d object) |
node |
either an integer corresponding to a node ID number, or a
character corresponding to a node label; for |
type |
( |
include.self |
whether to include self in list of siblings |
... |
a list of node numbers or names, or a vector of node numbers or names |
ancestors
and descendants
can take node
vectors of
arbitrary length, returning a list of output vectors if the number of valid
input nodes is greater than one. List element names are taken directly from
the input node vector.
If any supplied nodes are not found in the tree, the behavior currently varies across functions.
Invalid nodes are automatically omitted by ancestors
and descendants
, with a warning.
ancestor
will return NA
for any invalid nodes, with a warning.
Both children
and siblings
will return an empty
vector, again with a warning.
ancestors
return a named vector (or a list of such vectors in the case of multiple input nodes) of the ancestors and descendants of a node
descendants
return a named vector (or a list of such vectors in the case of multiple input nodes) of the ancestors and descendants of a node
ancestor
ancestor
is analogous to
ancestors(...{}, type="parent")
(i.e. direct ancestor
only), but returns a single concatenated vector in the case of
multiple input nodes
children
is analogous to descendants(...{},
type="children")
(i.e. direct descendants only), but is not
currently intended to be used with multiple input nodes
siblings
returns sibling nodes (children of the same parent)
mrca
, in the ape package, gives a list of all
subtrees
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | data(geospiza)
nodeLabels(geospiza) <- LETTERS[1:nNodes(geospiza)]
plot(as(geospiza, "phylo4"), show.node.label=TRUE)
ancestor(geospiza, "E")
children(geospiza, "C")
descendants(geospiza, "D", type="tips")
descendants(geospiza, "D", type="all")
ancestors(geospiza, "D")
MRCA(geospiza, "conirostris", "difficilis", "fuliginosa")
MRCA(geospiza, "olivacea", "conirostris")
## shortest path between 2 nodes
shortestPath(geospiza, "fortis", "fuliginosa")
shortestPath(geospiza, "F", "L")
## branch length from a tip to the root
sumEdgeLength(geospiza, ancestors(geospiza, "fortis", type="ALL"))
|
D
18
D fusca
18 12
Platyspiza difficilis scandens conirostris magnirostris fuliginosa
11 6 5 4 3 1
fortis pallida pauper parvulus psittacula
2 7 10 8 9
Platyspiza E F difficilis G scandens
11 19 20 6 21 5
H conirostris I magnirostris J fuliginosa
22 4 23 3 24 1
fortis K pallida L pauper M
2 25 7 26 10 27
parvulus psittacula
8 9
C B A
17 16 15
F
20
A
15
J
24
E K
19 25
[1] 0.88077
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.