farrellja / URD

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

Error in floodPseudotimeProcess #84

Open mary77 opened 1 year ago

mary77 commented 1 year ago

Thank you so much for the great tool.

I just wanted to report an error that I encountered when running floodPseudotimeProcess function. I don't know why my obj.urd@diff.data hasn't been initialized during diffusion step.

It seems function try to initialize it but return this error : obj.urd = floodPseudotimeProcess(obj.urd, flood.res, floods.name='pseudotime') Error in rownames(dm@eigenvectors) : object 'dm' not found In addition: Warning message: In floodPseudotimeProcess(obj.urd, flood.res, floods.name = "pseudotime") : Initializing @diff.data, though this should have been previously initialized by creation or importation of diffusion map.

When I checked the source code it seems that the initialization is not correct. Here is the first several lines of the floodPseudotimeProcess code:

if (nrow(object@diff.data) == 0) { warning("Initializing @diff.data, though this should have been previously initialized by creation or importation of diffusion map.") if (nrow(object@dm@eigenvectors) == 0) { stop("Make sure your diffusion map is loaded into the object (calcDM or importDM)") } object@diff.data <- data.frame(row.names = rownames(dm@eigenvectors)) } if (nrow(object@pseudotime) == 0) { warning("Initializing @pseudotime, though this should have been previously initialized by creation or importation of diffusion map.") if (nrow(object@dm@eigenvectors) == 0) { stop("Make sure your diffusion map is loaded into the object (calcDM or importDM)") } object@pseudotime <- data.frame(row.names = rownames(dm@eigenvectors)) }

I think it should be object@dm@eigenvectors instead of dm@eigenvectors

Do you have any idea why it hasn't been initialized by creation or importation of diffusion map ?

celinech commented 1 year ago

Hi mary, I'm not implied in the dev of the tool, I'm just using it.

Do you run the CalcDM function before ? or import it, as in the tutorials ? I say so because you have 1°) an error message

Error in rownames(dm@eigenvectors) : object 'dm' not found

and 2°) the warning message

Warning message: In floodPseudotimeProcess(obj.urd, flood.res, floods.name = "pseudotime") : Initializing @diff.data, though this should have been previously initialized by creation or importation of diffusion map.

The main message here is that you don't have the dm slot in your urd object. Hope this will help !

mary77 commented 1 year ago

Hi Celinech,

Thanks for your reply, Yes I used CalcDM to generate dm and I have it in my object. This issue happened once when I save dm and used it later in another session. I don't know something might went wrong with saving.

But I think there is a bug in the code in floodPseudotimeProcess() function which have URD obj as the parameter but try to access the dm@eigenvectors instead of object@dm@eigenvectors.

Probably dev forgot to initialize the dm first.