Ubergraph queries to populate
Given 2 seeds of classes S(s) and S(o): return all triples from the redundant graph for s subClassOf o as a simple Pandas dataframe with subject and object columns. We may expand in future to include objectProperties in seed, but OK to stay simple for now. (I’ll refer to this as enriched_df below).
Methods for deriving S(s) and S(o) from an initial seed, S(i), prior to calling basic query
- Simple: S(s) = S(i); S(o) = S(i)
- Minimal Slim enrichment: S(s) = S(i); S(o) = S(i) + all classes in some specified (set of) slims (where class in slim = class tagged with some specified ‘subset’ axiom)
- Full Slim enrichment: as Minimal slim enrichment but with transitive query of the non-redundant graph (owl:subClassOf*)
- Contextual enrichment: S(s) = S(i); S(o) = S(i) + all classes satisfied by some (set of) existential restrictions in the ubergraph redundant graph (e.g. part_of 'Kidney')
It is entirely possible that users will provide invalid IDs in the initial seed, so we need to test for this:
- Are the CURIE prefixes valid for UberGraph - throw exception/warning if not (option hard/soft fail)
- Are the CURIEs valid terms in UberGraph - throw exception/warning if not (option hard/soft fail)
- Do any CURIEs correspond to obsolete terms? (Option to update terms in the list via replaced_by?)
Users will need some way to find which slims are available. To do this we should include methods for finding available slims and displaying their contents:
- find_available_slims: query for all slims available in a specified ontology, returning name and definition.
- Show_slim_contents: list names and IDs of all terms in slim.
For all classes in enriched_df, query for labels and synonyms. Return as table with ID, label, synonyms (pipe sep) + column indicating presence in original seed (I’ll refer to this as name_lookup_df below)
User query methods over dataframes
The dataframes are designed to be sufficiently simple that a a bioinformatician with basic competency could work out how to use them to enrich their results. But I still think useful to wrap these.
Add sqlite as dependency for wrapping queries.
Basic query:
semantic_filter: (arg = dataframe + column name + name or synonym of query term) : result = filtered input dataframe via join on column to subject of enriched_df, looking up of object name or synonym via query of name_lookup.
Library should be released on PyPi