smorabit / hdWGCNA

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

SetDatExpr: Error in if (!(multi.group.by %in% names(seurat_obj@meta.data))) { : argument is of length zero #197

Closed 18876960318 closed 3 months ago

18876960318 commented 4 months ago

Hi,I really appreciated your contribution to such great project,but I ran into a bit of an error when I followed the instructions to run the tutorial data, even though I had the same problem with my own data.

single-cell analysis package

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) Allowing parallel execution with up to 8 working processes.

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
  • )

construct metacells in each group

seurat_obj <- MetacellsByGroups(

  • seurat_obj = seurat_obj,
  • group.by = c("cell_type", "Sample"), # specify the columns in seurat_obj@meta.data to group by
  • reduction = 'harmony', # select the dimensionality reduction to perform KNN on
  • k = 25, # nearest-neighbors parameter
  • max_shared = 10, # maximum number of shared cells between two metacells
  • ident.group = 'cell_type' # set the Idents of the metacell seurat object
  • ) Warning message: In MetacellsByGroups(seurat_obj = seurat_obj, group.by = c("cell_type", : Removing the following groups that did not meet min_cells: ASC#C4, MG#C2, MG#C3, MG#C4, ODC#C4, OPC#C12, OPC#C4, OPC#C9

    normalize metacell expression matrix:

    seurat_obj <- NormalizeMetacells(seurat_obj) Performing log-normalization 0% 10 20 30 40 50 60 70 80 90 100% [----|----|----|----|----|----|----|----|----|----| **| seurat_obj <- SetDatExpr(

  • seurat_obj,
  • group_name = "INH", # the name of the group of interest in the group.by column
  • group.by='cell_type', # the metadata column containing the cell type info. This same column should have also been used in MetacellsByGroups
  • assay = 'RNA', # using RNA assay
  • slot = 'data' # using normalized data
  • ) Error in if (!(multi.group.by %in% names(seurat_obj@meta.data))) { : argument is of length zero

I would really appreciate it if you have time to help with the problem

smorabit commented 3 months ago

Hi,

I am unfortunately not able to reproduce your error on the tutorial dataset or any other dataset. Are you using the most up to date version of hdWGCNA?

18876960318 commented 3 months ago

Hi, I have successfully run the code with the newest hd WGCNA. Thanks for your attention.

获取 Outlook for iOShttps://aka.ms/o0ukef


发件人: Sam Morabito @.> 发送时间: Tuesday, January 30, 2024 7:25:05 AM 收件人: smorabit/hdWGCNA @.> 抄送: 彭山森 @.>; Author @.> 主题: Re: [smorabit/hdWGCNA] SetDatExpr: Error in if (!(multi.group.by %in% @.***))) { : argument is of length zero (Issue #197)

Hi,

I am unfortunately not able to reproduce your error on the tutorial dataset or any other dataset. Are you using the most up to date version of hdWGCNA?

― Reply to this email directly, view it on GitHubhttps://github.com/smorabit/hdWGCNA/issues/197#issuecomment-1915751481, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BDI6ZXOD6MQNDFHE7OPFSFDYRAVVDAVCNFSM6AAAAABBQGQFP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJVG42TCNBYGE. You are receiving this because you authored the thread.Message ID: @.***>