smorabit/hdWGCNA

NormalizeMetacells

Closed this issue · 8 comments

zznx commented

Hi, Thank you to your team!

Describe the bug
seurat_obj <- NormalizeMetacells(seurat_obj)
| | 0%Error in seq_len(length.out = ncells) :
argument must be coercible to non-negative integer
In addition: Warning message:
In seq_len(length.out = ncells) :
first element used of 'length.out' argument

https://smorabit.github.io/hdWGCNA/articles/basic_tutorial.html

R session info
sessionInfo()
R version 4.4.0 (2024-04-24)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 22.04.4 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0

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

time zone: Etc/UTC
tzcode source: system (glibc)

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

other attached packages:
[1] hdWGCNA_0.3.03 igraph_2.0.3 ggrepel_0.9.5
[4] harmony_1.2.0 Rcpp_1.0.12 WGCNA_1.72-5
[7] fastcluster_1.2.6 dynamicTreeCut_1.63-1 patchwork_1.2.0
[10] cowplot_1.1.3 lubridate_1.9.3 forcats_1.0.0
[13] stringr_1.5.1 dplyr_1.1.4 purrr_1.0.2
[16] readr_2.1.5 tidyr_1.3.1 tibble_3.2.1
[19] ggplot2_3.5.1 tidyverse_2.0.0 Seurat_5.1.0
[22] SeuratObject_5.0.2 sp_2.1-4

loaded via a namespace (and not attached):
[1] RcppAnnoy_0.0.22 splines_4.4.0 later_1.3.2
[4] polyclip_1.10-6 preprocessCore_1.66.0 rpart_4.1.23
[7] fastDummies_1.7.3 lifecycle_1.0.4 doParallel_1.0.17
[10] globals_0.16.3 lattice_0.22-6 MASS_7.3-60.2
[13] backports_1.5.0 magrittr_2.0.3 rmarkdown_2.27
[16] Hmisc_5.1-3 plotly_4.10.4 httpuv_1.6.15
[19] sctransform_0.4.1 spam_2.10-0 spatstat.sparse_3.0-3
[22] reticulate_1.37.0 pbapply_1.7-2 DBI_1.2.3
[25] RColorBrewer_1.1-3 abind_1.4-5 zlibbioc_1.50.0
[28] Rtsne_0.17 BiocGenerics_0.50.0 nnet_7.3-19
[31] GenomeInfoDbData_1.2.12 IRanges_2.38.0 S4Vectors_0.42.0
[34] irlba_2.3.5.1 listenv_0.9.1 spatstat.utils_3.0-5
[37] goftest_1.2-3 RSpectra_0.16-1 spatstat.random_3.2-3
[40] fitdistrplus_1.1-11 parallelly_1.37.1 leiden_0.4.3.1
[43] codetools_0.2-20 tidyselect_1.2.1 UCSC.utils_1.0.0
[46] tester_0.2.0 matrixStats_1.3.0 stats4_4.4.0
[49] base64enc_0.1-3 spatstat.explore_3.2-7 jsonlite_1.8.8
[52] progressr_0.14.0 Formula_1.2-5 ggridges_0.5.6
[55] survival_3.5-8 iterators_1.0.14 foreach_1.5.2
[58] tools_4.4.0 ica_1.0-3 glue_1.7.0
[61] gridExtra_2.3 xfun_0.45 GenomeInfoDb_1.40.1
[64] withr_3.0.0 fastmap_1.2.0 fansi_1.0.6
[67] digest_0.6.35 timechange_0.3.0 R6_2.5.1
[70] mime_0.12 colorspace_2.1-0 scattermore_1.2
[73] GO.db_3.19.1 tensor_1.5 spatstat.data_3.0-4
[76] RSQLite_2.3.7 utf8_1.2.4 generics_0.1.3
[79] data.table_1.15.4 httr_1.4.7 htmlwidgets_1.6.4
[82] uwot_0.2.2 pkgconfig_2.0.3 gtable_0.3.5
[85] blob_1.2.4 impute_1.78.0 lmtest_0.9-40
[88] XVector_0.44.0 htmltools_0.5.8.1 dotCall64_1.1-1
[91] scales_1.3.0 Biobase_2.64.0 png_0.1-8
[94] knitr_1.47 rstudioapi_0.16.0 tzdb_0.4.0
[97] reshape2_1.4.4 checkmate_2.3.1 nlme_3.1-164
[100] proxy_0.4-27 zoo_1.8-12 cachem_1.1.0
[103] KernSmooth_2.23-22 parallel_4.4.0 miniUI_0.1.1.1
[106] foreign_0.8-86 AnnotationDbi_1.66.0 pillar_1.9.0
[109] grid_4.4.0 vctrs_0.6.5 RANN_2.6.1
[112] promises_1.3.0 xtable_1.8-4 cluster_2.1.6
[115] htmlTable_2.4.2 evaluate_0.24.0 cli_3.6.2
[118] compiler_4.4.0 rlang_1.1.4 crayon_1.5.2
[121] future.apply_1.11.2 plyr_1.8.9 stringi_1.8.4
[124] viridisLite_0.4.2 deldir_2.0-4 munsell_0.5.1
[127] Biostrings_2.72.1 lazyeval_0.2.2 spatstat.geom_3.2-9
[130] Matrix_1.7-0 RcppHNSW_0.6.0 hms_1.1.3
[133] bit64_4.0.5 future_1.33.2 KEGGREST_1.44.0
[136] shiny_1.8.1.1 ROCR_1.0-11 memoise_2.0.1
[139] bit_4.0.5

Screenshots
image

zznx commented

Input data: Zhou_2020_control.rds

zznx commented

The same problem occurs with Zhou_2020.rds data

Hi,

Can you please include any other hdWGCNA code that you ran?

zznx commented

Same code as in the tutorial

library(Seurat)

# plotting and data science packages
library(tidyverse)
library(cowplot)
library(patchwork)

# co-expression network analysis packages:
library(WGCNA)
library(hdWGCNA)

# using the cowplot theme for ggplot
theme_set(theme_cowplot())

# set random seed for reproducibility
set.seed(12345)

# optionally enable multithreading
enableWGCNAThreads(nThreads = 8)

# load the Zhou et al snRNA-seq dataset
seurat_obj <- readRDS('Zhou_2020.rds')

seurat_obj <- SetupForWGCNA(
  seurat_obj,
  gene_select = "fraction", # the gene selection approach
  fraction = 0.05, # fraction of cells that a gene needs to be expressed in order to be included
  wgcna_name = "tutorial" # the name of the hdWGCNA experiment
)

# normalize metacell expression matrix:
seurat_obj <- NormalizeMetacells(seurat_obj)

It looks like you forgot to run MetacellsByGroups?

zznx commented

Yeah, I forgot to run MetacellsByGroups

I have a question for you, without grouping the data, would it be better to aggregate the data based on knn and use seurat's variable genes?

zznx commented

How to skip groups for analysis?

Please open a separate issue for unrelated questions.