Slingshot|單細(xì)胞軌跡推斷R包

看Cross-tissue organization of the fibroblast lineage的時(shí)候發(fā)現(xiàn)作者使用了Slingshot這個(gè)r包來(lái)做擬時(shí)序分析,嘗試使用了一下。

一、加載數(shù)據(jù),轉(zhuǎn)換格式

我使用的數(shù)據(jù)集:正常成纖維單細(xì)胞數(shù)據(jù)集(https://doi.org/10.1038/s41586-021-03549-5 ),seurat文件。

library(slingshot)
library(Seurat)
library(SingleCellExperiment)
library(RColorBrewer)
#加載單細(xì)胞數(shù)據(jù)集
load(file = "sc.RData")
#seurat轉(zhuǎn)換為SingleCellExperiment
sc <- as.SingleCellExperiment(sc)

二、運(yùn)行slingshot

sc <- slingshot(sc, clusterLabels = "ClustName", reducedDim = "UMAP")
sc
#class: SingleCellExperiment 
#dim: 21087 5000 
#metadata(0):
#assays(2): counts logcounts
#rownames(21087): Sox17 Mrpl15 ... 1700109K24Rik Gm10556
#rowData names(0):
#colnames(5000): AAGGTTCAGACAGACC-1_1_1 AAGTCTGAGGATGGTC-1_1_1 ...
#  TTGGAACCACCACGTG.4_32 TTTATGCGTCTGATTG.4_32
#colData names(11): nCount_RNA nFeature_RNA ... slingPseudotime_3
#  slingPseudotime_4
#reducedDimNames(3): PCA HARMONY UMAP
#mainExpName: RNA
#altExpNames(0):
summary(sc$slingPseudotime_1)
#Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
#  0.155   7.934  12.553  13.726  19.180  27.999    1559 

三、可視化

折線圖:可指定起始和終點(diǎn)細(xì)胞簇(如果有先驗(yàn)知識(shí),不指定的話就是無(wú)監(jiān)督的)。

lin1 <- getLineages(sc, 
                    clusterLabels = "ClustName", 
                    #start.clus = 'Pi16',#可指定起始細(xì)胞簇
                    #end.clus=c("Comp","Col15a1","Ccl19"),#可指定終點(diǎn)細(xì)胞簇
                    reducedDim = "UMAP")
plot(reducedDims(sc)$UMAP,col = brewer.pal(10,'Paired')[sce$Cluster],pch=16,asp=1)
lines(SlingshotDataSet(lin1), lwd=2,col = 'black',type = 'lineages')
軌跡圖:不指定起始和終點(diǎn)細(xì)胞簇(左)和同時(shí)指定起始和終點(diǎn)細(xì)胞簇(右)。

曲線圖:我這里使用了同時(shí)指定起始和終點(diǎn)細(xì)胞簇的lin1,得到的結(jié)果和文章基本一致。

crv1 <- getCurves(lin1)
plot(reducedDims(sc)$UMAP,col = brewer.pal(10,'Paired')[sce$Cluster],pch=16,asp=1)
lines(SlingshotDataSet(crv1), lwd = 3, col = 'black')

參考文獻(xiàn):Slingshot: cell lineage and pseudotime inference for single-cell transcriptomics.BMC Genomics, 2018, 19, 477.
幫助文檔:Slingshot: Trajectory Inference for Single-Cell Data (bioconductor.org)

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容