kieranrcampbell / ouija

Descriptive probabilistic marker gene approach to single-cell pseudotime inference
http://kieranrcampbell.github.io/ouija
28 stars 3 forks source link

Error in svd when response_type="transient" #4

Open daniel-wells opened 7 years ago

daniel-wells commented 7 years ago

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.

kieranrcampbell commented 7 years ago

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

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 commented 7 years ago

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

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

daniel-wells commented 7 years ago

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