Almost working
[jalview.git] / src / jalview / analysis / AlignSeq.java
index 4ec0457..7165096 100755 (executable)
@@ -58,11 +58,11 @@ public class AlignSeq
   private static final int MAX_NAME_LENGTH = 30;
 
   //&!
-  private static final int GAP_OPEN_COST = 120;
-  //private static final int GAP_OPEN_COST = 100;
+  //private static final int GAP_OPEN_COST = 120;
+  private static final int GAP_OPEN_COST = 100;
 
-  private static final int GAP_EXTEND_COST = 20;
-  //private static final int GAP_EXTEND_COST = 5;
+  //private static final int GAP_EXTEND_COST = 20;
+  private static final int GAP_EXTEND_COST = 5;
 
   private static final int GAP_INDEX = -1;
 
@@ -508,7 +508,7 @@ public class AlignSeq
     int trace;
     maxscore = score[i][j] / 10f;
 
-    //&! get trailing gaps
+    //prepare trailing gaps
     while ((i < seq1.length - 1) || (j < seq2.length - 1))
     {
       i++;
@@ -526,7 +526,7 @@ public class AlignSeq
 
     count = (seq1.length + seq2.length) - 1;
 
-    //&! get trailing gaps
+    //get trailing gaps
     while ((i >= seq1.length) || (j >= seq2.length))
     {
       if (i >= seq1.length)
@@ -591,18 +591,18 @@ public class AlignSeq
       sb2.append(s2str.charAt(j));
     }
 
-    //&! get initial gaps
+    //get initial gaps
     while (j > 0 || i > 0)
     {
       if (j > 0)
       {
+       j--;
        sb1.append("-");
        sb2.append(s2str.charAt(j));
-       j--;
       } else if (i > 0) {
+       i--;
        sb1.append(s1str.charAt(i));
        sb2.append("-");
-       i--;
       }
     }
 
@@ -1436,7 +1436,8 @@ public class AlignSeq
     float prescore = score;    // only debug
     score *= coverage;
 
-    System.out.println(String.format("prepre-score: %f, pre-score: %f, longlength: %d\nscore: %f, mean: %f, max: %d", preprescore, prescore, _max[1], score, this.meanScore, this.hypotheticMaxScore));
-    this.alignmentScore = (preprescore < 1) ? Float.NaN : score;
+    System.out.println(String.format("prepre-score: %f, pre-score: %f, longlength: %d\nscore: %1.16f, mean: %f, max: %d", preprescore, prescore, _max[1], score, this.meanScore, this.hypotheticMaxScore));
+    float minScore = 1f;
+    this.alignmentScore = (preprescore < minScore) ? Float.NaN : score;
   }
 }