Function parasailors::semi_global_alignment_stats [] [src]

pub fn semi_global_alignment_stats(query_sequence: &[u8], database_sequence: &[u8], open_cost: i32, gap_extend_cost: i32, substitution_matrix: &Matrix) -> AlignmentStats

Provides statistics for semi-global pairwise alignment using a vectorized algorithm.

This results in a series of statistics, including a score that corresponds to a global alignment for the query sequence (i.e. the sequence in the Profile) and a local alignment for the reference sequence. This is particularly useful when checking for the presence of an NGS read in a much longer reference sequence. This behaves like a global alignment, except that gaps at the start or end of the reference sequence's alignment are ignored.

Other statistics include the number of matching characters, the number of positive substitutions, the length of the found alignment, and the starting point in both sequences where the alignment starts.

Examples

let identity_matrix = Matrix::new(MatrixType::Identity);
let query = b"AAAACCCCCCCCCCGGG";

let reference = b"AAAAAAAAAACCCCCCCCCCGGGGGGGGGGTTTTTTTTTTTNNNNNNNNN";
let stats = semi_global_alignment_stats(query, reference, 1, 1, &identity_matrix);
assert_eq!(17, stats.score);
assert_eq!(17, stats.num_matches);
assert_eq!(17, stats.num_positive_subs);
assert_eq!(17, stats.align_length);
assert_eq!(17, stats.query_end);
assert_eq!(23, stats.ref_end);