Combine ggmsa plot and ggtree?
Opened this issue · 2 comments
Ekie22 commented
Hi,
I am wondering if it is possible to combine the ggmsa plot with a ggtree. I tried it with aplot, but the alignment was not ordered according to the tree tips (see below). I am using R version 4.1.2, ggtree version 3.1.4.991, ggmsa version 1.1.0 and aplot version 0.1.1.
library(Biostrings)
library(ggtree)
library(ggmsa)
library(aplot)
nt_sequences <- system.file("extdata", "LeaderRepeat_All.fa", package = "ggmsa")
nt_align <- readDNAStringSet(nt_sequences)
p <- ggmsa(nt_align, seq_name = T, char_width = 0.5, font = NULL, color = "Chemistry_NT")
set.seed(42)
g <- ggtree(rtree(length(names(nt_align)), tip.label = names(nt_align))) + geom_tiplab() +
xlim(0,9)
p %>% insert_left(g, width = 0.5)
Any help or suggestion is appreciated.
Thanks
GuangchuangYu commented
Ekie22 commented
Many thanks.