投稿问答最小化  关闭

万维书刊APP下载

玩转单细胞(6):单细胞差异基因展示之对角散点图

2023/1/29 9:09:18  阅读:120 发布者:

年过完了,继续好好学学吧!看到一种新的单细胞差异基因的展示方式,相关文章如下:

ReferenceDissecting the cellular landscape and transcriptome network in viral myocarditis by single-cell RNA sequencing

ReferenceSingle-cell transcriptomics of the human retinal pigment epithelium and choroid in health and macular degeneration

本来被横坐标的Delta给吓住了,后来仔细阅读了一下图例,发现很简单,其实就是表达基因的两种细胞比例的一个差值,其实类似于ggplot作图的修饰和基因标注,就不再赘述了,我们复现一下效果:

首先做一下差异基因:

library(Seurat)

mouse_data <- readRDS("D:/KS科研分享与服务公众号/mouse_data.rds")

DimPlot(mouse_data, label = T)

PMN0 <- subset(mouse_data, celltype=='PMN(0)')

DEGs_PMN0 <- FindMarkers(PMN0,

                         ident.1 = '10X_ntph_F',

                         ident.2 = '10X_ntph_M',

                         group.by = "orig.ident",

                         logfc.threshold = 0,

                         min.pct = 0)

计算下差异比例,和显著基因(用于标记)。

DEGs_PMN0$difference <- DEGs_PMN0$pct.1 - DEGs_PMN0$pct.2

DEGs_PMN0_sig <- DEGs_PMN0[which(DEGs_PMN0$p_val_adj<0.05 & abs(DEGs_PMN0$avg_log2FC) >0.25),]

DEGs_PMN0_sig$label <- rownames(DEGs_PMN0_sig)

最后作图即可:

library(ggplot2)

library(ggrepel)

ggplot(DEGs_PMN0, aes(x=difference, y=avg_log2FC)) +

  geom_point(size=2, color="grey60") +

  geom_text_repel(data=DEGs_PMN0_sig, aes(label=label),

                  color="black",fontface="italic")+

  geom_point(data=DEGs_PMN0[which(DEGs_PMN0$p_val_adj<0.05 & DEGs_PMN0$avg_log2FC>0.1),],

             aes(x=difference, y=avg_log2FC),

             size=2, color="red")+

  geom_point(data=DEGs_PMN0[which(DEGs_PMN0$p_val_adj<0.05 & DEGs_PMN0$avg_log2FC< -0.1),],

             aes(x=difference, y=avg_log2FC),

             size=2, color="blue")+

  theme_classic()+

  theme(axis.text.x = element_text(colour = 'black',size = 12),

        axis.text.y = element_text(colour = 'black',size = 12),

        axis.title = element_text(colour = 'black',size = 15),

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

  geom_hline(yintercept = 0,lty=2,lwd = 1)+

  geom_vline(xintercept = 0,lty=2,lwd = 1)+

  ylab("Log-fold Change")+

  xlab("Delta Percent")

转自:KS科研分享与服务”微信公众号

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


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

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

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