-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
Important note to the person writing this issue
GitHub issues use the Markdown text language. If you are not familiar with Markdown, we strongly recommend consulting the Markdown style guide before writing your issue. It is easier for us to help you if your issue is properly formatted!
Describe the bug
When following the official documentation of hdWGCNA (using the recommended example data and code workflow), the ModuleEigengenes function throws an error when running the following code snippet:
packageVersion("hdWGCNA")
[1] ‘0.3.0’
seurat_obj <- ModuleEigengenes(
seurat_obj,
group.by.vars = "Sample"
)
Error in !CheckWGCNAName(seurat_obj, wgcna_name) : invalid argument type
Steps to reproduce
using the recommended example data and code workflow
# Put code in this box
setwd("~/Desktop/RStudio/单细胞")
# 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)
# load the Zhou et al snRNA-seq dataset
seurat_obj <- readRDS('示例数据/hdWGCNA/Zhou_2020_control.rds')
seurat_obj <- SeuratObject::UpdateSeuratObject(seurat_obj)
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 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
)
# normalize metacell expression matrix:
seurat_obj <- NormalizeMetacells(seurat_obj)
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
layer = 'data' # using normalized data
)
# Test different soft powers:
seurat_obj <- TestSoftPowers(
seurat_obj,
networkType = 'signed' # you can also use "unsigned" or "signed hybrid"
)
# plot the results:
plot_list <- PlotSoftPowers(seurat_obj)
# assemble with patchwork
wrap_plots(plot_list, ncol=2)
power_table <- GetPowerTable(seurat_obj)
head(power_table)
# construct co-expression network:
seurat_obj <- ConstructNetwork(
seurat_obj,
tom_name = 'INH' # name of the topoligical overlap matrix written to disk
)
PlotDendrogram(seurat_obj, main='INH hdWGCNA Dendrogram')
TOM <- GetTOM(seurat_obj)
# need to run ScaleData first or else harmony throws an error:
#seurat_obj <- ScaleData(seurat_obj, features=VariableFeatures(seurat_obj))
# compute all MEs in the full single-cell dataset
seurat_obj <- ModuleEigengenes(
seurat_obj,
group.by.vars="Sample"
)
**R session info**
> packageVersion("hdWGCNA")
[1] ‘0.3.0’
> R.version
_
platform aarch64-apple-darwin20
arch aarch64
os darwin20
system aarch64, darwin20
status
major 4
minor 5.1
year 2025
month 06
day 13
svn rev 88306
language R
version.string R version 4.5.1 (2025-06-13)
nickname Great Square Root
**Screenshots**
If applicable, add screenshots to help explain your problem.
**More than one problem?**
hdWGCNA has been updated to version 0.4 in the documentation, but the installable R package remains at version 0.3. Could you please release the new version of the R package?
Metadata
Metadata
Assignees
Labels
No labels