New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edge colouring with vector containing continuous data #105

Closed
AEgit opened this Issue Dec 7, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@AEgit

AEgit commented Dec 7, 2016

This is probably the wrong place to post this question, but I've been stuck with this problem for quite some time and so I thought I might ask here for help. Apologies in advance, if I should have posted this somewhere else.

I have a phylogenetic tree in "phylo" format and a vector with continuous data that corresponds to the branch/endge lengths of my tree. The continuous data values in the vector are in the same order as the edge lengths on the tree. I would like to colour the branch lengths of my tree according to the continuous data values of my vector. The output tree should look somewhat similar to the "Color tree" shown here:
https://bioconductor.org/packages/devel/bioc/vignettes/ggtree/inst/doc/treeAnnotation.html

I managed to produce such a tree with phytools, following this tutorial:
http://blog.phytools.org/2013/03/neat-new-function-to-color-branches-by.html

But when I try to do this with ggtree, I always get stuck somewhere. I've tried to convert my tree and the associated data into a phylo4d object (see #76), but when i do this the order of the continuous data points no longer corresponds to the original branch lengths. I've also tried to produce a jplace file, but that does not seem to work either for me.

I'm pretty sure there's probably a straightforward way of doing this in ggtree, but currently I just cannot see it. Could you help me with that? Apologies again for the silly question.

@AEgit

This comment has been minimized.

Show comment
Hide comment
@AEgit

AEgit Dec 7, 2016

Speak of the devil: Nevermind - I think I managed to get it working: I just have to check whether the continuous data values are applied to the correct branches. I'll let you know, once I've figured that out. Thanks again for this marvellous tool!

AEgit commented Dec 7, 2016

Speak of the devil: Nevermind - I think I managed to get it working: I just have to check whether the continuous data values are applied to the correct branches. I'll let you know, once I've figured that out. Thanks again for this marvellous tool!

@GuangchuangYu

This comment has been minimized.

Show comment
Hide comment
@GuangchuangYu

GuangchuangYu Dec 8, 2016

Owner

see http://guangchuangyu.github.io/2016/01/label-edge-number-in-ggtree/ and use:

p %<+% your_data + aes(color=your_var)

Here contains more examples you may find useful.

Owner

GuangchuangYu commented Dec 8, 2016

see http://guangchuangyu.github.io/2016/01/label-edge-number-in-ggtree/ and use:

p %<+% your_data + aes(color=your_var)

Here contains more examples you may find useful.

@AEgit

This comment has been minimized.

Show comment
Hide comment
@AEgit

AEgit Dec 8, 2016

The data has been applied to the correct branches!

Thank you very much for your comment: Yes, indeed, that's how I did it (see also https://groups.google.com/forum/#!topic/bioc-ggtree/4GgivKqVjB8).

I'll close this issue.

AEgit commented Dec 8, 2016

The data has been applied to the correct branches!

Thank you very much for your comment: Yes, indeed, that's how I did it (see also https://groups.google.com/forum/#!topic/bioc-ggtree/4GgivKqVjB8).

I'll close this issue.

@AEgit AEgit closed this Dec 8, 2016

@GuangchuangYu

This comment has been minimized.

Show comment
Hide comment
@GuangchuangYu

GuangchuangYu Dec 8, 2016

Owner

This reminds me that I already added this link in FAQ.

Owner

GuangchuangYu commented Dec 8, 2016

This reminds me that I already added this link in FAQ.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment