投稿问答最小化  关闭

万维书刊APP下载

复现20分文章的图形分析---学习两组差异基因可视化八象限图

2022/4/6 10:06:11  阅读:297 发布者:chichi77

今天做一下《journal of extracellular vesiclesIF:25上的一个图,其实图不是重点,重要的是这个思路。

图形如下,是差异分析的结果,只不过这个展示的是两个组的差异结果。我们利用一个更加通俗的例子来说明这个图的意义和思路,就不套用这个文章的结果了。假设我们有某个癌症的组织样本,cancer vs normal得到癌变后差异表达蛋白,而同样的。我们也去取血液的样本,检测血液中蛋白的变化,找到差异蛋白,这个时候就可以将这两个数据合在一起比较,比如某些基因在癌组织和血液中变化一致,可以认为他们是正常相关的,通过这样的思路我们可以确定某些标志物,也就是血液能够代替活检的相关蛋白筛选。大概意思就是这样,具体我们可以用下面的图呈现。

做这个图需要的数据是两组差异比较的差异倍数和FDR,这里我们首先用ggplot画一个散点图。

library(ggplot2)

library(ggrepel)

ggplot(A, aes(x=MeanRatio_X, y=MeanRatio_Y)) +

  geom_hline(yintercept= c(-0.6, 0.6), color = "black",  size=1) +#添加横线

  geom_vline(xintercept=c(-0.6, 0.6), color = "black", size=1)+

  geom_point()

可以看到xy轴范围和文章不一样,这里不清楚作者为什么这么设置,暂且按照它的数据吧。接下来需要修饰坐标轴,标记不同象限的点。

ggplot(A, aes(x=MeanRatio_X, y=MeanRatio_Y)) +

  geom_hline(yintercept= c(-0.6, 0.6), color = "black",  size=1) +

  geom_vline(xintercept=c(-0.6, 0.6), color = "black", size=1)+

  geom_point(size=3)+

  geom_point(data = A[A$MeanRatio_X>0.6 | A$MeanRatio_X < -0.6, ], size=3, shape=16, color="grey")+

  geom_point(data = A[A$MeanRatio_Y>0.6 | A$MeanRatio_Y < -0.6, ], size=3, shape=16, color="grey")+

  geom_point(data = A[A$MeanRatio_X>0.6 & A$MeanRatio_Y>0.6, ], size=3, shape=16, color="#66CC33")+

  geom_point(data = A[A$MeanRatio_X< -0.6 & A$MeanRatio_Y< -0.6, ], size=3, shape=16, color="#66CC33")+

  geom_point(data = A[A$MeanRatio_X< -0.6 & A$MeanRatio_Y > 0.6, ], size=3, shape=16, color="#CC3300")+

  geom_point(data = A[A$MeanRatio_X > 0.6 & A$MeanRatio_Y < -0.6, ], size=3, shape=16, color="#CC3300")+

  geom_point(size = 3,shape=21)+

  xlim(-4,4)+

  ylim(-3.2, 4.1)

接下来就是修改ggplot主题了。

ggplot(A, aes(x=MeanRatio_X, y=MeanRatio_Y)) +

  geom_hline(yintercept= c(-0.6, 0.6), color = "black",  size=1) +

  geom_vline(xintercept=c(-0.6, 0.6), color = "black", size=1)+

  geom_point(size=3)+

  geom_point(data = A[A$MeanRatio_X>0.6 | A$MeanRatio_X < -0.6, ], size=3, shape=16, color="grey")+

  geom_point(data = A[A$MeanRatio_Y>0.6 | A$MeanRatio_Y < -0.6, ], size=3, shape=16, color="grey")+

  geom_point(data = A[A$MeanRatio_X>0.6 & A$MeanRatio_Y>0.6, ], size=3, shape=16, color="#66CC33")+

  geom_point(data = A[A$MeanRatio_X< -0.6 & A$MeanRatio_Y< -0.6, ], size=3, shape=16, color="#66CC33")+

  geom_point(data = A[A$MeanRatio_X< -0.6 & A$MeanRatio_Y > 0.6, ], size=3, shape=16, color="#CC3300")+

  geom_point(data = A[A$MeanRatio_X > 0.6 & A$MeanRatio_Y < -0.6, ], size=3, shape=16, color="#CC3300")+

  geom_point(size = 3,shape=21)+

  xlim(-4,4)+

  ylim(-3.2, 4.1)+

  labs(x = "Mean Ratio Log2(AD F3 EVs vs NC F3 EVs)",

       y = "Mean Ratio Log2(AD BH vs NC BH)", title = "") +

  theme(panel.grid = element_blank(),

        axis.line = element_line(colour = 'black', size = 1),

        panel.background = element_blank(),

        plot.title = element_text(size = 14, hjust = 0.5),

        plot.subtitle = element_text(size = 14, hjust = 0.5),

        axis.text = element_text(size = 14, color = 'black'),

        axis.title = element_text(size = 14, color = 'black'))+

  theme(legend.position = "right")

添加标签,原文中作者是选择了一些miRNA呈现,但是呈现效果我认为很差(可能没想着让看),都重叠在一起看不出来,我这里选择一部分显示标签。

miRNA <- A[which(A$FDR_Y<0.1 | A$FDR_X<0.1),]

miRNA <- miRNA[which(abs(miRNA$MeanRatio_Y) >1 |abs(miRNA$MeanRatio_X)>1),]

ggplot(A, aes(x=MeanRatio_X, y=MeanRatio_Y)) +

  geom_hline(yintercept= c(-0.6, 0.6), color = "black",  size=1) +

  geom_vline(xintercept=c(-0.6, 0.6), color = "black", size=1)+

  geom_point(size=3)+

  geom_point(data = A[A$MeanRatio_X>0.6 | A$MeanRatio_X < -0.6, ], size=3, shape=16, color="grey")+

  geom_point(data = A[A$MeanRatio_Y>0.6 | A$MeanRatio_Y < -0.6, ], size=3, shape=16, color="grey")+

  geom_point(data = A[A$MeanRatio_X>0.6 & A$MeanRatio_Y>0.6, ], size=3, shape=16, color="#66CC33")+

  geom_point(data = A[A$MeanRatio_X< -0.6 & A$MeanRatio_Y< -0.6, ], size=3, shape=16, color="#66CC33")+

  geom_point(data = A[A$MeanRatio_X< -0.6 & A$MeanRatio_Y > 0.6, ], size=3, shape=16, color="#CC3300")+

  geom_point(data = A[A$MeanRatio_X > 0.6 & A$MeanRatio_Y < -0.6, ], size=3, shape=16, color="#CC3300")+

  geom_point(size = 3,shape=21)+

  xlim(-4,4)+

  ylim(-3.2, 4.1)+

  labs(x = "Mean Ratio Log2(AD F3 EVs vs NC F3 EVs)",

       y = "Mean Ratio Log2(AD BH vs NC BH)", title = "") +

  theme(panel.grid = element_blank(),

        axis.line = element_line(colour = 'black', size = 1),

        panel.background = element_blank(),

        plot.title = element_text(size = 14, hjust = 0.5),

        plot.subtitle = element_text(size = 14, hjust = 0.5),

        axis.text = element_text(size = 14, color = 'black'),

        axis.title = element_text(size = 14, color = 'black'))+

  geom_text_repel(data=miRNA, aes(label=rownames(miRNA)), color="black", size=4, fontface="italic",

                  point.padding = 0.3, segment.color = 'black', segment.size = 0.3, force = 1, max.iter = 3e3)

这个图还是很有意义的,显示的信息也挺多。可以结合自己的数据,看能不能有应用的地方。

 

如有侵权,请联系本站删除!

  • 万维QQ投稿交流群    招募志愿者

    版权所有 Copyright@2009-2015豫ICP证合字09037080号

     纯自助论文投稿平台    E-mail:eshukan@163.com