kbaseattic / relation_engine_spec

Specifications and config for the KBase Relation Engine
https://kbase.us
MIT License
0 stars 7 forks source link

Add a couple of reaction similarity queries for KE #25

Closed JamesJeffryes closed 5 years ago

jayrbolton commented 5 years ago

This is something I was working on avoiding but wasn't successful: return e._to == @rid ? e._from : e._to. Not saying we should do it now, just something to keep in mind.

I think the way to avoid it is to use a graph traversal for loop such as

for rxn in rxn_reaction
  for similar_rxn edge 1..1 ANY rxn rxn_similar_to_reaction
    filter edge.df_similarity >= xyz

I couldn't get things working quite right though. I find queries a lot easier to write when broken up into several subqueries with lets. Ironically this is more of a traditional sql strategy. Seems fast enough though.