INCATools / ontology-access-kit

Ontology Access Kit: A python library and command line application for working with ontologies
https://incatools.github.io/ontology-access-kit/
Apache License 2.0
110 stars 26 forks source link

Add a generator to NDEx CX format #470

Open cmungall opened 1 year ago

cmungall commented 1 year ago

CX format is used by cytoscape and ndexbio (https://www.ndexbio.org/). It would be useful to be able to export to CX from OAK, via the obograph model.

I envision this in two parts:

  1. ensuring the core logical content of the ontology (minimally: node.{id,lbl} and edge.{sub,pred,obj}) is exported
  2. exporting the kgviz stylesheets to the cx style language

the first should be pretty straightforward, at the core cx is very similar to obographs

    "nodes": [
      {
        "@id": 0,
        "n": "ACTA1",
        "r": "uniprot:P02568"
      },
      {
        "@id": 1,
        "n": "CASP3",
        "r": "uniprot:A8K5M2"
      },
...
  {
    "edges": [
      {
        "@id": 378,
        "s": 8,
        "t": 11,
        "i": "interacts with"
      },
      {
        "@id": 379,
        "s": 11,
        "t": 16,
        "i": "interacts with"
      },
...

At first I looked into doing this via a linkml model of CX. However, the structure of CX is a little unusual - the top level structure is a list, and different object types form elements of the list, with some assumptions about order. And CX is also self-describing in that a data dictionary of attributes is passed, so there is no one fixed schema of keys for the json.

I tried just manually constructing dict objects but my initial attempts produced invalid structures (I was using the ndex ui to test, not sure if there is a more efficient way)

On slack @bgyori suggests using ndex2, I think this makes the most sense, although I am loathe to add new dependencies, especially where it may introduce conflicts over shared libraries such as networkx

cmungall commented 1 year ago

A very bad experimental first pass #471