空间转录组第九讲:利用SingleR进行细胞类型注释

前面我们说过空间转录组技术不是真正的单细胞水平,每个spot会捕获5-10个细胞,这样每个spot里实际上可能存在几种不同类型的细胞。但是对于大部分组织细胞来说同一区域周围更可能分布着相同类型的细胞,这样对应的spot孔里面更容易捕获到同一种细胞(或者splot里的大部分细胞属于同一类型)。所以对空间转录组进行细胞类型注释有利判断不同组织细胞类型的大致空间分布。并且我们也介绍了用Loupe Browser软件和已知marker基因进行手动注释细胞类型。今天我们来介绍一下怎么用于SingleR软件来给空间转录组数据进行细胞类型注释。

SingleR是非常老牌且经典的单细胞测序细胞类型注释软件了。它通过给定的具有已知类型标签的细胞样本作为参考数据集,对测试数据集中与参考集相似的细胞进行标记注释。基本的原理是:选择参考数据库不同细胞类型间高度变化的基因,然后计算预测细胞跟参考数据库的相关性,通过不断剔除相关性最差的类型循环计算相关性,最终得到预测细胞的类型注释。相对来说SingleR对细胞类型的注释结果还是比较准确的,尤其是用已知marker进行判断结果不是很清晰的情况下,借助SingleR注释的结果更有利于细胞类型标签的判断。

软件安装:

if(!requireNamespace("BiocManager", quietly = TRUE))

install.packages("BiocManager")

BiocManager::install("SingleR")

SingleR****参考数据库:

一、SingleR自带5个人的参考数据库和2个小鼠的参考数据库,旧版的SingleR是直接把这几个库用RDS文件储存在R包里的,最新版的SingleR已经将这几个数据库单独放在了*celldex *R包里,所以调用的时候会先下载对应的数据库文件,这一步网速比较慢的话可能中途会断掉需要多下载几次。

每个数据库导入的方法如下:

ref <- HumanPrimaryCellAtlasData()

The HPCA reference consists of publicly available microarraydatasets derived from human primary cells (Mabbott et al. 2013). Most of thelabels refer to blood subpopulations but cell types from other tissues are alsoavailable.

ref <- BlueprintEncodeData()

The Blueprint/ENCODE reference consists of bulk RNA-seq datafor pure stroma and immune cells generated by Blueprint (Martens and Stunnenberg 2013) and ENCODE projects (The ENCODE Project Consortium2012).

ref <- ImmGenData()

The ImmGen reference consists of microarray profiles of puremouse immune cells from the project of the same name (Heng et al. 2008). This is currently the most highly resolved immune reference- possibly overwhelmingly so, given the granularity of the fine labels.

ref <- DatabaseImmuneCellExpressionData()

The DICE reference consists of bulk RNA-seq samples of sortedcell populations from the project of the same name (Schmiedel et al. 2018).

ref <- NovershternHematopoieticData()

The Novershtern reference (previously known asDifferentiation Map) consists of microarray datasets for sorted hematopoieticcell populations from GSE24759 (Novershtern et al. 2011).

ref <- MouseRNAseqData()

This reference consists of a collection of mouse bulk RNA-seqdata sets downloaded from the gene expression omnibus (Benayoun et al. 2019). A variety of cell types are available, again mostly fromblood but also covering several other tissues.

ref <- MonacoImmuneData()

The Monaco reference consists of bulk RNA-seq samples ofsorted immune cell populations from GSE107011 (Monaco et al. 2019).

二、SingleR也可以使用其他数据作为参考数据库,如scRNAseqR包中有很多带有手动注释结果的单细胞数据集,可以从这里面挑选数据集作为参考数据库进行细胞类型注释。

开始细胞类型注释

导入R包和空间转录组数据

library(SingleR)

library(Seurat) 

combin.data <-readRDS("combin.data.RDS") #空间转录组数据作为seurat分析后建议保存为RDS文件便于后期调用,这里直接调用前面保存的RDS文件

