Sequence colour moved to viewport
[jalview.git] / src / jalview / datamodel / SeqCigar.java
index 816e531..74a7812 100644 (file)
@@ -1,3 +1,21 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer
+ * Copyright (C) 2006 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
+ */
 package jalview.datamodel;
 
 import jalview.analysis.*;
@@ -62,10 +80,11 @@ public class SeqCigar
       throw new Error(
           "Implementation Error - unexpected null from getSequenceAndDeletions");
     }
-
+    int bounds[] = (int[]) edit_result[1];
     seq = new Sequence(refseq.getName(), (String) edit_result[0],
-                       refseq.getStart() + start+( (int[]) edit_result[1])[0],
-                       refseq.getStart() + start+( (int[]) edit_result[1])[2]);
+                       refseq.getStart() + start+bounds[0],
+                       refseq.getStart() + start+((bounds[2]==0) ? -1 : bounds[2]));
+    // seq.checkValidRange(); probably not needed
     seq.setDatasetSequence(refseq);
     return seq;
   }
@@ -416,8 +435,9 @@ public class SeqCigar
       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]);
+                             ref.getStart() + alseqs[i].start+(bounds[2]==0 ? -1 : bounds[2]));
       seqs[i].setDatasetSequence(ref);
+      seqs[i].setDescription(ref.getDescription());
     }
     if (segments!=null) {
       for (int i=0; i<segments.length; i+=3) {