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

abundance_expression_info contains empty dfs #14

Closed avdl25 closed 1 year ago

avdl25 commented 1 year ago

Hello,

I am running into an issue where I cannot run the prioritization_tables step from the MIS-C three-wise comparison vignette because some of the sender_receiver_info tables in the abundance_expression_info object are empty. This results in an error that says there are missing values. I am not sure how to fix this issue with the abundance_expression_info object and would really appreciate guidance.

Empty abundance expression info table example:

$sender_receiver_info$avg_df_group
# A tibble: 0 × 8
# Groups:   group, sender [0]
# ℹ 8 variables: group <chr>, sender <fct>, receiver <fct>, ligand <chr>,
#   receptor <chr>, avg_ligand_group <dbl>, avg_receptor_group <dbl>,
#   ligand_receptor_prod_group <dbl>

Error:

Error in `dplyr::mutate()`:
ℹ In argument: `scaled_LR_prod =
  nichenetr::scaling_zscore(ligand_receptor_prod)`.
Caused by error in `if (sd(x, na.rm = TRUE) > 0) ...`:
! missing value where TRUE/FALSE needed
avdl25 commented 1 year ago

Didn't realize a somewhat similar error had already been posted (#2) -- I was able to fix this error by running SummarizedExperiment::colData(sce)$celltype_id= SummarizedExperiment::colData(sce)$celltype_id%>% make.names() before running the multinichenet wrapper function.