monarch-initiative / biolink-api

API for linked biological knowledge
https://api.monarchinitiative.org/api/
BSD 3-Clause "New" or "Revised" License
64 stars 25 forks source link

Calls and return patterns needed for Monarch Application #143

Closed putmantime closed 6 years ago

putmantime commented 6 years ago

To drive the associations tables, it would be useful if Biolink followed the subject object predicate pattern in return objects.

For example: /bioentity/disease/{curie}/phenotype returns the disease as the subject and phenotype as the object /bioentity/disease/{curie}/gene however, returns the disease as the object and the gene as the subject I realize this is a symptom of monarch unidirectional modeling, but after talking with @cmungall it seems the logic to implement this pattern is best implemented in biolink server api code.

The calls needed to support monarch association tables in this pattern are here:

/phenotype/<identifier>/anatomy
/phenotype/<identifier>/cellline
/phenotype/<identifier>/disease
/phenotype/<identifier>/function
/phenotype/<identifier>/gene
/phenotype/<identifier>/genotype
/phenotype/<identifier>/homolog
/phenotype/<identifier>/interaction
/phenotype/<identifier>/literature
/phenotype/<identifier>/model
/phenotype/<identifier>/ortholog-phenotype
/phenotype/<identifier>/ortholog-disease
/phenotype/<identifier>/pathway
/phenotype/<identifier>/variant
/disease/<identifier>/anatomy
/disease/<identifier>/cellline
/disease/<identifier>/function
/disease/<identifier>/gene
/disease/<identifier>/genotype
/disease/<identifier>/homolog
/disease/<identifier>/interaction
/disease/<identifier>/literature
/disease/<identifier>/model
/disease/<identifier>/ortholog-phenotype
/disease/<identifier>/ortholog-disease
/disease/<identifier>/pathway
/disease/<identifier>/phenotype
/disease/<identifier>/variant
/gene/<identifier>/anatomy
/gene/<identifier>/cellline
/gene/<identifier>/disease
/gene/<identifier>/function
/gene/<identifier>/genotype
/gene/<identifier>/homolog
/gene/<identifier>/interaction
/gene/<identifier>/literature
/gene/<identifier>/model
/gene/<identifier>/ortholog-phenotype
/gene/<identifier>/ortholog-disease
/gene/<identifier>/pathway
/gene/<identifier>/phenotype
/gene/<identifier>/variant
/model/<identifier>/anatomy
/model/<identifier>/cellline
/model/<identifier>/disease
/model/<identifier>/function
/model/<identifier>/gene
/model/<identifier>/genotype
/model/<identifier>/homolog
/model/<identifier>/interaction
/model/<identifier>/literature
/model/<identifier>/ortholog-phenotype
/model/<identifier>/ortholog-disease
/model/<identifier>/pathway
/model/<identifier>/phenotype
/model/<identifier>/variant

Many of these are already implemented with the above pattern. Priority objects are variant, phenotype, model, disease, anatomy, homolog, literature, gene, function

cmungall commented 6 years ago

Yes, I think the client should get things back the way it asks for them. E.g if it asks for X-to-Y, it doesn't get Y-to-X.

This could be done in the biolink-api level or the underlying ontobio code, or even pre-populated in solr.

We will either have to invert the relationship type OR extend the model to add a property that says the relation is inverted (formally this is the same as making an OWL InverseOf(P) PropertyExpression). The latter is easier as we avoid any specific coupling between the code and the relations ontology (and not every relation has a named inverse, through we try to do this in RO). The client would just have to be smart enough to check this field. But then the client would need to look up the name of the inverse, unless we just display visually that this is inverted? OK, how about the API makes a best effort to return an atomic named relation that is valid, but in some cases it will return rel=P, inverse=true?

I thought we had some logic for doing this with symmetric relations like interaction. But I guess we just pre-materialize in both directions @kshefchek ?

cc @lhannest should beacons also have this inverse property?

kshefchek commented 6 years ago

I thought we had some logic for doing this with symmetric relations like interaction. But I guess we just pre-materialize in both directions @kshefchek ?

Correct, if a relation is symmetrical we can index in both directions, eg

(geneA)-[interacts_with]-(geneB)

As opposed to

(geneA)-[interacts_with]->(geneB)
putmantime commented 6 years ago

Any updates on when some of these will be implemented? I could take on some high priority ones myself if they aren't being worked on already.

deepakunni3 commented 6 years ago

All new calls should be working once Ontobio 1.1.5 is deployed with api.monarchinitiative.org