sc-RAN-seq 數(shù)據(jù)分析||Seurat新版教程: Using sctransform in Seurat

本教程介紹了Seurat包與sctransform 包一起分析時(shí)候的一般方法虏两。首先你也許會(huì)問(wèn):sctransform包是用來(lái)干嘛的宠页?

這是一個(gè)值得關(guān)心和探討的問(wèn)題拴泌,我也將做一個(gè)簡(jiǎn)單的回答殉农。最好的辦法當(dāng)然是到包所在的官網(wǎng)去讀人家的自我介紹了sctransform: Variance Stabilizing Transformations for Single Cell UMI Data

A normalization method for single-cell UMI count data using a variance stabilizing transformation. The transformation is based on a negative binomial regression model with regularized parameters. As part of the same regression framework, this package also provides functions for batch correction, and data correction. See Hafemeister and Satija 2019 <doi:10.1101/576827> for more details.

有沒(méi)有感覺(jué)很強(qiáng)大,在Seurat里面被封為SCTransform()函數(shù)可以:

  • 代替 NormalizeData, ScaleData, and FindVariableFeatures.三個(gè)函數(shù)
  • 轉(zhuǎn)換完了在SCT assay 里
  • 在均一化的同時(shí)可以移除線(xiàn)粒體細(xì)胞等的影響
library(Seurat)
packageVersion("Seurat")
# https://satijalab.org/seurat/mca.html
library(dplyr)
library(ggsci)

library(ggplot2)
library(sctransform)

# Load the PBMC dataset
list.files("D:\\Users\\Administrator\\Desktop\\RStudio\\single_cell\\filtered_gene_bc_matrices\\hg19")
?Read10X
pbmc.data <- Read10X(data.dir = "D:\\Users\\Administrator\\Desktop\\RStudio\\single_cell\\filtered_gene_bc_matrices\\hg19")
# Initialize the Seurat object with the raw (non-normalized data).
?CreateSeuratObject
pbmc <- CreateSeuratObject(counts = pbmc.data, project = "pbmc3k", min.cells = 3, min.features = 200)
pbmc

一步數(shù)據(jù)均一化蟀淮,也是比較慢的最住。

# store mitochondrial percentage in object meta data
pbmc <- PercentageFeatureSet(pbmc, pattern = "^MT-", col.name = "percent.mt")

# run sctransform
pbmc <- SCTransform(pbmc, vars.to.regress = "percent.mt", verbose = FALSE)

pbmc
An object of class Seurat 
26286 features across 2700 samples within 2 assays 
Active assay: SCT (12572 features)
 1 other assay present: RNA

然后是標(biāo)準(zhǔn)操作。

# These are now standard steps in the Seurat workflow for visualization and clustering
pbmc <- RunPCA(pbmc, verbose = FALSE)
pbmc <- RunUMAP(pbmc, dims = 1:30, verbose = FALSE)

pbmc <- FindNeighbors(pbmc, dims = 1:30, verbose = FALSE)
pbmc <- FindClusters(pbmc, verbose = FALSE)
DimPlot(pbmc, label = TRUE) + NoLegend()
為什么在轉(zhuǎn)化之后PC軸要比之前我們用NormalizeData 的時(shí)候要多呢?
  • 更有效地消除技術(shù)影響
  • 更高的PC維度可能代表一些微妙的生物學(xué)差異
  • In addition, sctransform returns 3,000 variable features by default, instead of 2,000. The rationale is similar, the additional variable features are less likely to be driven by technical differences across cells, and instead may represent more subtle biological fluctuations.

我們還可以像下面這樣去運(yùn)行:

pbmc <- CreateSeuratObject(pbmc_data) %>% PercentageFeatureSet(pattern = "^MT-", col.name = "percent.mt") %>% 
    SCTransform(vars.to.regress = "percent.mt") %>% RunPCA() %>% FindNeighbors(dims = 1:30) %>% 
    RunUMAP(dims = 1:30) %>% FindClusters()
Where are normalized values stored for sctransform?
  • pbmc[["SCT"]]@scale.data
  • pbmc[["SCT"]]@data 用于可視化的數(shù)據(jù)
  • pbmc[["SCT"]]@counts 校正后的count
  • You can use the corrected log-normalized counts for differential expression and integration. However, in principle, it would be most optimal to perform these calculations directly on the residuals (stored in the scale.data slot) themselves. This is not currently supported in Seurat v3, but will be soon.

