visualizing species delimitation results

257 views
Skip to first unread message

Bastian

unread,
Jun 25, 2021, 3:06:59 AM6/25/21
to ggtree
Hi there,

I was trying to visualize my species delimitation results (based on three different methods) with ggtree. So far, I only accomplished to plot my results using gheatmap, as such:

cox2 <- read.dna("test.fasta", "fasta")
class(cox2)

nj <- nj(dist.dna(cox2))
plot(ladderize(nj), type = "phylo", cex = .3, align.tip.label = F)

otu <- read.table("otu_test.txt", sep="\t", stringsAsFactor=F)

p <- ggtree(nj) +
  geom_tiplab(size=2, align = T)

p1 <-  gheatmap(p, otu, offset=0.01, width=0.5, colnames_position = "top", font.size=2, low="white", high="black")

plot(p1)


The figure (see Figure 1) is going in the right direction but it should look more like this (see Figure 2), where species are indicated by vertical bars.


Any help is highly appreciated,

Bastian
Figure 1.png
Figure 2.png

Pedro Senna

unread,
Jun 25, 2021, 7:58:53 AM6/25/21
to Bastian, ggtree
The ggheatmap function does not plot vertical bars, it appends boxes to the right side of each tip of a phylogenetic tree. You can control the dimensions of the box using the width argument, add your own colors to distinguish delimited clusters from each other using scale_fill_manual and remove the legend using theme(legend.position = "none"). I believe these vertical bars were made using other functions or even manually using softwares like inkscape. 

--
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.top/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/b93f7ed8-7e0a-47c2-a6b6-fee3fbd8af30n%40googlegroups.com.

Bastian

unread,
Jun 29, 2021, 5:44:26 AM6/29/21
to ggtree
Thanks Pedro,

for your reply. I only used gheatmap to show that I tried to solve my problem myself before asking, but I failed - obviously;)

Is there any other suggestion from your side or anyone else how to solve this? Doing it by hand will take ages, I think.


Cheers Bastian

Yu, Guangchuang

unread,
Nov 10, 2021, 10:29:03 PM11/10/21
to Bastian, ggtree
you can use multiple gheatmap() calls to add each column of your data one by one. Then you can set an offset for each heatmap. 



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