sqjin / CellChat

R toolkit for inference, visualization and analysis of cell-cell communication from single-cell data
GNU General Public License v3.0
621 stars 142 forks source link

computeCommunProb error #178

Closed JKarmanAbbVie closed 3 years ago

JKarmanAbbVie commented 3 years ago

The issue below started appearing with some of my CellChat objects. Help would be appreciated.

cellchat <- computeCommunProb(cellchat, raw.use = FALSE, population.size = TRUE)

|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=43s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=08m 37s |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=09s
|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=50s
Error in P1 * P2 : non-conformable arrays

sessionInfo()

R version 4.0.3 (2020-10-10) Platform: x86_64-pc-linux-gnu (64-bit) Running under: CentOS Linux 7 (Core)

Matrix products: default BLAS/LAPACK: /usr/lib64/libopenblasp-r0.3.3.so

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=en_US.UTF-8 LC_ADDRESS=en_US.UTF-8
[10] LC_TELEPHONE=en_US.UTF-8 LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=en_US.UTF-8

attached base packages: [1] parallel stats graphics grDevices utils datasets methods base

other attached packages: [1] xlsx_0.6.5 patchwork_1.1.1 CellChat_1.0.0 Biobase_2.50.0 BiocGenerics_0.36.0 [6] ggplot2_3.3.3 igraph_1.2.6 dplyr_1.0.5

loaded via a namespace (and not attached): [1] jsonlite_1.7.2 foreach_1.5.1 network_1.16.1 assertthat_0.2.1
[5] stats4_4.0.3 xlsxjars_0.6.1 ggrepel_0.9.1 globals_0.14.0
[9] pillar_1.6.0 lattice_0.20-41 glue_1.4.2 reticulate_1.18
[13] digest_0.6.27 RColorBrewer_1.1-2 colorspace_2.0-0 cowplot_1.1.1
[17] Matrix_1.3-2 plyr_1.8.6 pkgconfig_2.0.3 GetoptLong_1.0.5
[21] listenv_0.8.0 purrr_0.3.4 xtable_1.8-4 scales_1.1.1
[25] svglite_2.0.0 sna_2.6 ggalluvial_0.12.3 RSpectra_0.16-0
[29] tibble_3.1.0 pkgmaker_0.32.2 generics_0.1.0 IRanges_2.24.1
[33] ellipsis_0.3.1 withr_2.4.1 pbapply_1.4-3 gg.gap_1.3
[37] magrittr_2.0.1 crayon_1.4.1 statnet.common_4.4.1 fansi_0.4.2
[41] future_1.21.0 parallelly_1.24.0 doParallel_1.0.16 NMF_0.23.0
[45] FNN_1.1.3 Cairo_1.5-12.2 tools_4.0.3 registry_0.5-1
[49] GlobalOptions_0.1.2 lifecycle_1.0.0 matrixStats_0.58.0 gridBase_0.4-7
[53] ComplexHeatmap_2.7.9.1000 stringr_1.4.0 S4Vectors_0.28.1 munsell_0.5.0
[57] cluster_2.1.1 rngtools_1.5 irlba_2.3.3 compiler_4.0.3
[61] systemfonts_1.0.1 rlang_0.4.10 grid_4.0.3 iterators_1.0.13
[65] rjson_0.2.20 circlize_0.4.13.1001 gtable_0.3.0 codetools_0.2-18
[69] DBI_1.1.1 reshape2_1.4.4 R6_2.5.0 rle_0.9.2
[73] future.apply_1.7.0 utf8_1.2.1 clue_0.3-58 shape_1.4.5
[77] rJava_0.9-13 stringi_1.5.3 Rcpp_1.0.6 vctrs_0.3.7
[81] png_0.1-7 coda_0.19-4 tidyselect_1.1.0

sqjin commented 3 years ago

Can you check the data matrix object@data.signaling and the cell group information objecct@idents look ok?

JKarmanAbbVie commented 3 years ago

They do look ok to me:

length(cellchat@idents) [1] 5088 dim(cellchat@data.signaling) [1] 1514 5088

They also seem to contain the right type of data and they seem to be the right class (factor and dgCMatrix).

sqjin commented 3 years ago

@JKarmanAbbVie Can you show the unique(cellchat@idents)

JKarmanAbbVie commented 3 years ago

unique(cellchat@idents) [1] IL13_Thelper_0 Tcytotoxic_18 Thelper_4 KRT5_KRT14_keratino_1 Langerhans_20 Tcytotoxic_6 Treg_17 DC_3
[9] DC_7 KRT1_KRT10_keratino_2 KRT1_KRT10_keratino_5 Mast_14 Proliferating_T_22 CD16_DC_10 Melanocytes_9 LAMP3_DC_19
[17] Plasmacells_25 KRT5_KRT14_keratino_8 KRT6A_KRT10_keratino_15 DC_23 KRT5_KRT14_keratino_21 Thelper_26 Smoothmuscle_16
28 Levels: IL13_Thelper_0 KRT5_KRT14_keratino_1 KRT1_KRT10_keratino_2 DC_3 Thelper_4 KRT1_KRT10_keratino_5 Tcytotoxic_6 DC_7 KRT5_KRT14_keratino_8 Melanocytes_9 CD16_DC_10 ... DC_27

sqjin commented 3 years ago

@JKarmanAbbVie You need to drop some unused levels in the factor

identity$group = droplevels(identity$group, exclude = setdiff(levels(identity$group),unique(identity$group)))

JKarmanAbbVie commented 3 years ago

The levels of the identity was indeed the problem. Thank you for your help.