Skip to main content

Table

Struct Table 

Source
pub struct Table<'a> { /* private fields */ }
Expand description

A view into a score table from an alignment result.

§Layout

  • Rows represent positions in the query sequence (0..query_len)
  • Columns represent positions in the reference sequence (0..ref_len)
  • Data is stored as a flattened 1D array: data[row * cols + col]

§Example

use parasail_rs::prelude::Aligner;

let query = b"ACGT";
let reference = b"ACGT";
let aligner = Aligner::new().use_table().build();
let result = aligner.align(Some(query), reference)?;

let table = result.get_score_table()?;
println!("Table dimensions: {} rows x {} cols", table.rows(), table.cols());

// Access specific cell
if let Some(score) = table.get(0, 0) {
    println!("Score at (0, 0): {}", score);
}

// Get final alignment score
println!("Final score: {}", table.last());

Implementations§

Source§

impl<'a> Table<'a>

Source

pub fn get(&self, row: usize, col: usize) -> Option<i32>

Get the value at the given row and column index.

Returns None if indices are out of bounds.

§Example
let table = result.get_score_table()?;
if let Some(score) = table.get(2, 3) {
    println!("Score at (2, 3): {}", score);
}
Source

pub fn rows(&self) -> usize

Get the number of rows (query length).

Source

pub fn cols(&self) -> usize

Get the number of columns (reference length).

Source

pub fn as_slice(&self) -> &[i32]

Get the raw underlying data as a 1D slice.

The data is stored in row-major order, so element at (row, col) can be accessed at index row * cols + col.

Source

pub fn last(&self) -> i32

Get the value at the last cell (bottom-right of DP table).

Trait Implementations§

Source§

impl<'a> Debug for Table<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Table<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Table<'a>

§

impl<'a> RefUnwindSafe for Table<'a>

§

impl<'a> Send for Table<'a>

§

impl<'a> Sync for Table<'a>

§

impl<'a> Unpin for Table<'a>

§

impl<'a> UnsafeUnpin for Table<'a>

§

impl<'a> UnwindSafe for Table<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.