第四條很容易讓人困惑怠惶,先不說(shuō)技術(shù)上的涨缚,僅字面意思:這里給你的并不是最好的,最好的目前還沒(méi)有策治。這句話(huà)不能和最好的方法出來(lái)的時(shí)候再說(shuō)嗎脓魏?以后的方法比現(xiàn)在的好,這很容易理解啊通惫,但是你要告訴我最好的總在未來(lái)茂翔,我就糾結(jié)了。而且履腋,FAQ4中建議使用RNA assay做差異分析珊燎,而在這里有建議使用SCT assay的scale.data(而且This is not currently supported in Seurat v3, but will be soon.)。

官方的解釋是這樣的:

Hi,
Thanks for the question, and I apologize for the confusion. We're working on allowing for DE to be performed on pearson residuals from SCTransform in an optimal way. Until then, its easiest for us to advise users just to use the RNA assay. But if you're really excited to give it a try, it is not invalid to do so. Still, in the interest of simplicity, we'll keep the FAQ as-is.
best,
Rahul

https://github.com/satijalab/seurat/issues/1421

# These are now standard steps in the Seurat workflow for visualization and clustering Visualize
# canonical marker genes as violin plots.
VlnPlot(pbmc, features = c("CD8A", "GZMK", "CCL5", "S100A4", "ANXA1", "CCR7", "ISG15", "CD3D"), 
    pt.size = 0.2, ncol = 4)
# Visualize canonical marker genes on the sctransform embedding.
FeaturePlot(pbmc, features = c("CD8A", "GZMK", "CCL5", "S100A4", "ANXA1", "CCR7"), pt.size = 0.2, 
            ncol = 3)
FeaturePlot(pbmc, features = c("CD3D", "ISG15", "TCL1A", "FCER2", "XCL1", "FCGR3A"), pt.size = 0.2, 
            ncol = 3)

Using sctransform in Seurat

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市俐末,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌奄侠,老刑警劉巖卓箫,帶你破解...
    沈念sama閱讀 206,013評(píng)論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異垄潮,居然都是意外死亡烹卒,警方通過(guò)查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,205評(píng)論 2 382
  • 文/潘曉璐 我一進(jìn)店門(mén)弯洗,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)旅急,“玉大人,你說(shuō)我怎么就攤上這事牡整∶晁保” “怎么了?”我有些...
    開(kāi)封第一講書(shū)人閱讀 152,370評(píng)論 0 342
  • 文/不壞的土叔 我叫張陵逃贝,是天一觀(guān)的道長(zhǎng)谣辞。 經(jīng)常有香客問(wèn)我,道長(zhǎng)沐扳,這世上最難降的妖魔是什么泥从? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 55,168評(píng)論 1 278
  • 正文 為了忘掉前任,我火速辦了婚禮沪摄,結(jié)果婚禮上躯嫉,老公的妹妹穿的比我還像新娘。我一直安慰自己杨拐,他們只是感情好祈餐,可當(dāng)我...
    茶點(diǎn)故事閱讀 64,153評(píng)論 5 371
  • 文/花漫 我一把揭開(kāi)白布。 她就那樣靜靜地躺著戏阅,像睡著了一般昼弟。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上奕筐,一...
    開(kāi)封第一講書(shū)人閱讀 48,954評(píng)論 1 283
  • 那天舱痘,我揣著相機(jī)與錄音,去河邊找鬼离赫。 笑死芭逝,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的渊胸。 我是一名探鬼主播旬盯,決...
    沈念sama閱讀 38,271評(píng)論 3 399
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來(lái)了胖翰?” 一聲冷哼從身側(cè)響起接剩,我...
    開(kāi)封第一講書(shū)人閱讀 36,916評(píng)論 0 259
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎萨咳,沒(méi)想到半個(gè)月后懊缺,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 43,382評(píng)論 1 300
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡培他,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 35,877評(píng)論 2 323
  • 正文 我和宋清朗相戀三年鹃两,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片舀凛。...
    茶點(diǎn)故事閱讀 37,989評(píng)論 1 333
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡俊扳,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出猛遍,到底是詐尸還是另有隱情馋记,我是刑警寧澤,帶...
    沈念sama閱讀 33,624評(píng)論 4 322
  • 正文 年R本政府宣布懊烤,位于F島的核電站抗果,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏奸晴。R本人自食惡果不足惜冤馏,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,209評(píng)論 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望寄啼。 院中可真熱鬧逮光,春花似錦、人聲如沸墩划。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 30,199評(píng)論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)乙帮。三九已至杜漠,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間察净,已是汗流浹背驾茴。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 31,418評(píng)論 1 260
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留氢卡,地道東北人锈至。 一個(gè)月前我還...
    沈念sama閱讀 45,401評(píng)論 2 352
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像译秦,于是被迫代替她去往敵國(guó)和親峡捡。 傳聞我的和親對(duì)象是個(gè)殘疾皇子击碗,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 42,700評(píng)論 2 345

推薦閱讀更多精彩內(nèi)容