hdWGCNA
hdWGCNA copied to clipboard
Error in if (!(multi.group.by %in% names([email protected]))) { : argument is of length zero
Describe the bug when I run the code of hdWGCNA, a error can not be solved by myself. Whether I use official website's files or my own data, I get the same error.. Please help me.
Steps to reproduce
Put code in this box
seurat_obj <- readRDS('Zhou_2020_control.rds') p <- DimPlot(seurat_obj, group.by='cell_type', label=TRUE) +
- umap_theme() + ggtitle('Zhou et al Control Cortex') + NoLegend()
p 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 [email protected] 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
- )
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([email protected]))) { : argument is of length zero
seurat_obj <- SetDatExpr(
- seurat_obj,
- group_name = c("INH", "EX"),
- group.by='cell_type'
- ) Error in SetDatExpr(seurat_obj, group_name = c("INH", "EX"), group.by = "cell_type") : object 's_obj' not found
R session info R version 4.3.1 (2023-06-16) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.6 LTS
Hi,
There seems to be a problem with your markdown formatting so it is difficult to read your code, can you please re-enter your code into a properly formatted box? Please consult the markdown style guide.
Closing issue due to inactivity.
Hi,
I think there is some issue with SetDatExpr function.
seurat_obj <- SetDatExpr( seurat_obj, group_name= "celltype", #the name of the group of interest in the group.by column group.by='Treatment', # 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:
Error in SetDatExpr(seurat_obj, group_name = "celltype", group.by = "Treatment", : Some groups in group_name are not found in the seurat_obj: celltype
However, the col exists in the seurat.
[1] "orig.ident" "nCount_RNA" "nFeature_RNA" "Treatment"
[5] "percent.mt" "unintegrated_clusters" "seurat_clusters" "metacell_grouping"
[9] "celltype"
What do you suspect?
Thank you!