Skip to content

test: restore sequence diversity in prefilter fixtures - #104

Merged
mikessh merged 1 commit into
masterfrom
fix/prefilter-random-fixtures
Aug 15, 2026
Merged

test: restore sequence diversity in prefilter fixtures#104
mikessh merged 1 commit into
masterfrom
fix/prefilter-random-fixtures

Conversation

@mikessh

@mikessh mikessh commented Aug 15, 2026

Copy link
Copy Markdown
Member

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, so
every choice() returns the same base. Six prefilter fixtures were homopolymers, not varied
deterministic 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_rejected
was 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_searches gets a second fix. Its FASTA is deliberately
line-wrapped at 150 to assert _read_fasta_seqs joins the lines, but the query target[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, present
exactly once in the joined sequence and in neither line alone.

No source change; tests only.

Verification

  • tests/unit/test_prefilter.py — 10 passed
  • tests/unit tests/synthetic tests/realworld — 968 passed, 9 skipped
  • ruff 0.15.9 check src/ tests/unit/test_prefilter.py — clean

🤖 Generated with Claude Code

@mikessh
mikessh merged commit 3a37e39 into master Aug 15, 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.

Prefilter tests generate homopolymer fixtures instead of varied seeded DNA

2 participants