Skip to content

Bqtools 0.5.5#173

Merged
noamteyssier merged 18 commits intomainfrom
bqtools-0.5.5
Mar 27, 2026
Merged

Bqtools 0.5.5#173
noamteyssier merged 18 commits intomainfrom
bqtools-0.5.5

Conversation

@noamteyssier
Copy link
Copy Markdown
Collaborator

close #172
close #171

@noamteyssier noamteyssier merged commit f6cb78f into main Mar 27, 2026
6 checks passed
@noamteyssier noamteyssier deleted the bqtools-0.5.5 branch March 27, 2026 02:15
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates project dependencies, including a bump to rand 0.10.0 and sassy 0.2.1, and refactors the fuzzy matching logic in FuzzyMatcher and FuzzyPatternCounter to use EncodedPatterns and FixedBitSet. These changes optimize pattern matching and improve the handling of multi-pattern logic across sequence mates. The test suite was also updated to replace the nucgen dependency with a local nucleotide generation utility. Feedback was provided regarding an incorrect API call to the rand crate in the new test utility, along with a suggestion to use SliceRandom for a more idiomatic implementation.

Comment on lines +108 to +121
fn fill_nucleotide_buffer<R: Rng>(buffer: &mut Vec<u8>, rng: &mut R, slen: usize) {
buffer.clear();
buffer.reserve(slen);
for _ in 0..slen {
buffer.push(match rng.random_range(0..=4) {
0 => b'A',
1 => b'C',
2 => b'G',
3 => b'T',
4 => b'N',
_ => unreachable!(),
});
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The method random_range does not exist on the Rng trait in rand v0.10.0. It seems you intended to use gen_range.

This function can also be made more idiomatic and concise by using rand::seq::SliceRandom::choose to select a random nucleotide. This avoids the match statement and unreachable! panic.

You'll need to add use rand::seq::SliceRandom; to your imports.

fn fill_nucleotide_buffer<R: Rng>(buffer: &mut Vec<u8>, rng: &mut R, slen: usize) {
    const NUCLEOTIDES: &[u8] = b"ACGTN";
    buffer.clear();
    buffer.reserve(slen);
    for _ in 0..slen {
        buffer.push(*NUCLEOTIDES.choose(rng).unwrap());
    }
}

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.

remove --index from recursive encoding docs fix: enforce grep just on the specified mate when provided

1 participant