New padgaps works out number of gaps to insert, delete
authoramwaterhouse <Andrew Waterhouse>
Fri, 27 Oct 2006 16:13:57 +0000 (16:13 +0000)
committeramwaterhouse <Andrew Waterhouse>
Fri, 27 Oct 2006 16:13:57 +0000 (16:13 +0000)
src/jalview/datamodel/Alignment.java

index cb73d0c..713cb0d 100755 (executable)
@@ -597,7 +597,8 @@ public class Alignment implements AlignmentI
       return dataset;
     }
 
-    public boolean padGaps() {
+    public boolean padGaps()
+    {
       boolean modified=false;
 
       //Remove excess gaps from the end of alignment
@@ -620,14 +621,17 @@ public class Alignment implements AlignmentI
 
       maxLength++;
 
+      int cLength;
       for (int i = 0; i < sequences.size();
            i++)
       {
         current = getSequenceAt(i);
+        cLength = current.getLength();
 
-        if (current.getLength() < maxLength)
+        if (cLength < maxLength)
         {
-          current.insertCharAt(maxLength - 1, gapCharacter);
+          current.insertCharAt(cLength,
+                              maxLength-cLength, gapCharacter);
           modified=true;
         }
         else if(current.getLength() > maxLength)