想获取更多,请至公众号-KS科研分享与服务-
其实之前我们细胞的分群是很粗糙的,只是一个大概的方向,随着深入的研究,需要对特定细胞的更多亚群进行分析,这里我们选择免疫细胞进行分析,主要是为了跟随文章的脚步,也好完成后续一些示例,比如细胞互作,转录因子、拟时分析等。
首先提取免疫细胞群,然后跑一遍Seurat流程,重新聚类分群。
library(Seurat)
immune <- subset(scedata, celltype=="Immune")
immune <- ScaleData(immune, vars.to.regress = c("nCount_RNA", "percent.mt"), verbose = FALSE)
immune <- FindVariableFeatures(immune, nfeatures = 4000)
immune <- RunPCA(immune, npcs = 50, verbose = FALSE)
immune <- FindNeighbors(immune, reduction = "pca", dims = 1:50)
immune <- FindClusters(immune,
resolution = seq(from = 0.1,
to = 1.0,
by = 0.2))
immune <- RunUMAP(immune, reduction = "pca", dims = 1:50)
library(clustree)
clustree(immune)
Idents(immune) <- "RNA_snn_res.0.5"
immune$seurat_clusters <- [email protected]
DimPlot(immune, label = T,pt.size = 1)
查看下免疫细胞marker的表达。
immune_cellmarker <- c("CD3D",'CD3E','CD2',"CD4","CD8A",#T cell
'CD79A','MZB1','MS4A1','CD79B',#B cell
'FOXP3',"IL32",'TNFRSF18','TNFRSF4',#Treg
'IL17A','IL17F','CD40LG',#Th17
'S100A8','CXCL8','SOD2','NAMPT',#Neutrophil
'SEPP1','C1QA','APOE','CD14','RNASE1',#Macrophage
'TPSAB1','TPSB2','CPA3','HPGDS',#Mast
'HLA-DRA','HLA-DPB1','CST3','HLA-DPA1',#mDC
'PTGDS','SOX4','GZMB','IRF7',#pDC
'IGHA1','IGHG1',"IGHG2",#Plasma
'KLRF1','KLRD1','XCL2','XCL1'#NK
)
library(ggplot2)
DotPlot(immune, features = immune_cellmarker)+
theme_bw()+
theme(panel.grid = element_blank(), axis.text.x=element_text(hjust = 1,vjust=0.5,angle=90))+
labs(x=NULL,y=NULL)+guides(size=guide_legend(order=3))+
scale_color_gradientn(values = seq(0,1,0.2),colours = c('#330066','#336699','#66CC66','#FFCC33'))
然后对细胞进行定群。
immune <- subset(immune, idents = c("1","8","9"), invert = TRUE)
new.cluster.ids <- c("0"="Macrophage",
"2"="T cell",
"3"="Macrophage",
"4"="mDC",
"5"="Neutrophil",
"6"="Macrophage",
"7"="Macrophage",
"10"="Mast")
immune <- RenameIdents(immune, new.cluster.ids)
immune$celltype <- [email protected]
DimPlot(immune, label = T,pt.size = 1,group.by = "celltype")
以上并不是新内容,亚群分析之后还可以和之前一样,做比例等。不过今天这里我们演示下细胞互作,用Cellcall这个比较简单的包。
=============================================
将GM和BM分开做互作,可以看看不同状态下细胞互作之间的区别。
library(devtools)
devtools::install_github("ShellyCoder/cellcall")
library(cellcall)
GM_immune <- subset(immune, group=="GM")
test <- CreateObject_fromSeurat(Seurat.object= GM_immune, #seurat对象
slot="counts",
cell_type="celltype", #细胞类型
data_source="UMI",
scale.factor = 10^6,
Org = "Homo sapiens") #物种信息
mt <- TransCommuProfile(object = test,
pValueCor = 0.05,
CorValue = 0.1,
topTargetCor=1,
p.adjust = 0.05,
use.type="median",
probs = 0.9,
method="mean",
IS_core = TRUE,
Org = 'Homo sapiens')
#有多少细胞类型就设置多少个颜色
cell_color <- data.frame(color=c("#FF34B3","#BC8F8F","#20B2AA","#00F5FF","#FFA500"), stringsAsFactors = FALSE)
rownames(cell_color) <- c("Macrophage","T cell","mDC","Neutrophil","Mast")
#绘制互作图
ViewInterCircos(object = mt, font = 2, cellColor = cell_color,
lrColor = c("#F16B6F", "#84B1ED"),
arr.type = "big.arrow",arr.length = 0.04,
trackhight1 = 0.05, slot="expr_l_r_log2_scale",
linkcolor.from.sender = TRUE,
linkcolor = NULL, gap.degree = 0.5, #细胞类型多的话设置小点,不然图太大画不出来
trackhight2 = 0.032, track.margin2 = c(0.01,0.12), DIY = FALSE)
#可视化互作受配体关系
viewPheatmap(object = mt, slot="expr_l_r_log2_scale", show_rownames = T,
show_colnames = T,treeheight_row=0, treeheight_col=10,
cluster_rows = T,cluster_cols = F,fontsize = 12,angle_col = "45",
main="score")
BM的互作结果为,变化还是挺大的。
除了这些,cellcall还可以做其他的事情,具体参考:
https://github.com/ShellyCoder/cellcall
做细胞互作的工具很多,比如iTALK,Cellchat,CellphoneDB等,感兴趣的可以自己取探索下。好了,今天的分享就到这里了,其实这篇分享不是很严谨,主要是演示单细胞数据进一步分析思路,希望对大家有启发。