Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'wgcna_modules' slot of Seurat object has no rows #341

Open
dougbarrows opened this issue Dec 4, 2024 · 2 comments
Open

'wgcna_modules' slot of Seurat object has no rows #341

dougbarrows opened this issue Dec 4, 2024 · 2 comments
Labels
question Further information is requested

Comments

@dougbarrows
Copy link

Hello -

I've been going through the tutorial for hdWGCNA and after running the 'ConstructNetwork' function, the Seurat object has no rows in the 'wgcna_modules' (i.e. seu@misc$wgnca_name$wgcna_modules) slot. The Seurat object is from a CITEseq experiment where there are two groups of cells representing different treatment conditions, containing 2500 or 5000 cells. I used the 'SetDatExpr' function to set up networks for each group of cells, and then once I get to the 'ConstructNetwork' function, the group with 5000 cells produces a dataframe in the 'wgcna_modules' slot, while the group with 2500 cells does not.

Does this mean that no modules were found for this group of cells? If so, do you have any general advice as to why this would be the case and potentially which parameters I could modify to see whether interesting modules begin to appear for these data?

I'd be happy to provide any more information about the experiment, Seurat object, or my code if it would be helpful. Thank you so much!

@dougbarrows dougbarrows added the question Further information is requested label Dec 4, 2024
@smorabit
Copy link
Owner

smorabit commented Dec 5, 2024

Hi, it would help me to better understand your problem if you could show the code and any error message that you get.

@dougbarrows
Copy link
Author

Sure thing - below is the code from the hdWGCNA tutorial that I use. The object 'seu' is a seurat object that contains two types of cells, 'control' and 'KO', which is indicated by the 'control_or_KO' metadata column of the Seurat object. Here I am trying to construct the network for just the control cells (there are about 2500 of these cells in the object). After running the ConstructNetwork function, the seu@misc$control$wgcna_modules slot has a dataframe with no rows, and then when I run the ModuleEigengenes function, I get the following error: Error in checkSets(MEs, checkStructure = TRUE, useSets = useSets) : No data given. I assume this is because there are no modules in the object.

When I do this using the same object, but use the KO cells (so change the 'group_name' argument in the SetDatExpr and the 'wgcna_name' argument in all functions to 'KO'), I get a dataframe in the seu@misc$KO$wgcna_modules slot and don't get the error in the ModuleEigengenes function.

This is likely something to do with the data I am providing (control vs KO), but if you have any advice as to why this occurs or how I can optimize the workflow, I'd appreciate it. Also happy to provide more information if its helpful. Thank you!

seu <- SetupForWGCNA(
      seu,
      gene_select = "fraction", 
      fraction = 0.05, 
      wgcna_name = "control"  
    )

seu <- MetacellsByGroups(
      seu = seu,
      group.by = c("control_or_KO", "HTO_maxID"), # specify the columns in [email protected] to group by
      reduction = "pca", 
      k = 25, # nearest-neighbors parameter
      max_shared = 10, 
      ident.group = 'control_or_KO',
      wgcna_name = "control" 
    )
    
seu <- NormalizeMetacells(seu, wgcna_name = "control")

seu <- SetDatExpr(
      seu,
      group_name = "control", 
      group.by='control_or_KO', 
      assay = 'RNA', # using RNA assay
      layer = 'data', # using normalized data
      wgcna_name = "control" 
    )
    
   
seu <- TestSoftPowers(
      seu,
      networkType = 'signed', 
      wgcna_name = condition 
    )

seu <- ConstructNetwork(
      seu,
      tom_outdir = out_dir,
      tom_name = "control", 
      wgcna_name = "control" 
    )
  
seu <- ModuleEigengenes(
      seu,
      group.by.vars=NULL,
      wgcna_name = "control" 
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants