Browse code

Commit made by the Bioconductor Git-SVN bridge. Consists of 1 commit.

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

g.yu authored on 12/02/2015 02:44:40
Showing 4 changed files

  • DESCRIPTION index e8334eda..3cf394e5 100644
  • NEWS index 16284e5f..daa2720a 100644
  • R/gplot.R index 3e65ba96..d19cd028 100644
  • R/tree.R index ae14de25..6f9f7d4d 100644
... ...
@@ -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
... ...
@@ -1,3 +1,7 @@
1
+CHANGES IN VERSION 0.99.18
2
+------------------------
3
+ o bug fixed in reorder the labels in gplot.heatmap <2015-02-12, Thu>
4
+ 
1 5
 CHANGES IN VERSION 0.99.17
2 6
 ------------------------
3 7
  o add angle and branch.y variable in cladogram layout <2015-02-10, Tue>
... ...
@@ -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
 ##'