smorabit / hdWGCNA

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

error with the SetDatExpr function #64

Closed zftu closed 1 year ago

zftu commented 1 year ago

Hi Sam, I am very interested in your hdWGCNA package(v0.2.1). However. I got this error for the SetDatExpr function: "Error in Seurat::GetAssayData(s_obj, assay = assay, slot = slot)[genes_use, : invalid or not-yet-implemented 'Matrix' subsetting". Here is my code:

seurat_obj <- SetupForWGCNA(pbmc.integrated, features = list(rownames(pbmc.integrated)), wgcna_name = "test") seurat_obj <- MetacellsByGroups(seurat_obj,group.by = c("clusters"), ident.group = 'clusters',assay = 'RNA',slot = "counts", k = 25, max_shared = 10) seurat_obj <- NormalizeMetacells(seurat_obj) ## they run successfully!

seurat_obj <- SetDatExpr(seurat_obj,group_name = "cluster1", use_metacells = TRUE,group.by = "clusters", assay = "RNA",slot = "data") ## it failed with the wrong message above!

Do you have any idea what was happened?

Thanks, Tutu

smorabit commented 1 year ago

Hi Tutu,

Thanks for your interest in hdWGCNA. Could you please run sessionInfo() and show the output?

zftu commented 1 year ago

Thanks for your reply! here is my sessionInfo output (I ran it in jupyter notebook, but it also gave me the same error when i ran it in Rstudio (same server, different conda environment)).

R version 4.2.1 (2022-06-23) Platform: x86_64-conda-linux-gnu (64-bit) Running under: Ubuntu 16.04.5 LTS

Matrix products: default BLAS/LAPACK: /mnt/Storage1/home/biyan/software/Anaconda3/envs/R4.2.1/lib/libopenblasp-r0.3.21.so

locale: [1] LC_CTYPE=zh_CN.UTF-8 LC_NUMERIC=C
[3] LC_TIME=zh_CN.UTF-8 LC_COLLATE=zh_CN.UTF-8
[5] LC_MONETARY=zh_CN.UTF-8 LC_MESSAGES=zh_CN.UTF-8
[7] LC_PAPER=zh_CN.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C

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

other attached packages: [1] patchwork_1.1.2 cowplot_1.1.1 forcats_0.5.2
[4] stringr_1.4.1 dplyr_1.0.10 purrr_0.3.5
[7] readr_2.1.3 tidyr_1.2.1 tibble_3.1.8
[10] ggplot2_3.3.6 tidyverse_1.3.2 WGCNA_1.71
[13] fastcluster_1.2.3 dynamicTreeCut_1.63-1 hdWGCNA_0.2.01
[16] sp_1.5-0 SeuratObject_4.1.1 Seurat_4.1.1

