hetio / hetionet

Hetionet: an integrative network of disease
https://neo4j.het.io
264 stars 69 forks source link

Convert permutation hetnet to networkx #22

Open lingling93 opened 5 years ago

lingling93 commented 5 years ago

Any easy way to convert permutation graph of hetnet to networkx

dhimmel commented 5 years ago

It shouldn't be too hard to use the hetio Python package to read in the JSON-formatted permuted hetnet files and then create a network object from that. I think the MultiGraph is the best networkx data structure to store hetnets, but it is far from perfect:

From https://github.com/hetio/hetionet/issues/8#issuecomment-393663731:

networkx isn't a good option as it's hetnet support is mediocre --- the MultiGraph supports relationship types but not node types and doesn't really provide first-class type support.

Therefore, I personally have avoided using networkx for hetnets, and instead used Neo4j, hetio, and hetmatpy (when doing matrix operations).

@lingling93 what is your use case for converting the permuted hetnets into networkx? I can help you figure out the proper code to use, but I am wondering if networx is the right solution.

lingling93 commented 5 years ago

I want to compare the result of permutation graph with Hetio graph. Now I'm trying to input hetio graph and permutation graphs to node2vec(https://github.com/eliorc/node2vec), this package only accept networkx type graph.

dhimmel commented 5 years ago

Interesting, I haven't used node2vec, but my understanding is that it does not understand node or edge types, and thus may be of limited utility for hetnets. An alternative method for which I reviewed the manuscript but have not used, is called edge2vec. Tagging @RoyZhengGao, who's an author on that work.

Would love to see what you uncover about the differences between the permuted and unpermuted Hetionets. Note that we have also created additional permuted derivatives of Hetionet for our recent work. The file hetionet-v1.0-permutations.zip contains 200 permutations using the HetMat format from our new hetmatpy library. CC @zietzm