Coder Social home page Coder Social logo

collapse function not working about ggtree HOT 4 CLOSED

yulab-smu avatar yulab-smu commented on May 30, 2024
collapse function not working

from ggtree.

Comments (4)

GuangchuangYu avatar GuangchuangYu commented on May 30, 2024

the priority of %>% is higher than +, so you should use:

(ggtree(tree) + geom_text(aes(label=node))) %>% collapse(node=21)

from ggtree.

VareciaRubra avatar VareciaRubra commented on May 30, 2024

It looks like the collapse function is working backward and erasing all the parental branches instead of the daughters.

require(ape)
set.seed(123)
tree <- rtree(10)
tree <- ggtree(tree)
tree %>% ggtree::collapse(node=4)

bug_collapse_ggtree

R version 3.6.0 (2019-04-26)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 18.3

Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] tidytree_0.2.4 treeio_1.9.1 phytools_0.6-60 maps_3.3.0 ape_5.3 ggridges_0.5.1 cowplot_0.9.4
[8] forcats_0.4.0 stringr_1.4.0 dplyr_0.8.1 purrr_0.3.2 readr_1.3.1 tidyr_0.8.3 tibble_2.1.1
[15] tidyverse_1.2.1 ggplot2_3.1.1 ggtree_1.17.1

from ggtree.

GuangchuangYu avatar GuangchuangYu commented on May 30, 2024

> tree %>% ggtree::collapse(node=4)
Warning message:
In collapse.ggtree(., node = 4) : input node is a tip...

now it will throw warning if input node is a tip and return the input tree.

from ggtree.

rtobiaskoch avatar rtobiaskoch commented on May 30, 2024

still getting same error on data I know for a fact is not a tip

from ggtree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.