kstreet13 / slingshot

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

Smoothed heatmaps question #159

Closed CodeInTheSkies closed 2 years ago

CodeInTheSkies commented 2 years ago

Hi Kelly,

I'm trying to understand a bit more deeply about the smoothed heatmaps such as the one here: https://github.com/kstreet13/slingshot/issues/142#issuecomment-885709765

How exactly is the smoothing done? Is it a simple moving-window average? I'm wondering, if it's not too complicated, is it simple enough to manually do on a section of a matrix, for example? If you can point me to the code for the smoothing function, that will be great!

Would appreciate your input whenever you get a chance.

Thank you!

kstreet13 commented 2 years ago

Hi @CodeInTheSkies ,

This is a tradeSeq function, but briefly, the values represent the predicted mean smoother, for which we use smoothing splines (not a moving window, which would be more like a loess smoother).

And I'm not entirely sure what you mean by doing it manually on a section of a matrix (I think of the basic tradeSeq inputs as a counts matrix, a vector/matrix of pseudotime values, and a vector/matrix of weights), but feel free to check out the code, here.

Best, Kelly