merge from 2_4_Release branch
[jalview.git] / src / jalview / datamodel / SeqCigar.java
index 9ed0388..cc9eaa7 100644 (file)
@@ -1,17 +1,17 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
- *
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
+ * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
@@ -23,17 +23,20 @@ import java.util.Hashtable;
 import jalview.analysis.*;
 import jalview.util.*;
 
-public class SeqCigar
-    extends CigarSimple
+public class SeqCigar extends CigarSimple
 {
   /**
    * start(inclusive) and end(exclusive) of subsequence on refseq
    */
   private int start, end;
+
   private SequenceI refseq = null;
+
   private Hashtable seqProps;
+
   /**
    * Reference dataset sequence for the cigar string
+   * 
    * @return SequenceI
    */
   public SequenceI getRefSeq()
@@ -42,7 +45,7 @@ public class SeqCigar
   }
 
   /**
-   *
+   * 
    * @return int start index of cigar ops on refSeq
    */
   public int getStart()
@@ -51,7 +54,7 @@ public class SeqCigar
   }
 
   /**
-   *
+   * 
    * @return int end index (exclusive) of cigar ops on refSeq
    */
   public int getEnd()
@@ -61,17 +64,19 @@ public class SeqCigar
 
   /**
    * Returns sequence as a string with cigar operations applied to it
+   * 
    * @return String
    */
   public String getSequenceString(char GapChar)
   {
-    return (length == 0) ? "" :
-        (String) getSequenceAndDeletions(refseq.getSequenceAsString(start, end),
-                                         GapChar)[0];
+    return (length == 0) ? "" : (String) getSequenceAndDeletions(refseq
+            .getSequenceAsString(start, end), GapChar)[0];
   }
 
   /**
-   * recreates a gapped and edited version of RefSeq or null for an empty cigar string
+   * recreates a gapped and edited version of RefSeq or null for an empty cigar
+   * string
+   * 
    * @return SequenceI
    */
   public SequenceI getSeq(char GapChar)
@@ -81,30 +86,29 @@ public class SeqCigar
     {
       return null;
     }
-    Object[] edit_result = getSequenceAndDeletions(refseq.getSequenceAsString(
-        start, end),
-        GapChar);
+    Object[] edit_result = getSequenceAndDeletions(refseq
+            .getSequenceAsString(start, end), GapChar);
     if (edit_result == null)
     {
       throw new Error(
-          "Implementation Error - unexpected null from getSequenceAndDeletions");
+              "Implementation Error - unexpected null from getSequenceAndDeletions");
     }
     int bounds[] = (int[]) edit_result[1];
-    seq = new Sequence(refseq.getName(), (String) edit_result[0],
-                       refseq.getStart() + start + bounds[0],
-                       refseq.getStart() + start +
-                       ( (bounds[2] == 0) ? -1 : bounds[2]));
+    seq = new Sequence(refseq.getName(), (String) edit_result[0], refseq
+            .getStart()
+            + start + bounds[0], refseq.getStart() + start
+            + ((bounds[2] == 0) ? -1 : bounds[2]));
     seq.setDescription(refseq.getDescription());
-    int sstart = seq.getStart(),
-      send = seq.getEnd();
+    int sstart = seq.getStart(), send = seq.getEnd();
     // seq.checkValidRange(); probably not needed
-    // recover local properties if present 
-    if (seqProps!=null)
+    // recover local properties if present
+    if (seqProps != null)
     {
-      // this recovers dataset sequence reference as well as local features, names, start/end settings.
+      // this recovers dataset sequence reference as well as local features,
+      // names, start/end settings.
       SeqsetUtils.SeqCharacterUnhash(seq, seqProps);
     }
-    // ensure dataset sequence is up to date from local reference 
+    // ensure dataset sequence is up to date from local reference
     seq.setDatasetSequence(refseq);
     seq.setStart(sstart);
     seq.setEnd(send);
