diff --git a/tools/cellxgene_census_builder/src/cellxgene_census_builder/build_soma/globals.py b/tools/cellxgene_census_builder/src/cellxgene_census_builder/build_soma/globals.py index 9efb158e8..e48eaf495 100644 --- a/tools/cellxgene_census_builder/src/cellxgene_census_builder/build_soma/globals.py +++ b/tools/cellxgene_census_builder/src/cellxgene_census_builder/build_soma/globals.py @@ -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 diff --git a/tools/cellxgene_census_builder/src/cellxgene_census_builder/build_soma/tissue_mapper.py b/tools/cellxgene_census_builder/src/cellxgene_census_builder/build_soma/tissue_mapper.py index f8e7c8bf1..e73d3f1aa 100644 --- a/tools/cellxgene_census_builder/src/cellxgene_census_builder/build_soma/tissue_mapper.py +++ b/tools/cellxgene_census_builder/src/cellxgene_census_builder/build_soma/tissue_mapper.py @@ -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: @@ -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: """ @@ -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