def test_compute_substitution_score(self): # these results were computed manually subs_m = make_identity_substitution_matrix(5, -4) gap_chars = set('-.') self.assertEqual( _compute_substitution_score(['A'], ['A'], subs_m, 0, gap_chars), 5.0) self.assertEqual( _compute_substitution_score(['A', 'A'], ['A'], subs_m, 0, gap_chars), 5.0) self.assertEqual( _compute_substitution_score(['A', 'C'], ['A'], subs_m, 0, gap_chars), 0.5) self.assertEqual( _compute_substitution_score(['A', 'C'], ['A', 'C'], subs_m, 0, gap_chars), 0.5) self.assertEqual( _compute_substitution_score(['A', 'A'], ['A', '-'], subs_m, 0, gap_chars), 2.5) self.assertEqual( _compute_substitution_score(['A', 'A'], ['A', '-'], subs_m, 1, gap_chars), 3) # alt subs_m subs_m = make_identity_substitution_matrix(1, -2) self.assertEqual( _compute_substitution_score(['A', 'A'], ['A', '-'], subs_m, 0, gap_chars), 0.5)
def test_compute_substitution_score(self): # these results were computed manually subs_m = make_identity_substitution_matrix(5, -4) self.assertEqual( _compute_substitution_score(['A'], ['A'], subs_m, 0), 5.0) self.assertEqual( _compute_substitution_score(['A', 'A'], ['A'], subs_m, 0), 5.0) self.assertEqual( _compute_substitution_score(['A', 'C'], ['A'], subs_m, 0), 0.5) self.assertEqual( _compute_substitution_score(['A', 'C'], ['A', 'C'], subs_m, 0), 0.5) self.assertEqual( _compute_substitution_score(['A', 'A'], ['A', '-'], subs_m, 0), 2.5) self.assertEqual( _compute_substitution_score(['A', 'A'], ['A', '-'], subs_m, 1), 3) # alt subs_m subs_m = make_identity_substitution_matrix(1, -2) self.assertEqual( _compute_substitution_score(['A', 'A'], ['A', '-'], subs_m, 0), 0.5)