参考代码
读取数据
data <- read.table(file = "WRKY.motif_prot.txt", header = F)
motifName <- c("MEME-1","MEME-2","MEME-3","MEME-4","MEME-5","MEME-6","MEME-7", "MEME-8","MEME-9", "MEME-10")
绘制单个seqlogo图
library(ggplot2)
library(ggseqlogo)
list <- c()
for (i in motifName) {
seq <- as.character(data[data[,5] == i, 4])
list[[i]] <- seq
p<-ggplot() + geom_logo(seq) + theme_logo()
pdf(paste(i, "seqlogo.pdf", sep = "."),width = 15 ,height = 5)
print(p)
dev.off()
}
绘制整体seqlogo图
pdf(paste( "allmotif.seqlogo.pdf", sep = "."),width = 15 ,height = 50)
ggplot() + geom_logo(list) + theme_logo() +
facet_wrap(~seq_group, ncol=1, scales='free_x')
dev.off()
欢迎关注Bioinfor 生信云!
网友评论