def test_smith_waterman_sim_score(self): """Test abydos.distance.SmithWaterman.sim_score.""" self.assertEqual(SmithWaterman().sim_score('', ''), 0) # https://en.wikipedia.org/wiki/Needleman–Wunsch_algorithm self.assertEqual( SmithWaterman(1, _sim_nw).sim_score('GATTACA', 'GCATGCU'), 0) self.assertEqual( SmithWaterman(5, _sim_wikipedia).sim_score('AGACTAGTTAC', 'CGAGACGT'), 26, ) sw5 = SmithWaterman(5, _sim_nw) self.assertEqual(sw5.sim_score('CGATATCAG', 'TGACGSTGC'), 0) self.assertEqual(sw5.sim_score('AGACTAGTTAC', 'TGACGSTGC'), 1) self.assertEqual(sw5.sim_score('AGACTAGTTAC', 'CGAGACGT'), 0)
def test_smith_waterman_sim_score_nialls(self): """Test abydos.distance.SmithWaterman.sim_score (Nialls set).""" sw_vals = (5, 1, 1, 3, 2, 1, 1, 0, 0, 1, 1, 2, 2, 1, 0, 0) sw2 = SmithWaterman(2, _sim_nw) for i in range(len(NIALL)): self.assertEqual(sw2.sim_score(NIALL[0], NIALL[i]), sw_vals[i])