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

chore: pin uberon ontology version #388

Merged
merged 2 commits into from
Apr 20, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
CENSUS_SCHEMA_VERSION = "0.1.1"

CXG_SCHEMA_VERSION = "3.0.0" # version we write to the census
# NOTE: The UBERON ontology URL needs to manually updated if the CXG Dataset Schema is updated. This is a temporary
# hassle, however, since the TissueMapper, which relies upon this ontology, will eventually be removed from the Builder
CXG_UBERON_ONTOLOGY_URL = "https://github.com/obophenotype/uberon/releases/download/v2022-08-19/uberon.owl"
CXG_SCHEMA_VERSION_IMPORT = [CXG_SCHEMA_VERSION] # versions we can ingest

# Columns expected in the census_datasets dataframe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@

This code contains several places that do not pass the lint/static analysis CI for this pipeline, so the analysis is disabled in this prologue.
"""
from typing import List

import owlready2
from typing import List

from .globals import CXG_UBERON_ONTOLOGY_URL


class TissueMapper:
Expand Down Expand Up @@ -120,12 +122,10 @@ class TissueMapper:
"UBERON_0001062", # anatomical entity
]

def __init__(self, uberon_ontology: str = "http://purl.obolibrary.org/obo/uberon.owl"):
# TODO: use the pinned ontology at `single-cell-curation`
self._uberon = owlready2.get_ontology(uberon_ontology)
self._uberon.load()
def __init__(self):
self._cached_tissues = {}
self._cached_labels = {}
self._uberon = owlready2.get_ontology(CXG_UBERON_ONTOLOGY_URL).load()

def get_high_level_tissue(self, tissue_ontology_term_id: str) -> str:
"""
Expand Down Expand Up @@ -246,7 +246,6 @@ def _get_entity_from_id(self, ontology_term_id: str) -> owlready2.entity.ThingCl
"""
Given a readable ontology term id (e.g. "UBERON_0002048"), it returns the associated ontology entity
"""
# TODO: use the pinned ontology at `single-cell-curation`
return self._uberon.search_one(iri=f"http://purl.obolibrary.org/obo/{ontology_term_id}")

@staticmethod
Expand Down