fixed getCompactAlignment method to return proper cigarArray and added 'firstColumn...
authorjprocter <Jim Procter>
Mon, 9 Oct 2006 16:07:31 +0000 (16:07 +0000)
committerjprocter <Jim Procter>
Mon, 9 Oct 2006 16:07:31 +0000 (16:07 +0000)
src/jalview/datamodel/Alignment.java
src/jalview/datamodel/AlignmentView.java

index a770264..e4bc25e 100755 (executable)
@@ -835,7 +835,9 @@ public class Alignment implements AlignmentI
     for (int i=0; i<sequences.size(); i++) {
       alseqs[i] = new SeqCigar((SequenceI) sequences.elementAt(i));
     }
-    return new CigarArray(alseqs);
+    CigarArray cal = new CigarArray(alseqs);
+    cal.addOperation(CigarArray.M, getWidth());
+    return cal;
   }
 
 }
index a76e90e..e668470 100644 (file)
@@ -40,6 +40,7 @@ public class AlignmentView
     private SeqCigar[] sequences = null;
   private int[] contigs = null;
   private int width=0;
+  private int firstCol=0;
   public AlignmentView(CigarArray seqcigararray)
   {
     if (!seqcigararray.isSeqCigarArray())
@@ -49,6 +50,15 @@ public class AlignmentView
     sequences = seqcigararray.getSeqCigarArray();
     width = seqcigararray.getWidth(); // visible width
   }
+  /**
+   * Create an alignmentView where the first column corresponds with the 'firstcol' column of some reference alignment 
+   * @param sdata
+   * @param firstcol
+   */
+  public AlignmentView(CigarArray sdata, int firstcol) {
+    this(sdata);
+    firstCol=firstcol;
+  }
 
   public void setSequences(SeqCigar[] sequences)
   {
@@ -431,4 +441,12 @@ public class AlignmentView
       return new int[] { 0, width};
     }
   }
+  /**
+   * 
+   * @return position of first visible column of AlignmentView within its parent's alignment reference frame 
+   */
+  public int getAlignmentOrigin() {
+    // TODO Auto-generated method stub
+    return firstCol;
+  }
 }