kstreet13 / slingshot

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

Error while running getLineages() #216

Closed aditisk closed 1 year ago

aditisk commented 1 year ago

Hi slingshot team,

I am getting an error when I try to run the getLineages() function on a subset of my data (works fine if all cells are included). I am working with slingshot_2.4.0

lineages <- getLineages(data = dimred, clusterLabels = clustering) Error in igraph::shortest_paths(tree, from = l, to = ends, mode = "out", : At core/paths/dijkstra.c:360 : Weight vector must not contain NaN values, Invalid value

Could you please help me figure out what is going on here ? Thanks a lot.

kstreet13 commented 1 year ago

Hi @aditisk,

Thanks for submitting! It sounds like there are missing values in the matrix of distances between clusters. Since you said you're working with a subset of your data, is it the case that some clusters will be absent or very rare in this subset? This can lead to a couple issues.

If the cluster labels are encoded as a factor, it will still be aware of clusters that are absent from the subset. So it would expect to find more clusters than there actually are, leading to missing/NA distances between clusters. You could get around this by just converting the vector of cluster labels to a character vector.

Alternatively, very small clusters (fewer cells than dimensions in the dimensionality reduction) can mess with some of the distance metrics. I think the default method ("slingshot") generally handles this well, but not in all cases, like when there's a cluster with only one cell.

Best, Kelly

aditisk commented 1 year ago

Hi @kstreet13,

Thanks a lot for your quick response. I'll take a closer look at my data to check what is going on. I'll also switch to the slingshot() wrapper instead of doing the steps individually. I'll close this issue for now and re-open if needed.

erzakiev commented 8 months ago

@kstreet13 by the way there is no team behind you, right? You maintain slingshot all by yourself, whilst having a day job as a ass. prof.?? Just wanted to commend your amazing time management skills, kudos!

kstreet13 commented 8 months ago

Yeah, that's correct. And I really don't feel like that's true most days, but thank you.