Skip to main content

reverse_buf_value

Function reverse_buf_value 

Source
pub fn reverse_buf_value(value: &Value) -> Value
Expand description

Reverses a BufValue (array or string).

This function reverses per-base tag values to match read orientation when reads are mapped to the negative strand. Arrays and strings are reversed element-wise.

Supported types:

  • Arrays of any numeric type (i8, u8, i16, u16, i32, u32, f32)
  • Strings (character order reversed)

Other value types (integers, floats, characters) are returned unchanged.

§Arguments

  • value - The value to reverse

§Returns

A new BufValue with reversed contents, or a clone if not reversible

§Examples

// Reverse per-base quality scores for negative strand read
let quals = BufValue::Array(UInt8(vec![30, 25, 20, 15]));
let reversed = reverse_buf_value(&quals);
// Result: Array(UInt8(vec![15, 20, 25, 30]))