CellChat
CellChat copied to clipboard
Error in netVisual_embeddingPairwise() - arguments imply differing number of rows
Hello, and thank you for an excellent package - I've gotten a lot of good use out of it so far.
I have a merged CellChat object built from four separate conditions that I'm trying to do comparative analysis on, but I'm running into an error when I run netVisual_embeddingPairwise(). I saw some discussion of this issue secondary to another in #174, but I didn't see an answer there.
> unwounded.cellchat %<>% computeNetSimilarityPairwise(type = "functional") %>%
+ netEmbedding(type = "functional") %>%
+ netClustering(type = "functional")
Compute signaling network similarity for datasets 1 2 3 4
Manifold learning of the signaling networks for datasets 1 2 3 4
Classification learning of the signaling networks for datasets 1 2 3 4
> # visualize in 2D space
> (gg <- netVisual_embeddingPairwise(
+ unwounded.cellchat, type = "functional", label.size = 3.5
+ ))
2D visualization of signaling networks from datasets 1 2 3 4
Error in data.frame(x = Y[, 1], y = Y[, 2], Commun.Prob. = prob_sum/max(prob_sum), :
arguments imply differing number of rows: 241, 243
Examining the netP slot, I found the functional slot under netP had a matrix slot with 243 x 243, but the dr and group variables only had 241. I assume this disconnect between the matrix slot and the dr and group slots is where the problem stems from, but I'm not sure how to fix this. I ran the same workflow on the structural similarity, but did not encounter this issue there, nor did I encounter this issue working with the comparative analysis vignette.
> unwounded.cellchat %<>% computeNetSimilarityPairwise(type = "structural") %>%
+ netEmbedding(type = "structural") %>%
+ netClustering(type = "structural")
Compute signaling network similarity for datasets 1 2 3 4
Manifold learning of the signaling networks for datasets 1 2 3 4
Classification learning of the signaling networks for datasets 1 2 3 4
> # visualize in 2D space
> (gg1 <- netVisual_embeddingPairwise(unwounded.cellchat,
+ type = "structural",
+ label.size = 3.5))
2D visualization of signaling networks from datasets 1 2 3 4
Here's the session info I'm working with:
> sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Matrix products: default
BLAS/LAPACK: /usr/local/intel/compilers_and_libraries_2020.2.254/linux/mkl/lib/intel64_lin/libmkl_rt.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8
[8] LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats4 stats graphics grDevices utils datasets methods base
other attached packages:
[1] BiocParallel_1.30.3 reticulate_1.25 ggalluvial_0.12.3 NMF_0.24.0 cluster_2.1.3 rngtools_1.5.2
[7] pkgmaker_0.32.2 registry_0.5-1 patchwork_1.1.1 pheatmap_1.0.12 RColorBrewer_1.1-3 scater_1.24.0
[13] scuttle_1.6.2 condiments_1.4.0 tradeSeq_1.10.0 slingshot_2.4.0 TrajectoryUtils_1.4.0 princurve_2.1.6
[19] enrichplot_1.16.1 org.Mm.eg.db_3.15.0 AnnotationDbi_1.58.0 clusterProfiler_4.4.2 enrichR_3.0 clustree_0.4.4
[25] ggraph_2.0.5 scCustomize_0.7.0 Scillus_0.5.0 harmony_0.1.0 Rcpp_1.0.8.3 DoubletFinder_2.0.3
[31] DropletUtils_1.16.0 SingleCellExperiment_1.18.0 SummarizedExperiment_1.26.1 GenomicRanges_1.48.0 GenomeInfoDb_1.32.2 IRanges_2.30.0
[37] S4Vectors_0.34.0 MatrixGenerics_1.8.0 matrixStats_0.62.0 openxlsx_4.2.5 cowplot_1.1.1 magrittr_2.0.3
[43] forcats_0.5.1 stringr_1.4.0 purrr_0.3.4 readr_2.1.2 tidyr_1.2.0 tibble_3.1.7
[49] tidyverse_1.3.1 Matrix_1.4-1 SoupX_1.6.1 sp_1.5-0 SeuratObject_4.1.0 Seurat_4.1.1
[55] CellChat_1.4.0 synchronicity_1.3.5 bigmemory_4.6.1 Biobase_2.56.0 BiocGenerics_0.42.0 ggplot2_3.3.6
[61] igraph_1.3.2 dplyr_1.0.9
loaded via a namespace (and not attached):
[1] Ecume_0.9.1 spatstat.linnet_2.3-2 graphlayouts_0.8.0 pbapply_1.5-0 lattice_0.20-45 haven_2.5.0 vctrs_0.4.1
[8] mgcv_1.8-40 blob_1.2.3 survival_3.3-1 prodlim_2019.11.13 spatstat.data_2.2-0 later_1.3.0 DBI_1.1.2
[15] R.utils_2.11.0 uwot_0.1.11 dqrng_0.3.0 zlibbioc_1.42.0 rgeos_0.5-9 htmlwidgets_1.5.4 GlobalOptions_0.1.2
[22] future_1.26.1 formattable_0.2.1 leiden_0.4.2 parallel_4.2.0 irlba_2.3.5 tidygraph_1.2.1 KernSmooth_2.23-20
[29] promises_1.2.0.1 DelayedArray_0.22.0 limma_3.52.1 magick_2.7.3 RSpectra_0.16-1 fs_1.5.2 textshaping_0.3.6
[36] fastmatch_1.1-3 digest_0.6.29 png_0.1-7 sctransform_0.3.3 scatterpie_0.1.7 DOSE_3.22.0 here_1.0.1
[43] pkgconfig_2.0.3 GO.db_3.15.0 dittoSeq_1.9.1 gridBase_0.4-7 spatstat.random_2.2-0 DelayedMatrixStats_1.18.0 gower_1.0.0
[50] ggbeeswarm_0.6.0 iterators_1.0.14 statnet.common_4.6.0 network_1.17.2 circlize_0.4.15 beeswarm_0.4.0 GetoptLong_1.0.5
[57] xfun_0.31 zoo_1.8-10 tidyselect_1.1.2 reshape2_1.4.4 kernlab_0.9-30 ica_1.0-2 viridisLite_0.4.0
[64] rlang_1.0.3 spatstat_2.3-4 glue_1.6.2 modelr_0.1.8 lava_1.6.10 colorway_0.2.0 ggsignif_0.6.3
[71] recipes_0.2.0 labeling_0.4.2 httpuv_1.6.5 class_7.3-20 BiocNeighbors_1.14.0 DO.db_2.9 jsonlite_1.8.0
[78] XVector_0.36.0 bit_4.0.4 mime_0.12 systemfonts_1.0.4 gridExtra_2.3 stringi_1.7.6 spatstat.sparse_2.1-1
[85] scattermore_0.8 yulab.utils_0.0.4 hardhat_1.1.0 bitops_1.0-7 cli_3.3.0 rhdf5filters_1.8.0 RSQLite_2.2.14
[92] bigmemory.sri_0.1.3 data.table_1.14.2 rstudioapi_0.13 nlme_3.1-157 qvalue_2.28.0 ggprism_1.0.3.9000 locfit_1.5-9.5
[99] janitor_2.1.0 listenv_0.8.0 miniUI_0.1.1.1 gridGraphics_0.5-1 R.oo_1.24.0 dbplyr_2.2.0 readxl_1.4.0
[106] lifecycle_1.0.1 timeDate_3043.102 transport_0.12-2 distinct_1.8.0 munsell_0.5.0 cellranger_1.1.0 R.methodsS3_1.8.1
[113] codetools_0.2-18 coda_0.19-4 vipor_0.4.5 lmtest_0.9-40 xtable_1.8-4 ROCR_1.0-11 abind_1.4-5
[120] farver_2.1.0 FNN_1.1.3.1 parallelly_1.32.0 RANN_2.6.1 aplot_0.1.6 ggtree_3.4.0 RcppAnnoy_0.0.19
[127] goftest_1.2-3 future.apply_1.9.0 tidytree_0.3.9 ellipsis_0.3.2 lubridate_1.8.0 ggridges_0.5.3 reprex_2.0.1
[134] fgsea_1.22.0 paletteer_1.4.0 spatstat.utils_2.3-1 htmltools_0.5.2 utf8_1.2.2 plotly_4.10.0 ModelMetrics_1.2.2.2
[141] e1071_1.7-11 ggpubr_0.4.0 withr_2.5.0 fitdistrplus_1.1-8 bit64_4.0.5 doRNG_1.8.2 foreach_1.5.2
[148] Biostrings_2.64.0 spatstat.core_2.4-4 progressr_0.10.1 GOSemSim_2.22.0 ragg_1.2.2 rsvd_1.0.5 ScaledMatrix_1.4.0
[155] memoise_2.0.1 evaluate_0.15 tzdb_0.3.0 caret_6.0-92 curl_4.3.2 fansi_1.0.3 tensor_1.5
[162] edgeR_3.38.1 cachem_1.0.6 deldir_1.0-6 rjson_0.2.21 rstatix_0.7.0 ggrepel_0.9.1 clue_0.3-61
[169] rprojroot_2.0.3 tools_4.2.0 RCurl_1.98-1.7 proxy_0.4-27 car_3.1-0 ape_5.6-2 ggplotify_0.1.0
[176] xml2_1.3.3 httr_1.4.3 assertthat_0.2.1 rmarkdown_2.14 globals_0.15.1 R6_2.5.1 Rhdf5lib_1.18.2
[183] nnet_7.3-17 KEGGREST_1.36.0 treeio_1.20.0 shape_1.4.6 beachmat_2.12.0 rematch2_2.1.2 HDF5Array_1.24.1
[190] sna_2.7 BiocSingular_1.12.0 rhdf5_2.40.0 splines_4.2.0 snakecase_0.11.0 carData_3.0-5 ggfun_0.0.6
[197] colorspace_2.0-3 generics_0.1.2 pillar_1.7.0 tweenr_1.0.2 uuid_1.1-0 GenomeInfoDbData_1.2.8 plyr_1.8.7
[204] gtable_0.3.0 rvest_1.0.2 zip_2.2.0 knitr_1.39 ComplexHeatmap_2.12.0 shadowtext_0.1.2 fastmap_1.1.0
[211] Cairo_1.5-15 doParallel_1.0.17 broom_0.8.0 scales_1.2.0 backports_1.4.1 ipred_0.9-13 hms_1.1.1
[218] ggforce_0.3.3 Rtsne_0.16 shiny_1.7.1 polyclip_1.10-0 grid_4.2.0 lazyeval_0.2.2 crayon_1.5.1
[225] MASS_7.3-57 downloader_0.4 pROC_1.18.0 sparseMatrixStats_1.8.0 viridis_0.6.2 svglite_2.1.0 rpart_4.1.16
[232] compiler_4.2.0 spatstat.geom_2.4-0
I realized it may be of use to provide the traceback() report, so here's that:
> traceback()
3: stop(gettextf("arguments imply differing number of rows: %s",
paste(unique(nrows), collapse = ", ")), domain = NA)
2: data.frame(x = Y[, 1], y = Y[, 2], Commun.Prob. = prob_sum/max(prob_sum),
labels = as.character(labels), clusters = as.factor(clusters),
group = factor(group, levels = unique(group)))
1: netVisual_embeddingPairwise(unwounded.cellchat, type = "functional",
label.size = 3.5)
I am having the same issue
Same issue here as well
@siefejo1 Can you share me a data that can replicate this error?
I can share it with you privately. What's the best way to reach you?
@siefejo1 Either dropbox/google drive/OneDrive is fine. My gmail is [email protected]
Sorry, but apparently I am unable to provide the data. I did figure out the issue though. On line 26 of the netVisual_embeddingPairwise() function:
pathway.remove <- sub("--.*", "", pathway.remove)
removes the dataset annotation from the pathways, but then line 32:
pathway.remove.idx <- which(paste0(dimnames(probi)[[3]],"--",object.names[i]) %in% pathway.remove)
expects that format. Commenting out line 26 solved the problem for me
Same issue here as well
Is there any update regarding this issue?
netVisual_embeddingPairwise(cellchat, type = "functional", label.size = 3.5) 2D visualization of signaling networks from datasets 1 2 Error in data.frame(x = Y[, 1], y = Y[, 2], Commun.Prob. = prob_sum/max(prob_sum), : arguments imply differing number of rows: 76, 78 traceback() 3: stop(gettextf("arguments imply differing number of rows: %s", paste(unique(nrows), collapse = ", ")), domain = NA) 2: data.frame(x = Y[, 1], y = Y[, 2], Commun.Prob. = prob_sum/max(prob_sum), labels = as.character(labels), clusters = as.factor(clusters), group = factor(group, levels = unique(group))) 1: netVisual_embeddingPairwise(cellchat, type = "functional", label.size = 3.5)
@wajm The error should be fixed now. please reinstall it .
@wajm The error should be fixed now. please reinstall it .
Thanks for your great Packages, but I still got the same error even after installing Version 1.6.1.
netVisual_embeddingPairwise()
Error message :
data.frame(x = Y[, 1], y = Y[, 2], Commun.Prob. = prob_sum/max(prob_sum)