Sequence is char []
[jalview.git] / src / jalview / datamodel / AlignmentView.java
index a76e90e..58b379b 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)
   {
@@ -234,7 +244,7 @@ public class AlignmentView
                 }
                 else
                 {
-                  alignment[s].setSequence(alignment[s].getSequence() +
+                  alignment[s].setSequence(alignment[s].getSequenceAsString() +
                                            mseq[s].getSequence());
                   if (mseq[s].getStart() <= mseq[s].getEnd())
                   {
@@ -266,7 +276,7 @@ public class AlignmentView
                   }
                   else
                   {
-                    alignment[s].setSequence(alignment[s].getSequence() +
+                    alignment[s].setSequence(alignment[s].getSequenceAsString() +
                                              oseq.getSequence());
                     if (oseq.getEnd() >= oseq.getStart())
                     {
@@ -293,7 +303,7 @@ public class AlignmentView
             }
             else
             {
-              alignment[s].setSequence(alignment[s].getSequence() +
+              alignment[s].setSequence(alignment[s].getSequenceAsString() +
                                        hseq.getSequence());
               if (hseq.getEnd() >= hseq.getStart())
               {
@@ -322,7 +332,7 @@ public class AlignmentView
               }
               else
               {
-                alignment[s].setSequence(alignment[s].getSequence() +
+                alignment[s].setSequence(alignment[s].getSequenceAsString() +
                                          mseq[s].getSequence());
                 if (mseq[s].getEnd() >= mseq[s].getStart())
                 {
@@ -356,7 +366,7 @@ public class AlignmentView
                   }
                   else
                   {
-                    alignment[s].setSequence(alignment[s].getSequence() +
+                    alignment[s].setSequence(alignment[s].getSequenceAsString() +
                                              oseq.getSequence());
                     if (oseq.getEnd() >= oseq.getStart())
                     {
@@ -387,7 +397,7 @@ public class AlignmentView
   }
   /**
    * returns simple array of start end positions of visible range on alignment.
-   * vis_start and vis_end are inclusive - use SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence from underlying alignment. 
+   * vis_start and vis_end are inclusive - use SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence from underlying alignment.
    * @return int[] { start_i, end_i } for 1<i<n visible regions.
    */
   public int[] getVisibleContigs() {
@@ -419,7 +429,7 @@ public class AlignmentView
           viscontigs[nvis+1]=contigs[contig+1]-1; // end is inclusive
           nvis+=2;
         }
-        start = contigs[contig + 1] + contigs[contig + 2];              
+        start = contigs[contig + 1] + contigs[contig + 2];
       }
       if (start<fwidth) {
         viscontigs[nvis] = start;
@@ -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;
+  }
 }