ggtree icon indicating copy to clipboard operation
ggtree copied to clipboard

Can not find function getsubtree

Open ShangLiii opened this issue 1 year ago • 2 comments
trafficstars

Hi, I am using the most updated ggtree. When I tried to zoom in to specific clade using getsubtree, it is said the function not found. I am wondering whether there is any requirement I missed using installation. image Thanks!

Prerequisites

  • [ ] Have you read Feedback and follow the guide?
    • [ ] make sure your are using the latest release version
    • [ ] read the documents
    • [ ] google your question/issue

Describe you issue

  • [ ] Make a reproducible example (e.g. 1)
  • [ ] your code should contain comments to describe the problem (e.g. what expected and actually happened?)

Ask in right place

  • [ ] for bugs or feature requests, post here (github issue)
  • [ ] for questions, please post to google group

ShangLiii avatar Jul 05 '24 05:07 ShangLiii

In addition, I also tried to do this: image It seems the function is there but I cannot use it.

ShangLiii avatar Jul 05 '24 05:07 ShangLiii

The problem is that getSubtree() is not an exported function so you normally can't access it:

> getAnywhere(getSubtree)
A single object matching ‘getSubtree’ was found
It was found in the following places
  namespace:ggtree
with value

function (tree, node) 
{
    tidytree::offspring(tree, node, self_include = TRUE)
}
<bytecode: 0x000001a5d83b20c0>
<environment: namespace:ggtree>

One way to use it anyways would be:

> ggtree:::getSubtree()

Alternatively, you could also use the offspring() function from the tidytree package with self_include = TRUE.

You might want to have a look at #186.

yasche avatar Sep 10 '24 12:09 yasche