Browse code

unit test of groupOTU & groupClade

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

Guangchuang Yu authored on 22/09/2016 05:42:40
Showing4 changed files

... ...
@@ -1,10 +1,12 @@
1 1
 CHANGES IN VERSION 1.5.14
2 2
 ------------------------
3
+ o unit test for groupOTU and groupClade <2016-09-22, Thu>
4
+ o groupOTU label groups by input group names (when input is a named list) <2016-09-22, Thu>
3 5
  o update angle calculation for geom_tiplab <2016-09-13, Thu>
4 6
  o as.polytomy to collapse binary tree to polytomy by applying 'fun' to selected 'feature' (e.g. bootstrap value less than 70). <2016-09-13, Tue>
5 7
    + currently only phylo object supported.
6 8
    + add test for as.polytomy
7
-   
9
+
8 10
 CHANGES IN VERSION 1.5.13
9 11
 ------------------------
10 12
  o facet_plot for plotting data with tree <2016-09-06, Tue>
... ...
@@ -14,12 +16,12 @@ CHANGES IN VERSION 1.5.13
14 16
    + colnames_offset_y
15 17
    + hjust
16 18
  o offset parameter in geom_tiplab and geom_tiplab2 <2016-09-05, Mon>
17
- 
19
+
18 20
 CHANGES IN VERSION 1.5.12
19 21
 ------------------------
20 22
  o use data in all layers instead of the base layer for coordination calculation in subview <2016-09-01, Thu>
21 23
  o bug fixed in subview, width & height should be width/2 & height/2 <2016-09-01, Thu>
22
- 
24
+
23 25
 CHANGES IN VERSION 1.5.11
24 26
 ------------------------
25 27
  o gheatmap works with matrix <2016-08-28, Sun>
... ...
@@ -28,27 +30,27 @@ CHANGES IN VERSION 1.5.11
28 30
  o bug fixed in geom_tiplab <2016-08-17, Wed>
29 31
    + https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/bioc-ggtree/Tm9ULK7hd9E/HviXEh3CBwAJ
30 32
  o update citation info, add doi. <2016-08-16, Tue>
31
- 
33
+
32 34
 CHANGES IN VERSION 1.5.10
33 35
 ------------------------
34 36
  o fixed issue #72 for label of geom_treescale not displayed <2016-08-16, Tue>
35 37
    + https://github.com/GuangchuangYu/ggtree/issues/72
36
- 
38
+
37 39
 CHANGES IN VERSION 1.5.9
38 40
 ------------------------
39 41
  o update citation info <2016-08-12, Fri>
40
- 
42
+
41 43
 CHANGES IN VERSION 1.5.8
42 44
 ------------------------
43 45
  o add color parameter in geom_cladelabel, color should be of length 1 or 2 <2016-08-11, Thu>
44 46
  o geom_cladelabel support parsing expression <2016-08-11, Thu>
45
- 
47
+
46 48
 CHANGES IN VERSION 1.5.7
47 49
 ------------------------
48 50
  o geom_strip can accept taxa name as input but labeling strip will not supported.
49 51
    To support labeling strip, user need to input node id  <2016-07-27, Wed>
50
- o nodeid function for converting node label(s) to node id(s) <2016-07-27, Wed> 
51
- 
52
+ o nodeid function for converting node label(s) to node id(s) <2016-07-27, Wed>
53
+
52 54
 CHANGES IN VERSION 1.5.6
53 55
 ------------------------
54 56
  o remove dependency of Biostring for installing ggtree <2016-07-21, Thu>
... ...
@@ -69,7 +71,7 @@ CHANGES IN VERSION 1.5.5
69 71
  o bug fixed if time-scaled tree extend into the BCE. <2016-06-02, Thu>
70 72
    + as.Date won't work for BCE time.
71 73
    + as.Date=FALSE by default in fortify method, just use the time in decimal format (real number, not Date object).
72
- 
74
+
73 75
 CHANGES IN VERSION 1.5.4
74 76
 ------------------------
75 77
  o reroot method for raxml object <2016-05-22, Sun>
... ...
@@ -77,7 +79,7 @@ CHANGES IN VERSION 1.5.4
77 79
  o bug fixed in collapse <2016-05-20, Fri>
78 80
    + if user collapse a node that is an offspring of a collapsed node, print warning msg and return the tree directly
79 81
  o use byte compiler <2016-05-18, Wed>
80
- o change any(is.na()) to anyNA() which is more efficient <2016-05-18, Wed> 
82
+ o change any(is.na()) to anyNA() which is more efficient <2016-05-18, Wed>
81 83
  o https://github.com/Bioconductor-mirror/ggtree/commit/559548c66b51253e8ccb983d353385838a81f106
82 84
 
83 85
 CHANGES IN VERSION 1.5.3
... ...
@@ -86,9 +88,9 @@ CHANGES IN VERSION 1.5.3
86 88
    + add fan layout example in treeVisualization vignette
87 89
    + add open_tree and rotate_tree example in treeManipulation vignette
88 90
  o add angle in ggtree function, fan layout supported <2016-05-12, Thu>
