Repository navigation
Add opt-in orientation-preserving lookup - #108
Open
adamant-pwn wants to merge 14 commits into
Open
adamant-pwn wants to merge 14 commits into
adamant-pwn wants to merge 14 commits into
Conversation
Indexes built without preserve_orientation are written exactly as v6, so existing readers keep loading them and resaving a v6 index reproduces it byte for byte. Only oriented indexes use major version 7, which appends the orientation flag. Readers that only know v6 reject them with a version mismatch instead of treating them as canonical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Depends on #102. The orientation change touches the bucket lookup that #102 refactors, so this branch is built on it. Once #102 is merged, the diff here reduces to the orientation change.
MetaGraph’s BASIC graphs assign distinct IDs to a k-mer and its reverse complement. This adds opt-in
build_configuration::preserve_orientationsupport while keeping the existing boolean lookup API. With this option enabled,lookup(kmer, false)requires the stored orientation.lookup(kmer, true)also accepts the reverse complement and prefers a forward match when both are present. Exact duplicate k-mers remain unsupported.The index format stays v6 unless the option is used. Dictionaries built without it are byte-identical to those written by master, so existing readers load them unchanged. A sha256 comparison on five of the bundled datasets, one of them weighted, confirmed this. Resaving a v6 index also reproduces the original file. Dictionaries built with the option are saved as v7, which is the v6 layout plus a one-byte orientation flag. Readers that only know v6 reject these files with the existing major-version error, so they never treat an oriented index as canonical. Old readers validate only the major version, so a flag stored anywhere else would be ignored by them.
Prepared with AI assistance.
🤖 Generated with Claude Code