tgbugs / ontquery

a framework querying ontology terms
MIT License
3 stars 3 forks source link

Hierarchical relationships #4

Open bendichter opened 6 years ago

bendichter commented 6 years ago

Is it possible to search for all areas within a broader brain area?

tgbugs commented 6 years ago

query(curie='UBERON:0000955', predicates=('BFO:0000050',)) should be able to do that for the uberon terms, but the query results are not making it through. Looking into it.

tgbugs commented 6 years ago

I am not happy with how this is working right now, but it works.

See https://github.com/tgbugs/ontquery/blob/c709042dfe40f4194f2f3469b5760e124214ca3c/ontquery/__init__.py#L632-L634 for an example.

The right way to do this is to have an OntTerm.relationship(type, depth=1) method that hides the graph query implementation from the user.

tgbugs commented 6 years ago

Ended up implementing this as OntTerm.call which seemed like a reasonable place to put it since calling a term to have it give more information about itself seems reasonable. The other way we could do this would be via properties auto-generated from the query backend's list of all predicates, but not all predicates render nicely as python identifiers and not all predicates we care about have a query depth of 1 so passed on that for now.

See https://github.com/tgbugs/ontquery/blob/6821a0469d9e68a9b271c7e59a32ff94cabfdd42/ontquery/__init__.py#L655-#L656 for an example.

Another example to get a deeper result. OntTerm('UBERON:0000955')('hasPart:', depth=20). There are some performance issues with issuing multiple queries that I am still working out to get that to work as desired, but everything is in place.

There are a number of different partonomies that may be of interest. If you want to view them one way to do it is via http://ontology.neuinfo.org/trees/query/ilxtr:labelPartOf/MBA:997/ttl/generated/parcellation/mbaslim.ttl?branch=staging&restriction=true or http://ontology.neuinfo.org/trees/query/BFO:0000050/UBERON:0000955. See http://ontology.neuinfo.org/trees/examples for other examples.

bendichter commented 6 years ago

Could it support depth=np.Inf?

On Fri, Mar 23, 2018 at 2:32 PM Tom Gillespie notifications@github.com wrote:

Ended up implementing this as OntTerm.call which seemed like a reasonable place to put it since calling a term to have it give more information about itself seems reasonable. The other way we could do this would be via properties auto-generated from the query backend's list of all predicates, but not all predicates render nicely as python identifiers and not all predicates we care about have a query depth of 1 so passed on that for now.

Example:

https://github.com/tgbugs/ontquery/blob/6821a0469d9e68a9b271c7e59a32ff94cabfdd42/ontquery/__init__.py#L655l-#L656

Another example to get a deeper result. OntTerm('UBERON:0000955')('hasPart:', depth=20). There are some performance issues with issuing multiple queries that I am still working out to get that to work as desired, but everything is in place.

There are a number of different partonomies that may be of interest. If you want to view them one way to do it is via http://ontology.neuinfo.org/trees/query/ilxtr:labelPartOf/MBA:997/ttl/generated/parcellation/mbaslim.ttl?branch=staging&restriction=true or http://ontology.neuinfo.org/trees/query/BFO:0000050/UBERON:0000955. See http://ontology.neuinfo.org/trees/examples for other examples.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tgbugs/ontquery/issues/4#issuecomment-375804144, or mute the thread https://github.com/notifications/unsubscribe-auth/AAziEjFZ4oszw65nch56bJ0rRMX0SvCxks5thWnxgaJpZM4S40yU .

--

Ben Dichter, PhD Data Science Consultant