Skip to content
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

Trying to add a SINGLE circular ring to a tree #52

Closed
jsilve24 opened this issue Mar 26, 2016 · 8 comments

Comments

@jsilve24
Copy link
Contributor

commented Mar 26, 2016

First off, thank you for creating this wonderful package!

I am trying to add a color strip (in the style of iTOL) to my circular tree. I currently just want to define a single variable "phylum" as the coloring for that ring/heatmap.
(1) this gives an error as I think gheatmap only expects to get a dataframe with more than 1 column. (The rownames of my dataframe line up with tip labels of the tree).
(2) I agree with andersgs (#39), I think this may deserve its own function (e.g., geom_ring or geom_strip). I find the current method awkward.

I think (1) is more important than (2) obviously.

So far this is the best I have been able to come up with. I have had to double one of the columns and shrink the width. I also notice the color is washed out (looks like low alpha) which I think is because there are so many taxa and the cell borders are getting in the way.

rplot

Again I think iTOL like functionality would be wonderful for this type of comparative genomics.

@GuangchuangYu

This comment has been minimized.

Copy link
Member

commented Apr 6, 2016

how about this trick:

library(ggtree)
set.seed(1234)
tr=rtree(50)

geom_strip = function(...) geom_cladelabel(label="", barsize=5, align=T, offset=.5, ...)

ggtree(tr) + geom_strip(58, color='red') + geom_strip(84, color='green') + geom_strip(52, color='blue')
@GuangchuangYu

This comment has been minimized.

Copy link
Member

commented Apr 6, 2016

screenshot from 2016-04-07 00 01 24

@jsilve24

This comment has been minimized.

Copy link
Contributor Author

commented Apr 15, 2016

This sort of addresses the problem. However I am still not sure how to deal with this as my data relates tip labels to taxonomic names (at the phyla level). Thus I first have to find the MRCA of a given phyla however often its not mono-phyletic. Therefore the results are incorrect.

It would be easier if I could use the %<+% opperator to associate the phyla names to the tips and then just call a geom_strip function.

Do you have any suggestions?

@jsilve24

This comment has been minimized.

Copy link
Contributor Author

commented May 8, 2016

So I found a workaround - a package called MonoPhy that will estimate the MRCA despite non monophyletic clades. So I can use that... Its a pretty big work around though, it would be much easier if you could just associate a color with the tips as a bar.

@GuangchuangYu

This comment has been minimized.

Copy link
Member

commented May 9, 2016

2016-05-09-235143_1280x800_scrot

it's supported in ggtree >= 1.5.1

it's similar to geom_cladelabel, except that:

  • the input is not internal node number but taxa1 and taxa2.
  • label is optional.

It works for Monophyletic, Polyphyletic or Paraphyletc Taxa, so we can think of it as a super-geom_cladelabel.

@GuangchuangYu

This comment has been minimized.

Copy link
Member

commented May 9, 2016

wow, just realize you request a pull. Thanks, I will review your code tomorrow.

@jsilve24

This comment has been minimized.

Copy link
Contributor Author

commented May 9, 2016

I think I like your solution with geom_strip much better for my research! That said the pull request may be helpful as it fixes what i would consider a small bug with gheatmap function.

Thank you again for the wonderful work you are doing!

  • Justin

On May 9, 2016, at 11:58 AM, Guangchuang Yu notifications@github.com wrote:

wow, just realize you request a pull. Thanks, I will review your code tomorrow.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub #52 (comment)

@GuangchuangYu

This comment has been minimized.

Copy link
Member

commented May 9, 2016

merged & thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.