ROBOKOP knowledge service accessor service
278
Rosetta is the knowledge map and service invocation tier of the Gamma reasoner.
Rosetta coordinates semantically annotated data sources into a metadata graph. That graph can be queried to generate programs to perform complex data retrieval tasks. It looks like this:

Blue nodes are semantic types from the biolink-model
Download, install, and start Neo4J 3.2.6.
$ <neo4j-install-dir>/bin/neo4j start
Download, install, and start Redis 4.0.8
<redis-install-dir>/src/redis-server
Clone the repository.
$ git clone <repo>
$ cd repo/greent
$ pip install -r requirements.txt
Initialize the type graph. This imports the graph of Translator services, overlays local service configurations, and imports locally defined services. It configures all of these according to the biolink-model.
$ PYTHONPATH=$PWD/.. rosetta.py --delete-type-graph --initialize-type-graph --debug
Via the Neo4J interface at http://localhost:7474/browser/ query the entire type graph:
match (m)--(n) return *
Query a particular path:
MATCH (n:named_thing)-[a]->(d:disease)-[b]->(g:gene) RETURN *
In the returned graph, nodes are biolink-model concepts and edges contain attributes indicating the service to invoke.
The web API presents two endpoints:
Given a drug name and a disease name, it returns a knowledge graph of the clinical outcome pathway.
Each edge includes:
Each node includes:
Given inputs and a Cypher query representing a shortest path between two concepts, generate a graph of items. More complex graphs can be composed by iteratively invoking this endpoint.
This simple snippet demonstrates usage via the Python API:
from greent.graph_components import elements_to_json
from greent.rosetta import Rosetta
rosetta = Rosetta ()
knowledge_graph = rosetta.construct_knowledge_graph(**{
"inputs" : {
"disease" : [
"DOID:2841"
]
},
"query" :
"""MATCH (a:disease),(b:gene), p = allShortestPaths((a)-[*]->(b))
WHERE NONE (r IN relationships(p) WHERE type(r) = 'UNKNOWN' OR r.op is null)
RETURN p"""
})
We cache in Redis. Objects are serialized using Python's pickle scheme.
To find out what operations(id) combinations are cached:
$ ~/app/redis-4.0.8/src/redis-cli --raw keys '*ctd*'
To delete specific keys or patterns of keys from the cache:
$ ~/app/redis-4.0.8/src/redis-cli --raw keys '*' | xargs ~/app/redis-4.0.8/src/redis-cli --raw del
To add a data source to the knowledge map:
Instantiate your service, following the lazy loading pattern, in core.py
This YAML file links types in the biolink-model. Each link includes a predicate and the name of an operation. Operations are named:
<objectName>.<methodName>
where is a member of core.py, the central service manager.
$ PYTHONPATH=$PWD/.. rosetta.py --delete-type-graph --initialize-type-graph --debug
You should now be able to write cypher queries for Rosetta that use the biolink-model names specified in the rosetta.yml config file that are connected by your new service.
Content type
Image
Digest
Size
532 MB
Last updated
over 8 years ago
docker pull patrickkwang/robokop-interfaces