89
- o rotate_tree and open_tree function <2016-05-12, Thu> 
91
+ o rotate_tree and open_tree function <2016-05-12, Thu>
90 92
  o support reading BEAST MCC trees (multiple trees in one file) via the read.beast function <2016-05-12, Thu>
91
- o https://github.com/Bioconductor-mirror/ggtree/commit/51eec4721595c274c24dc4df2f1fdf40700cb1a5 
93
+ o https://github.com/Bioconductor-mirror/ggtree/commit/51eec4721595c274c24dc4df2f1fdf40700cb1a5
92 94
 
93 95
 CHANGES IN VERSION 1.5.2
94 96
 ------------------------
... ...
@@ -101,7 +103,7 @@ CHANGES IN VERSION 1.5.2
101 103
    + https://github.com/GuangchuangYu/ggtree/issues/40
102 104
  o supports phylo4d object <2016-05-10, Tue>
103 105
    + https://github.com/GuangchuangYu/ggtree/issues/47
104
- 
106
+
105 107
 CHANGES IN VERSION 1.5.1
106 108
 ------------------------
107 109
  o update vignettes <2016-05-10, Tue>
... ...
@@ -113,11 +115,11 @@ CHANGES IN VERSION 1.5.1
113 115
    + https://github.com/GuangchuangYu/ggtree/pull/57
114 116
  o geom_strip for associated taxa <2016-05-09, Mon>
115 117
    + https://github.com/GuangchuangYu/ggtree/issues/52
116
- 
118
+
117 119
 CHANGES IN VERSION 1.4.0
118 120
 ------------------------
119 121
  o BioC 3.3 released <2016-05-05, Thu>
120
- 
122
+
121 123
 CHANGES IN VERSION 1.3.16
122 124
 ------------------------
123 125
  o geom_treescale() supports family argument <2016-04-27, Wed>
... ...
@@ -127,7 +129,7 @@ CHANGES IN VERSION 1.3.16
127 129
  o support passing textConnection(text_string) as a file <2016-04-21, Thu>
128 130
    + contributed by Casey Dunn <casey_dunn@brown.edu>
129 131
    + https://github.com/GuangchuangYu/ggtree/pull/55#issuecomment-212859693
130
- 
132
+
131 133
 CHANGES IN VERSION 1.3.15
132 134
 ------------------------
133 135
  o geom_tiplab2 supports parameter hjust <2016-04-18, Mon>
... ...
@@ -135,9 +137,9 @@ CHANGES IN VERSION 1.3.15
135 137
  o geom_label2 that support subsetting <2016-04-07, Thu>
136 138
  o geom_tiplab2 for adding tip label of circular layout <2016-04-06, Wed>
137 139
  o use plot$plot_env to access ggplot2 parameter <2016-04-06, Wed>
138
- o geom_taxalink for connecting related taxa <2016-04-01, Fri> 
140
+ o geom_taxalink for connecting related taxa <2016-04-01, Fri>
139 141
  o geom_range for adding range of HPD to present uncertainty of evolutionary inference <2016-04-01, Fri>
140
- 
142
+
141 143
 CHANGES IN VERSION 1.3.14
142 144
 ------------------------
143 145
  o geom_tiplab works with NA values, compatible with collapse <2016-03-05, Sat>
... ...
@@ -145,12 +147,12 @@ CHANGES IN VERSION 1.3.14
145 147
  o offset works in `align=FFALSE` with `annotation_image` function <2016-02-23, Tue>
146 148
    + see https://github.com/GuangchuangYu/ggtree/issues/46
147 149
  o subview and inset now supports annotating with img files <2016-02-23, Tue>
148
- 
150
+
149 151
 CHANGES IN VERSION 1.3.13
150 152
 ------------------------
151 153
  o add example of rescale_tree function in treeAnnotation.Rmd <2016-02-07, Sun>
152 154
  o geom_cladelabel works with collapse <2016-02-07, Sun>
153
-   + see https://github.com/GuangchuangYu/ggtree/issues/38 
155
+   + see https://github.com/GuangchuangYu/ggtree/issues/38
154 156
 
155 157
 CHANGES IN VERSION 1.3.12
156 158
 ------------------------
... ...
@@ -158,8 +160,8 @@ CHANGES IN VERSION 1.3.12
158 160
  o solved issues of geom_tree2 <2016-01-25, Mon>
159 161
    + https://github.com/hadley/ggplot2/issues/1512
160 162
  o colnames_level parameter in gheatmap <2016-01-25, Mon>
161
- o raxml2nwk function for converting raxml bootstrap tree to newick format <2016-01-25, Mon> 
162
- 
163
+ o raxml2nwk function for converting raxml bootstrap tree to newick format <2016-01-25, Mon>
164
+
163 165
 CHANGES IN VERSION 1.3.11
164 166
 ------------------------
165 167
  o solved issues of geom_tree2 <2016-01-25, Mon>
... ...
@@ -171,7 +173,7 @@ CHANGES IN VERSION 1.3.11
171 173
  o implement geom_tree2 layer that support duplicated node records via the setup_tree_data function <2016-01-21, Thu>
