smorabit / hdWGCNA

High dimensional weighted gene co-expression network analysis
https://smorabit.github.io/hdWGCNA/
Other
316 stars 31 forks source link

Error in ModuleEigengenes #14

Closed wk-chan closed 1 year ago

wk-chan commented 2 years ago

Hi, firstly thanks a lot for this package it is very helpful.

I've been using it with my dataset following your vignette but got this error when I tried to run ModuleEigengenes()

Error in harmonyObj$moe_correct_ridge_cpp() : addition: incompatible matrix dimensions: 17x17 and 6x6 In addition: Warning message: In theta (1 - exp(-(N_b/(nclust tau))^2)) : longer object length is not a multiple of shorter object length

Can you please advise? Thanks in advance

smorabit commented 1 year ago

Hi,

Can you please provide any more information? What code was used exactly? What version of Seurat? What system are you running (linux, mac, windows)? I have not seen this error before but it looks like it's coming from Harmony. Do you get the same error when running on the tutorial dataset?

wk-chan commented 1 year ago

Thanks for the reply, I followed the steps in the hdWGCNA Basics vignette and it gave the error at the following:

compute all MEs in the full single-cell dataset

seurat_obj <- ModuleEigengenes( seurat_obj, group.by.vars="Sample" )

Here is my sessioninfo

R version 4.1.2 (2021-11-01) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.3 LTS

Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0 LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8 LC_MONETARY=en_GB.UTF-8
[6] LC_MESSAGES=en_GB.UTF-8 LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

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

other attached packages: [1] hdWGCNA_0.1.1.9002 WGCNA_1.71 fastcluster_1.2.3 dynamicTreeCut_1.63-1 patchwork_1.1.1 cowplot_1.1.1
[7] forcats_0.5.1 stringr_1.4.0 dplyr_1.0.9 purrr_0.3.4 readr_2.1.2 tidyr_1.2.0
[13] tibble_3.1.7 ggplot2_3.3.6 tidyverse_1.3.1 sp_1.4-7 SeuratObject_4.1.0 Seurat_4.1.1

loaded via a namespace (and not attached): [1] utf8_1.2.2 reticulate_1.25 tidyselect_1.1.2 RSQLite_2.2.14 AnnotationDbi_1.56.2 htmlwidgets_1.5.4
[7] grid_4.1.2 Rtsne_0.16 munsell_0.5.0 codetools_0.2-18 ica_1.0-2 preprocessCore_1.56.0 [13] future_1.25.0 miniUI_0.1.1.1 withr_2.5.0 spatstat.random_2.2-0 colorspace_2.0-3 progressr_0.10.0
[19] Biobase_2.54.0 knitr_1.39 rstudioapi_0.13 stats4_4.1.2 ROCR_1.0-11 tensor_1.5
[25] listenv_0.8.0 labeling_0.4.2 GenomeInfoDbData_1.2.7 polyclip_1.10-0 bit64_4.0.5 farver_2.1.0
[31] parallelly_1.31.1 vctrs_0.4.1 generics_0.1.2 xfun_0.31 R6_2.5.1 doParallel_1.0.17
[37] GenomeInfoDb_1.30.1 bitops_1.0-7 spatstat.utils_2.3-1 cachem_1.0.6 assertthat_0.2.1 promises_1.2.0.1
[43] scales_1.2.0 nnet_7.3-17 rgeos_0.5-9 gtable_0.3.0 globals_0.15.0 goftest_1.2-3
[49] rlang_1.0.2 splines_4.1.2 lazyeval_0.2.2 impute_1.68.0 spatstat.geom_2.4-0 broom_0.8.0
[55] checkmate_2.1.0 reshape2_1.4.4 abind_1.4-5 modelr_0.1.8 backports_1.4.1 httpuv_1.6.5
[61] Hmisc_4.7-0 tools_4.1.2 ellipsis_0.3.2 spatstat.core_2.4-4 RColorBrewer_1.1-3 BiocGenerics_0.40.0
[67] ggridges_0.5.3 Rcpp_1.0.8.3 plyr_1.8.7 base64enc_0.1-3 zlibbioc_1.40.0 RCurl_1.98-1.6
[73] rpart_4.1.16 deldir_1.0-6 pbapply_1.5-0 S4Vectors_0.32.4 zoo_1.8-10 haven_2.5.0
[79] ggrepel_0.9.1 cluster_2.1.2 fs_1.5.2 magrittr_2.0.3 data.table_1.14.2 scattermore_0.8
[85] lmtest_0.9-40 reprex_2.0.1 RANN_2.6.1 fitdistrplus_1.1-8 matrixStats_0.62.0 hms_1.1.1
[91] mime_0.12 xtable_1.8-4 jpeg_0.1-9 readxl_1.4.0 IRanges_2.28.0 gridExtra_2.3
[97] compiler_4.1.2 KernSmooth_2.23-20 crayon_1.5.1 htmltools_0.5.2 mgcv_1.8-40 later_1.3.0
[103] tzdb_0.3.0 Formula_1.2-4 lubridate_1.8.0 DBI_1.1.2 dbplyr_2.1.1 MASS_7.3-55
[109] Matrix_1.4-0 cli_3.3.0 parallel_4.1.2 igraph_1.3.1 pkgconfig_2.0.3 foreign_0.8-82
[115] plotly_4.10.0 spatstat.sparse_2.1-1 xml2_1.3.3 foreach_1.5.2 XVector_0.34.0 rvest_1.0.2
[121] digest_0.6.29 sctransform_0.3.3 RcppAnnoy_0.0.19 spatstat.data_2.2-0 Biostrings_2.62.0 cellranger_1.1.0
[127] leiden_0.4.2 htmlTable_2.4.0 uwot_0.1.11 shiny_1.7.1 lifecycle_1.0.1 nlme_3.1-155
[133] jsonlite_1.8.0 viridisLite_0.4.0 fansi_1.0.3 pillar_1.7.0 lattice_0.20-45 KEGGREST_1.34.0
[139] fastmap_1.1.0 httr_1.4.3 survival_3.3-1 GO.db_3.14.0 glue_1.6.2 png_0.1-7
[145] iterators_1.0.14 bit_4.0.4 stringi_1.7.6 blob_1.2.3 latticeExtra_0.6-29 memoise_2.0.1
[151] irlba_2.3.5 future.apply_1.9.0

I've tried again with the tutorial dataset and managed to run it fine. I'm not that familiar with Harmony, do you have any advice on this?

smorabit commented 1 year ago

Does your seurat object have a column named "Sample" in the meta.data?

wk-chan commented 1 year ago

Yes it does

smorabit commented 1 year ago

Unfortunately I am not able to replicate this particular issue on any of my datasets. Interesting to me that it's able to run on your configuration when you use the tutorial dataset. You can avoid running harmony by simply not setting anything for the group.by.vars parameter, like this:

seurat_obj <- ModuleEigengenes(seurat_obj)

smorabit commented 1 year ago

Closing this issue since it has gone stale but please re-open if there is any new information. My gut feeling is that it has something to do with your own dataset rather than the hdWGCNA code since the tutorial dataset is not giving an issue.