diff --git a/src/disease/query.py b/src/disease/query.py index 0d72c3a..381b1e5 100644 --- a/src/disease/query.py +++ b/src/disease/query.py @@ -335,6 +335,9 @@ def _create_concept_mapping( ) -> ConceptMapping: """Create concept mapping for identifier + ``system`` will use OBO Foundry persistent URL (PURL), source homepage, or + namespace prefix, in that order of preference, if available. + :param concept_id: Concept identifier represented as a curie :param relation: SKOS mapping relationship, default is relatedMatch :return: Concept mapping for identifier diff --git a/src/disease/schemas.py b/src/disease/schemas.py index d2dda2b..647dcf9 100644 --- a/src/disease/schemas.py +++ b/src/disease/schemas.py @@ -88,28 +88,28 @@ class NamespacePrefix(Enum): WIKIDATA = "wikidata" -# Source to URI (from identifiers.org, if found) +# Source to URI. Will use OBO Foundry persistent URL (PURL) or source homepage NAMESPACE_TO_SYSTEM_URI: dict[NamespacePrefix, str] = { - NamespacePrefix.NCIT: "https://www.ebi.ac.uk/ols4/ontologies/ncit/classes?short_form=NCIT_", - NamespacePrefix.MONDO: "https://monarchinitiative.org/MONDO:", - NamespacePrefix.DO: "https://www.ebi.ac.uk/ols4/ontologies/doid/terms?obo_id=DOID:", - NamespacePrefix.DOID: "https://www.ebi.ac.uk/ols4/ontologies/doid/terms?obo_id=DOID:", - NamespacePrefix.OMIM: "https://www.omim.org/entry/", - NamespacePrefix.ONCOTREE: "https://oncotree.mskcc.org/?version=oncotree_latest_stable&field=NAME&search=", - NamespacePrefix.EFO: "https://www.ebi.ac.uk/efo/EFO_", - NamespacePrefix.HP: "https://hpo.jax.org/app/browse/term/HP:", - NamespacePrefix.HPO: "https://hpo.jax.org/app/browse/term/HP:", - NamespacePrefix.KEGG: "https://www.kegg.jp/entry/", - NamespacePrefix.MEDDRA: "https://purl.bioontology.org/ontology/MEDDRA/", + NamespacePrefix.NCIT: "http://purl.obolibrary.org/obo/ncit.owl", + NamespacePrefix.MONDO: "http://purl.obolibrary.org/obo/mondo.owl", + NamespacePrefix.DO: "http://purl.obolibrary.org/obo/doid.owl", + NamespacePrefix.DOID: "http://purl.obolibrary.org/obo/doid.owl", + NamespacePrefix.OMIM: "https://www.omim.org", + NamespacePrefix.ONCOTREE: "https://oncotree.mskcc.org", + NamespacePrefix.EFO: "https://www.ebi.ac.uk/efo", + NamespacePrefix.HP: "http://purl.obolibrary.org/obo/hp.owl", + NamespacePrefix.HPO: "http://purl.obolibrary.org/obo/hp.owl", + NamespacePrefix.KEGG: "https://www.genome.jp/kegg/disease/", + NamespacePrefix.MEDDRA: "https://www.meddra.org/", NamespacePrefix.MEDGEN: "https://www.ncbi.nlm.nih.gov/medgen/", NamespacePrefix.MESH: "https://id.nlm.nih.gov/mesh/", - NamespacePrefix.MP: "https://www.ebi.ac.uk/ols4/ontologies/mp/terms?obo_id=MP:", - NamespacePrefix.OBI: "https://purl.obolibrary.org/obo/", - NamespacePrefix.ORPHANET: "https://www.orpha.net/consor/cgi-bin/OC_Exp.php?Lng=EN&Expert=", - NamespacePrefix.PATO: "https://www.ebi.ac.uk/ols4/ontologies/pato/terms?obo_id=PATO:", - NamespacePrefix.UMLS: "https://linkedlifedata.com/resource/umls/id/", - NamespacePrefix.WIKIPEDIA: "https://en.wikipedia.org/wiki/", - NamespacePrefix.WIKIDATA: "https://www.wikidata.org/entity/", + NamespacePrefix.MP: "http://purl.obolibrary.org/obo/mp.owl", + NamespacePrefix.OBI: "http://purl.obolibrary.org/obo/obi.owl", + NamespacePrefix.ORPHANET: "https://www.orpha.net", + NamespacePrefix.PATO: "http://purl.obolibrary.org/obo/pato.owl", + NamespacePrefix.UMLS: "https://www.nlm.nih.gov/research/umls/index.html", + NamespacePrefix.WIKIPEDIA: "https://en.wikipedia.org", + NamespacePrefix.WIKIDATA: "https://www.wikidata.org", } # URI to source @@ -318,21 +318,21 @@ class NormalizationService(BaseModel): { "coding": { "code": "0004355", - "system": "https://monarchinitiative.org/MONDO:", + "system": "http://purl.obolibrary.org/obo/mondo.owl", }, "relation": "relatedMatch", }, { "coding": { "code": "7757", - "system": "https://www.ebi.ac.uk/ols4/ontologies/doid/terms?obo_id=DOID:", + "system": "http://purl.obolibrary.org/obo/doid.owl", }, "relation": "relatedMatch", }, { "coding": { "code": "C1332977", - "system": "https://linkedlifedata.com/resource/umls/id/", + "system": "https://www.nlm.nih.gov/research/umls/index.html", }, "relation": "relatedMatch", }, diff --git a/tests/data/do/do_20240731.owl b/tests/data/do/do_20240731.owl index b8cc5f8..b926993 100644 --- a/tests/data/do/do_20240731.owl +++ b/tests/data/do/do_20240731.owl @@ -801,7 +801,7 @@ A benign neoplasm that derives_from germ cells. - url:https://en.wikipedia.org/wiki/Germ_cell_tumor + url:https://en.wikipedia.orgGerm_cell_tumor diff --git a/tests/data/mondo/mondo_20241203.obo b/tests/data/mondo/mondo_20241203.obo index e354b7f..70a997c 100644 --- a/tests/data/mondo/mondo_20241203.obo +++ b/tests/data/mondo/mondo_20241203.obo @@ -76,7 +76,7 @@ property_value: terms:source http://purl.obolibrary.org/obo/ncbitaxon.owl property_value: terms:source http://purl.obolibrary.org/obo/ncit.owl property_value: terms:source http://purl.obolibrary.org/obo/uberon.owl property_value: terms:source http://www.orpha.net/ontology/orphanet.owl -property_value: terms:source https://id.nlm.nih.gov/mesh/ +property_value: terms:source https://identifiers.org/mesh: property_value: terms:source https://rarediseases.info.nih.gov/ [Term] diff --git a/tests/unit/test_query.py b/tests/unit/test_query.py index 10f5614..da6eaaf 100644 --- a/tests/unit/test_query.py +++ b/tests/unit/test_query.py @@ -26,28 +26,28 @@ def neuroblastoma(): { "coding": { "code": "0005072", - "system": "https://monarchinitiative.org/MONDO:", + "system": "http://purl.obolibrary.org/obo/mondo.owl", }, "relation": "relatedMatch", }, { "coding": { "code": "NBL", - "system": "https://oncotree.mskcc.org/?version=oncotree_latest_stable&field=NAME&search=", + "system": "https://oncotree.mskcc.org", }, "relation": "relatedMatch", }, { "coding": { "code": "769", - "system": "https://www.ebi.ac.uk/ols4/ontologies/doid/terms?obo_id=DOID:", + "system": "http://purl.obolibrary.org/obo/doid.owl", }, "relation": "relatedMatch", }, { "coding": { "code": "C0027819", - "system": "https://linkedlifedata.com/resource/umls/id/", + "system": "https://www.nlm.nih.gov/research/umls/index.html", }, "relation": "relatedMatch", }, @@ -58,7 +58,7 @@ def neuroblastoma(): { "coding": { "code": "0000621", - "system": "https://www.ebi.ac.uk/efo/EFO_", + "system": "https://www.ebi.ac.uk/efo", }, "relation": "relatedMatch", }, @@ -73,14 +73,14 @@ def neuroblastoma(): { "coding": { "code": "635", - "system": "https://www.orpha.net/consor/cgi-bin/OC_Exp.php?Lng=EN&Expert=", + "system": "https://www.orpha.net", }, "relation": "relatedMatch", }, { "coding": { "code": "C2751421", - "system": "https://linkedlifedata.com/resource/umls/id/", + "system": "https://www.nlm.nih.gov/research/umls/index.html", }, "relation": "relatedMatch", }, @@ -136,7 +136,7 @@ def mafd2(): label="major affective disorder 2", mappings=[ { - "coding": {"code": "309200", "system": "https://www.omim.org/entry/"}, + "coding": {"code": "309200", "system": "https://www.omim.org"}, "relation": "relatedMatch", }, { @@ -153,7 +153,7 @@ def mafd2(): { "coding": { "code": "C1839839", - "system": "https://linkedlifedata.com/resource/umls/id/", + "system": "https://www.nlm.nih.gov/research/umls/index.html", }, "relation": "relatedMatch", },