pub fn score_alignments<M : Fn(Nucleotide, Nucleotide)-> i64, C : Fn(i64)->i64>(s : Sequence, t : Sequence, sub_matrix : Rc<M> , cost_func : Rc<C> ) -> i64 {
        let mut score = 0; 
        let mut gap_len = 0; 
        for (a, b) in s.nucleotides.iter().zip(t.nucleotides.iter()){ 
            if *a == Gap || *b == Gap {
                gap_len += 1; 
                score += cost_func(gap_len); 
            } else {
                gap_len = 0; 
                score += sub_matrix(*a, *b); 
            }
        }
        score
    }
//Assumes that the sequences are the same length. 
Assumes that the sequences are the same length.
Assumes that the sequences are the same length .
pub fn score_alignments<M : Fn(Nucleotide, Nucleotide)-> i64, C : Fn(i64)->i64>(s : Sequence, t : Sequence, sub_matrix : Rc<M> , cost_func : Rc<C> ) -> i64 {
        let mut score = 0; 
        let mut gap_len = 0; 
        for (a, b) in s.nucleotides.iter().zip(t.nucleotides.iter()){ 
            if *a == Gap || *b == Gap {
                gap_len += 1; 
                score += cost_func(gap_len); 
            } else {
                gap_len = 0; 
                score += sub_matrix(*a, *b); 
            }
        }
        score
    }
pub fn score_alignments < M : Fn ( Nucleotide , Nucleotide ) -> i64 , C : Fn ( i64 ) -> i64 > ( s : Sequence , t : Sequence , sub_matrix : Rc < M > , cost_func : Rc < C > ) -> i64 { let mut score = 0 ; let mut gap_len = 0 ; for ( a , b ) in s . nucleotides . iter ( ) . zip ( t . nucleotides . iter ( ) ) { if * a == Gap || * b == Gap { gap_len += 1 ; score += cost_func ( gap_len ) ; } else { gap_len = 0 ; score += sub_matrix ( * a , * b ) ; } } score }
Assumes that the sequences are the same length.
Assumes that the sequences are the same length .
s
Sequence
t
Sequence
sub_matrix
Rc<M>
cost_func
Rc<C>
s
Sequence
t
Sequence
sub_matrix
Rc<M>
cost_func
Rc<C>