ggmsa
对于多序列比对的可视化,我们大多数时候都是在windows的比对软件上顺带完成的,但是如果想要更加美观和个性化的绘制多序列比对图谱,往往缺乏灵活的手段。基于这种情况,我们开发了ggmsa包(‘ggplot2’ Based Multiple Sequence Alignment)。
安装
截止3月23日,ggmsa的开发本版为0.0.3,CRAN版本为0.0.2(0.0.3版本已经提交)。想要体验的可以通过下形式安装:
##CRAN发行版install.packages("ggmsa")##github开发版if(!requireNamespace("devtools")) install.packages("devtools")
devtools::install_github("git@github.com:YuLab-SMU/ggmsa.git")
使用
ggmsa支持对氨基酸序列和核酸序列可视化,包中收录5种配色方案分别作用于核酸和氨基酸序列(Clustal配色只用于氨基酸)并且支持3种展示字符的字体,目前附带两种小功能geom_seqlogo()和geom_GC()用于可视化核酸序列motif和GC含量。
以包中自带的数据为例,下面将展示ggmsa的使用方法和可视化效果。
序列可视化
library(ggplot2)library(ggmsa)
## Protein sequencesprotein_sequences <- system.file("extdata", "sample.fasta", package = "ggmsa")ggmsa(protein_sequences, 164, 213, color = "Chemistry_AA")

## DNA sequencesnt_sequence <- system.file("extdata", "LeaderRepeat_All.fa", package = "ggmsa")ggmsa(nt_sequence, color = "Chemistry_NT")

## null font nt_sequence <- system.file("extdata", "LeaderRepeat_All.fa", package = "ggmsa")ggmsa(nt_sequence, font = NULL, color = "Chemistry_NT")

额外的小功能
## Visualizing multiple sequence alignment with sequence logof <- system.file("extdata", "LeaderRepeat_All.fa", package = "ggmsa")ggmsa(f, font = NULL, color = "Chemistry_NT" ) + geom_seqlogo(f)

## Visualizing multiple sequence alignment with GC contentf <- system.file("extdata", "LeaderRepeat_All.fa", package = "ggmsa")ggmsa(f, font = NULL, color = "Chemistry_NT" ) + geom_GC(f)

联动-ggtree
因为都是基于ggplot,我们很容易的让ggmsa跟其他ggplot拓展工具联用,做出更多样的可视化效果:
## Visualizing multiple sequence alignment with ggtreelibrary(Biostrings)x <- readAAStringSet(protein_sequences)d <- as.dist(stringDist(x, method = "hamming")/width(x)[1])library(ape)tree <- bionj(d)library(ggtree)p <- ggtree(tree ) + geom_tiplab()
data = tidy_msa(x, 164, 213)p + geom_facet(geom = geom_msa, data = data, panel = 'msa', font = NULL, color = "Chemistry_AA") + xlim_tree(1)

新的功能
目前正在开发其他新功能,比如在序列中高亮显示miRNA seed …
同时我们也欢迎您在使用后提出改进意见和更多新功能的要求:https://github.com/YuLab-SMU/ggmsa/issues