Commits

Bob Harris  committed 42cd880

made gap/gap be ignored, and neighboring gaps on opposite strands incur two gap open penalties

  • Participants
  • Parent commits f37fda4

Comments (0)

Files changed (2)

File bx/align/score.py

     for i in range( len( text1 ) ):
         a = text1[i]
         b = text2[i]
+        if a == '-' and b == '-': continue # ignore gap/gap pair
         if a == '-' or b == '-':
             rval -= scoring_scheme.gap_extend
-            if not last_gap:
+            if not (last_gap and (a == '-') == gap_on_a):
                 rval -= scoring_scheme.gap_open
                 last_gap = True
+                gap_on_a = (a == '-')
         else:   
             rval += scoring_scheme.table[ord(a),ord(b)]
             last_gap = False

File bx/align/score_tests.py

 aligns = [ ( "CCACTAGTTTTTAAATAATCTACTATCAAATAAAAGATTTGTTAATAATAAATTTTAAATCATTAACACTT",
              "CCATTTGGGTTCAAAAATTGATCTATCA----------TGGTGGATTATTATTTAGCCATTAAGGACAAAT", 
              -111 ),
+           ( "CCACTAGTTTTTAAATAATCTAC-----AATAAAAGATTTGTTAATAAT---AAATTTTAAATCATTAA-----CACTT",
+             "CCATTTGGGTTCAAAAATTGATCTATCA----------TGGTGGAT---TATTATTT-----AGCCATTAAGGACAAAT", 
+             -3626 ),
+           ( "CCACTAGTTTTTGATTC",
+             "CCATTTGGGTTC-----", 
+             -299 ),
+           ( "CTTAGTTTTTGATCACC",
+             "-----CTTGGGTTTACC", 
+             -299 ),
            ( "gggaattgaacaatgagaacacatggacacaggaaggggaacatcacacacc----------ggggcctgttgtggggtggggggaag",
              "ggaactagaacaagggagacacatacaaacaacaacaacaacaacacagcccttcccttcaaagagcttatagtctgatggaggagag",
-             1690 )   
+             1690 )
          ]
 
 mafs = """##maf