JAL-1683 replace year/version strings with tokens in source
[jalview.git] / src / jalview / datamodel / AlignmentAnnotation.java
index 0207575..09d9ee0 100755 (executable)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
@@ -75,9 +75,10 @@ public class AlignmentAnnotation
   public SequenceFeature[] _rnasecstr = null;
 
   /**
-   * position of annotation resulting in invalid WUSS parsing or -1
+   * position of annotation resulting in invalid WUSS parsing or -1. -2 means
+   * there was no RNA structure in this annotation
    */
-  private long invalidrnastruc = -1;
+  private long invalidrnastruc = -2;
 
   /**
    * Updates the _rnasecstr field Determines the positions that base pair and
@@ -118,6 +119,7 @@ public class AlignmentAnnotation
 
   private void _markRnaHelices()
   {
+    int mxval = 0;
     // Figure out number of helices
     // Length of rnasecstr is the number of pairs of positions that base pair
     // with each other in the secondary structure
@@ -133,6 +135,10 @@ public class AlignmentAnnotation
       try
       {
         val = Integer.valueOf(_rnasecstr[x].getFeatureGroup());
+        if (mxval < val)
+        {
+          mxval = val;
+        }
       } catch (NumberFormatException q)
       {
       }
@@ -141,9 +147,10 @@ public class AlignmentAnnotation
       annotations[_rnasecstr[x].getBegin()].value = val;
       annotations[_rnasecstr[x].getEnd()].value = val;
 
-      annotations[_rnasecstr[x].getBegin()].displayCharacter = "" + val;
-      annotations[_rnasecstr[x].getEnd()].displayCharacter = "" + val;
+      // annotations[_rnasecstr[x].getBegin()].displayCharacter = "" + val;
+      // annotations[_rnasecstr[x].getEnd()].displayCharacter = "" + val;
     }
+    setScore(mxval);
   }
   /**
    * map of positions in the associated annotation
@@ -486,11 +493,10 @@ public class AlignmentAnnotation
     @Override
     public char charAt(int index)
     {
-      String dc;
       return ((index + offset < 0) || (index + offset) >= max
-              || annotations[index + offset] == null || (dc = annotations[index
-              + offset].displayCharacter.trim()).length() < 1) ? '.' : dc
-              .charAt(0);
+              || annotations[index + offset] == null || (annotations[index
+ + offset].secondaryStructure < ' ') ? ' '
+              : annotations[index + offset].secondaryStructure);
     }
 
     public String toString()
@@ -500,9 +506,8 @@ public class AlignmentAnnotation
 
       for (int i = offset; i < mx; i++)
       {
-        String dc;
-        string[i] = (annotations[i] == null || (dc = annotations[i].displayCharacter
-                .trim()).length() < 1) ? '.' : dc.charAt(0);
+        string[i] = (annotations[i] == null || (annotations[i].secondaryStructure < 32)) ? ' '
+                : annotations[i].secondaryStructure;
       }
       return new String(string);
     }