Browse code

update docs

Guangchuang Yu authored on 11/10/2018 02:44:13
Showing 6 changed files

... ...
@@ -1,3 +1,7 @@
1
+# Bradley Jones
2
+
3
++ made data usable with treedata in 'equal_angle' and 'daylight' layouts 
4
+  - <https://github.com/GuangchuangYu/ggtree/pull/201>
1 5
 
2 6
 # Justin Silverman
3 7
 
... ...
@@ -17,3 +21,4 @@
17 21
 + Refactor layoutDaylight
18 22
   - <https://github.com/GuangchuangYu/ggtree/pull/165>
19 23
   - <https://github.com/GuangchuangYu/ggtree/pull/169>
24
+
... ...
@@ -2,11 +2,12 @@ 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.13.5
5
+Version: 1.13.6
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")),
9 9
 	   person("Justin", "Silverman",   email = "jsilve24@gmail.com",      role = "ctb"),
10
+    person("Bradley", "Jones",      email = "brj1@sfu.ca",             role = "ctb"),
10 11
 	   person("Watal M.", "Iwasaki",   email = "heavy.watal@gmail.com",   role = "ctb")
11 12
 	   )
12 13
 Maintainer: Guangchuang Yu <guangchuangyu@gmail.com>
... ...
@@ -1,3 +1,8 @@
1
+# ggtree 1.13.6
2
+
3
++ made data usable with treedata in 'equal_angle' and 'daylight' layouts (2018-10-11, Thu)
4
+  - <https://github.com/GuangchuangYu/ggtree/pull/201>
5
+  
1 6
 # ggtree 1.13.5
2 7
 
3 8
 + enable additional parameters passed to `geom_rootedge` (2018-09-13, Thu)
... ...
@@ -7,7 +7,7 @@ layout.unrooted <- function(model, branch.length="branch.length", layout.method=
7 7
                  equal_angle = layoutEqualAngle(model, branch.length),
8 8
                  daylight = layoutDaylight(model, branch.length)
9 9
                  )
10
-    
10
+
11 11
     return(df)
12 12
 }
13 13
 
... ...
@@ -33,21 +33,28 @@ set_branch_length_cladogram <- function(tree) {
33 33
 ##' "Inferring Phylogenies" by Joseph Felsenstein.
34 34
 ##'
35 35
 ##' @title layoutEqualAngle
36
-##' @param tree phylo object
36
+##' @param model tree object, e.g. phylo or treedata
37 37
 ##' @param branch.length set to 'none' for edge length of 1. Otherwise the phylogenetic tree edge length is used.
38 38
 ##' @return tree as data.frame with equal angle layout.
39 39
 layoutEqualAngle <- function(model, branch.length ){
40 40
 	tree <- as.phylo(model)
41
-	
42
-    if (branch.length == "none") {
43
-        tree <- set_branch_length_cladogram(tree)
44
-    }
45 41
 
46
-    root <- getRoot(tree)
47
-    ## Convert Phylo tree to data.frame.
48
-    ## df <- as.data.frame.phylo_(tree)
49
-    df <- as_data_frame(model) %>%
50
-        mutate_(isTip = ~(! node %in% parent))
42
+  if (! is.null(tree$edge.length)) {
43
+      if (anyNA(tree$edge.length)) {
44
+          warning("'edge.length' contains NA values...\n## setting 'edge.length' to NULL automatically when plotting the tree...")
45
+          tree$edge.length <- NULL
46
+      }
47
+  }
48
+  
49
+  if (branch.length == "none") {
50
+      tree <- set_branch_length_cladogram(tree)
51
+  }
52
+  
53
+  root <- getRoot(tree)
54
+  ## Convert Phylo tree to data.frame.
55
+  ## df <- as.data.frame.phylo_(tree)
56
+  df <- as_data_frame(model) %>%
57
+      mutate_(isTip = ~(! node %in% parent))
51 58
 
52 59
     ## NOTE: Angles (start, end, angle) are in half-rotation units (radians/pi or degrees/180)
53 60
 
... ...
@@ -113,7 +120,7 @@ layoutEqualAngle <- function(model, branch.length ){
113 120
 ##' Equal daylight layout method for unrooted trees.
114 121
 ##'
115 122
 ##' #' @title
116
-##' @param tree phylo object
123
+##' @param model tree object, e.g. phylo or treedata
117 124
 ##' @param branch.length set to 'none' for edge length of 1. Otherwise the phylogenetic tree edge length is used.
118 125
 ##' @return tree as data.frame with equal angle layout.
119 126
 ##' @references
... ...
@@ -4,10 +4,10 @@
4 4
 \alias{layoutDaylight}
5 5
 \title{Equal daylight layout method for unrooted trees.}
6 6
 \usage{
7
-layoutDaylight(tree, branch.length)
7
+layoutDaylight(model, branch.length)
8 8
 }
9 9
 \arguments{
10
-\item{tree}{phylo object}
10
+\item{model}{tree object, e.g. phylo or treedata}
11 11
 
12 12
 \item{branch.length}{set to 'none' for edge length of 1. Otherwise the phylogenetic tree edge length is used.}
13 13
 }
... ...
@@ -4,10 +4,10 @@
4 4
 \alias{layoutEqualAngle}
5 5
 \title{layoutEqualAngle}
6 6
 \usage{
7
-layoutEqualAngle(tree, branch.length)
7
+layoutEqualAngle(model, branch.length)
8 8
 }
9 9
 \arguments{
10
-\item{tree}{phylo object}
10
+\item{model}{tree object, e.g. phylo or treedata}
11 11
 
12 12
 \item{branch.length}{set to 'none' for edge length of 1. Otherwise the phylogenetic tree edge length is used.}
13 13
 }