Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

slingshot plot(reducedDim(sds) error #6

Open
gebdu opened this issue Apr 19, 2023 · 2 comments
Open

slingshot plot(reducedDim(sds) error #6

gebdu opened this issue Apr 19, 2023 · 2 comments

Comments

@gebdu
Copy link

gebdu commented Apr 19, 2023

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([email protected])

[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

@lambdamoses
Copy link
Collaborator

This website has not been updated for years. The user interface of Slingshot might have changed, causing the error. Please consult the updated version of Slingshot documentation.

@gebdu
Copy link
Author

gebdu commented Apr 20, 2023

just adding: SlingshotDataSet
solves the problem

SlingshotDataSet(sds)

sds <- SlingshotDataSet(sds)

plot(reducedDim(sds, "UMAP"), col = cell_colors, pch = 16, cex = 0.5)
lines(SlingshotDataSet(sds), lwd = 2, type = 'lineages', col = 'black')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants