Skip to content

fix: infer-roothogs no longer drops proteins (#114) - #131

Open
alpae wants to merge 2 commits into
devfrom
fix/roothog-dropouts
Open

alpae wants to merge 2 commits into
devfrom
fix/roothog-dropouts

Conversation

@alpae

@alpae alpae commented Nov 17, 2026

Copy link
Copy Markdown
Member

Fixes #114. Part of #124.

The four leak points

  • merge_rhogs2 overflow: a merge cluster bigger than --big-rhog-size is now split into consecutive rootHOGs below the limit. Each is named after its smallest rootHOG. Before, newhost was not reset between clusters, so the overflow host lost its own proteins. A cluster whose rootHOGs were all gone also reused the previous cluster's host. Merged member lists keep their order now (dict.fromkeys instead of set).

  • Proteins without any hogmap row are treated as unmapped, with a warning, so they reach the clustering of unmapped proteins. N/A rows of proteins that are not in the length-filtered proteome are now ignored instead of counted as unmapped.

  • Long ids: add_species_name_prot_id no longer truncates ids to 230 characters. The truncated id stopped matching the hogmap, so the protein vanished. fastoma-check-input already rejects ids longer than 60 characters, and that is now the only limit.

  • Minor isoforms: the unmapped proteins are now filtered by isoform selection too, so non-selected isoforms no longer reach linclust.

Accounting

  • Each grouping step in create_root_hogs checks that it neither loses nor duplicates a protein. Only filter_big_roothogs may remove proteins.
  • The stage checks that every protein that passed the length filter has OMAmer hits, is unmapped, or is a non-selected isoform.
  • This is the same safety net as in infer-subhogs (fix: infer-subhogs no longer drops proteins (#113) #130). A violation is logged and repaired: a lost protein is kept as a singleton rootHOG or treated as unmapped. With FASTOMA_STRICT_INVARIANTS set, a violation raises instead; the tests set it. The helper moved to FastOMA/_invariants.py.
  • A summary line logs where all proteins went: in rootHOGs, unmapped/singletons sent to clustering, isoforms not selected, removed from big rootHOGs.
  • fastoma-protein-trace counts the new kept_as_singleton_roothog event under its consistency checks.

Tests

  • The five strict xfails of infer-roothogs silently drops proteins #114 now pass and their markers are removed.

  • New tests cover the split order of oversized clusters, clusters whose rootHOGs are all gone, the safety net (strict and repair modes, losses and duplicates), and the isoform filter of unmapped proteins.

  • The characterisation tests that pinned the old behaviour are updated: missing hogmap rows, id truncation, and the synthetic stage accounting.

  • Full suite: 415 passed, 23 skipped, 10 xfaile

  • refactor: move the strict-invariants helper to FastOMA/_invariants.py

  • fix: infer-roothogs no longer drops proteins (infer-roothogs silently drops proteins #114)

so that infer-roothogs can use the same safety net as infer-subhogs (#114).
- merge_rhogs2: a cluster bigger than --big-rhog-size is split into consecutive rootHOGs below the
  limit; before, the overflow host was not reset between clusters and lost its own proteins, and a
  cluster whose rootHOGs were all gone reused the previous host.

- parse_hogmap_omamer: proteins without any hogmap row are treated as unmapped (with a warning), so
  they reach the clustering of unmapped proteins. N/A rows of proteins that are not in the
  (length-filtered) proteome are ignored.

- add_species_name_prot_id no longer truncates ids to 230 characters: the truncated id did not match
  the hogmap any more. fastoma-check-input rejects ids that are too long for FastTree.

- the unmapped proteins are filtered by isoform selection too, so minor isoforms no longer reach
  linclust.

- every grouping step checks that it neither loses nor duplicates a protein (only
  filter_big_roothogs may remove proteins), and the stage checks that every protein has OMAmer hits,
  is unmapped, or is a minor isoform. As in infer-subhogs, a violation is logged and repaired, and
  raises with FASTOMA_STRICT_INVARIANTS (set in the tests). A summary line logs where all proteins
  went.
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.

1 participant