# 转录组表达数据分析的一些可视化

### 表达矩阵的可视化

```library(CLL)
library(ggplot2)
library(reshape2)
library(gpairs)
library(corrplot)```

```data(sCLLex)
sCLLex=sCLLex[,1:8] ## 样本太多，我就取前面8个
group_list=sCLLex\$Disease
exprSet=exprs(sCLLex)

```library(reshape2)
exprSet_L=melt(exprSet)
colnames(exprSet_L)=c('probe','sample','value')
exprSet_L\$group=rep(group_list,each=nrow(exprSet))

```p=ggplot(exprSet_L,aes(x=sample,y=value,fill=group))+geom_boxplot()
print(p)```

img

img

### 差异分析结果的火山图：

img

```my_volcano <- function(DEG,t_p,t_FC=0,t_marker){
## example: print(my_volcano(limma_results[,c(5,1)],0.01,0.6,0))
library(ggplot2)
DEG=na.omit(DEG)
colnames(DEG)=c('p','logFC')
DEG\$gene <- rownames(DEG)
DEG[DEG\$p < 1e-10,'p']=1e-10

if (t_FC == 0) {
t_FC <- with(DEG, mean(abs(logFC)) + 2 * sd(abs(logFC)))
}

#DEG\$change <- as.factor(DEG\$p<t_p & abs(DEG\$logFC) > t_FC)
DEG\$change= as.factor(ifelse(DEG\$p<t_p & abs(DEG\$logFC) > t_FC,
ifelse(DEG\$logFC > t_FC,"UP", "DOWN"), "NOT"))
this_tile <- paste0("Cutoff for logFC is ", round(t_FC, 3),
"\nThe number of up gene is ",
nrow(DEG[DEG\$change == "UP", ]),
"\nThe number of down gene is ",
nrow(DEG[DEG\$change == "DOWN", ]))

p <- ggplot(data=DEG, aes(x=logFC, y =-log10(p),color =change)) +
geom_point() +
scale_color_manual(values =c('blue',"black","red"))+
geom_hline(yintercept = -log10(t_p),lty=4,lwd=0.6,alpha=0.8)+
geom_vline(xintercept = c(t_FC,-t_FC),lty=4,lwd=0.6,alpha=0.8)+
theme_bw()+
theme(panel.border = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.line = element_line(colour = "black"))+ggtitle(this_tile) +
labs( x="log2 (fold change)",y="-log10 (q-value)")+
theme(plot.title = element_text(hjust = 0.5))
if (t_marker !=0 ) p = p+geom_text(DEG=subset(DEG, abs(logFC) > t_marker), aes(label=gene),col="green",alpha = 0.5)
return(p)
}```

486 篇文章223 人订阅

0 条评论

## 相关文章

1873

### 使用ARKit开发AR游戏-基础篇：ARKit入门篇

11月到12月，使用新出的ARkit开发了一个AR游戏，梳理下开发过程的经验，整理成文。 计划是一个系列，入门篇主要是收集的资料整合。

4574

### 让神经网络替你编程：如何用深度学习实现程序自动合成

【新智元导读】本文介绍了训练神经网络学习用复杂的函数式语言（FlashFill DSL）进行编程取得的成功，标志着神经程序合成方面一个令人兴奋的突破。 ● 作...

4198

861

1641

2956

2217

26610

29711

4817