Skip to content

ENH: update extract-annotations to generate per-contig feature table#328

Merged
misialq merged 11 commits into
bokulich-lab:mainfrom
misialq:contig-collapse-functional
Jun 11, 2026
Merged

ENH: update extract-annotations to generate per-contig feature table#328
misialq merged 11 commits into
bokulich-lab:mainfrom
misialq:contig-collapse-functional

Conversation

@misialq

@misialq misialq commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

Description

Closes #311.

AI Disclosure

  • NO AI USED.
  • AI USED.

AI Usage Details

Codex was used during some early stage ideating. All the code was reviewed and tested before PR submission.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enhances the EggNOG extract_annotations action to generate per-contig annotation counts and a function→contigs feature map in addition to the existing per-genome annotation counts.

Changes:

  • Updated extract_annotations to return three outputs: per-genome counts table, function→contigs map, and per-contig counts table.
  • Updated QIIME 2 plugin registration to expose the new outputs/types.
  • Expanded unit tests and adjusted EggNOG test annotation fixture data to reflect per-contig behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
q2_annotate/plugin_setup.py Registers new outputs for extract_annotations, including FeatureMap[FunctionToContigs] and a per-contig FeatureTable[Frequency].
q2_annotate/eggnog/annotation.py Refactors extraction to compute per-contig counts and build/merge function→contigs maps.
q2_annotate/eggnog/tests/test_annotation.py Updates tests for new return signature and adds coverage for map merging.
q2_annotate/eggnog/tests/data/annotations/1e9ffc02-0847-4f2c-b1e2-3965a4a78b15.emapper.annotations Adjusts fixture data to include a second contig for validating per-contig aggregation.
Comments suppressed due to low confidence (1)

q2_annotate/plugin_setup.py:1827

  • The registered method description/name still says it "calculates its frequencies across all MAGs", but the method now also returns a per-contig feature table and a function→contigs feature map. Update the name/description (and/or output descriptions) to reflect the new behavior so users understand what the extra outputs represent.
    name="Extract annotation frequencies from all annotations.",
    description=(
        "This method extract a specific annotation from the table "
        "generated by EggNOG and calculates its frequencies across "
        "all MAGs."

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread q2_annotate/eggnog/annotation.py Outdated
Comment thread q2_annotate/eggnog/tests/test_annotation.py
@misialq misialq marked this pull request as ready for review January 28, 2026 15:45
@codecov

codecov Bot commented Feb 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.11765% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.50%. Comparing base (03def26) to head (c76890f).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
q2_annotate/eggnog/annotation.py 93.93% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #328      +/-   ##
==========================================
- Coverage   94.53%   94.50%   -0.03%     
==========================================
  Files          38       38              
  Lines        2854     2875      +21     
  Branches      435      437       +2     
==========================================
+ Hits         2698     2717      +19     
- Misses         78       79       +1     
- Partials       78       79       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@VinzentRisch VinzentRisch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello

I ran the code with some test data and it all looks good. I have some minor suggestions below:

Comment thread q2_annotate/plugin_setup.py
Comment thread q2_annotate/eggnog/annotation.py
Comment thread q2_annotate/eggnog/annotation.py
@misialq misialq requested a review from VinzentRisch June 11, 2026 14:37

@VinzentRisch VinzentRisch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good :)

@misialq

misialq commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @VinzentRisch! 🙏

@misialq misialq merged commit 86dbe5c into bokulich-lab:main Jun 11, 2026
11 checks passed
@misialq misialq deleted the contig-collapse-functional branch June 11, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ENH: allow grouping by either samples or features with the action qiime annotate extract-annotations

3 participants