def local_test7(self):
     s1 = 'WCFFEXTSYRKFNTHPEQRNGDQSHITZBZYHBPEMKASGGZXACAYVHVNSLYXLFSNZNBIZRRANXYVNKBPAZVGEVMBACMTPQSDSFMFQMBKVCXDVYQBLACINNGLTTSYDSYFZTFYBR'
     s2 = 'CPDAZPXGMFLHMZZKKBMTPCDTXPLWKSEAGDQSHITZBZYHMKASGGZXACAYVHVNBZYCCSLYXLFSNZNBIZRRANXYVNFBPAZVGEVMBACMTPQSDSFMFQMBKVCFZBXDVYQBLACINKXDPXMYGY'
     S = self.S4
     gap = 12
     correct_score = 298
     s, a1, a2 = alignment.SmithWaterman(s1, s2, S, gap)
     self.assertEqual(alignment_util.scoreAlignment(a1,a2,S,gap), s, "Returned alignment score does not match actual alignment score")
     self.assertEqual(alignment_util.scoreAlignment(a1,a2,S,gap), correct_score, "Score of returned alignment is not optimal")
 def global_test2(self):
     s1 = "AAA"
     s2 = "AAA"
     S = self.S2
     gap = 1
     correct_score = 12
     s, a1, a2 = alignment.SmithWaterman(s1, s2, S, gap)
     self.assertEqual(alignment_util.scoreAlignment(a1,a2,S,gap), s, "Returned alignment score does not match actual alignment score")
     self.assertEqual(alignment_util.scoreAlignment(a1,a2,S,gap), correct_score, "Score of returned alignment is not optimal")
    def global_test7(self):
        s1 = 'GDQSHITZBZYHBPEMKASGGZXACAYVHVNSLYXLFSNZNBIZRRANXYVNKBPAZVGEVMBACMTPQSDSFMFQMBKVCXDVYQBLACIN'
        s2 = 'GDQSHITZBZYHMKASGGZXACAYVHVNBZYCCSLYXLFSNZNBIZRRANXYVNFBPAZVGEVMBACMTPQSDSFMFQMBKVCFZBXDVYQBLACIN'
        S = self.S4
        gap = 5
        correct_score = 375
        s, a1, a2 = alignment.SmithWaterman(s1, s2, S, gap)
        self.assertEqual(alignment_util.scoreAlignment(a1,a2,S,gap), s, "Returned alignment score does not match actual alignment score")
        self.assertEqual(alignment_util.scoreAlignment(a1,a2,S,gap), correct_score, "Score of returned alignment is not optimal")

        s, a1, a2 = alignment.SmithWaterman(s2, s1, S, gap)
        self.assertEqual(alignment_util.scoreAlignment(a1,a2,S,gap), s, "Returned alignment score does not match actual alignment score")
        self.assertEqual(alignment_util.scoreAlignment(a1,a2,S,gap), correct_score, "Score of returned alignment is not optimal")
    def local_test6(self):
        s1 = "CCCCCACCCCC"
        s2 = "TTTCCCCCCCCCCTTT"
        S = self.S2
        gap = 4
        correct_score = 36
        s, a1, a2 = alignment.SmithWaterman(s1, s2, S, gap)
        self.assertEqual(alignment_util.scoreAlignment(a1,a2,S,gap), s, "Returned alignment score does not match actual alignment score")
        self.assertEqual(alignment_util.scoreAlignment(a1,a2,S,gap), correct_score, "Score of returned alignment is not optimal")

        s, a1, a2 = alignment.SmithWaterman(s2, s1, S, gap)
        self.assertEqual(alignment_util.scoreAlignment(a1,a2,S,gap), s, "Returned alignment score does not match actual alignment score")
        self.assertEqual(alignment_util.scoreAlignment(a1,a2,S,gap), correct_score, "Score of returned alignment is not optimal")
Example #5
0
 def global_test2(self):
     s1 = "AAA"
     s2 = "AAA"
     S = self.S2
     gap = 1
     correct_score = 12
     s, a1, a2 = alignment.SmithWaterman(s1, s2, S, gap)
     self.assertEqual(
         alignment_util.scoreAlignment(a1, a2, S, gap), s,
         "Returned alignment score does not match actual alignment score")
     self.assertEqual(alignment_util.scoreAlignment(a1, a2, S,
                                                    gap), correct_score,
                      "Score of returned alignment is not optimal")