@@ -112,22 +116,26 @@ public class SeqCigar
   }
 
   /*
-     We don't allow this - refseq is given at construction time only
-   public void setSeq(SequenceI seq) {
-    this.seq = seq;
-     }
+   * We don't allow this - refseq is given at construction time only public void
+   * setSeq(SequenceI seq) { this.seq = seq; }
    */
   /**
-   * internal constructor - sets seq to a gapless sequence derived from seq
-   * and prepends any 'D' operations needed to get to the first residue of seq.
-   * @param seq SequenceI
-   * @param initialDeletion true to mark initial dataset sequence residues as deleted in subsequence
-   * @param _s index of first position in seq
-   * @param _e index after last position in (possibly gapped) seq
+   * internal constructor - sets seq to a gapless sequence derived from seq and
+   * prepends any 'D' operations needed to get to the first residue of seq.
+   * 
+   * @param seq
+   *                SequenceI
+   * @param initialDeletion
+   *                true to mark initial dataset sequence residues as deleted in
+   *                subsequence
+   * @param _s
+   *                index of first position in seq
+   * @param _e
+   *                index after last position in (possibly gapped) seq
    * @return true if gaps are present in seq
    */
   private boolean _setSeq(SequenceI seq, boolean initialDeletion, int _s,
-                          int _e)
+          int _e)
   {
     boolean hasgaps = false;
     if (seq == null)
@@ -147,13 +155,14 @@ public class SeqCigar
     start = seq.findPosition(_s) - seq.getStart();
     end = seq.findPosition(_e) - seq.getStart();
     int l_ungapped = end - start;
-    // Find correct sequence to reference and correct start and end - if necessary
+    // Find correct sequence to reference and correct start and end - if
+    // necessary
     SequenceI ds = seq.getDatasetSequence();
     if (ds == null)
     {
       // make a new dataset sequence
-      String ungapped = AlignSeq.extractGaps(jalview.util.Comparison.GapChars,
-                                             new String(seq_string));
+      String ungapped = AlignSeq.extractGaps(
+              jalview.util.Comparison.GapChars, new String(seq_string));
       l_ungapped = ungapped.length();
       // check that we haven't just duplicated an ungapped sequence.
       if (l_ungapped == seq.getLength())
@@ -162,11 +171,11 @@ public class SeqCigar
       }
       else
       {
-        ds = new Sequence(seq.getName(), ungapped,
-                          seq.getStart(),
-                          seq.getStart() + ungapped.length() - 1);
+        ds = new Sequence(seq.getName(), ungapped, seq.getStart(), seq
+                .getStart()
+                + ungapped.length() - 1);
         // JBPNote: this would be consistent but may not be useful
-        //        seq.setDatasetSequence(ds);
+        // seq.setDatasetSequence(ds);
       }
     }
     // add in offset between seq and the dataset sequence
@@ -199,22 +208,28 @@ public class SeqCigar
     refseq = ds;
     // copy over local properties for the sequence instance of the refseq
     seqProps = SeqsetUtils.SeqCharacterHash(seq);
-    // Check  offsets
+    // Check offsets
     if (end > ds.getLength())
     {
-      throw new Error("SeqCigar: Possible implementation error: sequence is longer than dataset sequence");
-//      end = ds.getLength();
+      throw new Error(
+              "SeqCigar: Possible implementation error: sequence is longer than dataset sequence");
+      // end = ds.getLength();
     }
 
     return hasgaps;
   }
 
   /**
-   * directly initialise a cigar object with a sequence of range, operation pairs and a sequence to apply it to.
-   * operation and range should be relative to the seq.getStart()'th residue of the dataset seq resolved from seq.
-   * @param seq SequenceI
-   * @param operation char[]
-   * @param range int[]
+   * directly initialise a cigar object with a sequence of range, operation
+   * pairs and a sequence to apply it to. operation and range should be relative
+   * to the seq.getStart()'th residue of the dataset seq resolved from seq.
+   * 
+   * @param seq
+   *                SequenceI
+   * @param operation
+   *                char[]
+   * @param range
+   *                int[]
    */
   public SeqCigar(SequenceI seq, char operation[], int range[])
   {
@@ -225,7 +240,8 @@ public class SeqCigar
     }
     if (operation.length != range.length)
     {
-      throw new Error("Implementation Bug. Cigar Operation list!= range list");
+      throw new Error(
+              "Implementation Bug. Cigar Operation list!= range list");
     }
 
     if (operation != null)
@@ -235,16 +251,17 @@ public class SeqCigar
 
       if (_setSeq(seq, false, 0, 0))
       {
-        throw new Error("NOT YET Implemented: Constructing a Cigar object from a cigar string and a gapped sequence.");
+        throw new Error(
+                "NOT YET Implemented: Constructing a Cigar object from a cigar string and a gapped sequence.");
       }
       for (int i = this.length, j = 0; j < operation.length; i++, j++)
       {
         char op = operation[j];
         if (op != M && op != I && op != D)
         {
-          throw new Error(
-              "Implementation Bug. Cigar Operation '" + j + "' '" + op +
-              "' not one of '" + M + "', '" + I + "', or '" + D + "'.");
+          throw new Error("Implementation Bug. Cigar Operation '" + j
+                  + "' '" + op + "' not one of '" + M + "', '" + I
+                  + "', or '" + D + "'.");
         }
         this.operation[i] = op;
         this.range[i] = range[j];
@@ -258,14 +275,17 @@ public class SeqCigar
       this.length = 0;
       if (_setSeq(seq, false, 0, 0))
       {
-        throw new Error("NOT YET Implemented: Constructing a Cigar object from a cigar string and a gapped sequence.");
+        throw new Error(
+                "NOT YET Implemented: Constructing a Cigar object from a cigar string and a gapped sequence.");
       }
     }
   }
 
   /**
    * add range matched residues to cigar string
-   * @param range int
+   * 
+   * @param range
+   *                int
    */
   public void addMatch(int range)
   {
@@ -273,19 +293,23 @@ public class SeqCigar
   }
 
   /**
-   * Adds
-   * insertion and match operations based on seq to the cigar up to
-   * the endpos column of seq.
-   *
-   * @param cigar CigarBase
-   * @param seq SequenceI
-   * @param startpos int
-   * @param endpos int
-   * @param initialDeletions if true then initial deletions will be added from start of seq to startpos
+   * Adds insertion and match operations based on seq to the cigar up to the
+   * endpos column of seq.
+   * 
+   * @param cigar
+   *                CigarBase
+   * @param seq
+   *                SequenceI
+   * @param startpos
+   *                int
+   * @param endpos
+   *                int
+   * @param initialDeletions
+   *                if true then initial deletions will be added from start of
+   *                seq to startpos
    */
   protected static void addSequenceOps(CigarBase cigar, SequenceI seq,
-                                       int startpos, int endpos,
-                                       boolean initialDeletions)
+          int startpos, int endpos, boolean initialDeletions)
   {
     char op = '\0';
     int range = 0;
@@ -298,8 +322,9 @@ public class SeqCigar
 
     while (p <= endpos)
     {
-      boolean isGap = (p < res) ? jalview.util.Comparison.isGap(seq.getCharAt(p)) : true;
-      if ( (startpos <= p) && (p <= endpos))
+      boolean isGap = (p < res) ? jalview.util.Comparison.isGap(seq
+              .getCharAt(p)) : true;
+      if ((startpos <= p) && (p <= endpos))
       {
         if (isGap)
         {
@@ -349,7 +374,9 @@ public class SeqCigar
 
   /**
    * create a cigar string for given sequence
-   * @param seq SequenceI
+   * 
+   * @param seq
+   *                SequenceI
    */
   public SeqCigar(SequenceI seq)
   {
@@ -365,9 +392,13 @@ public class SeqCigar
 
   /**
    * Create Cigar from a range of gaps and residues on a sequence object
-   * @param seq SequenceI
-   * @param start int - first column in range
-   * @param end int - last column in range
+   * 
+   * @param seq
+   *                SequenceI
+   * @param start
+   *                int - first column in range
+   * @param end
+   *                int - last column in range
    */
   public SeqCigar(SequenceI seq, int start, int end)
   {
@@ -382,28 +413,35 @@ public class SeqCigar
   }
 
   /**
-   * Create a cigar object from a cigar string like '[<I|D|M><range>]+'
-   * Will fail if the given seq already contains gaps (JBPNote: future implementation will fix)
-   * @param seq SequenceI object resolvable to a dataset sequence
-   * @param cigarString String
+   * Create a cigar object from a cigar string like '[<I|D|M><range>]+' Will
+   * fail if the given seq already contains gaps (JBPNote: future implementation
+   * will fix)
+   * 
+   * @param seq
+   *                SequenceI object resolvable to a dataset sequence
+   * @param cigarString
+   *                String
    * @return Cigar
    */
   public static SeqCigar parseCigar(SequenceI seq, String cigarString)
-      throws Exception
+          throws Exception
   {
     Object[] opsandrange = parseCigarString(cigarString);
-    return new SeqCigar(seq, (char[]) opsandrange[0], (int[]) opsandrange[1]);
+    return new SeqCigar(seq, (char[]) opsandrange[0],
+            (int[]) opsandrange[1]);
   }
 
   /**
    * createAlignment
-   *
-   * @param alseqs SeqCigar[]
-   * @param gapCharacter char
+   * 
+   * @param alseqs
+   *                SeqCigar[]
+   * @param gapCharacter
+   *                char
    * @return SequenceI[]
    */
   public static SequenceI[] createAlignmentSequences(SeqCigar[] alseqs,
-      char gapCharacter, ColumnSelection colsel, int[] segments)
+          char gapCharacter, ColumnSelection colsel, int[] segments)
   {
     SequenceI[] seqs = new SequenceI[alseqs.length];
     StringBuffer[] g_seqs = new StringBuffer[alseqs.length];
@@ -411,23 +449,28 @@ public class SeqCigar
     Object[] gs_regions = new Object[alseqs.length];
     for (int i = 0; i < alseqs.length; i++)
     {
-      alseqs_string[i] = alseqs[i].getRefSeq().
-          getSequenceAsString(alseqs[i].start, alseqs[i].end);
+      alseqs_string[i] = alseqs[i].getRefSeq().getSequenceAsString(
+              alseqs[i].start, alseqs[i].end);
       gs_regions[i] = alseqs[i].getSequenceAndDeletions(alseqs_string[i],
-          gapCharacter); // gapped sequence, {start, start col, end. endcol}, hidden regions {{start, end, col}})
+              gapCharacter); // gapped sequence, {start, start col, end.
+                              // endcol}, hidden regions {{start, end, col}})
       if (gs_regions[i] == null)
       {
-        throw new Error("Implementation error: " + i +
-                        "'th sequence Cigar has no operations.");
+        throw new Error("Implementation error: " + i
+                + "'th sequence Cigar has no operations.");
       }
-      g_seqs[i] = new StringBuffer( (String) ( (Object[]) gs_regions[i])[0]); // the visible gapped sequence
+      g_seqs[i] = new StringBuffer((String) ((Object[]) gs_regions[i])[0]); // the
+                                                                            // visible
+                                                                            // gapped
+                                                                            // sequence
     }
     // Now account for insertions. (well - deletions)
-    // this is complicated because we must keep track of shifted positions in each sequence
+    // this is complicated because we must keep track of shifted positions in
+    // each sequence
     ShiftList shifts = new ShiftList();
     for (int i = 0; i < alseqs.length; i++)
     {
-      Object[] gs_region = ( (Object[]) ( (Object[]) gs_regions[i])[2]);
+      Object[] gs_region = ((Object[]) ((Object[]) gs_regions[i])[2]);
       if (gs_region != null)
 
       {
@@ -439,7 +482,9 @@ public class SeqCigar
           {
             insert[s] = gapCharacter;
           }
-          int inspos = shifts.shift(region[2]); // resolve insertion position in current alignment frame of reference
+          int inspos = shifts.shift(region[2]); // resolve insertion position in
+                                                // current alignment frame of
+                                                // reference
           for (int s = 0; s < alseqs.length; s++)
           {
             if (s != i)
@@ -449,19 +494,21 @@ public class SeqCigar
                 // prefix insertion with more gaps.
                 for (int l = inspos - g_seqs[s].length(); l > 0; l--)
                 {
-                  g_seqs[s].append(gapCharacter); // to debug - use a diffferent gap character here
+                  g_seqs[s].append(gapCharacter); // to debug - use a diffferent
+                                                  // gap character here
                 }
               }
               g_seqs[s].insert(inspos, insert);
             }
             else
             {
-              g_seqs[s].insert(inspos,
-                               alseqs_string[i].substring(region[0],
-                  region[1] + 1));
+              g_seqs[s].insert(inspos, alseqs_string[i].substring(
+                      region[0], region[1] + 1));
             }
           }
-          shifts.addShift(region[2], insert.length); // update shift in alignment frame of reference
+          shifts.addShift(region[2], insert.length); // update shift in
+                                                      // alignment frame of
+                                                      // reference
           if (segments == null)
           {
             // add a hidden column for this deletion
@@ -472,12 +519,12 @@ public class SeqCigar
     }
     for (int i = 0; i < alseqs.length; i++)
     {
-      int[] bounds = ( (int[]) ( (Object[]) gs_regions[i])[1]);
+      int[] bounds = ((int[]) ((Object[]) gs_regions[i])[1]);
       SequenceI ref = alseqs[i].getRefSeq();
-      seqs[i] = new Sequence(ref.getName(), g_seqs[i].toString(),
-                             ref.getStart() + alseqs[i].start + bounds[0],
-                             ref.getStart() + alseqs[i].start +
-                             (bounds[2] == 0 ? -1 : bounds[2]));
+      seqs[i] = new Sequence(ref.getName(), g_seqs[i].toString(), ref
+              .getStart()
+              + alseqs[i].start + bounds[0], ref.getStart()
+              + alseqs[i].start + (bounds[2] == 0 ? -1 : bounds[2]));
       seqs[i].setDatasetSequence(ref);
       seqs[i].setDescription(ref.getDescription());
     }
@@ -485,10 +532,10 @@ public class SeqCigar
     {
       for (int i = 0; i < segments.length; i += 3)
       {
-        //int start=shifts.shift(segments[i]-1)+1;
-        //int end=shifts.shift(segments[i]+segments[i+1]-1)-1;
-        colsel.hideColumns(segments[i + 1],
-                           segments[i + 1] + segments[i + 2] - 1);
+        // int start=shifts.shift(segments[i]-1)+1;
+        // int end=shifts.shift(segments[i]+segments[i+1]-1)-1;
+        colsel.hideColumns(segments[i + 1], segments[i + 1]
+                + segments[i + 2] - 1);
       }
     }
     return seqs;
@@ -498,9 +545,11 @@ public class SeqCigar
    * non rigorous testing
    */
   /**
-   *
-   * @param seq Sequence
-   * @param ex_cs_gapped String
+   * 
+   * @param seq
+   *                Sequence
+   * @param ex_cs_gapped
+   *                String
    * @return String
    */
   public static String testCigar_string(Sequence seq, String ex_cs_gapped)
@@ -509,71 +558,69 @@ public class SeqCigar
     String cs_gapped = c_sgapped.getCigarstring();
     if (!cs_gapped.equals(ex_cs_gapped))
     {
-      System.err.println("Failed getCigarstring: incorect string '" + cs_gapped +
-                         "' != " + ex_cs_gapped);
+      System.err.println("Failed getCigarstring: incorect string '"
+              + cs_gapped + "' != " + ex_cs_gapped);
     }
     return cs_gapped;
   }
 
   public static boolean testSeqRecovery(SeqCigar gen_sgapped,
-                                        SequenceI s_gapped)
+          SequenceI s_gapped)
   {
-    // this is non-rigorous - start and end  recovery is not tested.
+    // this is non-rigorous - start and end recovery is not tested.
     SequenceI gen_sgapped_s = gen_sgapped.getSeq('-');
     if (!gen_sgapped_s.getSequence().equals(s_gapped.getSequence()))
     {
-      System.err.println("Couldn't reconstruct sequence.\n" +
-                         gen_sgapped_s.getSequenceAsString() + "\n" +
-                         s_gapped.getSequenceAsString());
+      System.err.println("Couldn't reconstruct sequence.\n"
+              + gen_sgapped_s.getSequenceAsString() + "\n"
+              + s_gapped.getSequenceAsString());
       return false;
     }
     return true;
   }
 
-  public static void main(String argv[])
-      throws Exception
+  public static void main(String argv[]) throws Exception
   {
     String o_seq;
     Sequence s = new Sequence("MySeq",
-                              o_seq =
-                              "asdfktryasdtqwrtsaslldddptyipqqwaslchvhttt",
-                              39, 80);
+            o_seq = "asdfktryasdtqwrtsaslldddptyipqqwaslchvhttt", 39, 80);
     String orig_gapped;
-    Sequence s_gapped = new Sequence("MySeq",
-                                     orig_gapped =
-        "----asdf------ktryas---dtqwrtsasll----dddptyipqqwa----slchvhttt",
-                                     39, 80);
+    Sequence s_gapped = new Sequence(
+            "MySeq",
+            orig_gapped = "----asdf------ktryas---dtqwrtsasll----dddptyipqqwa----slchvhttt",
+            39, 80);
     String ex_cs_gapped = "4I4M6I6M3I11M4I12M4I9M";
     s_gapped.setDatasetSequence(s);
     String sub_gapped_s;
-    Sequence s_subsequence_gapped = new Sequence("MySeq",
-                                                 sub_gapped_s =
-        "------ktryas---dtqwrtsasll----dddptyipqqwa----slchvh",
-                                                 43, 77);
+    Sequence s_subsequence_gapped = new Sequence(
+            "MySeq",
+            sub_gapped_s = "------ktryas---dtqwrtsasll----dddptyipqqwa----slchvh",
+            43, 77);
 
     s_subsequence_gapped.setDatasetSequence(s);
     SeqCigar c_null = new SeqCigar(s);
     String cs_null = c_null.getCigarstring();
     if (!cs_null.equals("42M"))
     {
-      System.err.println(
-          "Failed to recover ungapped sequence cigar operations:" +
-          ( (cs_null == "") ? "empty string" : cs_null));
+      System.err
+              .println("Failed to recover ungapped sequence cigar operations:"
+                      + ((cs_null == "") ? "empty string" : cs_null));
     }
     testCigar_string(s_gapped, ex_cs_gapped);
     SeqCigar gen_sgapped = SeqCigar.parseCigar(s, ex_cs_gapped);
     if (!gen_sgapped.getCigarstring().equals(ex_cs_gapped))
     {
-      System.err.println("Failed parseCigar(" + ex_cs_gapped +
-                         ")->getCigarString()->'" + gen_sgapped.getCigarstring() +
-                         "'");
+      System.err.println("Failed parseCigar(" + ex_cs_gapped
+              + ")->getCigarString()->'" + gen_sgapped.getCigarstring()
+              + "'");
     }
     testSeqRecovery(gen_sgapped, s_gapped);
     // Test dataset resolution
     SeqCigar sub_gapped = new SeqCigar(s_subsequence_gapped);
     if (!testSeqRecovery(sub_gapped, s_subsequence_gapped))
     {
-      System.err.println("Failed recovery for subsequence of dataset sequence");
+      System.err
+              .println("Failed recovery for subsequence of dataset sequence");
     }
     // width functions
     if (sub_gapped.getWidth() != sub_gapped_s.length())
@@ -590,14 +637,13 @@ public class SeqCigar
     SeqCigar sub_se_gp = new SeqCigar(s_subsequence_gapped, 8, 48);
     if (sub_se_gp.getWidth() != 41)
     {
-      System.err.println(
-          "SeqCigar(seq, start, end) not properly clipped alignsequence.");
+      System.err
+              .println("SeqCigar(seq, start, end) not properly clipped alignsequence.");
     }
-    System.out.println("Original sequence align:\n" + sub_gapped_s +
-                       "\nReconstructed window from 8 to 48\n"
-                       + "XXXXXXXX" + sub_se_gp.getSequenceString('-') + "..."
-                       + "\nCigar String:" + sub_se_gp.getCigarstring() + "\n"
-        );
+    System.out.println("Original sequence align:\n" + sub_gapped_s
+            + "\nReconstructed window from 8 to 48\n" + "XXXXXXXX"
+            + sub_se_gp.getSequenceString('-') + "..." + "\nCigar String:"
+            + sub_se_gp.getCigarstring() + "\n");
     SequenceI ssgp = sub_se_gp.getSeq('-');
     System.out.println("\t " + ssgp.getSequenceAsString());
     for (int r = 0; r < 10; r++)
@@ -616,36 +662,34 @@ public class SeqCigar
     }
     {
       SeqCigar[] set = new SeqCigar[]
-          {
-          new SeqCigar(s), new SeqCigar(s_subsequence_gapped, 8, 48),
-          new SeqCigar(s_gapped)};
+      { new SeqCigar(s), new SeqCigar(s_subsequence_gapped, 8, 48),
+          new SeqCigar(s_gapped) };
       Alignment al = new Alignment(set);
       for (int i = 0; i < al.getHeight(); i++)
       {
-        System.out.println("" + al.getSequenceAt(i).getName() + "\t" +
-                           al.getSequenceAt(i).getStart() + "\t" +
-                           al.getSequenceAt(i).getEnd() + "\t" +
-                           al.getSequenceAt(i).getSequenceAsString());
+        System.out.println("" + al.getSequenceAt(i).getName() + "\t"
+                + al.getSequenceAt(i).getStart() + "\t"
+                + al.getSequenceAt(i).getEnd() + "\t"
+                + al.getSequenceAt(i).getSequenceAsString());
       }
     }
     {
       System.out.println("Gapped.");
       SeqCigar[] set = new SeqCigar[]
-          {
-          new SeqCigar(s), new SeqCigar(s_subsequence_gapped, 8, 48),
-          new SeqCigar(s_gapped)};
+      { new SeqCigar(s), new SeqCigar(s_subsequence_gapped, 8, 48),
+          new SeqCigar(s_gapped) };
       set[0].deleteRange(20, 25);
       Alignment al = new Alignment(set);
       for (int i = 0; i < al.getHeight(); i++)
       {
-        System.out.println("" + al.getSequenceAt(i).getName() + "\t" +
-                           al.getSequenceAt(i).getStart() + "\t" +
-                           al.getSequenceAt(i).getEnd() + "\t" +
-                           al.getSequenceAt(i).getSequenceAsString());
+        System.out.println("" + al.getSequenceAt(i).getName() + "\t"
+                + al.getSequenceAt(i).getStart() + "\t"
+                + al.getSequenceAt(i).getEnd() + "\t"
+                + al.getSequenceAt(i).getSequenceAsString());
       }
     }
-//    if (!ssgapedseq.equals("ryas---dtqqwa----slchvh"))
-//      System.err.println("Subseqgaped\n------ktryas---dtqwrtsasll----dddptyipqqwa----slchvhryas---dtqwrtsasll--qwa----slchvh\n"+ssgapedseq+"\n"+sub_se_gp.getCigarstring());
+    // if (!ssgapedseq.equals("ryas---dtqqwa----slchvh"))
+    // System.err.println("Subseqgaped\n------ktryas---dtqwrtsasll----dddptyipqqwa----slchvhryas---dtqwrtsasll--qwa----slchvh\n"+ssgapedseq+"\n"+sub_se_gp.getCigarstring());
   }
 
 }