Beispiel #1
0
 def test_single_character_match(self):
     seq = 'A'
     al_1, al_2, s = make_alignment(seq, seq, MATCH, MISMATCH, GAP)
     self.check_answer_correctness(al_1, al_2, s, seq, seq)
     self.assertEqual(seq, al_1)
     self.assertEqual(seq, al_2)
     self.assertEqual(MATCH, s)
Beispiel #2
0
 def test_empty(self):
     seq = ''
     al_1, al_2, s = make_alignment(seq, seq, MATCH, MISMATCH, GAP)
     self.check_answer_correctness(al_1, al_2, s, seq, seq)
     self.assertEqual(seq, al_1)
     self.assertEqual(seq, al_2)
     self.assertEqual(0, s)
Beispiel #3
0
 def test_match_mismatch(self):
     seq1 = 'AT'
     seq2 = 'AG'
     al_1, al_2, s = make_alignment(seq1, seq2, MATCH, MISMATCH, GAP)
     self.check_answer_correctness(al_1, al_2, s, seq1, seq2)
     self.assertEqual(seq1, al_1)
     self.assertEqual(seq2, al_2)
     self.assertEqual(MATCH + MISMATCH, s)
Beispiel #4
0
 def test_match_gap(self):
     seq1 = 'A'
     seq2 = 'AG'
     al_1, al_2, s = make_alignment(seq1, seq2, MATCH, MISMATCH, GAP)
     self.check_answer_correctness(al_1, al_2, s, seq1, seq2)
     self.assertEqual('A-', al_1)
     self.assertEqual('AG', al_2)
     self.assertEqual(MATCH + GAP, s)
Beispiel #5
0
 def test_single_character_mismatch(self):
     seq1 = 'A'
     seq2 = 'B'
     al_1, al_2, s = make_alignment(seq1, seq2, MATCH, MISMATCH, GAP)
     self.check_answer_correctness(al_1, al_2, s, seq1, seq2)
     self.assertEqual(seq1, al_1)
     self.assertEqual(seq2, al_2)
     self.assertEqual(MISMATCH, s)
Beispiel #6
0
 def test_shifted(self):
     seq1 = 'ATG'
     seq2 = 'GAT'
     al_1, al_2, s = make_alignment(seq1, seq2, MATCH, MISMATCH, GAP)
     self.check_answer_correctness(al_1, al_2, s, seq1, seq2)
     self.assertEqual('-ATG', al_1)
     self.assertEqual('GAT-', al_2)
     self.assertEqual(2 * MATCH + 2 * GAP, s)
Beispiel #7
0
 def test_border_flip(self):
     seq1 = 'TGGGTA'
     seq2 = 'A'
     al_1, al_2, s = make_alignment(seq1, seq2, MATCH, MISMATCH, GAP)
     self.check_answer_correctness(al_1, al_2, s, seq1, seq2)
     self.assertEqual(seq1, al_1)
     self.assertEqual('-----A', al_2)
     self.assertEqual(MATCH + 5 * GAP, s)
Beispiel #8
0
 def test_complex_2(self):
     s_1WFN = 'GSSGSSGPQLVRTHEDVPGPVGHLSFSEILDTSLKVSWQEPGEKNGILTGYRISWEEYNRTNTRVTHYLPNVTLEYRVTGLTALTTYTIEVAAMTSKGQGQVSASTISSGVPPSGPSSG'
     s_1WIS = 'GSSGSSGTISSGVPPELPGPPTNLGISNIGPRSVTLQFRPGYDGKTSISRWLVEAQVGVVGEGEEWLLIHQLSNEPDARSMEVPDLNPFTCYSFRMRQVNIVGTSPPSQPSRKIQTLQSGPSSG'
     al_1, al_2, s = make_alignment(s_1WFN, s_1WIS, MATCH, MISMATCH, GAP)
     self.check_answer_correctness(al_1, al_2, s, s_1WFN, s_1WIS)
     self.assertEqual(-27, s)
Beispiel #9
0
 def test_complex_1(self):
     s_1WFN = 'GSSGSSGPQLVRTHEDVPGPVGHLSFSEILDTSLKVSWQEPGEKNGILTGYRISWEEYNRTNTRVTHYLPNVTLEYRVTGLTALTTYTIEVAAMTSKGQGQVSASTISSGVPPSGPSSG'
     s_1WFO = 'GSSGSSGRIGDGSPSHPPILERTLDDVPGPPMGILFPEVRTTSVRLIWQPPAAPNGIILAYQITHRLNTTTANTATVEVLAPSARQYTATGLKPESVYLFRITAQTRKGWGEAAEALVVTTEKRSGPSSG'
     al_1, al_2, s = make_alignment(s_1WFN, s_1WFO, MATCH, MISMATCH, GAP)
     self.check_answer_correctness(al_1, al_2, s, s_1WFN, s_1WFO)
     self.assertEqual(6, s)