How to flip over the positions between a tip node and a inner node(with the same parent)

110 views
Skip to first unread message

lingling zheng

unread,
Jan 22, 2018, 12:53:08 AM1/22/18
to ggtree
Hi all:

      I want to modify the structure of a tree in figure1, and move node1 on the top of the tree. The only way I thought of is to flip over many times, may be it's not a good idea. However, when I flip over between node 14 (with two child nodes 7 and 8) and node 1, the node 8 and node 2 overlapped together (figure 2). I have tried to collapse node 14 first, but it comes with another error in flipping over between a tip node and a collapsed node.

     Please find the attachment of figer1 and figure2, thanks for your help!

Best wishes!

Lily
figure1.png
figure2.png

Yu, Guangchuang

unread,
Jan 22, 2018, 1:02:09 AM1/22/18
to lingling zheng, ggtree
can you provide a reproducible example?

--
G Yu, DK Smith, H Zhu, Y Guan, TTY Lam*. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data, Methods in Ecology and Evolution, 2017, 8(1):28-36. doi:10.1111/2041-210X.12628
 
Homepage: https://guangchuangyu.github.io/ggtree
---
You received this message because you are subscribed to the Google Groups "ggtree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bioc-ggtree+unsubscribe@googlegroups.com.
To post to this group, send email to bioc-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bioc-ggtree/97a72eee-28e9-46d7-8547-eb902e156bad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
--~--~---------~--~----~------------~-------~--~----~
Guangchuang Yu PhD
Postdoc researcher
State Key Laboratory of Emerging Infectious Diseases
School of Public Health
The University of Hong Kong
Hong Kong SAR, China
-~----------~----~----~----~------~----~------~--~---

lingling zheng

unread,
Jan 22, 2018, 1:07:03 AM1/22/18
to ggtree
OK, please find the attachment of the tree file which is saved by NCBI common tree, and my code is:

test.Matazoa<-read.tree(file="/path/to/phyliptree_test.phy")
test<-ggtree(test.Matazoa) 

test + geom_text2(aes(label=node), hjust=-.3)  + xlim(0,8)
test<-flip(test,15,1)

##collapse node 15
cp <- ggtree(test.Matazoa) %>% ggtree::collapse(15)
cp  + geom_text2(aes(label=node), hjust=-.3)  + xlim(0,8)
flip(cp,15,1)






在 2018年1月22日星期一 UTC+8下午2:02:09,Yu, Guangchuang写道:
can you provide a reproducible example?
On Mon, Jan 22, 2018 at 1:53 PM, lingling zheng <zhlin...@gmail.com> wrote:
Hi all:

      I want to modify the structure of a tree in figure1, and move node1 on the top of the tree. The only way I thought of is to flip over many times, may be it's not a good idea. However, when I flip over between node 14 (with two child nodes 7 and 8) and node 1, the node 8 and node 2 overlapped together (figure 2). I have tried to collapse node 14 first, but it comes with another error in flipping over between a tip node and a collapsed node.

     Please find the attachment of figer1 and figure2, thanks for your help!

Best wishes!

Lily

--
G Yu, DK Smith, H Zhu, Y Guan, TTY Lam*. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data, Methods in Ecology and Evolution, 2017, 8(1):28-36. doi:10.1111/2041-210X.12628
 
Homepage: https://guangchuangyu.github.io/ggtree
---
You received this message because you are subscribed to the Google Groups "ggtree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bioc-ggtree...@googlegroups.com.

To post to this group, send email to bioc-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bioc-ggtree/97a72eee-28e9-46d7-8547-eb902e156bad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
phyliptree_test.phy

Yu, Guangchuang

unread,
Jan 22, 2018, 2:34:53 AM1/22/18
to lingling zheng, ggtree
all these two issues had been fixed in release v = 1.10.3 and devel v = 1.11.5.



To unsubscribe from this group and stop receiving emails from it, send an email to bioc-ggtree+unsubscribe@googlegroups.com.

To post to this group, send email to bioc-...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

lingling zheng

unread,
Jan 22, 2018, 4:31:29 AM1/22/18
to ggtree
Thanks for your help, but how can i get the version of ggtree (1.10.3)? I have updated the version of bioconductor to 3.6 and R version to 3.4.3, here's my code:
Bioconductor version 3.6 (BiocInstaller 1.28.0), ?biocLite for help

> biocLite("ggtree")
Using Bioconductor 3.6 (BiocInstaller 1.28.0), R 3.4.3 (2017-11-30).
Installing package(s) ‘ggtree’
Content type 'application/zip' length 8564807 bytes (8.2 MB)
downloaded 8.2 MB



在 2018年1月22日星期一 UTC+8下午2:07:03,lingling zheng写道:

Yu, Guangchuang

unread,
Jan 22, 2018, 4:56:31 AM1/22/18
to lingling zheng, ggtree

You need to wait 2-3 days for Bioconductor to update tarballs.

Otherwise, you can use devel branch.

biocLite(c("tidytree", "guangchuangyu/treeio", "guangchuangyu/ggtree"))

To unsubscribe from this group and stop receiving emails from it, send an email to bioc-ggtree+unsubscribe@googlegroups.com.

To post to this group, send email to bioc-...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages