Problem in changing branch length of outgroup

228 views
Skip to first unread message

Wannarat Yim-im

unread,
May 7, 2020, 7:36:48 PM5/7/20
to ggtree
Dear all,

       I have tried to follow the code provided in "change branch length of outgroup" explained in FAQ but it did not work with my data.

I have one long branch outgroup and try to make the branch shorter and the line type different from others.

This is the code tried on my data.

x <- read.iqtree("tree4_output_T1_completegenome_outgrouptop.tree")
p <- ggtree(x)
p$data[p$data$node %in% c("VR23-outgroup", "0.8")] <- mean(p$data$x)

The error messages I got

Error: Must assign to columns with a valid subscript vector.
ℹ Logical subscripts must match the size of the indexed input.
x The input has size 11 but the subscript `p$data$node %in% c("VR23-outgroup", "0.8")` has size 232.

I appreciate all suggestions.

Wannarat

long branch outgroup.pdf

Yu, Guangchuang

unread,
Sep 18, 2020, 5:09:14 AM9/18/20
to Wannarat Yim-im, ggtree
On Fri, May 8, 2020 at 7:36 AM Wannarat Yim-im <wyi...@iastate.edu> wrote:
Dear all,

       I have tried to follow the code provided in "change branch length of outgroup" explained in FAQ but it did not work with my data.

I have one long branch outgroup and try to make the branch shorter and the line type different from others.

This is the code tried on my data.

x <- read.iqtree("tree4_output_T1_completegenome_outgrouptop.tree")
p <- ggtree(x)
p$data[p$data$node %in% c("VR23-outgroup", "0.8")] <- mean(p$data$x)

Apparently, it should be p$data[p$data$node %in% c("VR23-outgroup", "0.8"), 'x'] <- mean(p$data$x)

The error messages I got

Error: Must assign to columns with a valid subscript vector.
ℹ Logical subscripts must match the size of the indexed input.
x The input has size 11 but the subscript `p$data$node %in% c("VR23-outgroup", "0.8")` has size 232.

I appreciate all suggestions.

Wannarat

--
1. G Yu*. Using ggtree to visualize data on tree-like structures. Current Protocols in Bioinformatics. 2020, 69:e96. https://doi.org/10.1002/cpbi.96
2. LG Wang, TTY Lam, S Xu, Z Dai, L Zhou, T Feng, P Guo, CW Dunn, BR Jones, T Bradley, H Zhu, Y Guan, Y Jiang, G Yu*. treeio: an R package for phylogenetic tree input and output with richly annotated and associated data. Molecular Biology and Evolution. 2020, 37(2):599-603. http://dx.doi.org/10.1093/molbev/msz240
3. G Yu*, TTY Lam, H Zhu, Y Guan*. Two methods for mapping and visualizing associated data on phylogeny using ggtree. Molecular Biology and Evolution, 2018, 35(2):3041-3043. https://doi.org/10.1093/molbev/msy194
4. G Yu, DK Smith, H Zhu, Y Guan, TTY Lam*. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data, Methods in Ecology and Evolution, 2017, 8(1):28-36. https://doi.org/10.1111/2041-210X.12628
5. Book: https://yulab-smu.github.io/treedata-book/
---
You received this message because you are subscribed to the Google Groups "ggtree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bioc-ggtree...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bioc-ggtree/977482e6-149a-4741-8ba6-e4cbc383d3b1%40googlegroups.com.


--
--~--~---------~--~----~------------~-------~--~----~
Guangchuang Yu PhD
Professor, Associate Director
Department of Bioinformatics
School of Basic Medical Sciences
Southern Medical University
Guangzhou, China
-~----------~----~----~----~------~----~------~--~---
Reply all
Reply to author
Forward
0 new messages