devela::_dep::stringzilla::sz

Function alignment_score

pub fn alignment_score<F, S>(
    first: F,
    second: S,
    matrix: [[i8; 256]; 256],
    gap: i8,
) -> isize 
where F: AsRef<[u8]>, S: AsRef<[u8]>,
Available on crate feature dep_stringzilla only.
Expand description

Computes the Needleman-Wunsch alignment score for two strings. This function is particularly used in bioinformatics for sequence alignment but is also applicable in other domains requiring detailed comparison between two strings, including gap and substitution penalties.

§Arguments

  • first: The first byte slice to align.
  • second: The second byte slice to align.
  • matrix: The substitution matrix used for scoring.
  • gap: The penalty for each gap introduced during alignment.

§Returns

An isize representing the total alignment score, where higher scores indicate better alignment between the two strings, considering the specified gap penalties and substitution matrix.