本文是參考學習CNS圖表復現(xiàn)04—單細胞聚類分群的resolution參數(shù)問題的學習筆記??赡芨鶕?jù)學習情況有所改動。
這個resolution參數(shù)到底應該是選擇多少呢?難道這個步驟沒有一個絕對的標準嗎?
我之前給大家舉例是使用balloonplot這個可視化函數(shù),代碼如下:
>`library(gplots)
tab.1=table(sce@meta.data$RNA_snn_res.0.2,sce@meta.data$RNA_snn_res.0.8)
balloonplot(tab.1)
就可以很直觀的看到,我們把resolution參數(shù)分別賦值為0.2和0.8的效果,如下:
圖片
0.2和0.8的效果對比</figcaption>
很明顯,這個resolution越小呢,我們得到的分群數(shù)量就越少,所以0.2的時候是17個群,但是0.8的時候是31個群。
而且我們根據(jù)balloonplot的可視化,可以看到,在0.2的時候的17個群里面的有一些群,會隨著resolution的調(diào)高,繼續(xù)裂變成為多個群。
有意思的是,我恰好在你要的rmarkdown文獻圖表復現(xiàn)全套代碼來了(單細胞) 看到了一個更好的可視化方法:
# Check clustering stability at given resolution
# Set different resolutions
res.used <- seq(0.1,1,by=0.2)
res.used
# Loop over and perform clustering of different resolutions
for(i in res.used){
sce <- FindClusters(object = sce, verbose = T, resolution = res.used)
}
# Make plot
library(clustree)
clus.tree.out <- clustree(sce) +
theme(legend.position = "bottom") +
scale_color_brewer(palette = "Set1") +
scale_edge_color_continuous(low = "grey80", high = "red")
clus.tree.out` </pre>
就是借用clustree包,可視化如下:
圖片
可以非常清晰的看到,隨著resolution的調(diào)高,具體是哪些群在不停地繼續(xù)裂變成為多個群。
但是呢,就是resolution設置多少,難道說沒有一個絕對的指標嗎?
我這里只能說,確實沒有,不僅僅是resolution參數(shù),生物信息學數(shù)據(jù)分析過程中,就比如這個單細胞吧,質(zhì)控的時候去除多少個質(zhì)量差的細胞去除多少基因,選擇高變基因數(shù)量多少,PCA降維后選擇多少個PC,基本上每個步驟都是可以靈活調(diào)整的。
這就是,數(shù)據(jù)分析的魅力吧。