Repository navigation
fix: accept case/plural EC/GO annotation key variants in annotate (addresses #96) - #104
Merged
nextgenusfs merged 1 commit intoOct 19, 2026
Conversation
…dresses nextgenusfs#96) annotate() merged functional annotations with exact-key checks (`if "ec_number" in fa` / `if "go_terms" in fa`), but eggNOG / funannotate2-addons emit the EC number under `EC_number` and InterProScan emits GO terms under `go_term` (singular), so those annotations were silently dropped. In the reporter's dataset, a local patch for these keys recovered 5,296 GO terms. Add utilities.resolve_annotation_key(), which resolves the canonical funannotate2 key (ec_number/go_terms) tolerant of the known case/plural variants. A key that actually carries data is preferred, so an empty canonical key never hides a populated variant; when both carry data the canonical key wins, so canonical-key inputs are unchanged. Route the EC/GO merge in annotate() through it. Addresses the EC/GO portion of nextgenusfs#96. The InterPro/SignalP summary counts the reporter also notes are computed in the gfftk dependency (gfftk/stats.py) and are out of scope here. New tests: tests/unit/test_utilities_annotation.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Addresses the EC/GO portion of #96.
Problem
annotate()merges functional annotations with exact-key checks:but eggNOG / funannotate2-addons write the EC number as
EC_number, and InterProScan writes GO terms asgo_term(singular). Those annotations were loaded and then silently dropped. In the #96 reporter's data, a local patch for these keys recovered 5,296 GO terms.Fix
Adds
utilities.resolve_annotation_key(fa, canonical_key), which finds the key present in an annotation dict forec_number/go_terms, tolerant of those known variants. A key that actually carries data is preferred, so an empty canonical key never hides a populated variant; when both carry data the canonical key wins, so existing canonical-key inputs behave exactly as before. The EC/GO merge inannotate()now goes through it.Scope
This covers the EC and GO keys from #96. The InterPro/SignalP summary counts the reporter also mentions are computed in the gfftk dependency (
gfftk/stats.py), so they aren't changed here.Tests
New
tests/unit/test_utilities_annotation.py(9 tests): canonical keys, theEC_number/go_termvariants, a populated variant winning over an empty canonical key, the canonical key winning when both are populated, absent keys, unknown keys matching only themselves, and a present-but-Nonevalue being preserved.Full unit suite run locally on top of current
main: 205 passed vs 196 on unmodifiedmain. The difference is the 9 new tests, with no regressions. (Run on Windows, whereannorefineandgapmm2don't install, sotest_predict*.pydidn't run locally, and one tmpdir test fails identically onmainbecause it expects a/tmppath. CI here should cover those.)🤖 Generated with Claude Code