看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)