test: restore sequence diversity in prefilter fixtures - #104
Merged
Conversation
(cherry picked from commit d0c7a1b)
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.
Closes #103. Fix authored by @marcus-campbell — cherry-picked from
https://github.com/marcus-campbell/arda/tree/fix-prefilter-random-fixtures with authorship preserved.
"".join(random.Random(seed).choice("ACGT") for _ in range(n))builds a fresh RNG per draw, soevery
choice()returns the same base. Six prefilter fixtures were homopolymers, not varieddeterministic DNA — seeds 1/3/8 gave poly-C, 2/6 poly-A, 5 poly-G. The tests passed while
exercising almost none of the diversity they read as covering:
test_unrelated_sequence_is_rejectedwas asserting k-mer specificity against a poly-C target.
The fix hoists the RNG into
_random_dna(seed, length)and advances it once per base.test_keep_records_indexes_the_fasta_mmseqs_searchesgets a second fix. Its FASTA is deliberatelyline-wrapped at 150 to assert
_read_fasta_seqsjoins the lines, but the querytarget[100:200]would still hit on k-mers wholly inside line 1 — so a reader that indexed the two lines separately
passed anyway. The query is now
target[142:158]: the single 16-mer straddling the wrap, presentexactly once in the joined sequence and in neither line alone.
No source change; tests only.
Verification
tests/unit/test_prefilter.py— 10 passedtests/unit tests/synthetic tests/realworld— 968 passed, 9 skippedruff 0.15.9 check src/ tests/unit/test_prefilter.py— clean🤖 Generated with Claude Code