kstreet13 / slingshot

Functions for identifying and characterizing continuous developmental trajectories in single-cell data.
265 stars 43 forks source link

slingshot plot(reducedDim(sds) error #218

Closed gebdu closed 1 year ago

gebdu commented 1 year ago

I am interested to run slingshot trajectory using your guideline using my Seurat object (Normalized, PCA, tSNE, UMAP, clustering done)

https://bustools.github.io/BUS_notebooks_R/slingshot.html

seu
An object of class Seurat
23572 features across 13696 samples within 1 assay
Active assay: RNA (23572 features, 1257 variable features)
3 dimensional reductions calculated: pca, tsne, umap

names([seu@meta.data](mailto:seu@meta.data))

[1] "orig.ident" "nCount_RNA" [3] "nFeature_RNA" "sample" [5] "tech" "tomato" [7] "percent.mito" "percent.ribo" [9] "pANN_0.25_0.24_3170" "DF.classifications_0.25_0.24_3170" [11] "RNA_snn_res.0.5" "seurat_clusters" [13] "silhouette_score" "RNA_snn_res.0.4" [15] "scina_labels"

sds <- slingshot(Embeddings(seu, "umap"), clusterLabels = seu$seurat_clusters, start.clus = 3, stretch = 0)

cell_pal <- function(cell_vars, pal_fun,...) { if (is.numeric(cell_vars)) { pal <- pal_fun(100, ...) return(pal[cut(cell_vars, breaks = 100)]) } else { categories <- sort(unique(cell_vars)) pal <- setNames(pal_fun(length(categories), ...), categories) return(pal[cell_vars]) } }

cell_colors <- cell_pal(seu$scina_labels, brewer_pal("qual", "Set2")) cell_colors_clust <- cell_pal(seu$seurat_clusters, hue_pal())

plot(reducedDim(sds), col = cell_colors, pch = 16, cex = 0.5)

Error in h(simpleError(msg, call)) : error in evaluating the argument 'x' in selecting a method for function 'plot': unable to find an inherited method for function 'reducedDim' for signature '"PseudotimeOrdering", "missing"'

Could you help what I am missing. I have all the required library installed and called.

sessionInfo()
R version 4.2.2 (2022-10-31)
slingshot_2.6.0
BUSpaRse_1.12.2
SeuratObject_4.1.3
Seurat_4.3.0
kstreet13 commented 1 year ago

That example analysis was not written by the Slingshot developers and we cannot ensure it's stability. Please see the official Slingshot vignette here: https://www.bioconductor.org/packages/release/bioc/vignettes/slingshot/inst/doc/vignette.html