Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to fetch annotation extensions in GOlr query. #134

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion ontobio/golr/golr_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ class GolrFields:
EVIDENCE_OBJECT_LABEL='evidence_object_label'
_VERSION_='_version_'
SUBJECT_GENE_CLOSURE_LABEL_SEARCHABLE='subject_gene_closure_label_searchable'
ANNOTATION_EXTENSION_JSON="annotation_extension_json"
EVIDENCE_WITH="evidence_with"
REFERENCE="reference"
EVIDENCE_TYPE="evidence_type"

RELATION='relation'
RELATION_LABEL='relation_label'
Expand Down Expand Up @@ -529,7 +533,7 @@ def __init__(self,
# test if client explicitly passes a URL; do not override
self.is_explicit_url = url is not None
self.non_null_fields=non_null_fields

if self.facet_fields is None:
self.facet_fields = [
M.SUBJECT_TAXON_LABEL,
Expand Down Expand Up @@ -1144,6 +1148,15 @@ def translate_doc(self, d, field_mapping=None, map_identifiers=None, **kwargs):
# solr does not allow nested objects, so evidence graph is json-encoded
if M.EVIDENCE_GRAPH in d:
assoc[M.EVIDENCE_GRAPH] = json.loads(d[M.EVIDENCE_GRAPH])

if M.ANNOTATION_EXTENSION_JSON in d:
assoc['annotation_extensions'] = [json.loads(ext) for ext in d[M.ANNOTATION_EXTENSION_JSON]]
if M.EVIDENCE_TYPE in d:
assoc[M.EVIDENCE_TYPE] = d[M.EVIDENCE_TYPE]
if M.EVIDENCE_WITH in d:
assoc[M.EVIDENCE_WITH] = d[M.EVIDENCE_WITH]
if M.REFERENCE in d:
assoc[M.REFERENCE] = d[M.REFERENCE]
return assoc

def translate_docs(self, ds, **kwargs):
Expand Down