pub struct SequenceEncoder { /* private fields */ }Expand description
A struct for encoding biological sequences into a compact, bit-packed format.
The SequenceEncoder is designed to efficiently encode sequences using a specified
alphabet type (e.g., DNA, protein, or ASCII). It uses a bit buffer to pack symbols
into bytes, minimizing memory usage while maintaining fast encoding performance.
§Fields
encoding_array- A lookup table that maps input bytes to their encoded values.bits_per_symbol- The number of bits used to represent each symbol in the sequence.encoded_sequence- A vector that stores the resulting bit-packed sequence.bit_pos- The current bit position in the encoded sequence.buffer- An internal bit buffer used for packing symbols into bytes.buffer_bits- The number of bits currently stored in the buffer.
§Usage
- Create a new
SequenceEncoderusing thenewmethod. - Add sequence chunks with the
updatemethod. - Call the
finalizemethod to retrieve the encoded sequence as aVec<u8>.
Implementations§
Auto Trait Implementations§
impl Freeze for SequenceEncoder
impl RefUnwindSafe for SequenceEncoder
impl Send for SequenceEncoder
impl Sync for SequenceEncoder
impl Unpin for SequenceEncoder
impl UnwindSafe for SequenceEncoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more