Is there a way to programmatically retrieve graph features (a networkx graph) from Cytoscape in Python 3?

EDIT: To add more details, I had a dictionary of proteins, each protein was associated with a list of proteins that it interacts with. I wanted to create a protein-protein interaction graph so that I could extract graph features from it, including things like k-core value of each node.

  • $\begingroup$ Welcome to Bioinformatics Beta! It would be helpful if you added more details. What have you attemped? What did you observe when you made the attempt that prevented you from getting the answer you wanted? $\endgroup$ – Galen Apr 20 at 16:49
  • $\begingroup$ Extract this information into what? A Python dictionary? JSON? Pandas DataFrame? It might help the community understand what your issue was if you elaborate. $\endgroup$ – Galen Apr 20 at 16:59

I was able to extract the graph features that I wanted just using networkx, without going through the intermediate step of Cytoscape.

EDIT: Initially, I planned to import the data into Cytoscape and extract graph features from Cytoscape. However, I noticed that a much easier solution would be to just use the methods of the networkx library. I initially had a few graph features in mind that I wanted to extract like k-core value of each node, and I was able to do this using methods from networkX. To calculate k-core for instance, I used the k_core method. For more information on networkX methods, check the docs

| improve this answer | |
  • $\begingroup$ I'm glad to hear that you solved your own question. If you edit your question to clarify what the issue was, and edit this answer on how you solved it, then this question can provide value to others who come across the same issue. $\endgroup$ – Galen Apr 20 at 16:52
  • $\begingroup$ Implementation details would be useful. For example, did you use nx.get_node_attributes, nx.get_edge_attributes, or something else? $\endgroup$ – Galen Apr 20 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.