slingshot icon indicating copy to clipboard operation
slingshot copied to clipboard

confusion about the end of a lineage

Open Dooozy opened this issue 7 months ago • 1 comments

Hi, Thank you for producing and maintaining this package, it gives me good insight of lineage trending. I set an initial cluster, but the endpoints of the lineage somehow fall outside the final cluster.

Here is my object in seurat cluster: plot1

I want the cluster 2 to be the root, then run the below code:

sim <- slingshot(sim, 
                 clusterLabels = 'celltype',  
                 reducedDim = 'UMAP',  
                 start.clus= "2", 
                 end.clus = NULL  
)

it did produce lineages that started in cluster 2, but the the curves are confusing:

> SlingshotDataSet(sim) 
class: SlingshotDataSet 

 Samples Dimensions
   37747          2

lineages: 3 
Lineage1: 2  3  1  0  5  
Lineage2: 2  3  1  7  
Lineage3: 2  4  6  

curves: 3 
Curve1: Length: 19.701	Samples: 21594.93
Curve2: Length: 18.412	Samples: 17134.35
Curve3: Length: 23.042	Samples: 21914.49

plot5

Then I found my question may related to some optional arguments. I refer to #118 and run the below code:

sim <- slingshot(sim, 
                 clusterLabels = 'celltype',  
                 reducedDim = 'UMAP',  
                 start.clus= "2", 
                 end.clus = NULL,     
                 extend = 'n',
                 stretch =0
)

the SlingshotDataSet(sim) is:

Samples Dimensions
   37747          2

lineages: 3 
Lineage1: 2  3  1  0  5  
Lineage2: 2  3  1  7  
Lineage3: 2  4  6  

curves: 3 
Curve1: Length: 13.48	Samples: 24681.55
Curve2: Length: 9.8714	Samples: 16468.86
Curve3: Length: 12.416	Samples: 13229.51 

plot4 this looks better, but the curves still not end in place as I expected

Take lineage 3 for example. I think if I have 'stretch =0', the end of the curve would be the center of the cluster 6. When I run:

colors <- colorRampPalette(brewer.pal(11,'Spectral')[-6])(100) 
plotcol <- colors[cut(sim$slingPseudotime_3, breaks=100)] 
plotcol[is.na(plotcol)] <- "lightgrey" 
plot(reducedDims(sim)$UMAP, col = plotcol, pch=16, asp = 1)
lines(SlingshotDataSet(sim), lwd=2, col=brewer.pal(9,"Set1"))
legend("right",
       legend = paste0("lineage",1:3),
       col = unique(brewer.pal(6,"Set1")),
       inset=0.8,
       pch = 16)

plot3 Many cells in blue (in the left) seems not belong to either clutser 2, 4 or 6. You can check on this, there are few cells left to UMAP-1 0 in clutser 2, 4 and 6. : plot2

How can I make the trajectory end at the cluster 6 in lineage3? Could you please explain why is this happening? Thank you!

Dooozy avatar Jun 28 '24 07:06 Dooozy