Example #6
0
 def local_test7(self):
     s1 = 'WCFFEXTSYRKFNTHPEQRNGDQSHITZBZYHBPEMKASGGZXACAYVHVNSLYXLFSNZNBIZRRANXYVNKBPAZVGEVMBACMTPQSDSFMFQMBKVCXDVYQBLACINNGLTTSYDSYFZTFYBR'
     s2 = 'CPDAZPXGMFLHMZZKKBMTPCDTXPLWKSEAGDQSHITZBZYHMKASGGZXACAYVHVNBZYCCSLYXLFSNZNBIZRRANXYVNFBPAZVGEVMBACMTPQSDSFMFQMBKVCFZBXDVYQBLACINKXDPXMYGY'
     S = self.S4
     gap = 12
     correct_score = 298
     s, a1, a2 = alignment.SmithWaterman(s1, s2, S, gap)
     self.assertEqual(
         alignment_util.scoreAlignment(a1, a2, S, gap), s,
         "Returned alignment score does not match actual alignment score")
     self.assertEqual(alignment_util.scoreAlignment(a1, a2, S,
                                                    gap), correct_score,
                      "Score of returned alignment is not optimal")
def test_SW(seq1, seq2, S, g):
    s, a1, a2 = alignment.SmithWaterman(seq1, seq2, S, g)
    s_sol, a1_sol, a2_sol = alignment_sol.SmithWaterman(seq1, seq2, S, g)
    score = 0
    
    # First: test that the function has returned has an optimal alignment
    if alignment_util.scoreAlignment(a1, a2, S, g) == s_sol:
        score += 70

    # Second: test that the function has returned an optimal score
    if s == s_sol:
        score += 20

    # Third: Test that the function has returned the correct score for the alignment
    if alignment_util.scoreAlignment(a1, a2, S, g) == s:
        score += 10

    return score/100.0
def test_SW(seq1, seq2, S, g):
    s, a1, a2 = alignment.SmithWaterman(seq1, seq2, S, g)
    s_sol, a1_sol, a2_sol = alignment_sol.SmithWaterman(seq1, seq2, S, g)
    score = 0

    # First: test that the function has returned has an optimal alignment
    if alignment_util.scoreAlignment(a1, a2, S, g) == s_sol:
        score += 70

    # Second: test that the function has returned an optimal score
    if s == s_sol:
        score += 20

    # Third: Test that the function has returned the correct score for the alignment
    if alignment_util.scoreAlignment(a1, a2, S, g) == s:
        score += 10

    return score / 100.0
Example #9
0
    def local_test6(self):
        s1 = "CCCCCACCCCC"
        s2 = "TTTCCCCCCCCCCTTT"
        S = self.S2
        gap = 4
        correct_score = 36
        s, a1, a2 = alignment.SmithWaterman(s1, s2, S, gap)
        self.assertEqual(
            alignment_util.scoreAlignment(a1, a2, S, gap), s,
            "Returned alignment score does not match actual alignment score")
        self.assertEqual(alignment_util.scoreAlignment(a1, a2, S,
                                                       gap), correct_score,
                         "Score of returned alignment is not optimal")

        s, a1, a2 = alignment.SmithWaterman(s2, s1, S, gap)
        self.assertEqual(
            alignment_util.scoreAlignment(a1, a2, S, gap), s,
            "Returned alignment score does not match actual alignment score")
        self.assertEqual(alignment_util.scoreAlignment(a1, a2, S,
                                                       gap), correct_score,
                         "Score of returned alignment is not optimal")
Example #10
0
    def global_test7(self):
        s1 = 'GDQSHITZBZYHBPEMKASGGZXACAYVHVNSLYXLFSNZNBIZRRANXYVNKBPAZVGEVMBACMTPQSDSFMFQMBKVCXDVYQBLACIN'
        s2 = 'GDQSHITZBZYHMKASGGZXACAYVHVNBZYCCSLYXLFSNZNBIZRRANXYVNFBPAZVGEVMBACMTPQSDSFMFQMBKVCFZBXDVYQBLACIN'
        S = self.S4
        gap = 5
        correct_score = 375
        s, a1, a2 = alignment.SmithWaterman(s1, s2, S, gap)
        self.assertEqual(
            alignment_util.scoreAlignment(a1, a2, S, gap), s,
            "Returned alignment score does not match actual alignment score")
        self.assertEqual(alignment_util.scoreAlignment(a1, a2, S,
                                                       gap), correct_score,
                         "Score of returned alignment is not optimal")

        s, a1, a2 = alignment.SmithWaterman(s2, s1, S, gap)
        self.assertEqual(
            alignment_util.scoreAlignment(a1, a2, S, gap), s,
            "Returned alignment score does not match actual alignment score")
        self.assertEqual(alignment_util.scoreAlignment(a1, a2, S,
                                                       gap), correct_score,
                         "Score of returned alignment is not optimal")