hdWGCNA icon indicating copy to clipboard operation
hdWGCNA copied to clipboard

Question about exporting the networks to Metascape

Open DelongZHOU opened this issue 1 year ago • 4 comments

Hi Sam, I wonder if there is a way to export the networks to Metascape so I can annotate the network with other information like protein-protein interaction or gene ontology association. Thank you!

DelongZHOU avatar Feb 19 '24 20:02 DelongZHOU

Hi,

I do not have a way to export to Metascape built in to hdWGCNA. I am not very familiar with Metascape but I will look into it and get back to you soon. I agree it would be interesting to have an export to Metascape option for hdWGCNA!

smorabit avatar Feb 22 '24 20:02 smorabit

Hi Sam,

I just realized that I didn't mean Metascape but Cytoscape!

I found this tutorial here which uses functions from WGCNA that I'll try to implement. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC10500560/

As for Metascape it accepts gene list(s) as input and I think it's best to use their webserver / installed version instead of trying to interact it through R.

I don't know if I should change my original title / content - I'll leave it for you to decide.

Best, Delong

DelongZHOU avatar Mar 14 '24 14:03 DelongZHOU

Hi,

I am unfortunately not familiar with Cytoscape (or Metascape). I found this function include in the WGCNA package, maybe you could make use of it.

https://rdrr.io/cran/WGCNA/man/exportNetworkToCytoscape.html

smorabit avatar Mar 20 '24 17:03 smorabit

Hi Sam, That's exactly the function used in the tuto that I cited earlier. I managed to adapt the process to hdWGCNA with the code below.

# Load data
seurat_obj<-readRDS('')
TOM <- GetTOM(seurat_obj)

# Print out the module names
modules <- GetModules(seurat_obj)
print(levels(modules$module))

# Select module to export
module_to_extract <- ''

# Get hubgenes
genes_df <- GetHubGenes(seurat_obj, n_hubs = 30)
modGenes <- genes_df[genes_df$module==module_to_extract,]$gene_name

# Select the corresponding Topological Overlap
modTOM <- TOM[modGenes, modGenes]
# Export 
cyt <- exportNetworkToCytoscape(modTOM,
								edgeFile = paste0('hdWGCNA_to_Cyto.',module_to_extract,'.hub=30.edge.txt'),
								nodeFile = paste0('hdWGCNA_to_Cyto.',module_to_extract,'.hub=30.node.txt'),
								threshold = 0
								)

I consider my issue solved. I'll leave it to you to decide whether to close the ticket.

Best, Delong

DelongZHOU avatar Mar 25 '24 21:03 DelongZHOU