Permalink
Browse files

Fixed a couple of typos in comments. PEP8 formatting

  • Loading branch information...
1 parent 708d3ee commit 6a31cb395c7a0589e2389a4f39924540c9a227f1 @peterjc peterjc committed Jan 28, 2013
Showing with 26 additions and 16 deletions.
  1. +26 −16 Tests/test_pairwise2.py
View
@@ -379,22 +379,24 @@ def test_align_one_char3(self):
class TestPersiteGapPenalties(unittest.TestCase):
- """
- This tests that the gap penalty callbacks are really being used with the correct gap opening position.
- The second test forces a bad alignment by having a very expsive gap penalty where one would noremally expect a gap, and a cheap gap pentaly in another place.
- """
+ """Check gap penalty callbacks use correct gap opening position.
+ This tests that the gap penalty callbacks are really being used
+ with the correct gap opening position.
+ """
def test_gap_here_only_1(self):
seq1 = "AAAABBBAAAACCCCCCCCCCCCCCAAAABBBAAAA"
seq2 = "AABBBAAAACCCCAAAABBBAA"
- breaks = [0,11,len(seq2)]
- nogaps = lambda x,y: -2000 -y#Very expensive to open a gap in seq1
- specificgaps = lambda x,y: (-2 -y) if x in breaks else (-2000 -y)#Very expensive to open a gap in seq2 unless it is in one of the allowed positions
- alignments = pairwise2.align.globalmc(seq1,seq2,1,-1,nogaps,specificgaps)
- self.assertEqual(len(alignments),1)
+ breaks = [0, 11, len(seq2)]
+ # Very expensive to open a gap in seq1:
+ nogaps = lambda x, y: -2000 - y
+ # Very expensive to open a gap in seq2 unless it is in one of the allowed positions
+ specificgaps = lambda x, y: (-2 -y) if x in breaks else (-2000 - y)
+ alignments = pairwise2.align.globalmc(seq1, seq2, 1, -1, nogaps, specificgaps)
+ self.assertEqual(len(alignments), 1)
formatted = pairwise2.format_alignment(*alignments[0])
- self.assertEqual(formatted,"""\
+ self.assertEqual(formatted, """\
AAAABBBAAAACCCCCCCCCCCCCCAAAABBBAAAA
||||||||||||||||||||||||||||||||||||
--AABBBAAAACC----------CCAAAABBBAA--
@@ -403,15 +405,23 @@ def test_gap_here_only_1(self):
def test_gap_here_only_2(self):
+ """Force a bad alignment.
+
+ Forces a bad alignment by having a very expensive gap penalty
+ where one would normally expect a gap, and a cheap gap penalty
+ in another place.
+ """
seq1 = "AAAABBBAAAACCCCCCCCCCCCCCAAAABBBAAAA"
seq2 = "AABBBAAAACCCCAAAABBBAA"
- breaks = [0,3,len(seq2)]
- nogaps = lambda x,y: -2000 -y#Very expensive to open a gap in seq1
- specificgaps = lambda x,y: (-2 -y) if x in breaks else (-2000 -y)#Very expensive to open a gap in seq2 unless it is in one of the allowed positions
- alignments = pairwise2.align.globalmc(seq1,seq2,1,-1,nogaps,specificgaps)
- self.assertEqual(len(alignments),1)
+ breaks = [0, 3, len(seq2)]
+ #Very expensive to open a gap in seq1:
+ nogaps = lambda x, y: -2000 - y
+ #Very expensive to open a gap in seq2 unless it is in one of the allowed positions:
+ specificgaps = lambda x, y: (-2 - y) if x in breaks else (-2000 - y)
+ alignments = pairwise2.align.globalmc(seq1, seq2, 1, -1, nogaps, specificgaps)
+ self.assertEqual(len(alignments), 1)
formatted = pairwise2.format_alignment(*alignments[0])
- self.assertEqual(formatted,"""\
+ self.assertEqual(formatted, """\
AAAABBBAAAACCCCCCCCCCCCCCAAAABBBAAAA
||||||||||||||||||||||||||||||||||||
--AAB----------BBAAAACCCCAAAABBBAA--

0 comments on commit 6a31cb3

Please sign in to comment.