farrellja / URD

URD - Reconstruction of Branching Developmental Trajectories
GNU General Public License v3.0
117 stars 41 forks source link

Error When Running pseudotimeWeightTransitionMatrix #37

Closed stephenchea closed 4 years ago

stephenchea commented 5 years ago

When I run pseudotimeWeightTransitionMatrix I get the following error. How do I make sense of the error and what should I do to resolve it?

pt.logistic <- pseudotimeDetermineLogistic(aggr.urd, "pseudotime", optimal.cells.forward=20, max.cells.back=40, do.plot = FALSE)

[1] "Mean pseudotime back (~40 cells) 0.000365363412175712" [1] "Chance of accepted move to equal pseudotime is 0.820789323633629" [1] "Mean pseudotime forward (~20 cells) -0.000183876064440276"

biased.tm <- pseudotimeWeightTransitionMatrix(aggr.urd, "pseudotime", logistic.params = pt.logistic)

Error in if (sparse && !sM) data <- as(data, "sparseMatrix") else if (!sparse) { : missing value where TRUE/FALSE needed Calls: pseudotimeWeightTransitionMatrix -> -> -> callGeneric -> eval -> eval -> Matrix In addition: Warning message: In sum(isN0(as(x, "matrix"))) : integer overflow - use sum(as.numeric(.)) Execution halted

farrellja commented 5 years ago

Hey @stephenchea,

This one is interesting. It looks like the call to pseudotimeDetermineLogistic has worked. The error that is occurring in pseudotimeWeightTransitionMatrix seems to be related to the Matrix package, which handles sparse matrices — it looks like something being passed to one of those functions is not a matrix?

Will you: (a) try installing from the debug branch (devtools::install_github("farrellja\URD@debug") and rerun? I made some changes to this function to allow it accomodate larger data sets; I don't think you're having that issue based on the errors, but perhaps it will solve things anyway. (b) It seems that it's failing in the multiplication operation. Will you verify that there's a diffusion map present (corner(aggr.urd@dm@transitions))? That and pseudotime are the only inputs into the mulitplication operation -- and I'm assuming pseudotime is fine, since the same value worked for pseudotimeDetermineLogistic. (c) If those don't solve / make obvious the problem, can you provide me a reproducible example so that I can debug?