Skip to content

Add more optimised find methods for BioSequences#331

Merged
jakobnissen merged 8 commits intoBioJulia:masterfrom
jakobnissen:findnext
Apr 27, 2025
Merged

Add more optimised find methods for BioSequences#331
jakobnissen merged 8 commits intoBioJulia:masterfrom
jakobnissen:findnext

Conversation

@jakobnissen
Copy link
Member

@jakobnissen jakobnissen commented Apr 26, 2025

This adds SIMD optimised methods for findprev and findnext (and therefore, by extension findfirst and findlast) for the predicates !isgap, iscertain, !iscertain, isambiguous and !isambiguous for the default alphabets for LongSequence and LongSubSeq

The purpose of these is to find e.g. regions of N's in a sequence, or find the first symbol in a long DNA sequence which is not a gap or an unambiguous symbol.

Some benchmarks for AA - nucleotide benchmarks are even better:

s = randaaseq(100_000)
@btime findfirst(isgap, s)
@btime findfirst(isambiguous, s)
@btime findfirst(!iscertain, s)
for i in eachindex(s)
   s[i] = AA_B
end
@btime findfirst(!isambiguous, s)
@btime findfirst(iscertain, s)

Before:
1.738 μs (0 allocations: 0 bytes)
39.195 μs (0 allocations: 0 bytes)
39.195 μs (0 allocations: 0 bytes)
39.205 μs (0 allocations: 0 bytes)
39.205 μs (0 allocations: 0 bytes)

After:
1.894 μs (0 allocations: 0 bytes)
3.270 μs (0 allocations: 0 bytes)
5.500 μs (0 allocations: 0 bytes)
3.240 μs (0 allocations: 0 bytes)
4.530 μs (0 allocations: 0 bytes)

@codecov
Copy link

codecov bot commented Apr 26, 2025

Codecov Report

Attention: Patch coverage is 99.36709% with 1 line in your changes missing coverage. Please review.

Project coverage is 91.87%. Comparing base (95d9218) to head (0d48bdf).
Report is 19 commits behind head on master.

Files with missing lines Patch % Lines
src/biosequence/find.jl 96.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #331      +/-   ##
==========================================
+ Coverage   90.87%   91.87%   +0.99%     
==========================================
  Files          31       29       -2     
  Lines        2400     2805     +405     
==========================================
+ Hits         2181     2577     +396     
- Misses        219      228       +9     
Flag Coverage Δ
unittests 91.87% <99.36%> (+0.99%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

@jakobnissen jakobnissen linked an issue Apr 27, 2025 that may be closed by this pull request
@jakobnissen jakobnissen marked this pull request as ready for review April 27, 2025 15:40
@jakobnissen jakobnissen merged commit 4a03043 into BioJulia:master Apr 27, 2025
22 checks passed
@jakobnissen jakobnissen deleted the findnext branch April 27, 2025 15:51
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.

Add optimised find functions

1 participant