ouija icon indicating copy to clipboard operation
ouija copied to clipboard

Error in svd when response_type="transient"

Open daniel-wells opened this issue 7 years ago • 3 comments

Firstly thanks for adding the transient option!

However, when response_type="transient" i.e. no genes are designated switching svd throws an error:

library(ouija)
data(example_gex)
oui <- ouija(example_gex, response_type="transient")
Error in svd(x, nu = 0, nv = k) : a dimension is zero

Presumably this is due to attempting prcomp on no genes

https://github.com/kieranrcampbell/ouija/blob/1ebc4ea8e6fd118600969eefaefa13da20c18a4e/R/ouija.R#L170

Perhaps just do a pca of the full Y?

Also in the readme the data is called synth_gex rather than example_gex.

daniel-wells avatar Sep 20 '17 23:09 daniel-wells

Hi Daniel,

Thanks for catching this. The reason for this behaviour is that if all your genes were transient then PC1 wouldn't correspond to anything like "true" pseudotime, whereas PCA-ing only the switch-like genes will still approximate pseudotime. Ways to fix this I would envisage as

  • Don't allow all-transient datasets
  • PCA the transient genes anyway
  • Set it randomly
  • Initialise from a different pseudotime algorithm (DPT is the only one I've found that actually works when everything is transient)

In any case, Stan with HMC is normally efficient enough that initialising randomly gets you back to the "truth", whereas Stan with ADVI is obviously sensitive to init.

Open to suggestions,

Thanks,

Kieran

kieranrcampbell avatar Sep 22 '17 08:09 kieranrcampbell

Hi Daniel,

Thanks for catching this. The reason for this behaviour is that if all your genes were transient then PC1 wouldn't correspond to anything like "true" pseudotime, whereas PCA-ing only the switch-like genes will still approximate pseudotime. Ways to fix this I would envisage as

  • Don't allow all-transient datasets
  • PCA the transient genes anyway
  • Set it randomly
  • Initialise from a different pseudotime algorithm (DPT is the only one I've found that actually works when everything is transient)

In any case, Stan with HMC is normally efficient enough that initialising randomly gets you back to the "truth", whereas Stan with ADVI is obviously sensitive to init.

Open to suggestions,

Thanks,

Kieran

kieranrcampbell avatar Sep 22 '17 08:09 kieranrcampbell

Ah I see, I think random initiation seems like a good option - simple and unrestrictive.

daniel-wells avatar Sep 26 '17 10:09 daniel-wells