kstreet13 / slingshot

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

Fewer line coordinates than cells #161

Closed petervangalen closed 2 years ago

petervangalen commented 2 years ago

Hi,

In R version 3.6.1 with slingshot_1.4.0 I was able to add line coordinates as metadata because the number of xy coordinates for the lines were the same as the cell number.

sling <- slingshot(sce, clusterLabels = "CellType", reducedDim = "umap", start.clus = "HSC")
nrow(slingCurves(sling)[[1]][["s"]]) == ncol(sce)

This used to be TRUE but not anymore in R version 4.1.1 with slingshot_2.1.1. Is it no longer possible to add the line coordinates as metadata to every cell?

Peter

kstreet13 commented 2 years ago

Hi @petervangalen,

That's a good question! It's still possible, it's just not the default behavior, anymore.

Since princurve (and subsequently slingshot) added the approx_points option, it's generally been faster to build the curves with fewer points than the total number of cells. So if you don't specify a value for approx_points, it will either use 150 or the total number of cells, whichever is smaller. You can switch back to the old behavior by setting approx_points = FALSE. Alternatively, if that's too slow, you could also use the new method, then get the projections onto the curves via princurve::project_to_curve.

Hope this helps! Kelly

petervangalen commented 2 years ago

Thanks! That's very helpful.