Closed diegomscoelho closed 5 years ago
Hi Diego,
This is a great change; thank you. I haven't committed it to the repo yet, but plan to. I had not realized that apply on sparse matrices just quietly converts them to a dense matrix behind the scenes. I hope to soon have time to scan through the code and find other instances where I've used apply on sparse matrices when it's not necessary and replace them as you've done above.
-- Jeff
Hi, I had an error using floodPseudotime in a very large matrix (~55k cells). ERROR MESAGE: "Error in asMethod(object) : Cholmod error 'problem too large' at file ../Core/cholmod_dense.c, line 105"
I saw that the problem was in floodBuildTM function. I tried to substitute: tm.sum.max <- max(apply(tm.flood, 1, sum)) by: tm.sum.max <- max(rowSums(tm.flood))
It was faster and didn't consume almost none of my RAM.
What you think?
The newest version should be: function (object = NULL, dm = NULL) { if (is.null(object) & is.null(dm)) stop("Must provide either object or diffusion map.") if (!is.null(object)) { tm.flood <- object@dm@transitions } else if (!is.null(dm)) { tm.flood <- dm@transitions } tm.sum.max <- max(rowSums(tm.flood)) tm.flood <- tm.flood/tm.sum.max return(tm.flood) }
Regards, Diego