Skip to content

Commit

Permalink
adding UCUM ontology support
Browse files Browse the repository at this point in the history
  • Loading branch information
pnrobinson committed Aug 31, 2024
1 parent 3c85188 commit b43a4a3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/pyphetools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from . import validation


__version__ = "0.9.102"
__version__ = "0.9.103"


__all__ = [
Expand Down
22 changes: 21 additions & 1 deletion src/pyphetools/pp/v202/_meta_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,14 @@ def omim(version:str) -> "Resource":

@staticmethod
def loinc(version:str) -> "Resource":
"""
LOINC does not offer a resource that we can address as if it were an OBO Foundry ontology
but the following should be unique within the Phenopacket ecosystem
"""
return Resource(id="loinc",
name="Logical Observation Identifier Names and Codes",
namespace_prefix="LOINC",
iri_prefix="http://purl.bioontology.org/ontology/LNC/",
iri_prefix="http://purl.bioontology.org/ontology/LOINC_",
url="https://loinc.org/",
version=version)

Expand All @@ -220,6 +224,19 @@ def sequence_ontology(version: str) -> "Resource":
iri_prefix="http://purl.obolibrary.org/obo/SO_",
url="http://purl.obolibrary.org/obo/so.obo",
version=version)

@staticmethod
def ucum(version: str) -> "Resource":
"""
UCUM does not offer a resource that we can address as if it were an OBO Foundry ontology
but the following should be unique within the Phenopacket ecosystem
"""
return Resource(id="ucum",
name="Unified Code for Units of Measure",
namespace_prefix="UCUM",
iri_prefix="https://ucum.org/UCUM_",
url="https://ucum.org/",
version=version)


class Update(MessageMixin):
Expand Down Expand Up @@ -491,6 +508,7 @@ def metadata_for_pmid(created_by:str,
MONDO_DEFAULT_VERSION = '2024-08-06'
SO_DEFAULT_VERSION = "2021-11-22"
LOINC_DEFAULT_VERSION = "2.78"
UCUM_DEFAULT_VERSION = "1.7"
if hpo_version is None:
hpo_version = HPO_DEFAULT_VERSION
hpo = Resource.hpo(hpo_version)
Expand All @@ -499,12 +517,14 @@ def metadata_for_pmid(created_by:str,
omim = Resource.omim(OMIM_DEFAULT_VERSION)
mondo = Resource.mondo(MONDO_DEFAULT_VERSION)
loinc = Resource.loinc(LOINC_DEFAULT_VERSION)
ucum = Resource.ucum(UCUM_DEFAULT_VERSION)
so = Resource.sequence_ontology(SO_DEFAULT_VERSION)
resources = [hpo, geno, hgnc, omim, so]
if include_mondo:
resources.append(mondo)
if include_loinc:
resources.append(loinc)
resources.append(ucum)

from datetime import datetime
now = datetime.now() # current date and time
Expand Down

0 comments on commit b43a4a3

Please sign in to comment.