JAL-1503 update version in GPL header
[jalview.git] / src / jalview / datamodel / Sequence.java
index 580c850..910c86d 100755 (executable)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
- * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
+ * Copyright (C) 2014 The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
@@ -14,6 +14,7 @@
  * PURPOSE.  See the GNU General Public License for more details.
  * 
  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
 package jalview.datamodel;
 
@@ -707,6 +708,7 @@ public class Sequence implements SequenceI
     {
       tmp = new char[i];
       System.arraycopy(sequence, 0, tmp, 0, i);
+      j=sequence.length;
     }
     else
     {
@@ -715,6 +717,9 @@ public class Sequence implements SequenceI
       System.arraycopy(sequence, j, tmp, i, sequence.length - j);
     }
     boolean createNewDs = false;
+    // TODO: take a look at the new dataset creation validation method below -
+    // this could become time comsuming for large sequences - consider making it
+    // more efficient
     for (int s = i; s < j; s++)
     {
       if (jalview.schemes.ResidueProperties.aaIndex[sequence[s]] != 23)
@@ -992,6 +997,18 @@ public class Sequence implements SequenceI
       datasetSequence.setPDBId(getPDBId());
       setPDBId(null);
       datasetSequence.updatePDBIds();
+      if (annotation != null)
+      {
+        Vector<AlignmentAnnotation> _annot = annotation;
+        annotation = null;
+        for (AlignmentAnnotation aa : _annot)
+        {
+          aa.sequenceRef = datasetSequence;
+          aa.adjustForAlignment(); // uses annotation's own record of
+                                   // sequence-column mapping
+          datasetSequence.addAlignmentAnnotation(aa);
+        }
+      }
     }
     return datasetSequence;
   }