def test_pairwise_returns_score(self): """exercise pairwise local/global returns alignment score""" S = make_dna_scoring_dict(10, -1, -8) aln, score = local_pairwise(seq1, seq2, S, 10, 2, return_score=True) self.assertTrue(score > 100) aln, score = global_pairwise(seq1, seq2, S, 10, 2, return_score=True) self.assertTrue(score > 100)
def test_local_tiebreak(self): """Should pick the first best-equal hit rather than the last one""" # so that the Pyrex and Python versions give the same result. score_matrix = make_dna_scoring_dict(match=1, transition=-1, transversion=-1) pattern = DNA.make_seq("cwc", name="pattern") two_hit = DNA.make_seq("cactc", name="target") aln = local_pairwise(pattern, two_hit, score_matrix, 5, 2) hit = aln.named_seqs["target"] self.assertEqual(str(hit).lower(), "cac")