Commit information:
Commit id: ff5910ddcc9c1c3fc364da83fed02f4c0b6bdbac
bug fixed in reorders of label
Committed by: GuangchuangYu
Author Name: GuangchuangYu
Commit date: 2015-02-12 10:44:16 +0800
Author date: 2015-02-12 10:44:16 +0800
git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ggtree@99396 bc3139a8-67e5-0310-9ffc-ced21a209358
... | ... |
@@ -1,7 +1,7 @@ |
1 | 1 |
Package: ggtree |
2 | 2 |
Type: Package |
3 | 3 |
Title: a phylogenetic tree viewer for different types of tree annotations |
4 |
-Version: 0.99.17 |
|
4 |
+Version: 0.99.18 |
|
5 | 5 |
Author: Guangchuang Yu |
6 | 6 |
Maintainer: Guangchuang Yu <guangchuangyu@gmail.com> |
7 | 7 |
Description: ggtree extends the ggplot2 plotting system which implemented the |
... | ... |
@@ -42,7 +42,7 @@ gplot.heatmap <- function(p, data, low, high, font.size) { |
42 | 42 |
df=p$data |
43 | 43 |
df=df[df$isTip,] |
44 | 44 |
|
45 |
- levels(dd$Var1) <- df$label[order(df$y)] |
|
45 |
+ dd$Var1 <- factor(dd$Var1, levels = df$label[order(df$y)]) |
|
46 | 46 |
|
47 | 47 |
p2 <- ggplot(dd, aes(Var2, Var1, fill=value))+geom_tile(color="black") |
48 | 48 |
p2 <- p2 + scale_fill_gradient(low=low, high=high) |
... | ... |
@@ -217,7 +217,20 @@ layout.unrooted <- function(tree) { |
217 | 217 |
return(df) |
218 | 218 |
} |
219 | 219 |
|
220 |
+get.offspring.tip.number_from_df <- function(df, node) { |
|
221 |
+ i <- which(df$parent == node) |
|
222 |
+ if (length(i) == 0) { |
|
223 |
+ return(0) |
|
224 |
+ } |
|
225 |
+ |
|
226 |
+ res <- df[i, "node"] |
|
220 | 227 |
|
228 |
+ res <- c(res, sapply(res, get.offspring.tip.number_from_df, df=df)) |
|
229 |
+ res <- res[res > 0] |
|
230 |
+ return(res) |
|
231 |
+} |
|
232 |
+ |
|
233 |
+ |
|
221 | 234 |
##' extract offspring tips |
222 | 235 |
##' |
223 | 236 |
##' |