Seurat亮点之细胞周期评分和回归
斯坦福大學Satija lab的?Seurat v3.1 guidline于近日更新啦!其中包括許多個性化的模塊,其中我個人比較感興趣的是Cell-Cycle Scoring and Regression模塊,因為在條件干預的情況下,部分細胞處于非穩定狀態下,如增殖類細胞出現由于細胞周期相關基因的不同導致細胞聚類發生一定的偏移。
其實在許多已經發表的文獻中,我們也可以看到由于細胞周期不同所導致的分類偏移。如在Spatially and functionally distinct subclasses of breast cancer-associated fibroblasts revealed by single cell RNA sequencing?? 中 vCAFs和cCAFs中只有cell cycle genes的表達差異。
當作者使用SC3重新進行聚類時,兩種亞型又重新聚在了一起 (重點關注圖中的cluster1和cluster3,不要被顏色誤導了。同一個cluster,不同的配色方案,也是服了,還是看看史上最全的圖表色彩運用原理吧)。
系統介紹
通過計算各個細胞可能所處的細胞周期階段的得分 (G1,S,G2期),并在預處理過程 (主要是ScaleData步驟)中將細胞周期得分作為混雜因素移除,從而排除單細胞所處細胞周期不同對基因表達和細胞分型的影響。作者在小鼠造血祖細胞的數據集上證明了該觀點?(Nestorowa et al. Blood 2016.),其實只要是Seurat v3對象,自己的數據都是可以跑得通的。
細胞周期相關基因集使用的是人的基因,用小鼠進行測試,說明該細胞周期相關基因數據集適合人和小鼠;如果是其它物種,準備方法見 https://github.com/satijalab/seurat/issues/462。
下面是操作代碼:
library(Seurat)# 讀取表達矩陣, The first row is a header row, the first column is rownames exp.mat <- read.table(file = "../data/nestorawa_forcellcycle_expressionMatrix.txt",header = TRUE, as.is = TRUE, row.names = 1)# 一系列的細胞周期相關的markers,其中包括處于S期的43個細胞周期相關基因,54個G2M期的細胞周期相關基因, # from Tirosh et al, 2015, is loaded with Seurat. We can # segregate this list into markers of G2/M phase and markers of S phase s.genes <- cc.genes$s.genes g2m.genes <- cc.genes$g2m.genes# 創建Seurat對象并進行標準化;marrow <- CreateSeuratObject(counts = exp.mat) marrow <- NormalizeData(marrow) marrow <- FindVariableFeatures(marrow, selection.method = "vst") marrow <- ScaleData(marrow, features = rownames(marrow))如果我們在Seurat對象上進行PCA分析,使用FindVariableFeatures中找到高可變基因,進行PCA分析,并展示對各個主成分貢獻最大的基因。
PCA分析有不少需要注意的,具體見用了這么多年的PCA可視化竟然是錯的!!!?和?PCA主成分分析實戰和可視化 | 附R代碼和測試數據。
marrow <- RunPCA(marrow, features = VariableFeatures(marrow), ndims.print = 6:10, nfeatures.print = 10)我們看到對PC8和PC10貢獻最大的基因中一部分是細胞周期相關基因,包括TOP2A和MKI67。
從下面的熱圖也可以看出來。
DimHeatmap(marrow, dims = c(8, 10))#熱圖表示我們將嘗試從數據中去除該組分,從而確保細胞周期異質性對PCA或下游分析沒有貢獻。
分配細胞周期分數
首先,根據其G2/M和S期標記基因的表達為每個細胞分配一個所處周期的分數。這些標記基因的表達水平應該是反相關的,而不表達這些標記基因的細胞可能處于G1期。
我們用CellCycleScoring函數計算細胞周期分數,并在metadata中存儲S和G2/M分數,以及G2M,S或G1階段中每個細胞的預測分類。如果指定set.ident=T,則CellCycleScoring將Seurat對象中每個細胞的分組信息設置為其所處的細胞周期階段。
marrow <- CellCycleScoring(marrow, s.features = s.genes, g2m.features = g2m.genes, set.ident = TRUE)# view cell cycle scores and phase assignments head(marrow[[]])觀察細胞周期基因的表達情況 (評估計算的準確性)
注:R語言可視化學習筆記之ggridges包可繪制類似圖形。
# 觀察細胞周期基因的表達情況 RidgePlot(marrow, features = c("PCNA", "TOP2A", "MCM6", "MKI67"), ncol = 2)我們用CellCycleScoring函數計算細胞周期分數,并在metadata中存儲S和G2/M分數,以及G2M,S或G1階段中每個細胞的預測分類。如果指定set.ident=T,則CellCycleScoring將Seurat對象中每個細胞的分組信息設置為其所處的細胞周期階段。利用細胞周期基因進行PCA分析 (這個例子可以拓展,使用任意指定的基因集進行細胞周期分析)
PCA分析有不少需要注意的,具體見用了這么多年的PCA可視化竟然是錯的!!!?和?PCA主成分分析實戰和可視化 | 附R代碼和測試數據。
# Running a PCA on cell cycle genes reveals, unsurprisingly, that cells separate entirely by # phase marrow <- RunPCA(marrow, features = c(s.genes, g2m.genes)) DimPlot(marrow)在數據標歸一化時去除細胞周期影響
marrow <- ScaleData(marrow, vars.to.regress = c("S.Score", "G2M.Score"), features = rownames(marrow))再次做PCA時,就看不到細胞周期相關基因對主成分的貢獻了。
# 我們可以看到組分中不再出現細胞周期相關的基因 marrow <- RunPCA(marrow, features = VariableFeatures(marrow), nfeatures.print = 10)再次根據細胞周期相關基因進行PCA分析時,也不分不出群了,說明移除細胞周期影響的效果還是比較好的。
# When running a PCA on only cell cycle genes, cells no longer separate by cell-cycle phase marrow <- RunPCA(marrow, features = c(s.genes, g2m.genes)) DimPlot(marrow)如果細胞周期不合適時怎么辦?
上述過程去除了與細胞周期相關的所有信息。在某些情況下,我們發現這會對下游分析產生負面影響,特別是在分化過程(如小鼠血細胞分化生成過程中 hematopoiesis)中,干細胞處于靜止狀態,分化細胞正在增殖(反之亦然)。在這種情況下,消除所有細胞周期效應也會模糊干細胞和前體細胞之間的區別。
作為替代方案,我們建議消除G2M和S期分數之間的差異。這意味著將保持非周期細胞和周期細胞的組分差異,但是增殖細胞之間的細胞周期階段的差異將從數據中去除。
# 計算并移除分數差異 marrow$CC.Difference <- marrow$S.Score - marrow$G2M.Score marrow <- ScaleData(marrow, vars.to.regress = "CC.Difference", features = rownames(marrow))細胞周期相關的基因對各個主成分貢獻減小
# cell cycle effects strongly mitigated in PCA # 在PCA中不再出現大量的細胞周期相關的基因 marrow <- RunPCA(marrow, features = VariableFeatures(marrow), nfeatures.print = 10)G1期區分開,G2/M和S期聚在一起。
# when running a PCA on cell cycle genes, actively proliferating cells remain distinct from G1 # cells. # however, within actively proliferating cells, G2M and S phase cells group together marrow <- RunPCA(marrow, features = c(s.genes, g2m.genes)) DimPlot(marrow)單細胞是目前很火的領域,分析工具很多,而且也還在不斷發展中。Seurat是其中一個,雖然好用,卻不一定是最好的。而且運用好工具,需要對原理有很好的理解,易生信8月份的單細胞課程邀請來在單細胞算法開發上很有經驗的中科院博士開課,深入淺出的講述了單細胞分析的方法和注意事項,我個人認為課程講的特別好,很多學員也反映特別好,在此強烈推薦。
總結
以上是生活随笔為你收集整理的Seurat亮点之细胞周期评分和回归的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 单基因GSEA怎么做?
- 下一篇: 展示一个基本的正则用例