saeyslab / nichenetr

NicheNet: predict active ligand-target links between interacting cells
469 stars 117 forks source link

Error in calculate_de() function - Prioritization #217

Closed AClab-sgarcia closed 1 year ago

AClab-sgarcia commented 1 year ago

Good morning, thank you very much for your package, it is very useful.

I am following the prioritization vignette (Perform NicheNet analysis with prioritization) to do the NicheNet analysis.

In the "Perform prioritization of ligand-receptor pairs" step, the function "calculate_de" is used to calculate the DEGs with the genes present in the ligand-receptor network. When running this I get the following error: Error in calculate_de(seurat_obj = data_annotated, celltype_colname = "annotation", : object 'seuratObj' not found

I have been checking the source of this error with the help of: R/prioritization.R .

Based on this page, I noticed that in the line: # Set celltype as identity class Idents(seurat_obj) <- seuratObj[[celltype_colname, drop=[TRUE]]] the object seuratObj is called, when it has not been previously defined (only seurat_obj has been defined).

I don't know if this could be the origin of the error or if there is something in my code that is not correct. My script: DE_table <- calculate_de(seurat_obj = data_annotated, celltype_colname = "annotation", condition_colname = "BMI_grade", condition_oi = condition_oi, features = union(expressed_ligands, expressed_receptors))

Thank you in advance , Saioa

csangara commented 1 year ago

Hi Saioa,

You're completely right, can't believe I missed that...I've fixed this, and it should work now with reinstallation.

Really sorry about this, and thanks a lot for the heads up.

AClab-sgarcia commented 1 year ago

Thank you very much for your quick answer.

Now works perfectly.