expdata =combin.data[["Spatial"]]@data  ##导入空间转录组的细胞表达矩阵,注意这里跟单细胞的区别(用Spatial替换RNA)。

ref.se=MouseRNAseqData()#导入参考数据集

直接按亚群注释:

SingleR可以按亚群进行注释,它会将亚群里的所有细胞的基因表达值求和然后再跟参考数据集比较。

#导出seurat亚群信息

clusters <-combin.data[['seurat_clusters']]

#进行注释,注意SingleR自带的几个数据库的表情是分main和fine的,fine表示更细分的标签,空间转录组的数据其实用main的结果就可以了。

anno.cluster.main<- SingleR(test = expdata, ref = ref.se, labels = ref.se$label.main, method= "cluster", clusters = clusters)

#设置标签

celltype <-data.frame(ClusterID=rownames(anno.main),             

celltype=anno.main$labels,stringsAsFactors = F)

combin.data[['celltype']]<- 
celltype$celltype[match(Idents(combin.data), celltype$ClusterID)]

##画图展示

DimPlot(combin.data,reduction = "tsne" ,group.by="celltype")
image

这里我们使用的是小鼠大脑的数据,注释到的细胞类型主要是神经细胞(Neurons)和少突胶质细胞(Oligodendrocytes)。

查看亚群的对应注释:

> celltype
image

按单个细胞注释:

除了前面介绍的按亚群进行注释,SingleR也可以按单个细胞进行注释。

anno.cell.main=SingleR(test=expdata , ref = ref.se, labels = ref.se$label.main)  

combin.data[["SingleR.labels"]]<- as.character(anno.cell.main$labels)

DimPlot(combin.data,reduction = "tsne" ,group.by="SingleR.labels")

细胞分类结果展示:

image

再分统计亚群的注释

cluster_type <-tapply(Idents(combin.data),combin.data[["SingleR.labels"]],table)

celltypes <-names(cluster_type)

cluster_type <-as.data.frame(bind_cols(cluster_type))

rownames(cluster_type)<- names(cluster_type[[1]])

colnames(cluster_type)<- celltypes

cluster_type
image

这时候我们会发现,很多亚群其实是同时包括两类细胞的,有的甚至包括3类细胞。出现这种情况其实很正常的,本身亚群聚类不可能就100%将同一类细胞聚到一群的,一般会选择比例最多的类型最为这一群的细胞类型标签。

不过通过比较前面亚群注释的结果我们会发现有些群的注释结果不太一致的,比如说13号群,按亚群的注释方法得到的是少突胶质细胞(Oligodendrocytes),而按单个细胞注释却主要是神经细胞(Neurons)。那么该怎么选择呢?****建议还是按单个细胞的注释结果为准,因为按亚群注释的时候实际上是亚群所有细胞基因求均值得到基因的表达来做注释,这样容易受到细胞异质性的影响,导致整体的表达值容易受少数细胞****基因表达异常的影响从而影响最终的注释结果。另外对于空间转录组的数据,由于本身就不是单细胞水平,避免不了一个spot孔里有多种细胞类型,所以某些亚群注释的时候出现几种类型的细胞比例都不小的时候建议以多种细胞类型共同命名。比如说这里的0号亚群可以命名为****Oligodendrocytes& Neurons.

更多干货移步公众号:简生信
简生信,致力于分析单细胞、空转、其他组学生信数据挖掘分享。

空间转录组专题

空间转录组第一讲:10x空间转录组技术介绍

空间转录组第二讲:Space Ranger的使用

空间转录组第三讲:图像手动对齐

空间转录组第四讲:最详细的10x空间转录组summary网页报告解读

空间转录组第五讲:10x spaceranger aggr合并多个样本

空间转录组第六讲:数据预处理、降维、聚类(seurat)

空间转录组第七讲:多样本合并、marker基因分析

空间转录组第八讲:万字长文教你不写代码如何挖掘自己的数据

你可能感兴趣的:(空间转录组第九讲:利用SingleR进行细胞类型注释)