2
$\begingroup$

When I run following code, I get error at -

slingshot_df <- data.frame(colData(sce))

the error is :

Error in as.vector(x) : no method for coercing this S4 class to a vector

library(Polychrome)
library(ggbeeswarm)
library(ggthemes)

# this define the cluster color. You can change it with different color scheme.
my_color <- createPalette(length(levels(sce$ident)), c("#010101", "#ff0000"), M=1000)
names(my_color) <- unique(as.character(sce$ident))

slingshot_df <- data.frame(colData(sce))

# re-order y-axis for better figure: This should be tailored with your own cluster names
# slingshot_df$ident = factor(slingshot_df$ident, levels=c(4,2,1,0,3,5,6))

ggplot(slingshot_df, aes(x = slingPseudotime_1, y = ident, 
                              colour = ident)) +
    geom_quasirandom(groupOnX = FALSE) + theme_classic() +
    xlab("First Slingshot pseudotime") + ylab("cell type") +
    ggtitle("Cells ordered by Slingshot pseudotime")+scale_colour_manual(values = my_color)
$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.