loaded via a namespace (and not attached): [1] utf8_1.2.2 reticulate_1.26 tidyselect_1.2.0
[4] RSQLite_2.2.17 AnnotationDbi_1.58.0 htmlwidgets_1.5.4
[7] grid_4.2.1 Rtsne_0.16 munsell_0.5.0
[10] codetools_0.2-18 ica_1.0-3 preprocessCore_1.58.0 [13] interp_1.1-3 pbdZMQ_0.3-7 future_1.28.0
[16] miniUI_0.1.1.1 withr_2.5.0 spatstat.random_2.2-0 [19] colorspace_2.0-3 progressr_0.11.0 Biobase_2.56.0
[22] knitr_1.40 uuid_1.1-0 rstudioapi_0.14
[25] stats4_4.2.1 ROCR_1.0-11 tensor_1.5
[28] listenv_0.8.0 repr_1.1.4 GenomeInfoDbData_1.2.8 [31] polyclip_1.10-0 bit64_4.0.5 parallelly_1.32.1
[34] vctrs_0.5.0 generics_0.1.3 xfun_0.33
[37] R6_2.5.1 doParallel_1.0.17 GenomeInfoDb_1.32.4
[40] bitops_1.0-7 spatstat.utils_2.3-1 cachem_1.0.6
[43] assertthat_0.2.1 promises_1.2.0.1 scales_1.2.1
[46] nnet_7.3-18 googlesheets4_1.0.1 rgeos_0.5-9
[49] gtable_0.3.1 globals_0.16.1 goftest_1.2-3
[52] rlang_1.0.6 splines_4.2.1 lazyeval_0.2.2
[55] gargle_1.2.1 impute_1.70.0 spatstat.geom_2.4-0
[58] broom_1.0.1 checkmate_2.1.0 modelr_0.1.9
[61] reshape2_1.4.4 abind_1.4-5 backports_1.4.1
[64] httpuv_1.6.6 Hmisc_4.7-1 tools_4.2.1
[67] ellipsis_0.3.2 spatstat.core_2.4-4 RColorBrewer_1.1-3
[70] BiocGenerics_0.42.0 ggridges_0.5.3 Rcpp_1.0.9
[73] plyr_1.8.7 base64enc_0.1-3 zlibbioc_1.42.0
[76] RCurl_1.98-1.8 rpart_4.1.16 deldir_1.0-6
[79] pbapply_1.5-0 S4Vectors_0.34.0 zoo_1.8-11
[82] haven_2.5.1 ggrepel_0.9.1 cluster_2.1.4
[85] fs_1.5.2 magrittr_2.0.3 data.table_1.14.2
[88] scattermore_0.8 reprex_2.0.2 lmtest_0.9-40
[91] RANN_2.6.1 googledrive_2.0.0 fitdistrplus_1.1-8
[94] matrixStats_0.62.0 hms_1.1.2 mime_0.12
[97] evaluate_0.16 xtable_1.8-4 jpeg_0.1-9
[100] readxl_1.4.1 IRanges_2.30.1 gridExtra_2.3
[103] compiler_4.2.1 KernSmooth_2.23-20 crayon_1.5.1
[106] htmltools_0.5.3 tzdb_0.3.0 mgcv_1.8-40
[109] later_1.3.0 Formula_1.2-4 lubridate_1.8.0
[112] DBI_1.1.3 dbplyr_2.2.1 MASS_7.3-58.1
[115] Matrix_1.5-1 cli_3.4.1 parallel_4.2.1
[118] igraph_1.3.5 pkgconfig_2.0.3 foreign_0.8-83
[121] IRdisplay_1.1 plotly_4.10.0 spatstat.sparse_2.1-1 [124] xml2_1.3.3 foreach_1.5.2 XVector_0.36.0
[127] rvest_1.0.3 digest_0.6.30 sctransform_0.3.4
[130] RcppAnnoy_0.0.19 spatstat.data_2.2-0 Biostrings_2.64.1
[133] cellranger_1.1.0 leiden_0.4.3 htmlTable_2.4.1
[136] uwot_0.1.14 shiny_1.7.2 lifecycle_1.0.3
[139] nlme_3.1-159 jsonlite_1.8.2 viridisLite_0.4.1
[142] fansi_1.0.3 pillar_1.8.1 lattice_0.20-45
[145] KEGGREST_1.36.3 fastmap_1.1.0 httr_1.4.4
[148] survival_3.4-0 GO.db_3.15.0 glue_1.6.2
[151] png_0.1-7 iterators_1.0.14 bit_4.0.4
[154] stringi_1.7.8 blob_1.2.3 latticeExtra_0.6-30
[157] memoise_2.0.1 IRkernel_1.3 irlba_2.3.5
[160] future.apply_1.9.1

zftu commented 1 year ago

Also when I load the tidyverse packages, it give me the conflicts: ── Attaching packages ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.3.2 ── ✔ ggplot2 3.3.6 ✔ purrr 0.3.5 ✔ tibble 3.1.8 ✔ dplyr 1.0.10 ✔ tidyr 1.2.1 ✔ stringr 1.4.1 ✔ readr 2.1.3 ✔ forcats 0.5.2 ── Conflicts ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ── ✖ dplyr::filter() masks stats::filter() ✖ dplyr::lag() masks stats::lag()

Thanks again for your time!

smorabit commented 1 year ago

Are you able to reproduce the error on the tutorial dataset, or is this just occurring on your own dataset?

zftu commented 1 year ago

em.....it is ok on the tutorial dataset, so strange...

zftu commented 1 year ago

Hi Sam, I compared my seurat object with the tutorial dataset carefully, and the difference I found between them is the active assay in my object is "integrated",but not "RNA". By seting DefaultAssay(pbmc.integrated) = "RNA", I fixed this problem. Thanks!