Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/fgumi-sam/src/alignment_tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ pub fn regenerate_alignment_tags_raw(
let cigar_ops = fgumi_raw_bam::get_cigar_ops(record);

// Calculate reference span from CIGAR ops
let ref_span = fgumi_raw_bam::reference_length_from_cigar(&cigar_ops) as usize;
let ref_span = usize::try_from(fgumi_raw_bam::reference_length_from_cigar(&cigar_ops))
.context("CIGAR-derived reference span is negative")?;

// Handle edge case: CIGAR with no reference-consuming operations
if ref_span == 0 {
Expand Down
7 changes: 1 addition & 6 deletions crates/fgumi-sam/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,6 @@ pub fn reverse_buf_value(value: &BufValue) -> BufValue {
///
/// A new `BufValue` with reverse complemented sequence, or a clone if not a string
///
/// # Panics
///
/// Cannot panic in practice: the byte-level complement maps ASCII to ASCII,
/// so `String::from_utf8` always succeeds.
///
/// # Examples
///
/// ```rust,ignore
Expand All @@ -328,7 +323,7 @@ pub fn revcomp_buf_value(value: &BufValue) -> BufValue {
match value {
BufValue::String(s) => {
let revcomp = fgumi_dna::reverse_complement(s.as_bytes());
BufValue::from(String::from_utf8(revcomp).expect("complement of ASCII is ASCII"))
BufValue::from(String::from_utf8_lossy(&revcomp).into_owned())
}
_ => value.clone(),
}
Expand Down
Loading