日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

UCell:單細(xì)胞評分分析R包及可視化應(yīng)用

 TS的美夢 2023-06-07 發(fā)布于廣東
?

詳情請聯(lián)系作者:

?
單細(xì)胞評分我們之前說過AUCell和seurat自帶的打分函數(shù)
跟著Cell學(xué)單細(xì)胞轉(zhuǎn)錄組分析(十一):單細(xì)胞基因評分|AUCell評分

我們之前講過單細(xì)胞評分,一個(gè)是Seurat自帶的打分函AddModuleScore()。一個(gè)是AUcell包。最近看到一個(gè)評分R包,感覺還是挺好的這里分享一下。Ucell是基于Mann-Whitney U統(tǒng)計(jì)的單細(xì)胞評分R包,靈感來源于SUCell,使用起來穩(wěn)定性較好,且與其他的方式相比較,Ucell計(jì)算所需的時(shí)間和耗費(fèi)的內(nèi)存更小。即使在計(jì)算能力有限的機(jī)器上也可以在幾分鐘內(nèi)處理大型數(shù)據(jù)集。UCell可以應(yīng)用于任何單細(xì)胞數(shù)據(jù)矩陣,可直接與Seurat對象交互。Ucell在高分SCI文章的應(yīng)用還是挺多的,我們在自己的分析中也可以視情況選擇使用。原始文獻(xiàn)參考:

https://www./science/article/pii/S2001037021002816?via%3Dihub

這里我們使用seurat單細(xì)胞對象進(jìn)行演示。首先對單細(xì)胞marker基因的評分,這個(gè)有利于細(xì)胞分群的鑒定。
setwd('D:/KS項(xiàng)目/公眾號文章/Ucell單細(xì)胞評分')library(Seurat)BiocManager::install("UCell")library(UCell)uterus <- readRDS("D:/KS項(xiàng)目/公眾號文章/uterus.rds")DimPlot(uterus,label = T)+NoLegend()
#UCell評分函數(shù)AddModuleScore_UCell可以提供方seurat對象#評分基因set是以list的形式提供markers <- list()markers$SM <- c("ACTA2", "RGS5")markers$Marc <- c("MS4A6A", "CD68","LYZ")markers$Ly <- c("CCL5", "STK17B","PTPRC")markers$SF <- c("DCN", "COL6A3", "LUM")markers$Endo <- c("PECAM1","PCDH17", "VWF")markers$unEP <- c("EPCAM", "CDH1")markers$cEP <- c("FOXJ1","CDHR3","DYDC2")
#評分計(jì)算marker_score <- AddModuleScore_UCell(uterus, features=markers)#可視化是Ucell scorelibrary(stringr)library(ggplot2)library(viridis)a <- colnames(marker_score@meta.data) %>% str_subset("_UCell")FeaturePlot(marker_score,features = a,order = T, ncol = 4, cols = viridis(256))

第二個(gè)是對于通路的評分,并進(jìn)行可視化,參考這篇文章:
(reference:A reference single-cell regulomic and transcriptomic map of cynomolgus monkeys)

library(clusterProfiler)metabolism <- read.gmt("KEGG_metabolism_nc.gmt") unique(metabolism$term)#我們選擇其中一條通路進(jìn)行評分Oxidative <- subset(metabolism, term=="Oxidative phosphorylation")Oxidative <- list(Oxidative$gene)#將基因整成listnames(Oxidative)[1] <- 'Oxidative'DefaultAssay(uterus) <- 'RNA'metabolism_score <- AddModuleScore_UCell(uterus,                                         features=Oxidative,                                         name="_metabolism_score")
#可視化所有細(xì)胞FeaturePlot(metabolism_score,features = "Oxidative_metabolism_score", order = T,cols = viridis(256))
FeaturePlot(metabolism_score,features = "Oxidative_metabolism_score", order = T,cols = viridis(256), split.by = 'orig.ident')

做箱線圖:
library(ggrastr)library(dplyr)data<- FetchData(metabolism_score,vars = c("celltype","Oxidative_metabolism_score"))data$cellid <- case_when(data$celltype ==unique(data$celltype)[1] ~ "SMC",                         data$celltype ==unique(data$celltype)[2] ~ 'Ly',                         data$celltype ==unique(data$celltype)[3] ~ 'unEP',                         data$celltype ==unique(data$celltype)[4] ~ 'SF',                         data$celltype ==unique(data$celltype)[5] ~ 'cEP',                         data$celltype ==unique(data$celltype)[6] ~ 'Endo',                         data$celltype ==unique(data$celltype)[7] ~ 'Macro')colors <- c('#507BA8','#F38D37','#5D9F53','#B5972D','#48998E','#E05758','#F1CE60')


ggplot(data, aes(x=cellid,y=Oxidative_metabolism_score,fill=cellid,color=cellid)) + theme_bw()+RotatedAxis()+ theme(panel.grid = element_blank(), axis.text.x=element_text(size=12), axis.text.y = element_text(size=10), plot.title = element_text(hjust = 0.5), legend.position = 'none')+ labs(x=NULL,y=NULL,title = "Oxidative_metabolism_score")+ geom_jitter_rast(col="#00000033", pch=19,cex=2, position = position_jitter(0.2))+ geom_boxplot(position=position_dodge(0))+ scale_fill_manual(values = colors)+ geom_boxplot(position=position_dodge(0),color='black', outlier.colour = NA,outlier.fill=NA,outlier.shape=NA)

這里賣個(gè)關(guān)子,我們做了那么多的ggplot可視化,給大家思考一下,細(xì)胞數(shù)是如何添加上的(純代碼,簡單的方式)。

第三種應(yīng)用是對于基因集的評分。看看這些評分在我們樣本之間的差異。
#做基因集評分genes <- list(c("PTEN","PIK3CA","KRAS","ARID1A","RCA1","WNT5A"))names(genes) <- 'gene'gene_score <- AddModuleScore_UCell(uterus,features=genes,name="_score")

#提取數(shù)據(jù)library(ggpubr)df<- FetchData(gene_score,vars = c("orig.ident","gene_score"))df$orig.ident <- factor(df$orig.ident,levels = c("HC","EEC","AEH"))#設(shè)置順序

#設(shè)置比較組my_comparisons1 <- list(c("HC", "EEC")) my_comparisons2 <- list(c("AEH", "EEC"))my_comparisons3 <- list(c("HC", "AEH"))
#做小提琴圖ggplot(df,aes(x=orig.ident,y=gene_score,fill=orig.ident))+ geom_violin(color='black',size=1)+#小提琴 theme_classic() + theme(text = element_text(size=10, colour = "black")) + theme(plot.title = element_text(hjust = 0.5, size = 15), axis.text.x = element_text(colour = "black", size = 12), axis.text.y = element_text(colour = "black", size = 10), axis.title.y = element_text(color = 'black', size = 12), axis.line = element_line(size = 1))+ theme(legend.position="none") + geom_boxplot(width=0.1, fill="white", outlier.shape = NA) +#箱線圖 stat_compare_means(method="t.test",hide.ns = F, comparisons =c(my_comparisons1,my_comparisons2,my_comparisons3), label="p.signif", bracket.size=0.8, size=6)#添加顯著性比較

這個(gè)方法用在自己的數(shù)據(jù)集研究中還是挺有用的,覺得分享有用的點(diǎn)個(gè)贊,點(diǎn)一下分享再走唄!

    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章