Closed xiangpin closed 2 years ago
what's the difference between the new feature and the offspring()
?
Yes, it is similar to offspring
. But offspring
has some arguments and it was depended on many functions of ggtree
. And the offspring
and old child
functions did not support vector .node
(length >1), offspring
also did not support the internal nodes (without tips). The request use the recursion method, I do not test the performance between them.
no ggtree dependency, see https://github.com/YuLab-SMU/treeio/blob/master/R/offspring.R#L55-L85.
I think it would be better to move the functionalities of extracting offspring nodes (internal, external or all) to the offspring function.
The child()
can be a superset of the offspring
, and this can only be in this way:
child <- function(..., type = 'child') {
if (type = 'child') {
# do something, the actual child function.
} else {
offspring(..., type=type)
}
}
It is very important for not confusing users.
Description
The original
child
function only can search the children nodes. But we want to extract all the descendant nodes, the tip nodes or only the internal nodes sometimes. So this request update it to meet these needs.Related Issue
Example