UMAP圖上同時(shí)展示多個(gè)marker基因

最近有小伙伴問(wèn)道一個(gè)問(wèn)題,如何在一個(gè)單細(xì)胞UMAP/TSNE圖上展示多個(gè)marker基因的表達(dá),乍一看挺簡(jiǎn)單的,后來(lái)也是思考了一些時(shí)間,慢慢解決了這個(gè)問(wèn)題。

image

首先,Seurat中的FeaturePlot函數(shù)能夠完成兩種marker的組合,但是不能超過(guò)兩個(gè),否則報(bào)錯(cuò)!

#使用Featureplot標(biāo)記基因
FeaturePlot(human_data, features = c("CD3E", "IL1B"),
            cols = c("lightgrey", "blue", "blue"),
            blend=T,blend.threshold=0)

#三個(gè)基因的時(shí)候就不行了
FeaturePlot(human_data, features = c("CD3E", "IL1B","CD74"),
            cols = c("lightgrey", "blue", "blue"),
            blend=T,blend.threshold=0)
# Error in FeaturePlot(human_data, features = c("CD3E", "IL1B", "CD74"),  : 
#                        Blending feature plots only works with two features

image

后來(lái)我想到用ggplot疊加geom_point,但是有問(wèn)題,不能顯示漸變。

#找到表達(dá)這些基因的細(xì)胞坐標(biāo),添加上去
p1=DimPlot(human_data,group.by = 'celltype',
           cols = c("grey","grey",
                    "grey","grey","grey"),
           pt.size = 1)+NoLegend()

gene1 <- "CD3E"
gene2 <- "CD74"
gene3 <- "IL1B"

pos_gene=human_data@reductions$umap@cell.embeddings
pos_gene1=pos_gene[human_data@assays$RNA@data[gene1,]>0,]
pos_gene2=pos_gene[human_data@assays$RNA@data[gene2,]>0,]
pos_gene3=pos_gene[human_data@assays$RNA@data[gene3,]>0,]


p1+geom_point(data = as.data.frame(pos_gene1),
              aes(x=UMAP_1,y=UMAP_2), 
              shape = 16,size = 0.5, color="blue")+
  geom_point(data = as.data.frame(pos_gene2),
             aes(x=UMAP_1,y=UMAP_2), 
             shape = 16,size = 0.5, color="blue")+
  geom_point(data = as.data.frame(pos_gene3),
             aes(x=UMAP_1,y=UMAP_2), 
             shape = 16,size = 0.5, color="blue")
image

所以最后我直接想著用ggplot實(shí)現(xiàn),首先區(qū)分三個(gè)顏色看一下效果,看是不是有覆蓋!可見(jiàn)三種基因都標(biāo)記上了,而且表達(dá)量是漸變的。****

image
最后統(tǒng)一顏色,修飾下主題,就完成了。****
image

更多精彩請(qǐng)至我的公眾號(hào)---KS科研分享與服務(wù)

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容