kstreet13 / slingshot

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

Plotting MST In UMAP Space #214

Closed connerlambden closed 1 year ago

connerlambden commented 1 year ago

Hi, I'm using the following code to try and plot the MST in UMAP space, but the cluster centers don't seem to line up. Any ideas?

plot(reducedDims(sce)$UMAP, col = plotcol, pch = 16, asp = 1, main = "Slingshot Inferred Lineage with Cluster-based Minimum Spanning Tree") umap_curve_embedding <- embedCurves(sce, newDimRed=reducedDims(sce)$UMAP) lines(SlingshotDataSet(umap_curve_embedding), lwd = 2, type = 'lineages', col = 'black')

Screenshot 2023-03-27 at 1 36 24 PM

Also, is there any way of measuring the probabilities of different lineages? e.g the (frequentist I guess?) probability of a cell taking trajectory a or b?

Thanks so much for the help, I really appreciate it.

kstreet13 commented 1 year ago

Hi @connerlambden,

This is an interesting one, because the PseudotimeOrdering object doesn't actually store the cluster centers, they just get re-calculated whenever they're needed (in this case, by lines). I'm guessing that this is an issue with the UMAP embedding, where the terminal cluster was split into multiple parts, so its center ends up somewhere between them that doesn't really make sense. You could check this by coloring the cells according to their cluster labels.

(I should mention that this also kind of looks like the classic Slingshot plotting problem where you set the color based on the pseudotime values, but since those values contain NAs, some of the cells don't show up in the plot. However, since there only seems to be one lineage here, I don't think that's what's happening).

And yes, while I wouldn't treat them as valid probabilities, I think the proportional weights generated by Slingshot would work as sort of a best guess for which lineage each cell belongs to or will belong to. You should be able to get these with slingCurveWeights(sce, as.probs = TRUE).

Best, Kelly

connerlambden commented 1 year ago

Thanks!!