smorabit / hdWGCNA

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

Question about genes with zero standard deviation in ConstructNetwork() #141

Closed sahanda66 closed 9 months ago

sahanda66 commented 9 months ago

Hi, I am trying to do co-expression analysis of single cell RNA-seq data with hdWGCNA. When I run ConstructNetwork() I get the following error.

Error in blockwiseIndividualTOMs(multiExpr = multiExpr, checkMissingData = checkMissingData,  : 
  Standard deviation of some genes is zero.

I select different cell types and even select multiple cell types in SetDatExpr() to avoid this, but it doesn't work. I think WGCNA has an argument to substitute zero standard deviation, but I don't know about hdWGCNA. Could you please help me with issue?

Thanks

smorabit commented 9 months ago

Hi, I am wondering if you get this error when you use the tutorial dataset? I can help you identify the source of the error if you can provide a reproducible example.

sahanda66 commented 9 months ago

Hi. I tried with tutorial dataset. I don't get this error with tutorial dataset. I also tried another sc dataset and didn't get any error and it worked well.

Maybe it is better to ask this in a new issue, but I guess this error is due to an earlier error that I get when running SetupForWGCNA(seurat_obj, gene_select = "fraction", fraction = 0.05, wgcna_name = "XXX"):

Error in cut.default(1:nrow(expr_mat), n_chunks) : 
  invalid number of intervals

After getting this error, I changed to "variable" instead of "fraction" to proceed the workflow. However, I think the true gene-select should be "fraction".

I get this error with two totally different scRNA-seq datasets. Do you have any idea how to fix the error above with my data?

Thanks, Sahand

sahanda66 commented 9 months ago

Just to let other that may face a similar error as above ( invalid number of intervals), I fixed it by changing default assay of seurat object from "integrated" to "RNA".

Sahand

smorabit commented 9 months ago

I am not really sure what is your "integrated" assay or your "RNA" assay, but this step requires the assay to have count data available.