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

Error in `dplyr::inner_join()`: Problem with `ligand` and `target`. #11

Closed catsargent closed 1 year ago

catsargent commented 1 year ago

Hi, When using the wrapper to run multinichenet on my data, I get the following error:

[1] "Calculate differential expression for all cell types"
[1] "DE analysis is done:"
[1] "included cell types are:"
 [1] "MAC"                     "SMACs"                   "VSM"                     "Tc"                      "Ductal.KCs"             
 [6] "Classical.MECs"          "Oral.Mucosal.KCs"        "ILCs"                    "Fibroblast.1"            "Fibroblast.2"           
[11] "Non.Classical.Monocytes" "Th"                      "MAIT"                    "CD8..IEL"                "IgA.Plasma.Cells"       
[16] "Plasmablasts"            "VECs"                   
[1] "Make diagnostic abundance plots + Calculate expression information"
[1] "Calculate NicheNet ligand activities and ligand-target links"
[1] "Combine all the information in prioritization tables"
Error in `dplyr::inner_join()`:
! Join columns in `x` must be present in the data.
✖ Problem with `ligand` and `target`.
Run `rlang::last_trace()` to see where the error occurred.
There were 35 warnings (use warnings() to see them)

Running rlang::last_trace() gave the following message:

<error/rlang_error>
Error in `dplyr::inner_join()`:
! Join columns in `x` must be present in the data.
✖ Problem with `ligand` and `target`.
---
Backtrace:
    ▆
 1. ├─multinichenetr::multi_nichenet_analysis(...)
 2. │ └─multinichenetr::multi_nichenet_analysis_combined(...)
 3. │   └─multinichenetr::lr_target_prior_cor_inference(...)
 4. │     └─... %>% dplyr::ungroup()
 5. ├─dplyr::ungroup(.)
 6. ├─dplyr::mutate(., id_target = paste(id, target, sep = "_"))
 7. ├─dplyr::inner_join(., ligand_target_df, by = c("ligand", "target"))
 8. └─dplyr:::inner_join.data.frame(., ligand_target_df, by = c("ligand", "target"))
Run rlang::last_trace(drop = FALSE) to see 4 hidden frames.

Any help you can provide regarding this error would be gratefully received!

Thanks, Catherine

p.s. I installed multinichenet again a few days ago based on the recommendation from the error that I had been receiving then.

jluft-uoe commented 1 year ago

Hi - I encountered the same issue. I believe it's because you're trying to calculate a correlation with <5 samples. The Hmisc::rcorr function by 'lr_target_prior_cor' requires >4 observations.

browaeysrobin commented 1 year ago

Hi @catsargent and @jluft-uoe

In the updated version of multinichenetr (v1.0.1), a message should be thrown and not an error in case you cannot calculate LR-T correlations because you have <5 samples. I will close this issue, but feel free to re-open if updating multinichenetr did not resolve this issue.