... | ... |
@@ -6,7 +6,8 @@ Authors@R: c( |
6 | 6 |
person("Guangchuang", "Yu", email = "guangchuangyu@gmail.com", role = c("aut", "cre")), |
7 | 7 |
person("Tommy Tsan-Yuk", "Lam", email = "tylam.tommy@gmail.com", rol = "ths"), |
8 | 8 |
person("Justin", "Silverman", email = "jsilve24@gmail.com", rol = "ctb", comment = "geom_balance"), |
9 |
- person("Casey", "Dunn", email = "casey_dunn@brown.edu", rol = "ctb", comment = "propose using txtConnection so that parser functions can use tree strings as input") |
|
9 |
+ person("Casey", "Dunn", email = "casey_dunn@brown.edu", rol = "ctb", |
|
10 |
+ comment = "propose using txtConnection so that parser functions can use tree strings as input") |
|
10 | 11 |
) |
11 | 12 |
Maintainer: Guangchuang Yu <guangchuangyu@gmail.com> |
12 | 13 |
Description: 'ggtree' extends the 'ggplot2' plotting system which implemented the grammar of graphics. |
... | ... |
@@ -100,10 +100,22 @@ |
100 | 100 |
##' @author Guangchuang Yu |
101 | 101 |
`%+>%` <- function(p, data) { |
102 | 102 |
df <- p$data |
103 |
- ## res <- merge(df[, c('label', 'y')], data, by.x='label', by.y=1) ## , all.x=TRUE) |
|
104 |
- res <- merge(df, data, by.x='label', by.y=1) ## , all.x=TRUE) |
|
105 | 103 |
lv <- levels(df$panel) |
106 |
- res$panel <- factor(lv[length(lv)], levels=lv) |
|
104 |
+ |
|
105 |
+ if (is(data, "GRanges") || is(data, "GRangesList")) { |
|
106 |
+ names(data) <- df$y[match(names(data), df$label)] |
|
107 |
+ res <- data[order(as.numeric(names(data)))] |
|
108 |
+ mcols <- get_fun_from_pkg("GenomicRanges", "mcols") |
|
109 |
+ `mcols<-` <- get_fun_from_pkg("GenomicRanges", "`mcols<-`") |
|
110 |
+ mcols(res)$panel <- factor(lv[length(lv)], levels=lv) |
|
111 |
+ } else if (is(data, "data.frame") || is(data, "tbl_df")) { |
|
112 |
+ data <- as.data.frame(data) |
|
113 |
+ ## res <- merge(df[, c('label', 'y')], data, by.x='label', by.y=1) ## , all.x=TRUE) |
|
114 |
+ res <- merge(df, data, by.x='label', by.y=1) ## , all.x=TRUE) |
|
115 |
+ res$panel <- factor(lv[length(lv)], levels=lv) |
|
116 |
+ } else { |
|
117 |
+ stop("input 'data' is not supported...") |
|
118 |
+ } |
|
107 | 119 |
return(res) |
108 | 120 |
} |
109 | 121 |
|
... | ... |
@@ -1,9 +1,9 @@ |
1 | 1 |
ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data |
2 | 2 |
=========================================================================================================================== |
3 | 3 |
|
4 |
-[](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) |
|
4 |
+[](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) |
|
5 | 5 |
|
6 |
-[](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) |
|
6 |
+[](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 | 7 |
|
8 | 8 |
[](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) |
9 | 9 |
|
... | ... |
@@ -50,7 +50,7 @@ For details, please visit our project website, <https://guangchuangyu.github.io/ |
50 | 50 |
|
51 | 51 |
### Download stats |
52 | 52 |
|
53 |
-[](https://bioconductor.org/packages/stats/bioc/ggtree/) [](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) |
|
53 |
+[](https://bioconductor.org/packages/stats/bioc/ggtree/) [](https://bioconductor.org/packages/stats/bioc/ggtree) [](https://bioconductor.org/packages/stats/bioc/ggtree) |
|
54 | 54 |
|
55 | 55 |
+-------------------------+------------------------+-------------------------+----------------+ |
56 | 56 |
| * | |