Skip to content

Commit 33e9a20

Browse files
Add par_iter_kmer_ambiguity_with_buf
1 parent 09a579a commit 33e9a20

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

src/packed_seq.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,6 +1395,42 @@ impl<'s> PackedSeqBase<'s, 1> {
13951395
)
13961396
.advance(skip)
13971397
}
1398+
1399+
#[inline(always)]
1400+
pub fn par_iter_kmer_ambiguity_with_buf(
1401+
self,
1402+
k: usize,
1403+
context: usize,
1404+
skip: usize,
1405+
buf: &'s mut Vec<S>,
1406+
) -> PaddedIt<impl ChunkIt<S> + use<'s>> {
1407+
#[cfg(target_endian = "big")]
1408+
panic!("Big endian architectures are not supported.");
1409+
1410+
assert!(k > 0, "par_iter_kmers requires k>0, but k={k}");
1411+
assert!(k <= 96, "par_iter_kmers requires k<=96, but k={k}");
1412+
1413+
let this = self.normalize();
1414+
let o = this.offset;
1415+
assert!(o < Self::C8);
1416+
1417+
let delay = k - 1;
1418+
1419+
let it = self.par_iter_bp_delayed_with_buf(context, Delay(delay), buf);
1420+
1421+
let mut cnt = u32x8::ZERO;
1422+
1423+
it.map(
1424+
#[inline(always)]
1425+
move |(a, r)| {
1426+
cnt += a;
1427+
let out = cnt.cmp_gt(S::ZERO);
1428+
cnt -= r;
1429+
out
1430+
},
1431+
)
1432+
.advance(skip)
1433+
}
13981434
}
13991435

14001436
#[cfg(target_feature = "neon")]

0 commit comments

Comments
 (0)