Closed TongzhenXu closed 1 month ago
Hi @TongzhenXu ,
I think you just need to load the ggplot2
library, via library(ggplot2)
. If you haven't installed that library, you can do so with install.packages('ggplot2')
.
Best, Kelly
@kstreet13 I'm sorry, I just noticed that the image I uploaded in the previous post was incorrect. Here is the correct image. My sce has two treatment groups, CRT and ICI. After using the slingshot_condition function on sce, the generated sdss object cannot use the embedCurves function to convert PCA to UMAP for visualization. However, when using the slingshot function on sce, the generated object can use the embedCurves function to convert PCA to UMAP for visualization. My goal is to convert the PCA of sdss to UMAP for visualization, but I haven't succeeded. I'm not sure which step in the process went wrong.
Hi @TongzhenXu,
Ah, that makes more sense! I think the issue is the combination of inputs being a PseudotimeOrdering
object and a character
, because neither of these actually contain the UMAP coordinates. Rather than setting the second argument to "UMAP"
, try supplying the actual matrix of UMAP coordinates and I think that should work.
Best, Kelly
@kstreet13 Thank you for your advice. I have figured out this problem by the following code to separate PCA data of two different conditions into UMAP visualization and it works. So I will close this question.
Hi! I am currently working with the slingshot algorithm on PCA data and following the Second example from bioc2021trajectories for pseudotime analysis under different conditions. I aim to visualize the skeletons plot on a UMAP plot by using the embedCurves method to transform PCA data for different conditions. However, I encountered an error when running the following R code: sce <- slingshot(sce, omega = T, dist.method = 'mnn', omega_scale = 3,
approx_points = 150,,
) sdss <- slingshot_conditions(sce, sce$treat_group, approx_points = FALSE, extend = "n", reweight = FALSE, reassign = FALSE)
Plot skeletons
msts <- lapply(sdss, slingMST, as.df = TRUE) %>% bind_rows(.id = "treat_group") %>% arrange(treat_group)
ggplot(umap_coords, aes(x = UMAP1, y = UMAP2, col = treat_group)) + geom_point(size = .7, alpha = .1) + scale_color_brewer(palette = "Accent") + geom_point(data = msts, size = 3) + geom_path(data = msts, aes(group = interaction(Lineage, treat_group)), linewidth = 2) Error in ggplot(umap_coords, aes(x = UMAP1, y = UMAP2, col = treat_group)) : could not find function "ggplot"
Could you please advise me on how to correctly embed the PCA data from sdss into UMAP data, integrate this data into msts, and subsequently visualize it using ggplot? Any guidance on resolving the error and achieving the desired plot would be greatly appreciated.