Skip to content

Commit aa934f8

Browse files
Update malariagen_data/anoph/genome_features.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 9031f99 commit aa934f8

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

malariagen_data/anoph/genome_features.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,11 @@ def canonical_transcript(
372372
# Normalize input: strip whitespace
373373
gene_normalized = gene.strip()
374374

375+
# Reject empty identifiers after normalization to avoid ambiguous matches
376+
if not gene_normalized:
377+
raise ValueError(
378+
"Gene identifier is empty after stripping whitespace; please provide a valid gene ID or name."
379+
)
375380
# Try exact ID match first (case-sensitive)
376381
debug(f"Attempting ID match for '{gene_normalized}'")
377382
gene_id_match = df_genes[df_genes["ID"].str.strip() == gene_normalized]

0 commit comments

Comments
 (0)