saeyslab / multinichenetr

MultiNicheNet: a flexible framework for differential cell-cell communication analysis from multi-sample multi-condition single-cell transcriptomics data
GNU General Public License v3.0
112 stars 14 forks source link

Warning when running lr_target_prior_cor_inference() #24

Closed VivianQM closed 1 year ago

VivianQM commented 1 year ago

Hi,

Thank you for all the help you have provided.

I have encountered another error when using this package when running lr_target_prior_cor_inference():

Warning message in FUN(X[[i]], ...): “not enough samples for a correlation analysis for the celltype Cumulus” [1] "For no celltypes, sufficient samples (>= 5) were available for a correlation analysis. lr_target_prior_cor, the output of this function, will be NULL. As a result, not all types of downstream visualizations can be created."

This is only a warning and do not throw an error. However, this line does when I try to save it: multinichenet_output = list( celltype_info = abundance_expression_info$celltype_info, celltype_de = celltype_de, sender_receiver_info = abundance_expression_info$sender_receiver_info, sender_receiver_de = sender_receiver_de, ligand_activities_targets_DEgenes = ligand_activities_targets_DEgenes, prioritization_tables = prioritization_tables, grouping_tbl = grouping_tbl, lr_target_prior_cor = lr_target_prior_cor ) multinichenet_output = make_lite_output(multinichenet_output) save = FALSE if(save == TRUE){ saveRDS(multinichenet_output, paste0(path, "multinichenet_Theca+GratoCC.rds")) }

This is the error: Error in UseMethod("inner_join"): no applicable method for 'inner_join' applied to an object of class "NULL" Traceback:

  1. make_lite_output(multinichenet_output)
  2. multinichenet_output$lr_target_prior_cor %>% dplyr::inner_join(LR_subset_cor, . by = c("sender", "receiver", "ligand", "receptor")) %>% dplyr::filter(target %in% . gene_subset)
  3. dplyr::filter(., target %in% gene_subset)
  4. dplyr::inner_join(., LR_subset_cor, by = c("sender", "receiver", . "ligand", "receptor"))

    What is also strange is that none of my cell types has more than 5 samples (I am running multiple multinichenet runs for different CCI between cell types) For this one above I have:

    image

    But some of the runs will throw the error message (“not enough samples for a correlation analysis for the celltype”), while some other runs will not. Why?

Any help would be highly appreciated. Thank you.

Best, Vivian

browaeysrobin commented 1 year ago

This should be fixed now: make_lite_output will now assess whether lr_target_prior_cor is empty (when this could not be calculated because too few samples).

Same issue as #21

VivianQM commented 1 year ago

Hi! Reinstalled and still did not work.

Error in if (nrow(multinichenet_output$lr_target_prior_cor) > 0) {: argument is of length zero Traceback:

  1. make_lite_output(multinichenet_output)
browaeysrobin commented 1 year ago

Hi @VivianQM,

Can you try to reinstall again? The fix passes a unit test for this type of example, so I think the issue will be really solved now.

VivianQM commented 1 year ago

Hi @browaeysrobin,

That error was fine but now this comes up...

Error in if (!is.na(multinichenet_output$lr_target_prior_cor)) {: the condition has length > 1 Traceback:

  1. make_lite_output(multinichenet_output)
browaeysrobin commented 1 year ago

Are you sure this error was thrown with the most recent version (v1.0.2)?

VivianQM commented 1 year ago

Are you sure this error was thrown with the most recent version (v1.0.2)?

Removed and Installed again, the error went away. Thanks.