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
125 stars 14 forks source link

Error running multi_nichenet_analysis() in "Combine all the information in prioritization tables" step #27

Closed lchan8 closed 1 year ago

lchan8 commented 1 year ago

Hi,

I got the following error when I ran multi_nichenet_analysis() on my dataset.

[1] "Calculate differential expression for all cell types" [1] "DE analysis is done:" [1] "included cell types are:" [1] "NK" "Mono" [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 metadata_combined[, c(sample_id, group_id)]: ! Can't subset columns that don't exist. ✖ Columns sample and condition don't exist. Run rlang::last_trace() to see where the error occurred.

When I checked head(ColData(sce)), I saw the columns 'sample' and 'condition.'

DataFrame with 6 rows and 31 columns orig.ident sample condition nCount_RNA nFeature_RNA species gene_count tscp_count mread_count bc1_well bc2_well

03_01_66__s1 A3 X01.158H Non_infected_vaccina.. 2819 1645 hg38-viral 1645 2819 10871 A3 A1 03_05_02__s1 A3 X01.158H Non_infected_vaccina.. 5237 2421 hg38-viral 2421 5237 19782 A3 A5 03_07_50__s1 A3 X01.158H Non_infected_vaccina.. 5891 2805 hg38-viral 2805 5891 23960 A3 A7 03_07_94__s1 A3 X01.158H Non_infected_vaccina.. 5864 2795 hg38-viral 2795 5864 23805 A3 A7 03_08_34__s1 A3 X01.158H Non_infected_vaccina.. 3295 1875 hg38-viral 1875 3295 12988 A3 A8 03_11_31__s1 A3 X01.158H Non_infected_vaccina.. 6728 2873 hg38-viral 2873 6728 24538 A3 A11 bc3_well bc1_wind bc2_wind bc3_wind percent.mt percent.rps percent.rpl percent.rrna percent.hb nCount_SCT nFeature_SCT SCT_snn_res.1 03_01_66__s1 F6 3 1 66 0.851366 0.319262 0.212841 0 0.0000000 3277 1645 12 03_05_02__s1 A2 3 5 2 13.710139 0.286424 0.133664 0 0.0000000 4288 2420 2 03_07_50__s1 E2 3 7 50 2.359531 0.220676 0.101850 0 0.0000000 4375 2790 5 03_07_94__s1 H10 3 7 94 3.615280 0.306958 0.272851 0 0.0000000 4411 2775 5 03_08_34__s1 C10 3 8 34 4.400607 0.303490 0.364188 0 0.0606980 3420 1875 2 03_11_31__s1 C7 3 11 31 6.019620 0.549941 0.326992 0 0.0297265 4436 2709 2 seurat_clusters SCT_snn_res.0.8 cell.name predicted.celltype.l1.score predicted.celltype.l1 predicted.celltype.l2.score predicted.celltype.l2 03_01_66__s1 10 10 03_01_66__s1 0.963905 NK 0.963905 NK 03_05_02__s1 4 4 03_05_02__s1 0.653232 Mono 0.336875 CD16 Mono 03_07_50__s1 7 7 03_07_50__s1 0.580162 Mono 0.431182 CD16 Mono 03_07_94__s1 7 7 03_07_94__s1 0.778808 Mono 0.778808 CD16 Mono 03_08_34__s1 4 4 03_08_34__s1 0.704229 Mono 0.568204 CD14 Mono 03_11_31__s1 4 4 03_11_31__s1 0.840202 Mono 0.840202 CD14 Mono ident 03_01_66__s1 10 03_05_02__s1 4 03_07_50__s1 7 03_07_94__s1 7 03_08_34__s1 4 03_11_31__s1 4 I wondered if this error could be related to not having enough statistical power, so I set 'p_val_adj = FALSE' and 'logFC_threshold = 0.20', but I still got this error.
lchan8 commented 1 year ago

I got the function to work after making my own version and deleting "rm(sce)". When I moved "rm(sce) to after "metadata_combined = SummarizedExperiment::colData(sce) %>% tibble::as_tibble()", the function did not finish running and I got the following warning:

[1] "Combine all the information in prioritization tables" Warning: cannot open compressed file '/Users/lchan8/.local/share/rstudio/notebooks/D870D146-MultiNicheNet_vignette/1/9A6E152Da699236c/cgn9i4w3xdvgb_t/_rs_rdf_16432566a4a75.rdf', probable reason 'No such file or directory'Error in gzfile(file, "wb") : cannot open the connection

Is this an appropriate fix to my problem, or is there some other underlying problem? Thank you.

browaeysrobin commented 1 year ago

Hi @lchan8

Thank you for pointing this out. There seems to be a bug in the wrapper function. This should be fixed now after reinstalling multinichenetr. Let me know if you still get an error. In that case, also give more details about the analysis you ran (eg from which vignette you started etc).