172 174
  o rescale_tree function for rescaling branch length of tree object <2016-01-20, Wed>
173 175
  o upgrade set_branch_length, now branch can be rescaled using feature in extraInfo slot <2016-01-20, Wed>
174
- 
176
+
175 177
 CHANGES IN VERSION 1.3.10
176 178
 ------------------------
177 179
  o remove dependency of gridExtra by implementing multiplot function instead of using grid.arrange <2016-01-20, Wed>
... ...
@@ -185,7 +187,7 @@ CHANGES IN VERSION 1.3.9
185 187
  o viewClade, scaleClade, collapse, expand, rotate, flip, get_taxa_name and scale_x_ggtree accepts input tree_view=NULL.
186 188
    these function will access the last plot if tree_view=NULL. <2016-01-13, Wed>
187 189
    + > ggtree(rtree(30)); viewClade(node=35) works. no need to pipe.
188
- 
190
+
189 191
 CHANGES IN VERSION 1.3.8
190 192
 ------------------------
191 193
  o add example of viewClade in 'Tree Manipulation' vignette <2016-01-13, Wed>
... ...
@@ -195,7 +197,7 @@ CHANGES IN VERSION 1.3.8
195 197
  o 05 advance tree annotation vignette <2016-01-04, Mon>
196 198
  o export theme_inset <2016-01-04, Mon>
197 199
  o inset, nodebar, nodepie functions <2015-12-31, Thu>
198
- 
200
+
199 201
 CHANGES IN VERSION 1.3.7
200 202
 ------------------------
201 203
  o split the long vignette to several vignettes
... ...
@@ -204,14 +206,14 @@ CHANGES IN VERSION 1.3.7
204 206
    + 02 tree visualization <2015-12-28, Mon>
205 207
    + 03 tree manipulation <2015-12-28, Mon>
206 208
    + 04 tree annotation <2015-12-29, Tue>
207
- 
209
+
208 210
 CHANGES IN VERSION 1.3.6
209 211
 ------------------------
210 212
  o MRCA function for finding Most Recent Common Ancestor among a vector of tips <2015-12-22, Tue>
211 213
  o geom_cladelabel: add bar and label to annotate a clade <2015-12-21, Mon>
212 214
    - remove annotation_clade and annotation_clade2 functions.
213 215
  o geom_treescale: tree scale layer. (add_legend was removed) <2015-12-21, Mon>
214
- 
216
+
215 217
 CHANGES IN VERSION 1.3.5
216 218
 ------------------------
217 219
  o bug fixed, read.nhx now works with scientific notation <2015-11-30, Mon>
... ...
@@ -226,12 +228,12 @@ CHANGES IN VERSION 1.3.4
226 228
    + see https://github.com/GuangchuangYu/ggtree/issues/26
227 229
  o support NHX (New Hampshire X) format via read.nhx function <2015-11-17, Tue>
228 230
  o bug fixed in extract.treeinfo.jplace <2015-11-17, Thu>
229
- 
231
+
230 232
 CHANGES IN VERSION 1.3.3
231 233
 ------------------------
232 234
  o support color=NULL in gheatmap, then no colored line will draw within the heatmap <2015-10-30, Fri>
233 235
  o add `angle` for also rectangular, so that it will be available for layout='rectangular' following by coord_polar() <2015-10-27, Tue>
234
- 
236
+
235 237
 CHANGES IN VERSION 1.3.2
236 238
 ------------------------
237 239
  o update vignette, add example of ape bootstrap and phangorn ancestral sequences <2015-10-26, Mon>
... ...
@@ -239,7 +241,7 @@ CHANGES IN VERSION 1.3.2
239 241
    see https://github.com/GuangchuangYu/ggtree/issues/20
240 242
  o add support of ancestral sequences inferred by phangorn <2015-10-26, Mon>
241 243
    see https://github.com/GuangchuangYu/ggtree/issues/21
242
- 
244
+
243 245
 CHANGES IN VERSION 1.3.1
244 246
 ------------------------
245 247
  o change angle to angle + 90, so that label will in radial direction <2015-10-22, Thu>
... ...
@@ -247,17 +249,17 @@ CHANGES IN VERSION 1.3.1
247 249
  o na.rm should be always passed to layer(), fixed it in geom_hilight and geom_text2 <2015-10-21, Wed>
248 250
    + see https://github.com/hadley/ggplot2/issues/1380
249 251
  o matching beast stats with tree using internal node number instead of label <2015-10-20, Tue>
250
- 
252
+
251 253
 CHANGES IN VERSION 1.2.0
252 254
 ------------------------
253 255
  o BioC 3.2 released
254
- 
256
+
255 257
 CHANGES IN VERSION 1.1.21
256 258
 ------------------------
257 259
  o support hyphy output of ancestral sequences that is in phylip sequential format (no TAXALABELS block available) <2015-10-07, Wed>
258 260
  o fixed bug in geom_tiplab when x contains NA (eg, removing by collapse function) <2015-10-01, Thu>
259 261
  o new implementation of geom_hilight, a truly geom layer function <2015-09-10, Thu>
260
- 
262
+
261 263
 CHANGES IN VERSION 1.1.20
262 264
 ------------------------
263 265
  o bug fixed in %add2%, if node available use node, otherwise use label <2015-09-04, Fri>
... ...
@@ -268,7 +270,7 @@ CHANGES IN VERSION 1.1.20
268 270
    + read.r8s, parser function
269 271
    + fortify method
270 272
    + plot, get.tree, get.fields, groupOTU, groupClade, scale_color, gzoom and show methods
271
- o bug fixed in fortify.multiPhylo, convert df$.id to factor of levels=names(multiPhylo_object) <2015-09-02, Wed>   
273
+ o bug fixed in fortify.multiPhylo, convert df$.id to factor of levels=names(multiPhylo_object) <2015-09-02, Wed>
272 274
  o update scale_x_ggtree to support Date as x-axis <2015-09-01, Tue>
273 275
  o add mrsd parameter for user to specify 'most recent sampling date' for time tree <2015-09-01, Tue>
274 276
    - remove 'time_scale' parameter.
... ...
@@ -278,15 +280,15 @@ CHANGES IN VERSION 1.1.20
278 280
    + plot, get.tree, get.fields, groupOTU, groupClade, scale_color, gzoom and show methods
279 281
    + fortify.raxml method
280 282
  o bug fixed in edgeNum2nodeNum for jplace parsing jplace file <2015-09-01, Tue>
281
- 
283
+
282 284
 CHANGES IN VERSION 1.1.19
283 285
 ------------------------
284
- o use fortify instead of fortify.phylo in fortify.multiPhylo, 
286
+ o use fortify instead of fortify.phylo in fortify.multiPhylo,
285 287
    so that multiPhylo can be a list of beast/codeml or other supported objects. <2015-08-31, Mon>
286 288
  o support multiPhylo object, should use + facet_wrap or + facet_grid <2015-08-31, Mon>
287 289
  o remove dependency of EBImage and phytools to speedup the installation process of ggtree <2015-08-31, Mon>
288 290
    + these two packages is not commonly used, and will be loaded automatically when needed.
289
- 
291
+
290 292
 CHANGES IN VERSION 1.1.18
291 293
 ------------------------
292 294
  o layout name change to 'rectangular', 'slanted', 'circular'/'fan' for phylogram and cladogram (if branch.length = 'none')
... ...
@@ -294,37 +296,37 @@ CHANGES IN VERSION 1.1.18
294 296
  o implement geom_point2, geom_text2, geom_segment2 to support subsetting <2015-08-28, Fri>
295 297
      see https://github.com/hadley/ggplot2/issues/1295
296 298
  o update geom_tiplab according to geom_text2 and geom_segment2 <2015-08-28, Fri>
297
- o add geom_tippoint, geom_nodepoint and geom_rootpoint <2015-08-28, Fri> 
298
- 
299
+ o add geom_tippoint, geom_nodepoint and geom_rootpoint <2015-08-28, Fri>
300
+
299 301
 CHANGES IN VERSION 1.1.17
300 302
 ------------------------
301 303
  o bug fixed in rm.singleton.newick by adding support of scientific notation in branch length <2015-08-27, Thu>
302 304
  o bug fixed in gheatmap, remove inherit aes from ggtree <2015-08-27, Thu>
303 305
  o add 'width' parameter to add_legend, now user can specify the width of legend bar <2015-08-27, Thu>
304
- o add 'colnames_position' parameter to gheatmap, now colnames can be display on the top of heatmap <2015-08-27, Thu> 
306
+ o add 'colnames_position' parameter to gheatmap, now colnames can be display on the top of heatmap <2015-08-27, Thu>
305 307
  o theme_transparent to make background transparent <2015-08-27, Thu>
306
- o subview for adding ggplot object (subview) to another ggplot object (mainview) <2015-08-27, Thu>  
307
- 
308
+ o subview for adding ggplot object (subview) to another ggplot object (mainview) <2015-08-27, Thu>
309
+
308 310
 CHANGES IN VERSION 1.1.16
309 311
 ------------------------
310 312
  o update citation <2015-08-17, Mon>
311
- 
313
+
312 314
 CHANGES IN VERSION 1.1.15
313 315
 ------------------------
314 316
  o open text angle parameter for annotation_clade/annotation_clade2 <2015-08-13, Thu>
315 317
  o support changing size of add_legend <2015-08-13, Thu>
316 318
  o reroot methods for phylo and beast <2015-08-07, Fri>
317
- 
319
+
318 320
 CHANGES IN VERSION 1.1.14
319 321
 ------------------------
320 322
  o update paml_rst to compatible with only marginal ancestral sequence or joint ancestral sequence available <2015-08-07, Fri>
321
- 
323
+
322 324
 CHANGES IN VERSION 1.1.13
323 325
 ------------------------
324 326
  o implement annotation_image <2015-08-01, Sat>
325 327
  o better implementation of geom_tiplab for accepting aes mapping and auto add align dotted line <2015-08-01, Sat>
326 328
  o open group_name parameter of groupOTU/groupClade to user <2015-08-01, Sat>
327
- 
329
+
328 330
 CHANGES IN VERSION 1.1.12
329 331
 ------------------------
330 332
  o update vignette according to the changes <2015-07-31, Fri>
... ...
@@ -332,14 +334,14 @@ CHANGES IN VERSION 1.1.12
332 334
  o extend groupClade to support operating on tree view <2015-07-31, Fri>
333 335
  o extend groupOTU to support operating on tree view <2015-07-31, Fri>
334 336
  o new implementation of groupClade & groupOTU <2015-07-31, Fri>
335
- 
337
+
336 338
 CHANGES IN VERSION 1.1.11
337 339
 ------------------------
338 340
  o annotation_clade and annotation_clade2 functions. <2015-07-30, Thu>
339 341
  o better add_legend implementation. <2015-07-30, Thu>
340 342
  o add ... in theme_tree & theme_tree2 for accepting additional parameter. <2015-07-30, Thu>
341 343
  o better geom_tree implementation. Now we can scale the tree with aes(color=numVar). <2015-07-30, Thu>
342
- 
344
+
343 345
 CHANGES IN VERSION 1.1.10
344 346
 ------------------------
345 347
  o solve overlapping branches for layout = "fan" || "radial",
... ...
@@ -355,32 +357,32 @@ CHANGES IN VERSION 1.1.9
355 357
  o get_taxa_name function will return taxa name vector of a selected clade <2015-06-30, Tue>
356 358
  o add example of flip function in vignette <2015-06-30, Tue>
357 359
  o flip function for exchanging positions of two selected branches <2015-06-30, Tue>
358
- 
360
+
359 361
 CHANGES IN VERSION 1.1.8
360 362
 ------------------------
361 363
  o update get.placement <2015-06-05, Fri>
362 364
  o edgeNum2nodeNum for converting edge number to node number for EPA/pplacer output <2015-06-04, Thu>
363 365
  o mv scale_x_gheatmap to scale_x_ggtree, which also support msaplot <2015-06-02, Tue>
364 366
  o add mask function <2015-06-02, Tue>
365
- 
367
+
366 368
 CHANGES IN VERSION 1.1.7
367 369
 ------------------------
368 370
  o add example of msaplot in vignette <2015-05-22, Fri>
369 371
  o msaplot for adding multiple sequence alignment <2015-05-22, Fri>
370
- 
372
+
371 373
 CHANGES IN VERSION 1.1.6
372 374
 ------------------------
373 375
  o add vertical_only parameter to scaleClade and set to TRUE by default.
374 376
    only vertical will be scaled by default. <2015-05-22, Fri>
375 377
  o update add_colorbar & add_legend <2015-05-21, Thu>
376
- o add example of add_legend and gheatmap in vignette <2015-05-18, Mon> 
378
+ o add example of add_legend and gheatmap in vignette <2015-05-18, Mon>
377 379
  o gheatmap implementation of gplot <2015-05-18, Mon>
378 380
  o add_legend for adding evolution distance legend <2015-05-18, Mon>
379
- 
381
+
380 382
 CHANGES IN VERSION 1.1.5
381 383
 ------------------------
382 384
  o implement scaleClade <2015-05-12, Tue>
383
- 
385
+
384 386
 CHANGES IN VERSION 1.1.4
385 387
 ------------------------
386 388
  o better performance of parsing beast tree  <2015-05-11, Mon>
... ...
@@ -388,13 +390,13 @@ CHANGES IN VERSION 1.1.4
388 390
    + support file that only contains one evidence for some of the nodes/tips
389 391
  o update add_colorbar to auto determine the position <2015-05-04, Mon>
390 392
  o add_colorbar function <2015-04-30, Thu>
391
- 
393
+
392 394
 CHANGES IN VERSION 1.1.3
393 395
 ------------------------
394 396
  o add space between residue substitution (e.g. K123R / E155D) <2015-04-30, Thu>
395 397
  o remove slash line in heatmap legend <2015-04-30, Thu>
396 398
  o update vignette to add example of merge_tree <2015-04-29, Wed>
397
- 
399
+
398 400
 CHANGES IN VERSION 1.1.2
399 401
 ------------------------
400 402
  o in addition to parsing beast time scale tree in XXX_year[\\.\\d]*, now supports XXX/year[\\.\\d]* <2015-04-29, Wed>
... ...
@@ -409,17 +411,17 @@ CHANGES IN VERSION 1.1.2
409 411
  o extend get.fields methods to support additional fields <2015-04-28, Tue>
410 412
  o extend tree class to support additional info by merging two tree <2015-04-28, Tue>
411 413
  o implement merge_tree function to merge two tree objects into one <2015-04-28, Tue>
412
- 
414
+
413 415
 CHANGES IN VERSION 1.1.1
414 416
 ------------------------
415 417
  o minor bug fixed in extracting node ID of rst file <2015-04-27, Mon>
416 418
  o update parsing beast time scale tree to support _year (originally supports _year.\\d+) <2015-04-27, Mon>
417 419
  o add Tommy in author <2015-04-27, Mon>
418
- 
420
+
419 421
 CHANGES IN VERSION 0.99.28
420 422
 ------------------------
421 423
  o update vignette with floating table of content <2015-04-08, Wed>
422
- 
424
+
423 425
 CHANGES IN VERSION 0.99.27
424 426
 ------------------------
425 427
  o bug fixed, see https://github.com/GuangchuangYu/ggtree/issues/4 <2015-03-07, Tue>
... ...
@@ -428,42 +430,42 @@ CHANGES IN VERSION 0.99.26
428 430
 ------------------------
429 431
  o update geom_tiplab <2015-03-31, Tue>
430 432
  o update plot method of beast <2015-03-17, Tue>
431
- 
433
+
432 434
 CHANGES IN VERSION 0.99.25
433 435
 ------------------------
434 436
  o implement groupClade <2015-03-13, Fri>
435
- 
437
+
436 438
 CHANGES IN VERSION 0.99.24
437 439
 ------------------------
438 440
  o use "round" segment end, look very better <2015-03-12, Thu>
439 441
  o update vignett <2015-03-11, Wed>
440
- 
442
+
441 443
 CHANGES IN VERSION 0.99.23
442 444
 ------------------------
443 445
  o mv geom_hilight to hilight <2015-03-11, Wed>
444 446
  o mv geom_phylopic to phylopic <2015-03-11, Wed>
445
- o implement collapse and expand for collapse and expand a selected clade <2015-03-11, Wed> 
446
- 
447
+ o implement collapse and expand for collapse and expand a selected clade <2015-03-11, Wed>
448
+
447 449
 CHANGES IN VERSION 0.99.22
448 450
 ------------------------
449 451
  o remove quote in beast tip/node labels <2015-03-10, Tue>
450
- 
452
+
451 453
 CHANGES IN VERSION 0.99.21
452 454
 ------------------------
453 455
  o fixed downloading png file in Windows platform, should explicitly setting mode="wb". <2015-03-03, Tue>
454
- 
456
+
455 457
 CHANGES IN VERSION 0.99.19
456 458
 ------------------------
457 459
  o for time scale tree inferred by BEAST, now user can use time_scale=TRUE parameter in ggtree function <2015-02-12, Thu>
458
- 
460
+
459 461
 CHANGES IN VERSION 0.99.18
460 462
 ------------------------
461 463
  o bug fixed in reorder the labels in gplot.heatmap <2015-02-12, Thu>
462
- 
464
+
463 465
 CHANGES IN VERSION 0.99.17
464 466
 ------------------------
465 467
  o add angle and branch.y variable in cladogram layout <2015-02-10, Tue>
466
- 
468
+
467 469
 CHANGES IN VERSION 0.99.16
468 470
 ------------------------
469 471
  o correct typo in vignette <2015-02-10, Tue>
... ...
@@ -471,7 +473,7 @@ CHANGES IN VERSION 0.99.16
471 473
 CHANGES IN VERSION 0.99.15
472 474
 ------------------------
473 475
  o fully support of replace operator, %<% <2015-02-09, Mon>
474
- 
476
+
475 477
 CHANGES IN VERSION 0.99.14
476 478
 ------------------------
477 479
  o add example in groupOTU for adding legend manually <2015-02-09, Mon>.
... ...
@@ -479,13 +481,13 @@ CHANGES IN VERSION 0.99.14
479 481
 CHANGES IN VERSION 0.99.13
480 482
 ------------------------
481 483
  o two dimensional tree <2015-02-06, Fri>
482
- 
484
+
483 485
 CHANGES IN VERSION 0.99.12
484 486
 ------------------------
485 487
  o update vignette <2015-02-04, Wed>
486 488
  o gzoom methods that supports all tree objects <2015-02-04, Wed>
487
- o geom_hilight layer for highlighting clade <2015-02-04, Wed> 
488
- 
489
+ o geom_hilight layer for highlighting clade <2015-02-04, Wed>
490
+
489 491
 CHANGES IN VERSION 0.99.11
490 492
 ------------------------
491 493
  o add scale_color to support colored lines and text based on numerical values and update vignette <2015-02-04, Wed>
... ...
@@ -499,12 +501,12 @@ CHANGES IN VERSION 0.99.10
499 501
 CHANGES IN VERSION 0.99.9
500 502
 ------------------------
501 503
  o update vignette <2015-02-02, Mon>
502
- 
504
+
503 505
 CHANGES IN VERSION 0.99.8
504 506
 ------------------------
505 507
  o add get.phylopic function to read the online phylo pic and convert it to grob object,
506 508
    which can be use to annotate ggplot figure using annotation_custom <2015-01-30, Fri>
507
- 
509
+
508 510
 CHANGES IN VERSION 0.99.7
509 511
 ------------------------
510 512
  o add angle information for 'fan' & 'unrooted' layout <2015-01-29, Thu>
... ...
@@ -513,7 +515,7 @@ CHANGES IN VERSION 0.99.6
513 515
 ------------------------
514 516
  o read.beast now supports support values of sets such as {x, y, z} <2015-01-19, Mon>
515 517
  o now read.beast supports characters in support values <2015-01-18, Sun>
