Warn on ambiguous gene name lookup (2.1.1) - #46
Merged
Conversation
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.
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 checkedgene.idcollisions, and even that check was buggy: it testedgene.id in idx, whereidxis 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:
Test plan
pytestsuite passes (21 passed), including a new regression test covering both id and name collision warningsflake8/blackcleanpython -m build+twine check dist/*pass at 2.1.1