Skip to content

Commit

Permalink
use obo foundry purl or homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
korikuzma committed Dec 30, 2024
1 parent 7e1ec5a commit be907bc
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 33 deletions.
3 changes: 3 additions & 0 deletions src/disease/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 22 additions & 22 deletions src/disease/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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",
},
Expand Down
2 changes: 1 addition & 1 deletion tests/data/do/do_20240731.owl
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@
<owl:annotatedSource rdf:resource="http://purl.obolibrary.org/obo/DOID_0080601"/>
<owl:annotatedProperty rdf:resource="http://purl.obolibrary.org/obo/IAO_0000115"/>
<owl:annotatedTarget xml:lang="en">A benign neoplasm that derives_from germ cells.</owl:annotatedTarget>
<oboInOwl:hasDbXref>url:https://en.wikipedia.org/wiki/Germ_cell_tumor</oboInOwl:hasDbXref>
<oboInOwl:hasDbXref>url:https://en.wikipedia.orgGerm_cell_tumor</oboInOwl:hasDbXref>
</owl:Axiom>


Expand Down
2 changes: 1 addition & 1 deletion tests/data/mondo/mondo_20241203.obo
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
18 changes: 9 additions & 9 deletions tests/unit/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand All @@ -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",
},
Expand All @@ -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",
},
Expand Down Expand Up @@ -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",
},
{
Expand All @@ -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",
},
Expand Down

0 comments on commit be907bc

Please sign in to comment.