... | ... |
@@ -1,5 +1,7 @@ |
1 | 1 |
CHANGES IN VERSION 1.7.8 |
2 | 2 |
------------------------ |
3 |
+ o get_taxa_name now sorted by taxa position and also support whole tree <2017-03-01, Wed> |
|
4 |
+ o unrooted layout support branch.length="none", fixed #114 <2017-03-01, Wed> |
|
3 | 5 |
o remove apeBootstrap and raxml object support as they were removed from treeio <2017-02-28, Tue> |
4 | 6 |
|
5 | 7 |
CHANGES IN VERSION 1.7.7 |
... | ... |
@@ -1,4 +1,4 @@ |
1 |
-##' get taxa name of a selected node |
|
1 |
+##' get taxa name of a selected node (or tree if node=NULL) sorted by their position in plotting |
|
2 | 2 |
##' |
3 | 3 |
##' |
4 | 4 |
##' @title get_taxa_name |
... | ... |
@@ -7,16 +7,20 @@ |
7 | 7 |
##' @return taxa name vector |
8 | 8 |
##' @export |
9 | 9 |
##' @author Guangchuang Yu |
10 |
-get_taxa_name <- function(tree_view=NULL, node) { |
|
10 |
+get_taxa_name <- function(tree_view=NULL, node=NULL) { |
|
11 | 11 |
tree_view %<>% get_tree_view |
12 | 12 |
|
13 | 13 |
df <- tree_view$data |
14 |
- sp <- get.offspring.df(df, node) |
|
15 |
- res <- df[sp, "label"] |
|
16 |
- return(res[df[sp, "isTip"]]) |
|
17 |
-} |
|
18 |
- |
|
14 |
+ if (!is.null(node)) { |
|
15 |
+ sp <- get.offspring.df(df, node) |
|
16 |
+ df <- df[sp, ] |
|
17 |
+ } |
|
19 | 18 |
|
19 |
+ with(df, { |
|
20 |
+ i = order(y, decreasing=T) |
|
21 |
+ label[i][isTip[i]] |
|
22 |
+ }) |
|
23 |
+} |
|
20 | 24 |
|
21 | 25 |
|
22 | 26 |
##' view a clade of tree |
... | ... |
@@ -494,7 +494,7 @@ fortify.phylo <- function(model, data, layout="rectangular", |
494 | 494 |
as.data.frame.phylo <- function(x, row.names, optional, |
495 | 495 |
layout="rectangular", ...) { |
496 | 496 |
if (layout == "unrooted") { |
497 |
- return(layout.unrooted(x)) |
|
497 |
+ return(layout.unrooted(x, ...)) |
|
498 | 498 |
} |
499 | 499 |
as.data.frame.phylo_(x, layout, ...) |
500 | 500 |
} |
... | ... |
@@ -159,7 +159,7 @@ reroot_node_mapping <- function(tree, tree2) { |
159 | 159 |
|
160 | 160 |
|
161 | 161 |
##' @importFrom ape reorder.phylo |
162 |
-layout.unrooted <- function(tree) { |
|
162 |
+layout.unrooted <- function(tree, branch.length="branch.length", ...) { |
|
163 | 163 |
N <- getNodeNum(tree) |
164 | 164 |
root <- getRoot(tree) |
165 | 165 |
|
... | ... |
@@ -198,7 +198,12 @@ layout.unrooted <- function(tree) { |
198 | 198 |
alpha <- (end - start) * ntip.child/curNtip |
199 | 199 |
beta <- start + alpha / 2 |
200 | 200 |
|
201 |
- length.child <- df[child, "length"] |
|
201 |
+ if (branch.length == "none") { |
|
202 |
+ length.child <- 1 |
|
203 |
+ } else { |
|
204 |
+ length.child <- df[child, "length"] |
|
205 |
+ } |
|
206 |
+ |
|
202 | 207 |
df[child, "x"] <- df[curNode, "x"] + cospi(beta) * length.child |
203 | 208 |
df[child, "y"] <- df[curNode, "y"] + sinpi(beta) * length.child |
204 | 209 |
df[child, "angle"] <- -90 -180 * beta * sign(beta - 1) |
... | ... |
@@ -2,9 +2,9 @@ |
2 | 2 |
ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data |
3 | 3 |
=========================================================================================================================== |
4 | 4 |
|
5 |
-[](https://bioconductor.org/packages/ggtree) [](https://github.com/GuangchuangYu/ggtree) [](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#since) [](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) <img src="logo.png" align="right" /> |
|
5 |
+[](https://bioconductor.org/packages/ggtree) [](https://github.com/GuangchuangYu/ggtree) [](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#since) [](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) <img src="logo.png" align="right" /> |
|
6 | 6 |
|
7 |
-[](http://www.repostatus.org/#active) [](https://codecov.io/gh/GuangchuangYu/ggtree) [](https://github.com/GuangchuangYu/ggtree/commits/master) [](https://github.com/GuangchuangYu/ggtree/network) [](https://github.com/GuangchuangYu/ggtree/stargazers) [](https://awesome-r.com/#awesome-r-graphic-displays) |
|
7 |
+[](http://www.repostatus.org/#active) [](https://codecov.io/gh/GuangchuangYu/ggtree) [](https://github.com/GuangchuangYu/ggtree/commits/master) [](https://github.com/GuangchuangYu/ggtree/network) [](https://github.com/GuangchuangYu/ggtree/stargazers) [](https://awesome-r.com/#awesome-r-graphic-displays) |
|
8 | 8 |
|
9 | 9 |
[](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#archives) [](https://bioconductor.org/checkResults/devel/bioc-LATEST/ggtree/) [](https://travis-ci.org/GuangchuangYu/ggtree) [](https://ci.appveyor.com/project/GuangchuangYu/ggtree) [](http://bioconda.github.io/recipes/bioconductor-ggtree/README.html) |
10 | 10 |
|
... | ... |
@@ -51,7 +51,7 @@ For details, please visit our project website, <https://guangchuangyu.github.io/ |
51 | 51 |
|
52 | 52 |
### Download stats |
53 | 53 |
|
54 |
-[](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) |
|
54 |
+[](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) |
|
55 | 55 |
|
56 | 56 |
++--------------------+--------------------+--------------------+--------------------+--------+ |
57 | 57 |
| * | |
... | ... |
@@ -4,7 +4,7 @@ |
4 | 4 |
\alias{get_taxa_name} |
5 | 5 |
\title{get_taxa_name} |
6 | 6 |
\usage{ |
7 |
-get_taxa_name(tree_view = NULL, node) |
|
7 |
+get_taxa_name(tree_view = NULL, node = NULL) |
|
8 | 8 |
} |
9 | 9 |
\arguments{ |
10 | 10 |
\item{tree_view}{tree view} |
... | ... |
@@ -15,7 +15,7 @@ get_taxa_name(tree_view = NULL, node) |
15 | 15 |
taxa name vector |
16 | 16 |
} |
17 | 17 |
\description{ |
18 |
-get taxa name of a selected node |
|
18 |
+get taxa name of a selected node (or tree if node=NULL) sorted by their position in plotting |
|
19 | 19 |
} |
20 | 20 |
\author{ |
21 | 21 |
Guangchuang Yu |