Skip to content

Warn on ambiguous gene name lookup (2.1.1) - #46

Merged
YalanBi merged 2 commits into
masterfrom
fix/warn-ambiguous-gene-lookup
Aug 5, 2026
Merged

Warn on ambiguous gene name lookup (2.1.1)#46
YalanBi merged 2 commits into
masterfrom
fix/warn-ambiguous-gene-lookup

Conversation

@YalanBi

@YalanBi YalanBi commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #27: Transcriptome[...] gene lookup by name silently returned an arbitrary gene when the name was shared by multiple genes -- no warning at all.

make_index() only checked gene.id collisions, and even that check was buggy: it tested gene.id in idx, where idx is the combined id+name index, not an id-only set -- so it could miss real id collisions or false-positive on an id/name cross-match. Gene name collisions (expected in real annotation: paralogs, duplicated symbols) were completely unchecked.

Fix tracks id and name collisions independently, each with its own warning:

  • id collision: a real anomaly (ids should be unique) -- warns with both conflicting genes shown.
  • name collision: expected/common, not inherently wrong -- warns that lookup-by-name is ambiguous and suggests using the id instead.

Test plan

  • Full pytest suite passes (21 passed), including a new regression test covering both id and name collision warnings
  • Verified the new test fails against the pre-fix code (name collision was silently unwarned)
  • Verified via a fresh independent clone of the pushed branch
  • flake8/black clean
  • python -m build + twine check dist/* pass at 2.1.1
  • CI green across the full matrix

YalanBi added 2 commits August 5, 2026 17:30
make_index() only checked gene.id collisions, and even that check was
buggy -- it tested gene.id against the combined id+name index rather
than ids alone. Gene *name* collisions (common in real annotation:
paralogs, duplicated symbols) were completely silent, with the second
gene silently overwriting the first in the name-based index.

Track id and name collisions separately with distinct warnings: id
collisions are a real anomaly (ids should be unique), name collisions
are expected and just need a heads-up that lookup-by-name is
ambiguous. Closes #27.
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@YalanBi YalanBi self-assigned this Aug 5, 2026
@YalanBi YalanBi added the bug Something isn't working label Aug 5, 2026
@YalanBi
YalanBi merged commit 00cf68b into master Aug 5, 2026
19 checks passed
@YalanBi
YalanBi deleted the fix/warn-ambiguous-gene-lookup branch August 5, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lookup of Gene object in Transcriptome should warn if identifier is not unique

1 participant