kstreet13 / slingshot

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

Map cells onto existing trajectory? #213

Closed lucygarner closed 1 year ago

lucygarner commented 1 year ago

Hi,

I performed Slingshot on the UMAP of my first scRNA-seq dataset. I then obtained a second similar scRNA-seq dataset and projected it into the coordinates of the first dataset UMAP using Seurat functions (https://satijalab.org/seurat/reference/projectumap). I am wondering whether it is possible for me to obtain pseudotime positions of cells from the second dataset on the Slingshot trajectories?

There seems to be a predict function in the package, but I can't find an example of its usage in: https://www.bioconductor.org/packages/devel/bioc/vignettes/slingshot/inst/doc/vignette.html. My SlingshotDataSet object contains three trajectories, but I only want to map onto two of these. Is that possible?

Best wishes, Lucy

kstreet13 commented 1 year ago

Hi @lucygarner,

Thanks for posting this, I didn't realize that the predict function was not so poorly documented. You're right that that's the proper method, but in order to access the documentation on it (since the general predict function is not from slingshot), I had to use:

?slingshot::`predict,PseudotimeOrdering-method`

However, there's no way to make the this function project onto only two out of three curves. If you really want to force the issue, you could adjust the slingCurveWeights of the resulting object by zeroing out the weights on the third lineage and redistributing them among the other two, but that might cause some weird downstream complications.

Let me how it goes or if anything is unclear. Best, Kelly

lucygarner commented 1 year ago

Ok great thank you, I'll give it a go.

kstreet13 commented 1 year ago

I also added a small section to the vignette about the predict method (that should be released with the upcoming new version of Bioconductor), so hopefully it's a little easier now for anyone else having this issue.