Skip to content

Commit

Permalink
refactor: remove unnecessary .lower() call when creating concept ma…
Browse files Browse the repository at this point in the history
…pping (#387)

also updates docstring
  • Loading branch information
korikuzma authored Dec 28, 2024
1 parent ad6edf1 commit f217f66
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/gene/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ def _add_gene(
:param record: Gene record
:param match_type: query's match type
:param possible_concepts: List of other normalized concepts found
:raises ValueError: If source of record's concept ID or xrefs/associated with
sources is not a valid ``NamespacePrefix``
:return: Response with core Gene
"""

Expand All @@ -404,16 +406,18 @@ def _create_concept_mapping(
) -> ConceptMapping:
"""Create concept mapping for identifier
:param concept_id: Concept identifier represented as a curie
:param concept_id: A lowercase concept identifier represented as a curie
:param relation: SKOS mapping relationship, default is relatedMatch
:raises ValueError: If source of concept ID is not a valid
``NamespacePrefix``
:return: Concept mapping for identifier
"""
source, source_id = concept_id.split(":")

try:
source = NamespacePrefix(source.lower())
source = NamespacePrefix(source)
except ValueError as e:
err_msg = f"Namespace prefix not supported: {source.lower()}"
err_msg = f"Namespace prefix not supported: {source}"
raise ValueError(err_msg) from e

system = NAMESPACE_TO_SYSTEM_URI.get(source, source)
Expand Down

0 comments on commit f217f66

Please sign in to comment.