Browse code

Commit made by the Bioconductor Git-SVN bridge.

Commit id: 6a8688fb37bcb8dd68977824539842b2e2e1ebe7

remove quote in beast tip/node labels <2015-03-10, Tue>



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

g.yu authored on 10/03/2015 10:15:35
Showing 4 changed files

... ...
@@ -1,7 +1,7 @@
1 1
 Package: ggtree
2 2
 Type: Package
3 3
 Title: a phylogenetic tree viewer for different types of tree annotations
4
-Version: 0.99.21
4
+Version: 0.99.22
5 5
 Author: Guangchuang Yu
6 6
 Maintainer: Guangchuang Yu <guangchuangyu@gmail.com>
7 7
 Description: ggtree extends the ggplot2 plotting system which implemented the
... ...
@@ -1,3 +1,7 @@
1
+CHANGES IN VERSION 0.99.22
2
+------------------------
3
+ o remove quote in beast tip/node labels <2015-03-10, Tue>
4
+ 
1 5
 CHANGES IN VERSION 0.99.21
2 6
 ------------------------
3 7
  o fixed downloading png file in Windows platform, should explicitly setting mode="wb". <2015-03-03, Tue>
... ...
@@ -15,11 +15,19 @@ read.beast <- function(file) {
15 15
     stats <- read.stats_beast(file)
16 16
     fields <- sub("_lower|_upper", "", names(stats)) %>% unique
17 17
     fields %<>% `[`(.!="node")
18
+
19
+    phylo <- read.nexus(file)
20
+    if (!is.null(phylo$node.label)) {
21
+        phylo$node.label %<>% gsub("\"*'*", "", .)
22
+    }
23
+    if ( !is.null(phylo$tip.label)) {
24
+        phylo$tip.label %<>% gsub("\"*'*", "", .) 
25
+    }
18 26
     
19 27
     new("beast",
20 28
         fields      = fields,
21 29
         treetext    = read.treetext_beast(file),
22
-        phylo       = read.nexus(file),
30
+        phylo       = phylo,
23 31
         translation = read.trans_beast(file),
24 32
         stats       = stats,
25 33
         file        = file
... ...
@@ -124,7 +124,8 @@ fortify.beast <- function(model, data,
124 124
             len <- sapply(stats[,ii], length)
125 125
             if (any(len > 1)) {
126 126
                 stats[,ii] %<>% sapply(., function(x) {
127
-                    y <- unlist(x) %>% as.character %>% gsub("\"", "", .)
127
+                    y <- unlist(x) %>% as.character %>%
128
+                        gsub("\"", "", .) %>% gsub("'", "", .)
128 129
                     if (length(y) == 1) {
129 130
                         return(y)
130 131
                     } else {
... ...
@@ -132,7 +133,8 @@ fortify.beast <- function(model, data,
132 133
                     }
133 134
                 })
134 135
             } else {
135
-                stats[,ii] %<>% unlist %>% as.character %>% gsub("\"", "", .)
136
+                stats[,ii] %<>% unlist %>% as.character %>%
137
+                    gsub("\"", "", .) %>% gsub("'", "", .)
136 138
             }
137 139
             next
138 140
         }