bitnuc

Function from_2bit_alloc

Source
pub fn from_2bit_alloc(
    packed: u64,
    expected_size: usize,
) -> Result<Vec<u8>, NucleotideError>
Expand description

This calls from_2bit but allocates a new Vec to store the result.

§Arguments

  • packed - A u64 containing the 2-bit packed sequence
  • expected_size - The number of bases to unpack

§Returns

Returns a Vec<u8> containing the ASCII sequence.

§Errors

Returns NucleotideError::InvalidLength if expected_size is greater than 32

§Examples

Basic unpacking:

use bitnuc::from_2bit_alloc;

let packed = 0b11100100; // "ACGT" in 2-bit encoding
let seq = from_2bit_alloc(packed, 4)?;
assert_eq!(&seq, b"ACGT");