516
- o add example of gzoom and groupOTU in vignette <2015-01-14, Wed> 
518
+ o add example of gzoom and groupOTU in vignette <2015-01-14, Wed>
517 519
  o implement groupOTU methods <2015-01-14, Wed>
518 520
  o export get.offspring.tip <2015-01-14, Wed>
519 521
 
... ...
@@ -524,7 +526,7 @@ CHANGES IN VERSION 0.99.5
524 526
  o add gzoom function, similar to zoom function in ape <2015-01-07, Wed>
525 527
  o add examples in man pages of %<% and %<+% operators <2015-01-06, Tue>
526 528
  o remove <<- and update vignette <2015-01-06, Tue>
527
- o update vignette and use BibTex and CSL for references <2015-01-05, Mon>  
529
+ o update vignette and use BibTex and CSL for references <2015-01-05, Mon>
528 530
  o update cladogram layout <2015-01-05, Mon>
529 531
  o read.baseml function and update vignette with baseml example <2015-01-04, Sun>
530 532
  o plot method for hyphy and hyphy example in vignette <2015-01-04, Sun>
... ...
@@ -532,9 +534,9 @@ CHANGES IN VERSION 0.99.5
532 534
 
533 535
 CHANGES IN VERSION 0.99.4
534 536
 ------------------------
535
- o ggtree now support branch.length = "none" to only draw tree topology <2015-01-03, Sat> 
537
+ o ggtree now support branch.length = "none" to only draw tree topology <2015-01-03, Sat>
536 538
  o get.subs method for hyphy object <2015-01-03, Sat>
537
- o show, get.tree and get.subs methods of hyphy <2015-01-02, Fri> 
539
+ o show, get.tree and get.subs methods of hyphy <2015-01-02, Fri>
538 540
  o export read.hyphy <2015-01-02, Fri>
539 541
  o export hyphy class <2015-01-01, Thu>
540 542
  o plot method for beast class and get.tree method for codeml class <2014-12-31, Wed>
... ...
@@ -547,7 +549,7 @@ CHANGES IN VERSION 0.99.4
547 549
  o update man file and add example file of beast output <2014-12-26, Fri>
548 550
  o get.tree and get.fileds methods of beast class <2014-12-26, Fri>
549 551
  o read.beast <2014-12-26, Fri>
550
- o beast class and show method <2014-12-26, Fri> 
552
+ o beast class and show method <2014-12-26, Fri>
551 553
  o coplot prototype<2014-12-24, Wed>
552 554
  o parse translation matrix in beast nexus <2014-12-24, Wed>
553 555
  o extract beast stats info <2014-12-23, Tue>
... ...
@@ -560,7 +562,7 @@ CHANGES IN VERSION 0.99.3
560 562
  o write.jplace and fully supports of jplace by ggtree. <2014-12-21, Sun>
561 563
  o support unrooted layout in ggplot. <2014-12-21, Sun>
562 564
  o support fan, radial, dendrogram layout in geom_tree. <2014-12-21, Sun>
563
- 
565
+
564 566
 CHANGES IN VERSION 0.99.2
565 567
 ------------------------
566 568
  o layout of unrooted tree, implemented equal-angle algorithm that described in Chapter 34
