Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
korikuzma committed Dec 26, 2024
1 parent e3e77e5 commit d77d05b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/gene/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from gene.database import AbstractDatabase, DatabaseReadException
from gene.schemas import (
NAMESPACE_TO_SYSTEM_URI,
SYSTEM_URI_TO_NAMESPACE,
BaseGene,
BaseNormalizationService,
Gene,
Expand Down Expand Up @@ -347,9 +348,9 @@ def _add_merged_meta(self, response: NormalizeService) -> NormalizeService:

sources = []
for m in gene.mappings or []:
for ns, system in NAMESPACE_TO_SYSTEM_URI.items():
if system == m.coding.system and ns.value in PREFIX_LOOKUP:
sources.append(PREFIX_LOOKUP[ns.value])
ns = SYSTEM_URI_TO_NAMESPACE.get(m.coding.system)
if ns in PREFIX_LOOKUP:
sources.append(PREFIX_LOOKUP[ns])

for src in sources:
if src not in sources_meta:
Expand Down
5 changes: 5 additions & 0 deletions src/gene/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@ class NamespacePrefix(Enum):
NamespacePrefix.IUPHAR: "https://www.guidetopharmacology.org/GRAC/ObjectDisplayForward?objectId=",
}

# URI to source
SYSTEM_URI_TO_NAMESPACE = {
system_uri: ns.value for ns, system_uri in NAMESPACE_TO_SYSTEM_URI.items()
}


class DataLicenseAttributes(BaseModel):
"""Define constraints for data license attributes."""
Expand Down

0 comments on commit d77d05b

Please sign in to comment.