All or nothing drawing display char
authoramwaterhouse <Andrew Waterhouse>
Mon, 15 May 2006 14:09:34 +0000 (14:09 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 15 May 2006 14:09:34 +0000 (14:09 +0000)
src/jalview/datamodel/AlignmentAnnotation.java
src/jalview/io/AnnotationReader.java

index ae3c5f9..7f6b08a 100755 (executable)
@@ -139,6 +139,8 @@ public class AlignmentAnnotation
         this.annotations = annotations;\r
         graph = graphType;\r
 \r
+        boolean drawValues = true;\r
+\r
         if (min == max)\r
         {\r
             min = 999999999;\r
@@ -149,6 +151,11 @@ public class AlignmentAnnotation
                     continue;\r
                 }\r
 \r
+                if(drawValues && annotations[i].displayCharacter.length() > 1 )\r
+                {\r
+                  drawValues = false;\r
+                }\r
+\r
                 if (annotations[i].value > max)\r
                 {\r
                     max = annotations[i].value;\r
@@ -161,6 +168,15 @@ public class AlignmentAnnotation
             }\r
         }\r
 \r
+        if(!drawValues)\r
+        {\r
+          for (int i = 0; i < annotations.length; i++)\r
+          {\r
+            if (annotations[i] != null)\r
+              annotations[i].displayCharacter = "";\r
+          }\r
+        }\r
+\r
         graphMin = min;\r
         graphMax = max;\r
 \r
index d42167a..cd7abfd 100755 (executable)
@@ -170,6 +170,7 @@ public class AnnotationReader
     String desc = "", displayChar="";\r
     char ss = ' '; // secondaryStructure\r
     float value = 0;\r
+    boolean parsedValue = false;\r
     StringTokenizer st = new StringTokenizer(string, ",");\r
     String token;\r
     while(st.hasMoreTokens())\r
@@ -178,29 +179,24 @@ public class AnnotationReader
       if(token.length()==0)\r
         continue;\r
 \r
-      if(value==0)\r
-      {  try{\r
-          value =  new Float(token).floatValue();\r
+      if(!parsedValue)\r
+      {\r
+        try{\r
+          value = new Float(token).floatValue();\r
+          displayChar = token;\r
+          parsedValue = true;\r
         }catch(NumberFormatException ex){}\r
       }\r
 \r
-      if(token.length()==1)\r
+      if(token.equals("H") || token.equals("E"))\r
       {\r
         // Either this character represents a helix or sheet\r
         // or an integer which can be displayed\r
-        if(token.equals("H") || token.equals("E"))\r
-        {\r
-          ss = token.charAt(0);\r
-        }\r
-        else //if(value!=0)\r
-        {\r
-          displayChar = token;\r
-        }\r
+        ss = token.charAt(0);\r
       }\r
       else if(desc.length()<1)\r
         desc = token;\r
-      else\r
-        displayChar = token;\r
+\r
     }\r
 \r
     return new Annotation(displayChar, desc, ss, value);\r