diff --git a/api/python/pyproject.toml b/api/python/pyproject.toml index d47f7728..6ca3f720 100644 --- a/api/python/pyproject.toml +++ b/api/python/pyproject.toml @@ -11,7 +11,7 @@ authors = [ ] license = { file = "LICENSE" } readme = "README.md" -requires-python = "~= 3.11" +requires-python = "~= 3.10" dependencies = ["semantic_version==2.10.0"] [project.optional-dependencies] diff --git a/api/python/src/cellxgene_ontology_guide/entities.py b/api/python/src/cellxgene_ontology_guide/entities.py index cc65c857..871f77fd 100644 --- a/api/python/src/cellxgene_ontology_guide/entities.py +++ b/api/python/src/cellxgene_ontology_guide/entities.py @@ -15,28 +15,3 @@ class Ontology(Enum): MmusDv = "mmusdv" PATO = "pato" NCBITaxon = "ncbitaxon" - - -class OntologyVariant(Enum): - """ - Enum for the standard set of ontology variants. Each is curated for a specific purpose. - - See https://oboacademy.github.io/obook/explanation/owl-format-variants/ for more information on the distinction - and use-cases for each variant. - """ - - FULL = "full" - BASE = "base" - SIMPLE = "simple" - BASIC = "basic" - - -class OntologyFileType(Enum): - """ - Enum for the standard set of ontology file types. Each requires different parsing tools, but relay the same - information. - """ - - OWL = "owl" - OBO = "obo" - JSON = "json" diff --git a/api/python/src/cellxgene_ontology_guide/ontology_parser.py b/api/python/src/cellxgene_ontology_guide/ontology_parser.py index faa4b0b0..c1abbce8 100644 --- a/api/python/src/cellxgene_ontology_guide/ontology_parser.py +++ b/api/python/src/cellxgene_ontology_guide/ontology_parser.py @@ -1,7 +1,7 @@ import re from typing import Any, Dict, Iterable, List, Union -from cellxgene_ontology_guide.entities import Ontology, OntologyFileType, OntologyVariant +from cellxgene_ontology_guide.entities import Ontology from cellxgene_ontology_guide.supported_versions import CXGSchema @@ -274,26 +274,17 @@ def get_term_label(self, term_id: str) -> str: label: str = self.cxg_schema.ontology(ontology_name)[term_id]["label"] return label - def get_ontology_download_url( - self, ontology: Ontology, ontology_filetype: OntologyFileType, ontology_variant: OntologyVariant = None - ) -> str: + def get_ontology_download_url(self, ontology: Ontology) -> str: """ - Get the download URL for a given ontology file. If the ontology_variant is not provided, the default ontology - file will be returned. + Get the download URL for a given ontology file. Examples: - get_ontology_download_url("CL", "owl") -> "http://example.com/2024-01-01/cl.owl" - get_ontology_download_url("CL", "obo", "base") -> "http://example.com/2024-01-01/cl-base.obo" + get_ontology_download_url("CL") -> "http://example.com/2024-01-01/cl.owl" :param ontology: Ontology enum of the ontology to fetch - :param ontology_filetype: OntologyFileType enum of the ontology file type to fetch - :param ontology_variant: OntologyVariant enum of the ontology variant to fetch :return: str download URL for the requested ontology file """ source_url = self.cxg_schema.supported_ontologies[ontology.name]["source"] version = self.cxg_schema.supported_ontologies[ontology.name]["version"] - return ( - f"{source_url}/{version}/{ontology.value}-{ontology_variant.value}.{ontology_filetype.value}" - if ontology_variant - else f"{source_url}/{version}/{ontology.value}.{ontology_filetype.value}" - ) + filename = self.cxg_schema.supported_ontologies[ontology.name]["filename"] + return f"{source_url}/{version}/{filename}" diff --git a/api/python/tests/test_ontology_parser.py b/api/python/tests/test_ontology_parser.py index 2195c1e7..3d5f1897 100644 --- a/api/python/tests/test_ontology_parser.py +++ b/api/python/tests/test_ontology_parser.py @@ -1,7 +1,7 @@ from unittest.mock import patch import pytest -from cellxgene_ontology_guide.entities import Ontology, OntologyFileType, OntologyVariant +from cellxgene_ontology_guide.entities import Ontology from cellxgene_ontology_guide.ontology_parser import OntologyParser from cellxgene_ontology_guide.supported_versions import CXGSchema @@ -44,7 +44,7 @@ def ontology_dict(): @pytest.fixture def mock_CXGSchema(ontology_dict, mock_load_supported_versions, mock_load_ontology_file): mock_load_supported_versions.return_value = { - "v5.0.0": {"CL": {"version": "2024-01-01", "source": "http://example.com", "filetype": "owl"}} + "v5.0.0": {"CL": {"version": "2024-01-01", "source": "http://example.com", "filename": "cl.owl"}} } cxg_schema = CXGSchema() cxg_schema.ontology_file_names = {"CL": "CL-ontology-2024-01-01.json.gz"} @@ -212,11 +212,4 @@ def test_get_distance_between_terms(ontology_parser): def test_get_ontology_download_url(ontology_parser): - assert ( - ontology_parser.get_ontology_download_url(Ontology.CL, OntologyFileType.OWL) - == "http://example.com/2024-01-01/cl.owl" - ) - assert ( - ontology_parser.get_ontology_download_url(Ontology.CL, OntologyFileType.OBO, OntologyVariant.BASE) - == "http://example.com/2024-01-01/cl-base.obo" - ) + assert ontology_parser.get_ontology_download_url(Ontology.CL) == "http://example.com/2024-01-01/cl.owl" diff --git a/artifact-schemas/ontology_info_schema.json b/artifact-schemas/ontology_info_schema.json index 529b34bd..d80f6bd7 100644 --- a/artifact-schemas/ontology_info_schema.json +++ b/artifact-schemas/ontology_info_schema.json @@ -52,15 +52,15 @@ "format": "uri", "description": "Source to find and download canonical ontology version for this data release" }, - "filetype": { + "filename": { "type": "string", - "description": "filetype used to build generated artifacts for this ontology data release" + "description": "name of ontology file used to build generated artifacts for this ontology data release" } }, "required": [ "version", "source", - "filetype" + "filename" ], "additionalProperties": false } diff --git a/ontology-assets/CL-ontology-v2024-01-04.json.gz b/ontology-assets/CL-ontology-v2024-01-04.json.gz index 606c5afb..aad404e3 100644 Binary files a/ontology-assets/CL-ontology-v2024-01-04.json.gz and b/ontology-assets/CL-ontology-v2024-01-04.json.gz differ diff --git a/ontology-assets/EFO-ontology-v3.62.0.json.gz b/ontology-assets/EFO-ontology-v3.62.0.json.gz index 02f086f7..e788f7c4 100644 Binary files a/ontology-assets/EFO-ontology-v3.62.0.json.gz and b/ontology-assets/EFO-ontology-v3.62.0.json.gz differ diff --git a/ontology-assets/HANCESTRO-ontology-3.0.json.gz b/ontology-assets/HANCESTRO-ontology-3.0.json.gz index d0c8184f..a0f32c20 100644 Binary files a/ontology-assets/HANCESTRO-ontology-3.0.json.gz and b/ontology-assets/HANCESTRO-ontology-3.0.json.gz differ diff --git a/ontology-assets/HsapDv-ontology-11.json.gz b/ontology-assets/HsapDv-ontology-11.json.gz index dfbc0377..2b62d592 100644 Binary files a/ontology-assets/HsapDv-ontology-11.json.gz and b/ontology-assets/HsapDv-ontology-11.json.gz differ diff --git a/ontology-assets/MONDO-ontology-v2024-01-03.json.gz b/ontology-assets/MONDO-ontology-v2024-01-03.json.gz index 91e9eadc..f1755161 100644 Binary files a/ontology-assets/MONDO-ontology-v2024-01-03.json.gz and b/ontology-assets/MONDO-ontology-v2024-01-03.json.gz differ diff --git a/ontology-assets/MmusDv-ontology-9.json.gz b/ontology-assets/MmusDv-ontology-9.json.gz index 2ce4751d..aeb615da 100644 Binary files a/ontology-assets/MmusDv-ontology-9.json.gz and b/ontology-assets/MmusDv-ontology-9.json.gz differ diff --git a/ontology-assets/NCBITaxon-ontology-v2023-06-20.json.gz b/ontology-assets/NCBITaxon-ontology-v2023-06-20.json.gz index 20f9241a..73e1c8f6 100644 Binary files a/ontology-assets/NCBITaxon-ontology-v2023-06-20.json.gz and b/ontology-assets/NCBITaxon-ontology-v2023-06-20.json.gz differ diff --git a/ontology-assets/PATO-ontology-v2023-05-18.json.gz b/ontology-assets/PATO-ontology-v2023-05-18.json.gz index d5d1db12..587f9ac4 100644 Binary files a/ontology-assets/PATO-ontology-v2023-05-18.json.gz and b/ontology-assets/PATO-ontology-v2023-05-18.json.gz differ diff --git a/ontology-assets/UBERON-ontology-v2024-01-18.json.gz b/ontology-assets/UBERON-ontology-v2024-01-18.json.gz index e882785e..85587c6b 100644 Binary files a/ontology-assets/UBERON-ontology-v2024-01-18.json.gz and b/ontology-assets/UBERON-ontology-v2024-01-18.json.gz differ diff --git a/ontology-assets/ontology_info.json b/ontology-assets/ontology_info.json index 9a186060..00642744 100644 --- a/ontology-assets/ontology_info.json +++ b/ontology-assets/ontology_info.json @@ -3,47 +3,47 @@ "CL": { "version": "v2024-01-04", "source": "https://github.com/obophenotype/cell-ontology/releases/download", - "filetype": "owl" + "filename": "cl.owl" }, "EFO": { "version": "v3.62.0", "source": "https://github.com/EBISPOT/efo/releases/download", - "filetype": "owl" + "filename": "efo.owl" }, "HANCESTRO": { "version": "3.0", "source": "https://github.com/EBISPOT/hancestro/raw", - "filetype": "owl" + "filename": "hancestro.owl" }, "HsapDv": { "version": "11", "source": "http://aber-owl.net/media/ontologies/HSAPDV", - "filetype": "owl" + "filename": "hsapdv.owl" }, "MONDO": { "version": "v2024-01-03", "source": "https://github.com/monarch-initiative/mondo/releases/download", - "filetype": "owl" + "filename": "mondo.owl" }, "MmusDv": { "version": "9", "source": "http://aber-owl.net/media/ontologies/MMUSDV", - "filetype": "owl" + "filename": "mmusdv.owl" }, "NCBITaxon": { "version": "v2023-06-20", "source": "https://github.com/obophenotype/ncbitaxon/releases/download", - "filetype": "owl.gz" + "filename": "ncbitaxon.owl.gz" }, "UBERON": { "version": "v2024-01-18", "source": "https://github.com/obophenotype/uberon/releases/download", - "filetype": "owl" + "filename": "uberon.owl" }, "PATO": { "version": "v2023-05-18", "source": "https://github.com/pato-ontology/pato/raw", - "filetype": "owl" + "filename": "pato.owl" } } } diff --git a/tools/ontology-builder/src/all_ontology_generator.py b/tools/ontology-builder/src/all_ontology_generator.py index ec187b7b..d3fc6a49 100755 --- a/tools/ontology-builder/src/all_ontology_generator.py +++ b/tools/ontology-builder/src/all_ontology_generator.py @@ -62,7 +62,7 @@ def download(_ontology: str, _url: str) -> None: def _build_url(_ontology: str) -> str: onto_ref_data = ontology_info[_ontology] - return f"{onto_ref_data['source']}/{onto_ref_data['version']}/{ontology.lower()}.{onto_ref_data['filetype']}" + return f"{onto_ref_data['source']}/{onto_ref_data['version']}/{onto_ref_data['filename']}" threads = [] for ontology, _ in ontology_info.items(): diff --git a/tools/ontology-builder/tests/test_all_ontology_generator.py b/tools/ontology-builder/tests/test_all_ontology_generator.py index fb23ee3e..1384aa9c 100644 --- a/tools/ontology-builder/tests/test_all_ontology_generator.py +++ b/tools/ontology-builder/tests/test_all_ontology_generator.py @@ -13,7 +13,7 @@ def mock_ontology_info(): "ontology_name": { "source": "http://example.com", "version": "v1", - "filetype": "owl", + "filename": "ontology_name.owl", } } @@ -50,7 +50,9 @@ def test_get_ontology_info_file_default(mock_ontology_info_file): ontology_info = _get_ontology_info_file(ontology_info_file=mock_ontology_info_file) # Assertion - assert ontology_info == {"ontology_name": {"source": "http://example.com", "version": "v1", "filetype": "owl"}} + assert ontology_info == { + "ontology_name": {"source": "http://example.com", "version": "v1", "filename": "ontology_name.owl"} + } def test_get_ontology_info_file_version(mock_ontology_info_file):