Skip to content

Keep the metacoder taxonomy graph as one tree - #9

Merged
dsmutin merged 1 commit into
mainfrom
cursor/readme-examples-report-49fb
Sep 25, 2026
Merged

dsmutin merged 1 commit into
mainfrom
cursor/readme-examples-report-49fb

Conversation

@dsmutin

@dsmutin dsmutin commented Sep 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Metacoder heat trees and engine = "metacoder" differential trees were a forest: missing ranks became nodes named NA, and genus/species parsed from labels had one root per genus.
  • Those nodes are now dropped and their children reattached, the same way metacoder::parse_phyloseq filters taxa named "NA". A root node is added only when the remaining ranks do not already share one parent.
  • phyloseq_to_metacoder() uses that construction for archi_phyloseq lists, and parse_phyloseq for a real phyloseq object when that result is already one tree.
  • The README heat tree is rendered again from the Kraken rank table, so the picture is one lineage under Bacteria.

Verification

  • Genus and species Kraken taxmaps have one root (Bacteria), no nodes named NA, and every other node has exactly one parent
  • A two-kingdom table and a label-only table each get a single root
  • Harness visualization tests pass with metacoder installed
Open in Web Open in Cursor 

Empty ranks were parsed as nodes named NA, and genus/species labels
without a shared kingdom became a forest. Drop those nodes and reattach
their children the way parse_phyloseq does, and add a root only when the
remaining ranks do not already share one parent.

Co-authored-by: dvsmutin <dvsmutin@gmail.com>
@dsmutin
dsmutin marked this pull request as ready for review September 25, 2026 09:58
@dsmutin
dsmutin merged commit 659551f into main Sep 25, 2026
1 check passed
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.

2 participants