Skip to content

Commit 75838a5

Browse files
committed
Add expanded_cigar_iter
1 parent c291613 commit 75838a5

4 files changed

Lines changed: 10 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ is roughly based on [Keep a Changelog], and this project tries to adheres to
1212
- Added macros for facilitating floating point comparisons under the `fuzzing` feature
1313
- Implemented `Arbitrary` for PHMM-related types under the `fuzzing feature
1414
- Added `SamHmmWriter` for writing pHMMs to SAM model files
15+
- Added `expanded_cigar_iter` for iterating over the operations in a CIGAR string
1516

1617
### Changed
1718

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
edition = "2024"
33
name = "zoe"
4-
version = "0.0.18-dev"
4+
version = "0.0.19-dev"
55
rust-version = "1.88"
66
description = "A nightly library for viral genomics"
77
license = "Apache-2.0"

src/data/types/cigar/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ impl Cigar {
7373
CigletIterator::new(&self.0)
7474
}
7575

76+
/// Returns an iterator over the opcodes in the CIGAR string, with each
77+
/// repeated the number of times specified in the CIGAR string.
78+
#[inline]
79+
pub fn expanded_cigar_iter(&self) -> impl Iterator<Item = u8> {
80+
self.iter().flat_map(|Ciglet { inc, op }| std::iter::repeat_n(op, inc))
81+
}
82+
7683
/// Validates that a CIGAR only contains valid (inc, op) pairs
7784
#[inline]
7885
#[must_use]

0 commit comments

Comments
 (0)