前几期我们确定了我们想要的cluster,接下来就需要进入标志物识别阶段,此步骤可以帮助我们验证某些类群的身份,推测未知类群的身份,即:细胞亚群注释。
细胞亚群注释有机器注释(注释结果不一定百分百可靠)和人工注释(主观性强)。
本期我们将介绍如何进行人工注释。
如果已经安装,此步请跳过。
install.packages('Seurat')
install.packages('dplyr')
install.packages('tidyverse')
install.packages('patchwork')
library(Seurat)
library(dplyr)
library(tidyverse)
library(patchwork)
setwd("D:/sc-seq")
根据自己的数据存放位置自定义路径
该数据为harmony后的数据。
scRNA <- load("scdata2.Rdata")
数据获取请查看:单细胞转录组 | 多样本处理与Harmony整合
函数格式:FindAllMarkers(object, test.use="……", only.pos = True,logfc.threshold = "……")
object:harmony整合后的对象;
test.use:检验方法;
only.pos:仅返回表达倍数大于0的基因(默认为 FALSE);
logfc.threshold:类群中基因的平均表达量相对于所有其他类群的平均表达量的最小log2倍数。默认为0.25。
cluster_markers <- FindAllMarkers(object = scRNA_harmony,
test.use="wilcox" ,
only.pos = TRUE,
logfc.threshold = 0.25)
输出文件:
p_val:P值;
avg_log2FC:平均的差异倍数;
pct.1:以IBSP为例,即:有84.1%的0cluster的细胞表达IBSP这个基因;
pct.2:除了0cluster以外的其余cluster中表达IBSP的细胞为31.6%;
cluster:细胞cluster类群。
# 筛选p_val<0.05的基因
all.markers =cluster_markers %>% dplyr::select(gene,everything()) %>% dplyr::filter(p_val<0.05)
# 将avg_log2FC排名前10的基因筛选出来
top10 = all.markers %>% group_by(cluster) %>% top_n(n = 10, wt = avg_log2FC)
输出文件:
我们可以通过下面的数据库进行查找maker基因进行细胞注释。这里我们以CellMarker数据库为例进行演示。
CellMarker数据库:https://panglaodb.se/index.html
PanglaoDB数据库:https://panglaodb.se/index.html
步骤:
① 在官网红框处输出你要查找的maker基因;
② 查看结果
这里数据库匹配的是"Stem cell",实际情况下每个cluster需要多搜索几个基因再确定细胞类型,这在里因为我比较懒,所以仅以"IBSP"基因为例,展示网站使用方法。
函数格式:RenameIdents(object,oldname = newname,……)
scRNA1 = RenameIdents(scRNA_harmony,"0" = "Stem cell","1" = "Osteoclast")
返回结果:
可以看到红框处"0"和"1"的cluster类群名已经被替换。
teneplot = DimPlot(scRNA1,reduction = "tsne", label =T)
查看图片:
0 cluster和1 cluster的类群名已经被更改。