Browse code

bug fixed

Guangchuang Yu authored on 26/12/2018 10:10:58
Showing 3 changed files

... ...
@@ -2,7 +2,7 @@ Package: ggtree
2 2
 Type: Package
3 3
 Title: an R package for visualization and annotation of phylogenetic trees with
4 4
     their covariates and other associated data
5
-Version: 1.15.2
5
+Version: 1.15.3
6 6
 Authors@R: c(
7 7
 	   person("Guangchuang", "Yu",     email = "guangchuangyu@gmail.com", role = c("aut", "cre", "cph"), comment = c(ORCID = "0000-0002-6485-8781")),
8 8
 	   person("Tommy Tsan-Yuk", "Lam", email = "tylam.tommy@gmail.com",   role = c("aut", "ths")),
... ...
@@ -1,3 +1,8 @@
1
+# ggtree 1.15.3
2
+
3
++ bug fixed for setting `branch.length="none"` in unrooted layouts (2018-12-26, Wed)
4
+  - bug introduced in <https://github.com/GuangchuangYu/ggtree/pull/201>
5
+
1 6
 # ggtree 1.15.2
2 7
 
3 8
 + compatible with `tibble` v=2.0.0 (2018-11-29, Thu)
... ...
@@ -46,10 +46,12 @@ layoutEqualAngle <- function(model, branch.length ){
46 46
       }
47 47
   }
48 48
   
49
-  if (branch.length == "none") {
49
+  if (is.null(tree$edge.length) || branch.length == "none") {
50 50
       tree <- set_branch_length_cladogram(tree)
51 51
   }
52
-  
52
+  brlen <- numeric(getNodeNum(tree))
53
+  brlen[tree$edge[,2]] <- tree$edge.length
54
+
53 55
   root <- getRoot(tree)
54 56
   ## Convert Phylo tree to data.frame.
55 57
   ## df <- as.data.frame.phylo_(tree)
... ...
@@ -71,6 +73,9 @@ layoutEqualAngle <- function(model, branch.length ){
71 73
     df[root, "end"]   <- 2 # 360-degrees
72 74
     df[root, "angle"] <- 0 # Angle label.
73 75
 
76
+    df$branch.length <- brlen[df$node] # for cladogram
77
+
78
+
74 79
     N <- getNodeNum(tree)
75 80
 
76 81
     ## Get number of tips for each node in tree.