... ...
@@ -90,7 +90,7 @@ setMethod("groupOTU", signature(object="paml_rst"),
90 90
 
91 91
 ##' group tree based on selected OTU, will traceback to MRCA
92 92
 ##'
93
-##' 
93
+##'
94 94
 ##' @rdname groupOTU-methods
95 95
 ##' @exportMethod groupOTU
96 96
 setMethod("groupOTU", signature(object="phylo"),
... ...
@@ -111,21 +111,26 @@ setMethod("groupOTU", signature(object="r8s"),
111 111
 
112 112
 
113 113
 ##' @importFrom ape which.edge
114
-gfocus <- function(phy, focus, group_name) {
114
+gfocus <- function(phy, focus, group_name, focus_label=NULL) {
115 115
     if (is.character(focus)) {
116 116
         focus <- which(phy$tip.label %in% focus)
117 117
     }
118
-    
118
+
119 119
     n <- getNodeNum(phy)
120 120
     if (is.null(attr(phy, group_name))) {
121 121
         foc <- rep(0, n)
122 122
     } else {
123 123
         foc <- attr(phy, group_name)
124 124
     }
125
-    i <- max(foc) + 1
125
+    i <- max(suppressWarnings(as.numeric(foc)), na.rm=TRUE) + 1
126 126
     ## sn <- phy$edge[which.edge(phy, focus),] %>% as.vector %>% unique
127 127
     sn <- unique(as.vector(phy$edge[which.edge(phy, focus),]))
128
-    foc[sn] <- i
128
+    if (is.null(focus_label)) {
129
+        foc[sn] <- i
130
+    } else {
131
+        foc[sn] <- focus_label
132
+    }
133
+
129 134
     attr(phy, group_name) <- foc
130 135
     phy
131 136
 }
... ...
@@ -133,7 +138,7 @@ gfocus <- function(phy, focus, group_name) {
133 138
 
134 139
 ##' group OTU
135 140
 ##'
136
-##' 
141
+##'
137 142
 ##' @title groupOTU.phylo
138 143
 ##' @param phy tree object
139 144
 ##' @param focus tip list
... ...
@@ -144,8 +149,8 @@ groupOTU.phylo <- function(phy, focus, group_name="group") {
144 149
     attr(phy, group_name) <- NULL
145 150
     if ( is(focus, "list") ) {
146 151
         for (i in 1:length(focus)) {
147
-            phy <- gfocus(phy, focus[[i]], group_name)
148
-        } 
152
+            phy <- gfocus(phy, focus[[i]], group_name, names(focus)[i])
153
+        }
149 154
     } else {
150 155
         phy <- gfocus(phy, focus, group_name)
151 156
     }
... ...
@@ -167,14 +172,14 @@ groupOTU.ggplot <- function(object, focus, group_name) {
167 172
     df <- object$data
168 173
     df[, group_name] <- 0
169 174
     object$data <- groupOTU.df(df, focus, group_name)
170
-    return(object)     
175
+    return(object)
171 176
 }
172 177
 
173 178
 
174
-groupOTU.df <- function(df, focus, group_name) {    
179
+groupOTU.df <- function(df, focus, group_name) {
175 180
     if (is(focus, "list")) {
176 181
         for (i in 1:length(focus)) {
177
-            df <- gfocus.df(df, focus[[i]], group_name)
182
+            df <- gfocus.df(df, focus[[i]], group_name, names(focus)[i])
178 183
         }
179 184
     } else {
180 185
         df <- gfocus.df(df, focus, group_name)
... ...
@@ -183,13 +188,16 @@ groupOTU.df <- function(df, focus, group_name) {
183 188
     return(df)
184 189
 }
185 190
 
186
-gfocus.df <- function(df, focus, group_name) {
191
+gfocus.df <- function(df, focus, group_name, focus_label=NULL) {
187 192
     focus <- df$node[which(df$label %in% focus)]
193
+    if (is.null(focus_label))
194
+        focus_label <- max(suppressWarnings(as.numeric(df[, group_name])), na.rm=TRUE) + 1
195
+
188 196
     if (length(focus) == 1) {
189
-        df[match(focus, df$node), group_name] <- max(df(df[, group_name])) + 1
197
+        df[match(focus, df$node), group_name] <-focus_label
190 198
         return(df)
191 199
     }
192
-    
200
+
193 201
     anc <- getAncestor.df(df, focus[1])
194 202
     foc <- c(focus[1], anc)
195 203
     for (j in 2:length(focus)) {
... ...
@@ -200,7 +208,7 @@ gfocus.df <- function(df, focus, group_name) {
200 208
         foc <- c(foc, comAnc[1])
201 209
     }
202 210
     idx <- match(foc, df$node)
203
-    df[idx, group_name] <- max(df[, group_name]) + 1
211
+    df[idx, group_name] <- focus_label
204 212
     return(df)
205 213
 }
206 214
 
... ...
@@ -3,7 +3,7 @@ ggtree: an R package for visualization and annotation of phylogenetic trees with
3 3
 
4 4
 [![releaseVersion](https://img.shields.io/badge/release%20version-1.4.20-green.svg?style=flat)](https://bioconductor.org/packages/ggtree) [![develVersion](https://img.shields.io/badge/devel%20version-1.5.14-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-13439/total-blue.svg?style=flat)](https://bioconductor.org/packages/stats/bioc/ggtree) [![month](https://img.shields.io/badge/downloads-1122/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--09--21-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--09--22-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
 
10 10
new file mode 100644
... ...
@@ -0,0 +1,35 @@
1
+context('groupOTU')
2
+
3
+test_that('groupOTU', {
4
+    nwk <- system.file("extdata", "sample.nwk", package="ggtree")
5
+    tree <- read.tree(nwk)
6
+    focus <- c("D", "E", "F", "G")
7
+    df <- fortify(groupOTU(tree, focus=focus))
8
+    expect_true(all(df$group[df$label %in% focus] == 1))
9
+
10
+    cls <- list(c1=c("A", "B", "C", "D", "E"),
11
+                c2=c("F", "G", "H"),
12
+                c3=c("L", "K", "I", "J"),
13
+                c4="M")
14
+    df <- fortify(groupOTU(tree, cls))
15
+    for (i in seq_along(cls)) {
16
+        expect_true(all(df$group[df$label %in% cls[[i]]] == names(cls)[i]))
17
+    }
18
+})
19
+
20
+
21
+context('groupClade')
22
+
23
+test_that('groupClade', {
24
+    nwk <- system.file("extdata", "sample.nwk", package="ggtree")
25
+    tree <- read.tree(nwk)
26
+    focus <- c("D", "E", "F", "G")
27
+    nodes <- c(21, 17)
28
+    df <- fortify(groupClade(tree, node=nodes))
29
+
30
+    for (i in seq_along(nodes)) {
31
+        expect_true(all(df$group[df$node %in% ggtree:::get.offspring.df(df, nodes[i])] == i))
32
+    }
33
+
34
+})
35
+