dynverse/ti_slingshot

User Defined Dim Reduction

Closed this issue · 3 comments

For slingshot I think it would be helpful if the dim reductions provided by add_dimred() could be used rather than PCA.

I agree, to some extent. You're referring to this line of code, I suppose. The code used in ti_slingshot was provided by @kstreet13.

@kstreet13: What do you think about changing this line of code to something like

dyndimred::dimred(expression, method = parameters$dimred_method, ndim = parameters$ndim)

This would add another parameter to ti_slingshot, namely the dimred_method, for which the default would be PCA.

That sounds good! Our intention with Slingshot was to be somewhat agnostic to the upstream dimensionality reduction technique, so I think it would be good to have that extra flexibility.

Hello @mpmorley,

This should be fixed now. You can specify a prior dimred as follows.

library(tislingshot)
library(dyntoy)

dataset <- dyntoy::generate_dataset()

method <- tislingshot::ti_slingshot()

dataset$prior_information$dimred <- stats::prcomp(dataset$expression)$x[,1:5]

model <- dynwrap::infer_trajectory(dataset, method, give_priors = "dimred")

Let me know if this has not solved your issue.

Kind regards,
Robrecht