Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove unnecessary .lower() call when creating concept mapping #387

Merged
merged 1 commit into from
Dec 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading