kstreet13 / slingshot

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

Removing a lineage from a `PseudotimeOrdering` object? #245

Closed Dazcam closed 4 months ago

Dazcam commented 4 months ago

Hi there,

How would one go about removing a spurious lineage from a PseudotimeOrdering object after running getLineages?

Running something like lin1@metadata$lineages$Lineage4 <- NULL is insufficient as it doesn't remove all lineage information from the object. For example, running getCurves(lin1) after trying to remove lineage 4 using the above code results the following error:

Error in D[, ] <- vapply(pcurves, function(p) { : 
  number of items to replace is not a multiple of replacement length

Many Thanks

kstreet13 commented 4 months ago

Hi @Dazcam,

Unfortunately, there is currently no way to do this as you have described it. The best thing you can do is revisit your dimensionality reduction and/or clustering to try to simplify the resulting lineage structure. For example, choosing a smaller resolution parameter (for graph-based clustering) or smaller number of clusters (for k-means and similar methods) could reduce the likelihood of a spurious branching event.

Alternatively, if the spurious lineage is not too intrusive, you can always continue your analysis and simply choose to focus on the results from the other lineages. For example, if you run tradeSeq on the resulting trajectory, the results will be broken down by lineage, so you can easily produce lists of genes that are significant along any of your non-spurious lineages.

Hope this helps! Best, Kelly

Dazcam commented 4 months ago

Hi @kstreet13, thank you for your suggestions. I've opted to remove some cells from the trajectory analyses to get around this. The issue was with a small population of myeloid cells were being linked to the neuronal progenitor population that I designated as the root population. These cell types are from different lineages so this made no biological sense. Slingshot appears to draw a lineage from the designated root population to all possible 'maturer' populations.

kstreet13 commented 4 months ago

One other thing that may be useful, depending on your data, is the omega argument. If the myeloid cells are reasonably well separated from the other cell populations, then you can allow slingshot to detect breaks in the trajectory by setting omega = TRUE. Under the default settings, though, you are correct that it will connect all the input clusters.