JAL-1517 update copyright to version 2.8.2
[jalview.git] / src / jalview / datamodel / Sequence.java
index 580c850..24c409a 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.2)
+ * 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;
 
@@ -22,6 +23,8 @@ import jalview.analysis.AlignSeq;
 import java.util.Enumeration;
 import java.util.Vector;
 
+import fr.orsay.lri.varna.models.rna.RNA;
+
 /**
  * 
  * Implements the SequenceI interface for a char[] based sequence object.
@@ -48,6 +51,8 @@ public class Sequence implements SequenceI
   String vamsasId;
 
   DBRefEntry[] dbrefs;
+  
+  RNA rna;
 
   /**
    * This annotation is displayed below the alignment but the positions are tied
@@ -60,7 +65,7 @@ public class Sequence implements SequenceI
    */
   int index = -1;
 
-  /** array of seuqence features - may not be null for a valid sequence object */
+  /** array of sequence features - may not be null for a valid sequence object */
   public SequenceFeature[] sequenceFeatures;
 
   /**
@@ -707,6 +712,7 @@ public class Sequence implements SequenceI
     {
       tmp = new char[i];
       System.arraycopy(sequence, 0, tmp, 0, i);
+      j=sequence.length;
     }
     else
     {
@@ -715,6 +721,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 +1001,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;
   }
@@ -1200,4 +1221,9 @@ public class Sequence implements SequenceI
   {
     index = value;
   }
+  
+  public void setRNA(RNA r){rna=r;}
+  
+  public RNA getRNA() { return rna; }
+  
 }