Skip to content

Feature: PHIBF - #348

Merged
eseiler merged 12 commits into
seqan:mainfrom
smehringer:phibf
Dec 2, 2026
Merged

eseiler merged 12 commits into
seqan:mainfrom
smehringer:phibf

Conversation

@smehringer

@smehringer smehringer commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

With some fixes analysed by CLaude

Depends on seqan/hibf#343

@seqan-actions seqan-actions added lint and removed lint labels Oct 12, 2026
Comment thread src/util/display_layout/general.cpp Resolved
@seqan-actions

Copy link
Copy Markdown
Member

Documentation preview available at https://docs.seqan.de/preview/seqan/chopper/348

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.78977% with 93 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.68%. Comparing base (59ea55f) to head (7998129).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/layout/partition_user_bins.cpp 83.90% 80 Missing ⚠️
src/set_up_parser.cpp 52.94% 8 Missing ⚠️
include/chopper/layout/fast_layout_cluster.hpp 28.57% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #348      +/-   ##
==========================================
- Coverage   94.68%   91.68%   -3.01%     
==========================================
  Files          25       28       +3     
  Lines        1299     1949     +650     
  Branches       20       67      +47     
==========================================
+ Hits         1230     1787     +557     
- Misses         69      162      +93     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@smehringer
smehringer requested a review from eseiler October 21, 2026 08:13
@seqan-actions seqan-actions added lint and removed lint labels Oct 21, 2026
@smehringer

Copy link
Copy Markdown
Member Author

I can't correctly display the remaining coverage problem. The one in set_up_parser seems bogus.

@eseiler

eseiler commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

I can't correctly display the remaining coverage problem. The one in set_up_parser seems bogus.

Multi-line constructors and such are sometimes wrongly attributed by gcov, so those are bogus.

@seqan-actions seqan-actions added lint and removed lint labels Oct 26, 2026
smehringer and others added 7 commits December 2, 2026 19:25
lsh_hash_the_sketch and LSH_fill_hashtable move from lsh_distributed_ibf_layout.cpp to the new
header lsh.hpp. LSH_fill_hashtable and LSH_find_representative_cluster become templates over the
cluster type, such that the partitioned HIBF can use them for clusters of clusters.

User bins with invalid MinHash sketches are still skipped, now per user bin. Such a user bin never
collides, so it always stays a single cluster, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With --number-of-partitions p >= 2, the user bins are distributed onto p partitions, and each
partition is laid out as a separate HIBF. The layout file contains one complete layout per
partition, one after another: the file names, the configuration and the layout, with
partition-local user bin indices. Each of them can be validated and read like a single layout.

--partitioning-approach (advanced) selects how the user bins are distributed: blocked, sorted,
folded, weighted_fold, similarity, lsh or lsh_sim. lsh and lsh_sim cluster similar user bins with
MinHash LSH and need MinHash sketches, which are now also computed for a partitioned HIBF.

Without --tmax, the tmax of each partition is chosen based on its number of user bins. The
partitioned HIBF cannot be combined with --fast-layout or --determine-best-tmax.

Configuration format version 4 stores number_of_partitions and partitioning_approach.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
display_layout general and sizes read the layouts of a layout file one after another and write the
statistics of each of them, also one after another. Each layout is validated after reading, as
before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
--number-of-partitions 0 failed an assertion in execute and, with NDEBUG, wrote to the first
element of an empty vector of partitions. The CLI now reports a parser error, and execute throws
std::invalid_argument.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
execute is documented to throw std::invalid_argument if a partitioned HIBF is combined with
fast_layout, and the CLI rejects this combination. execute instead laid out each partition with
fast_layout, which produced an invalid layout ("User bin 0 occupies zero technical bins").

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
execute replaced hibf_config.tmax by next_multiple_of_64(ceil(sqrt(n))) unless tmax_is_set, also for
a single HIBF. Only the CLI sets tmax_is_set, so API callers lost their tmax, e.g., 240 user bins
with tmax 128 were laid out with 64 technical bins. The CLI was not affected: without --tmax,
validate_and_set_defaults() computes the same value.

The tmax of each partition is now only chosen per partition for a partitioned HIBF.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
execute laid out every HIBF with a copy of the configuration and added back only the DP, union
estimation and rearrangement timers. For the fast layout, the timers of the LSH, the top-level
distribution and the small layouts stayed 0 in --timing-output, unlike on main.

A single HIBF is again laid out with the configuration itself. The partitions of a partitioned HIBF
use copies with their own timers, which start at 0, so that adding them back does not count the
input configuration's time twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eseiler and others added 5 commits December 2, 2026 19:44
The configuration written for each partition contained the tmax of the input configuration instead
of the tmax the partition was laid out with, e.g., 128 instead of 64 for 4200 user bins in two
partitions without --tmax. The layout was also validated against that tmax. In addition, execute
left the input configuration with the number of user bins of the last partition, which chopper
layout then wrote to the sketch file.

Each partition now has its own configuration with its tmax and number of user bins, which is used
for laying it out, validating it and writing it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With --output-verbose-statistics, the statistics of each partition were computed with the sketches
and cardinalities of all user bins, indexed by the partition-local user bin indices of its layout.
For example, partition 0 of the sorted approach, which holds the largest user bins, was reported
with the sketches of the user bins 0, 1, 2, ....

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The folded approach moves on to the next partition once a partition holds half the cardinality per
partition. If one user bin holds most k-mers, the remaining user bins may not fill the next
partition, so later partitions stayed empty, and partition_user_bins threw. This happened for 16 of
150 random inputs with heavy-tailed cardinalities (2 to 16 partitions, up to 315 user bins).

As in the sorted approach, it now also moves on if only as many user bins remain as partitions that
were not reached yet. The partitions of all other inputs are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The similarity approach shuffled the blocks of user bins that seed the partitions with a
std::random_device seed, so the partitions, and thereby the layout, changed between runs.

The blocks are now shuffled by a Fisher-Yates shuffle over std::mt19937_64 with its default seed.
Unlike std::shuffle, this gives the same order with every standard library.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
find_best_partition asserted that the union of a user bin and a partition is not estimated smaller
than the partition. Near the switch from linear counting to the raw estimate (2.5 * 4096 k-mers for
sketch_bits 12), HyperLogLog can estimate a superset smaller, e.g., 10'244 for 10'053 hashes and
10'279 for the first 10'052 of them. This failed the assertion; with NDEBUG, the difference wrapped
around in size_t, and the partition got no similarity.

The difference is now clamped to 0, as in find_best_technical_bin of the fast layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@seqan-pr-bot

seqan-pr-bot Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Documentation preview available at https://seqan.github.io/docs-preview/seqan/chopper/348/

@eseiler
eseiler merged commit 80ddba2 into seqan:main Dec 2, 2026
34 of 44 checks passed
@eseiler
eseiler deployed to docs-preview December 2, 2026 20:16 — with GitHub Actions Active

This branch was successfully deployed

1 active deployment
docs-preview — 7998129a Deployed Dec 2, 2026 by eseiler via Documentation Preview / Delete Preview #13
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.

3 participants