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

Question about exporting the networks to Metascape #223

Open
DelongZHOU opened this issue Feb 19, 2024 · 4 comments
Open

Question about exporting the networks to Metascape #223

DelongZHOU opened this issue Feb 19, 2024 · 4 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@DelongZHOU
Copy link

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 DelongZHOU added the question Further information is requested label Feb 19, 2024
@smorabit
Copy link
Owner

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 smorabit added the enhancement New feature or request label Feb 22, 2024
@DelongZHOU
Copy link
Author

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

@smorabit
Copy link
Owner

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

@DelongZHOU
Copy link
Author

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

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

No branches or pull requests

2 participants