SingleR是用于單細(xì)胞RNA測(cè)序(scRNAseq)數(shù)據(jù)的自動(dòng)注釋方法(Aran et al.2019)箱玷。給定具有已知標(biāo)簽的樣本(單細(xì)胞或RNAseq)參考數(shù)據(jù)集窿克,它將基于與參考數(shù)據(jù)的相似性標(biāo)記測(cè)試數(shù)據(jù)集中的新細(xì)胞汗侵。具體來(lái)說(shuō)降铸,對(duì)于每個(gè)測(cè)試單元:
- 計(jì)算其表達(dá)譜與每個(gè)參考樣品的表達(dá)譜之間的Spearman相關(guān)性河胎。
- 將每個(gè)標(biāo)簽的分?jǐn)?shù)定義為相關(guān)性分布的fixed quantile(默認(rèn)為0.8)勃刨。
- 對(duì)所有標(biāo)簽重復(fù)此操作栋烤,然后將得分最高的標(biāo)簽作為此細(xì)胞的注釋谒养。
- 選擇性執(zhí)行微調(diào)
安裝
BiocManager::install("SingleR")
BiocManager::install("scRNAseq")
SingleR通過(guò)專(zhuān)用的數(shù)據(jù)檢索功能提供了多個(gè)參考數(shù)據(jù)集(主要來(lái)自大量RNA-seq或微陣列數(shù)據(jù))。例如明郭,我們使用HumanPrimaryCellAtlasData()
函數(shù)從人類(lèi)原代細(xì)胞圖集獲得參考數(shù)據(jù)买窟,該函數(shù)返回一個(gè)SummarizedExperiment
對(duì)象,該對(duì)象包含帶有樣本級(jí)標(biāo)簽的對(duì)數(shù)表達(dá)值矩陣薯定。
1.使用內(nèi)置的參考
library(SingleR)
hpca.se <- HumanPrimaryCellAtlasData()
hpca.se
導(dǎo)入要檢測(cè)的數(shù)據(jù)集
我們的測(cè)試數(shù)據(jù)集將取自La Manno et al. (2016)始绍。
為了提高速度,我們只選取100個(gè)細(xì)胞來(lái)標(biāo)記細(xì)胞類(lèi)型话侄。
library(scRNAseq)
hESCs <- LaMannoBrainData('human-es')
hESCs <- hESCs[,1:100]
# SingleR() expects log-counts, but the function will also happily take raw
# counts for the test dataset. The reference, however, must have log-values.
library(scater)
hESCs <- logNormCounts(hESCs)
使用hpca.se作為參考對(duì)測(cè)試數(shù)據(jù)集hESCs通過(guò)SingleR()進(jìn)行注釋
默認(rèn)的檢測(cè)marker的方法是largest positive log-fold changes in the per-label medians for each gene.
輸出的每一行都包含單個(gè)細(xì)胞的預(yù)測(cè)結(jié)果亏推。在 fine-tuning(first.labels)之前, fine-tuning()之后labels和after pruning (pruned.labels)之后的細(xì)胞標(biāo)簽年堆,以及相關(guān)的分?jǐn)?shù)吞杭。
pred.hesc <- SingleR(test = hESCs, ref = hpca.se, labels = hpca.se$label.main)
pred.hesc
## DataFrame with 100 rows and 5 columns
## scores first.labels
## <matrix> <character>
## 1772122_301_C02 0.347652:0.109547:0.123901:... Neuroepithelial_cell
## 1772122_180_E05 0.361187:0.134934:0.148672:... Neuroepithelial_cell
## 1772122_300_H02 0.446411:0.190084:0.222594:... Neuroepithelial_cell
## 1772122_180_B09 0.373512:0.143537:0.164743:... Neuroepithelial_cell
## 1772122_180_G04 0.357341:0.126511:0.141987:... Neuroepithelial_cell
## ... ... ...
## 1772122_299_E07 0.371989:0.169379:0.1986877:... Neuroepithelial_cell
## 1772122_180_D02 0.353314:0.115864:0.1374981:... Neuroepithelial_cell
## 1772122_300_D09 0.348789:0.136732:0.1303042:... Neuroepithelial_cell
## 1772122_298_F09 0.332361:0.141439:0.1437860:... Neuroepithelial_cell
## 1772122_302_A11 0.324928:0.101609:0.0949826:... Neuroepithelial_cell
## tuning.scores labels pruned.labels
## <DataFrame> <character> <character>
## 1772122_301_C02 0.1824402:0.0991116 Neuroepithelial_cell Neuroepithelial_cell
## 1772122_180_E05 0.1375484:0.0647134 Neurons Neurons
## 1772122_300_H02 0.2757982:0.1369690 Neuroepithelial_cell Neuroepithelial_cell
## 1772122_180_B09 0.0851623:0.0819878 Neuroepithelial_cell Neuroepithelial_cell
## 1772122_180_G04 0.1988415:0.1016622 Neuroepithelial_cell Neuroepithelial_cell
## ... ... ... ...
## 1772122_299_E07 0.1760025:0.0922504 Neuroepithelial_cell Neuroepithelial_cell
## 1772122_180_D02 0.1967609:0.1124805 Neuroepithelial_cell Neuroepithelial_cell
## 1772122_300_D09 0.0816424:0.0221368 Neuroepithelial_cell Neuroepithelial_cell
## 1772122_298_F09 0.1872499:0.0671893 Neuroepithelial_cell Neuroepithelial_cell
## 1772122_302_A11 0.1560800:0.1051322 Astrocyte Astrocyte
統(tǒng)計(jì)細(xì)胞個(gè)數(shù)
table(pred.hesc$labels)
##
## Astrocyte Neuroepithelial_cell Neurons
## 14 81 5
2.使用單個(gè)細(xì)胞參考
在這里,我們將使用兩個(gè)人類(lèi)胰腺數(shù)據(jù)集变丧。目的是使用一個(gè)預(yù)先標(biāo)記的數(shù)據(jù)集注釋另一個(gè)未標(biāo)記的數(shù)據(jù)集芽狗。
library(scRNAseq)
sceM <- MuraroPancreasData()
#移除未標(biāo)記的細(xì)胞
sceM <- sceM[,!is.na(sceM$label)]
sceM <- logNormCounts(sceM)
sceG <- GrunPancreasData()
sceG <- sceG[,colSums(counts(sceG)) > 0] # Remove libraries with no counts.
sceG <- logNormCounts(sceG)
#選取100個(gè)測(cè)試
sceG <- sceG[,1:100]
SingleR()
,與之前一樣的用法痒蓬,但是這次使用了marker檢測(cè)模式童擎,該模式考慮了跨細(xì)胞種類(lèi)表達(dá)的差異。在這里攻晒,將使用Wilcoxon ranked sum test來(lái)識(shí)別marker顾复。與默認(rèn)檢測(cè)算法相比,此方法更慢炎辨,但更適合單細(xì)胞數(shù)據(jù)捕透。
pred.grun <- SingleR(test=sceG, ref=sceM, labels=sceM$label, de.method="wilcox")
table(pred.grun$labels)
##
## acinar beta delta duct
## 53 4 2 41
3.對(duì)細(xì)胞分?jǐn)?shù)可視化
SingleR提供了強(qiáng)大的可視化工具。 plotScoreHeatmap()
顯示所有參考標(biāo)簽上的分?jǐn)?shù),這使用戶(hù)可以檢查整個(gè)數(shù)據(jù)集中預(yù)測(cè)標(biāo)簽的置信度乙嘀。每個(gè)細(xì)胞的實(shí)際分配標(biāo)簽顯示在頂部末购。理想情況下,每個(gè)cell(即熱圖的一列)應(yīng)具有一個(gè)明顯大于其余得分的分?jǐn)?shù)虎谢,表明已將其明確分配給標(biāo)簽盟榴。
plotScoreHeatmap(pred.grun)
歡迎關(guān)注!
reference:
https://www.nature.com/articles/s41590-018-0276-y
https://bioconductor.org/packages/devel/bioc/vignettes/SingleR/inst/doc/SingleR.html