smorabit / hdWGCNA

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

Seeking parameter suggestions for hdwgcna #285

Open xjyenjoy81 opened 2 weeks ago

xjyenjoy81 commented 2 weeks ago

Hi,@smorabit, thank you for your answer to a small bug in my hdWGCNA last time. I have encountered a question that I would like to ask you. For example, the single-cell data I studied for stroke consists of 8 samples, of which 4 are MCAO and 4 are Sham. I want to find the hub genes of MCAO astrocytes. In the Construction Metacells step, should I delete the cell_type in the demonstration code and change it to seurat_obj<- MetacellsByGroups( seurat_obj = seurat_obj, group.by=c('Sample'), k = 25, max_shared = 10, ident.group = 'Sample' ) seurat_obj <- NormalizeMetacells(seurat_obj) In the step of Set up the expression matrix, it becomes seurat_obj <- SetDatExpr( seurat_obj, group_name = "Astrocyte", group.by='Sample', assay = 'RNA', slot = 'data' ) Finally, the hub gene was obtained by selecting modules with darker colors from three MCAO samples. Is my parameter selection correct?

smorabit commented 1 week ago

Hi,

I appreciate that you are trying to find the "correct" way to run hdWGCNA. However, the logic here is fundamentally flawed.

I want to emphasize that there is not a "correct" set of parameters or way to run hdWGCNA (or many algorithms for that matter). The choices that you make in your analysis affect the downstream interpretation, but that doesn't make one way "correct" and another "incorrect". Different parameters could work better or worse for different data. I don't know your dataset so I can't really recommend what to do in your case.

xjyenjoy81 commented 1 week ago

Sir you are right in pointing out that I used a wrong logical way of thinking to ask you a question. I have reorganized my logic to ask you for advice. The data I am currently analyzing is GSE174574, and the summary of this data reads 'Here, we employed single-cell RNA sequencing (scRNA-seq) to comprehensively map the cellular and cellular populations in the mouse model of MCAO (middle cerebral artery occlusion). populations in the mouse model of MCAO (middle cerebral artery occlusion).' The sample for this data looks like this 'GSM5319987 Brain Sham rep1 GSM5319988 Brain Sham rep2 GSM5319989 Brain Sham rep3 GSM5319990 Brain MCAO rep1 GSM5319991 Brain MCAO rep2 GSM5319992 Brain MCAO rep3 ', I have downscaled, clustered, and subclustered this data, and the following code results show my results ' table(seurat_obj$orig.ident) GSM5319987_MCAO1 GSM5319987_MCAO2 GSM5319987_MCAO3 GSM5319987_sham1 GSM5319987_sham2 GSM5319987_sham3 11055 10740 7425 8447 8202 9604 table(seurat_obj$group) MCAO sham 29220 26253 table(seurat_obj$celltype) Astrocyte Endothelial cell Ependymal cell Fibroblast Macrophage 3230 25719 2498 387 4076 Microglia Neural progenitor cell Neutrophil Oligodendrocyte Pericyte 12845 519 689 1289 1082 T cell Vascular smooth muscle cell 456 2683 'These are the preparations I intend to make before hdwgcna, my aim is to probe the core genes of astrocytes under MCAO, attached is my code, after running the code, does the choice of my parameters explain my aim?Looking forward to your reply!

          Thank you!

Sam Morabito @.***> 于2024年6月28日周五 18:37写道:

Hi,

I appreciate that you are trying to find the "correct" way to run hdWGCNA. However, the logic here is fundamentally flawed.

I want to emphasize that there is not a "correct" set of parameters or way to run hdWGCNA (or many algorithms for that matter). The choices that you make in your analysis affect the downstream interpretation, but that doesn't make one way "correct" and another "incorrect". Different parameters could work better or worse for different data. I don't know your dataset so I can't really recommend what to do in your case.

— Reply to this email directly, view it on GitHub https://github.com/smorabit/hdWGCNA/issues/285#issuecomment-2196604680, or unsubscribe https://github.com/notifications/unsubscribe-auth/BGMLROCGFD6QK7SSZGPS73TZJU4FDAVCNFSM6AAAAABJ5BUY6KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJWGYYDINRYGA . You are receiving this because you authored the thread.Message ID: @.***>

seurat_obj <- readRDS('522.rds') seurat_obj <- seurat_obj[,Idents(seurat_obj)%in%c('Astrocyte')]

I missed another dimension reduction clustering

seurat_obj <- SetupForWGCNA( seurat_obj, gene_select = "fraction", fraction = 0.05, wgcna_name = "tutorial" )

seurat_obj <- MetacellsByGroups( seurat_obj = seurat_obj, group.by = c("group","orig.ident"), reduction = 'harmony', k = 25, max_shared = 10, ident.group = 'group' ) seurat_obj <- NormalizeMetacells(seurat_obj)

seurat_obj <- SetDatExpr( seurat_obj, group_name = 'MCAO', group.by='group', assay = 'RNA', slot = 'data' )

seurat_obj <- TestSoftPowers( seurat_obj, networkType = 'signed' )

plot_list <- PlotSoftPowers(seurat_obj) wrap_plots(plot_list, ncol=2) power_table <- GetPowerTable(seurat_obj) head(power_table)

seurat_obj <- ConstructNetwork( seurat_obj, tom_name ='MCAO',overwrite_tom = TRUE ) PlotDendrogram(seurat_obj, main='MCAO hdWGCNA Dendrogram')

seurat_obj <- ScaleData(seurat_obj, features=VariableFeatures(seurat_obj))

seurat_obj <- ModuleEigengenes( seurat_obj, group.by.vars="orig.ident" )

seurat_obj <- ModuleConnectivity( seurat_obj, group.by = 'group', group_name = 'MCAO' ) hMEs <- GetMEs(seurat_obj) head(hMEs) seurat_obj <- ResetModuleNames( seurat_obj, new_name = "MCAO" )

PlotKMEs(seurat_obj, ncol=5) modules <- GetModules(seurat_obj) %>% subset(module != 'grey')

head(modules[,1:6]) hub_df <- GetHubGenes(seurat_obj, n_hubs = 10)

head(hub_df) ModuleCorrelogram(seurat_obj)

MEs <- GetMEs(seurat_obj, harmonized=TRUE) mods <- colnames(MEs); mods <- mods[mods != 'grey']

@. <- @., MEs)

ModuleNetworkPlot(seurat_obj)