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

Issue with KMe Calculation : PlotKMEs and GetHubGenes Incomplete #338

Open
tetsy2 opened this issue Nov 29, 2024 · 6 comments
Open

Issue with KMe Calculation : PlotKMEs and GetHubGenes Incomplete #338

tetsy2 opened this issue Nov 29, 2024 · 6 comments

Comments

@tetsy2
Copy link

tetsy2 commented Nov 29, 2024

Hello Sam,

I have just recently installed the package and I get the same problem as reported in #318

I follow the tutorial with my data until I get to the ModuleConnectivity.

compute eigengene-based connectivity (kME):

seurat_obj <- ModuleConnectivity(
seurat_obj,
group.by = 'orig.ident'
)

This gives a good results, BUT the next step is not working

p <- PlotKMEs(seurat_obj, ncol=3,wgcna_name='tutorial')

Indeed, this also works: GetHubGenes(seurat_obj, n_hubs=2, wgcna_name='tutorial',mods=NULL), but the results are wihout KMe (only the head):

gene_name module kME
1 TUBA1B turquoise NaN
2 MKI67 turquoise NaN
3 RRM2 turquoise NaN
4 TYMS turquoise NaN
5 UBE2C turquoise NaN
6 HIST1H1B turquoise NaN

Do you have any idea about what it could be?

Thanks!

@smorabit
Copy link
Owner

smorabit commented Dec 2, 2024

Hi, are you using the latest version of hdWGCNA? In #318 I was able to re-produce the issue but I pushed a fix for it already.

@tetsy2
Copy link
Author

tetsy2 commented Dec 2, 2024

I used this:

devtools::install_github('smorabit/hdWGCNA', ref='dev')

Is there any recommended way yo install the package?

@smorabit
Copy link
Owner

smorabit commented Dec 2, 2024

What does it say when you run this:

packageVersion('hdWGCNA')

It could also help me better understand your issue if you include the other code that you have run before PlotKMEs.

@tetsy2
Copy link
Author

tetsy2 commented Dec 2, 2024

Hello Sam!

This is the result: packageVersion('hdWGCNA')
[1] '0.4.0'

@tetsy2
Copy link
Author

tetsy2 commented Dec 2, 2024

I am running this code:
seurat_obj <- SetupForWGCNA(
seurat_obj,
gene_select = "variable", # the gene selection approach
wgcna_name = "tutorial" # the name of the hdWGCNA experiment
)

construct metacells in each group

seurat_obj <- MetacellsByGroups(
seurat_obj = seurat_obj,
group.by = c("orig.ident"), # 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 = 'orig.ident' # set the Idents of the metacell seurat object
)

seurat_obj <- NormalizeMetacells(seurat_obj)
seurat_obj <- ScaleMetacells(seurat_obj, features=VariableFeatures(seurat_obj))

seurat_obj <- SetDatExpr(
seurat_obj,
assay = 'RNA',
layer = 'data'
)

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)

seurat_obj <- ConstructNetwork(
seurat_obj,overwrite_tom = TRUE,
tom_name = 'Variable2' # name of the topoligical overlap matrix written to disk
)

PlotDendrogram(seurat_obj, main='INH hdWGCNA Dendrogram')
TOM <- GetTOM(seurat_obj)
pheatmap(TOM)

compute all MEs in the full single-cell dataset

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

harmonized module eigengenes:

hMEs <- GetMEs(seurat_obj,wgcna_name='tutorial')

@smorabit
Copy link
Owner

smorabit commented Dec 5, 2024

Hi, I just ran through your code using the hdWGCNA tutorial dataset, and I am not able to reproduce your error on my end. I am not able to help resolve the issue until I am able to reproduce the behavior.

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

No branches or pull requests

2 participants