美文网首页
已知矩阵,制作RNA_motif的logo

已知矩阵,制作RNA_motif的logo

作者: Ray钱 | 来源:发表于2019-06-09 12:58 被阅读0次

这是一个很简单的诉求,可以用的方法有很多,今天谈一下MotifStack.
介绍链接:MotifStack
先弄清楚,motif的矩阵格式。

DNA motif 矩阵数据

大家应该看明白了,motif的矩阵格式为:横轴为对应碱基位置,纵轴为ACGT的概率。

故所有其他格式的矩阵,都要换为这个格式。

我用的代码如下:

##将原文件行列互换另存为ipt.txt
rm(list=ls())
if (!requireNamespace("BiocManager", quietly = TRUE))
  install.packages("BiocManager")

BiocManager::install("motifStack")

suppressPackageStartupMessages(library(motifStack))
a <- read.table("~/Documents/R/motif/ipt.txt", sep="")  #读取矩阵
rownames(a) <- c("A","C","G","T") #插入rowname
motif2 <- new("pcm", mat=as.matrix(a), name="ybx1-d")
plot(motif2)
rna <- a
rownames(rna)[4] <- "U" #将DNA的T变成RNA的U。
motif3 <- new("pcm", mat=as.matrix(rna), name="ybx1")
plot(motif3)

相当简单。其他方法也能画logo,但是rna-logo,用这个比较容易实现。

相关文章

网友评论

      本文标题:已知矩阵,制作RNA_motif的logo

      本文链接:https://www.haomeiwen.com/subject/lwgpxctx.html