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

Accessing children of a relationship #177

Open
manulera opened this issue Jun 21, 2022 · 3 comments
Open

Accessing children of a relationship #177

manulera opened this issue Jun 21, 2022 · 3 comments

Comments

@manulera
Copy link

Is it possible to access the children of a relationship? For example, with the method term.subclasses() I can access all the inverse is_a relationships. Is there a way to access other relationships this way? E.g regulates in GO?

I am new to the use of ontologies, so I am not sure if that's the case, but this example from the documentation seems to be doing exactly that.

go = pronto.Ontology.from_obo_library("go.obo")
go['GO:0048870']
list(go['GO:0048870'].objects(go.get_relationship('part_of')))

However, when I run it I get this:

NotImplementedWarning: `Term.objects` is not semantically correct, most of the logic rules have not been implemented. Consider using an actual reasoner instead.
  list(go['GO:0048870'].objects(go.get_relationship('part_of')))

Any tips on this?

@cmungall
Copy link

cmungall commented Jul 6, 2022

The warning is a little confusing, and I think it's actually a red herring/false positive.

The issue here is that GO changed since the documentation was written, and this term has no direct part-of relationships any more. The actual return value of [] is correct

Try another term, it will give results, without warning:

>>> list(go['GO:0060887'].objects(go.get_relationship('part_of')))
[Term('GO:0060173', name='limb development')]

FWIW, I usually do this:

>>> [r for r in go['GO:0060887'].relationships]
[Relationship('part_of', name='part of')]

See also #119

@manulera
Copy link
Author

Hi @cmungall thanks for the detailed response and the examples, and sorry for the super-late answer. I tried your example and indeed it works. However, I think my question was not well formulated, I meant to ask whether it was possible to get the inverse relationship (what I would think of as a child). For example, for the term GO:0006366, get all these children and the relationship that links them to GO:0006366:

Screenshot 2022-07-27 at 14 07 56

@manulera
Copy link
Author

HI @cmungall any advise on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants