Browse code

facet_plot supports ggbio::geom_alignment

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/ggtree@123042 bc3139a8-67e5-0310-9ffc-ced21a209358

Guangchuang Yu authored on 26/10/2016 08:28:49
Showing 4 changed files

... ...
@@ -4,12 +4,11 @@ Title: an R package for visualization and annotation of phylogenetic trees with
4 4
 Version: 1.7.1
5 5
 Authors@R: c(
6 6
 	   person("Guangchuang", "Yu", email = "guangchuangyu@gmail.com", role = c("aut", "cre")),
7
-	   person("Tommy Tsan-Yuk", "Lam", email = "tylam.tommy@gmail.com", rol = "aut"),
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
-Author: Guangchuang Yu <guangchuangyu@gmail.com> and Tommy Tsan-Yuk Lam with contributions from
12
-   	Justin Silverman and Casey Dunn.
13 12
 Maintainer: Guangchuang Yu <guangchuangyu@gmail.com>
14 13
 Description: 'ggtree' extends the 'ggplot2' plotting system which implemented the grammar of graphics.
15 14
 	     'ggtree' is designed for visualization and annotation of phylogenetic trees with their covariates and other associated data.
... ...
@@ -1,5 +1,7 @@
1 1
 CHANGES IN VERSION 1.7.1
2 2
 ------------------------
3
+ o facet_plot supports ggbio::geom_alignment <2016-10-26, Wed>
4
+   + https://github.com/tengfei/ggbio/issues/83
3 5
  o make tree stats available in facet_plot <2016-10-24, Mon>
4 6
 
5 7
 CHANGES IN VERSION 1.6.0
... ...
@@ -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
-[![releaseVersion](https://img.shields.io/badge/release%20version-1.6.0-green.svg?style=flat)](https://bioconductor.org/packages/ggtree) [![develVersion](https://img.shields.io/badge/devel%20version-1.7.1-green.svg?style=flat)](https://github.com/GuangchuangYu/ggtree) [![Bioc](http://www.bioconductor.org/shields/years-in-bioc/ggtree.svg)](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#since) [![total](https://img.shields.io/badge/downloads-15614/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) [![month](https://img.shields.io/badge/downloads-1678/month-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree)
4
+[![releaseVersion](https://img.shields.io/badge/release%20version-1.6.1-green.svg?style=flat)](https://bioconductor.org/packages/ggtree) [![develVersion](https://img.shields.io/badge/devel%20version-1.7.1-green.svg?style=flat)](https://github.com/GuangchuangYu/ggtree) [![Bioc](http://www.bioconductor.org/shields/years-in-bioc/ggtree.svg)](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#since) [![total](https://img.shields.io/badge/downloads-15734/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) [![month](https://img.shields.io/badge/downloads-1678/month-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree)
5 5
 
6
-[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![codecov](https://codecov.io/gh/GuangchuangYu/ggtree/branch/master/graph/badge.svg)](https://codecov.io/gh/GuangchuangYu/ggtree) [![Last-changedate](https://img.shields.io/badge/last%20change-2016--10--24-green.svg)](https://github.com/GuangchuangYu/ggtree/commits/master) [![GitHub forks](https://img.shields.io/github/forks/GuangchuangYu/ggtree.svg)](https://github.com/GuangchuangYu/ggtree/network) [![GitHub stars](https://img.shields.io/github/stars/GuangchuangYu/ggtree.svg)](https://github.com/GuangchuangYu/ggtree/stargazers) [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://awesome-r.com/#awesome-r-graphic-displays)
6
+[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![codecov](https://codecov.io/gh/GuangchuangYu/ggtree/branch/master/graph/badge.svg)](https://codecov.io/gh/GuangchuangYu/ggtree) [![Last-changedate](https://img.shields.io/badge/last%20change-2016--10--26-green.svg)](https://github.com/GuangchuangYu/ggtree/commits/master) [![GitHub forks](https://img.shields.io/github/forks/GuangchuangYu/ggtree.svg)](https://github.com/GuangchuangYu/ggtree/network) [![GitHub stars](https://img.shields.io/github/stars/GuangchuangYu/ggtree.svg)](https://github.com/GuangchuangYu/ggtree/stargazers) [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://awesome-r.com/#awesome-r-graphic-displays)
7 7
 
8 8
 [![platform](http://www.bioconductor.org/shields/availability/devel/ggtree.svg)](https://www.bioconductor.org/packages/devel/bioc/html/ggtree.html#archives) [![Build Status](http://www.bioconductor.org/shields/build/devel/bioc/ggtree.svg)](https://bioconductor.org/checkResults/devel/bioc-LATEST/ggtree/) [![Linux/Mac Travis Build Status](https://img.shields.io/travis/GuangchuangYu/ggtree/master.svg?label=Mac%20OSX%20%26%20Linux)](https://travis-ci.org/GuangchuangYu/ggtree) [![AppVeyor Build Status](https://img.shields.io/appveyor/ci/Guangchuangyu/ggtree/master.svg?label=Windows)](https://ci.appveyor.com/project/GuangchuangYu/ggtree) [![install with bioconda](https://img.shields.io/badge/install%20with-bioconda-green.svg?style=flat)](http://bioconda.github.io/recipes/bioconductor-ggtree/README.html)
9 9
 
... ...
@@ -17,7 +17,7 @@ Please cite the following article when using `ggtree`:
17 17
 
18 18
 **G Yu**, DK Smith, H Zhu, Y Guan, TTY Lam<sup>\*</sup>. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data. ***Methods in Ecology and Evolution***. *accepted*
19 19
 
20
-[![doi](https://img.shields.io/badge/doi-10.1111/2041--210X.12628-green.svg?style=flat)](http://dx.doi.org/10.1111/2041-210X.12628) [![citation](https://img.shields.io/badge/cited%20by-1-green.svg?style=flat)](https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627) [![Altmetric](https://img.shields.io/badge/Altmetric-246-green.svg?style=flat)](https://www.altmetric.com/details/10533079)
20
+[![doi](https://img.shields.io/badge/doi-10.1111/2041--210X.12628-green.svg?style=flat)](http://dx.doi.org/10.1111/2041-210X.12628) [![citation](https://img.shields.io/badge/cited%20by-1-green.svg?style=flat)](https://scholar.google.com.hk/scholar?oi=bibs&hl=en&cites=7268358477862164627) [![Altmetric](https://img.shields.io/badge/Altmetric-250-green.svg?style=flat)](https://www.altmetric.com/details/10533079)
21 21
 
22 22
 ------------------------------------------------------------------------
23 23
 
... ...
@@ -50,7 +50,7 @@ For details, please visit our project website, <https://guangchuangyu.github.io/
50 50
 
51 51
 ### Download stats
52 52
 
53
-[![download](http://www.bioconductor.org/shields/downloads/ggtree.svg)](https://bioconductor.org/packages/stats/bioc/ggtree/) [![total](https://img.shields.io/badge/downloads-15614/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) [![month](https://img.shields.io/badge/downloads-1678/month-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree)
53
+[![download](http://www.bioconductor.org/shields/downloads/ggtree.svg)](https://bioconductor.org/packages/stats/bioc/ggtree/) [![total](https://img.shields.io/badge/downloads-15734/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) [![month](https://img.shields.io/badge/downloads-1678/month-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree)
54 54
 
55 55
          +-------------------------+------------------------+-------------------------+----------------+
56 56
          |                                                                                         *   |