dhimmel / obonet

OBO-formatted ontologies → networkx (Python 3)
https://github.com/dhimmel/obonet/blob/main/examples/go-obonet.ipynb
Other
136 stars 28 forks source link

obonet says GO is not a DAG #5

Closed msinclair2 closed 6 years ago

msinclair2 commented 7 years ago

Hi Daniel,

I just downloaded and used obonet (thanks by the way for making and posting it!) and executed the code:

graph = obonet.read_obo('../data/go.obo')
print(networkx.is_directed_acyclic_graph(graph))

And for some reason it comes back FALSE. Should I be concerned? Any idea why GO is not a DAG according to networkx?

Thanks for any advice you can give!

dhimmel commented 7 years ago

@msinclair2, see the Gene Ontology downloads page. If you use, go-basic.obo rather than go.obo, the resulting networkx graph should be acyclic.

From the go-basic.obo doc:

This is the basic version of the GO filtered such that the graph is guaranteed to be acyclic, and annotations can be propagated up the graph. The relations included are is_a, part_of, regulates, negatively_regulates and positively_regulates. This version excludes relationships that cross the 3 main GO hierarchies. This is the version that should be used with most GO-based annotation tools.

From the go.obo doc:

These files contain the core GO ontology in two formats, OBO and OWL-RDF/XML. This view includes relationships not in the filtered version of GO including has_part and occurs_in. The set of relationships used is likely to extend over time. Many of these relationships may not be safe for propagating annotations across, so this version should not be used with legacy GO tools. This version currently excludes relationships to external ontologies.

Perhaps I should add some functionality or examples to prune the network to a subset of relationship types. Therefore, you could use go.obo and specify which relationship types to retain.

msinclair2 commented 7 years ago

Thank you for explaining that. I wasn't aware that networkx was looking at all the relations and not just the is_a taxonomy backbone. I'll use go-basic.obo just to be safe.

dhimmel commented 7 years ago

I wasn't aware that networkx was looking at all the relations and not just the is_a taxonomy backbone.

My understanding is that which relationship types matter is a rather ontology dependent determination. So this is a good reason to implement a filtering solution.