fix for JAL-1297: COMBINE output now follows specification and all additional annotat...
authorJim Procter <jprocter@compbio.dundee.ac.uk>
Wed, 22 May 2013 16:53:03 +0000 (17:53 +0100)
committerJim Procter <jprocter@compbio.dundee.ac.uk>
Fri, 24 May 2013 14:10:55 +0000 (15:10 +0100)
src/jalview/io/AnnotationFile.java

index a94bd3c..d15e7c5 100755 (executable)
@@ -132,6 +132,7 @@ public class AnnotationFile
       StringBuffer graphLine = new StringBuffer();
       StringBuffer rowprops = new StringBuffer();
       Hashtable graphGroup = new Hashtable();
+      BitSet graphGroupSeen = new BitSet();
 
       java.awt.Color color;
 
@@ -139,7 +140,7 @@ public class AnnotationFile
       {
         row = annotations[i];
 
-        if (!row.visible && !row.hasScore())
+        if (!row.visible && !row.hasScore() && !(row.graphGroup>-1 && graphGroupSeen.get(row.graphGroup)))
         {
           continue;
         }
@@ -251,6 +252,7 @@ public class AnnotationFile
 
           if (row.graphGroup > -1)
           {
+            graphGroupSeen.set(row.graphGroup);
             String key = String.valueOf(row.graphGroup);
             if (graphGroup.containsKey(key))
             {
@@ -382,10 +384,10 @@ public class AnnotationFile
       text.append(graphLine.toString());
       if (graphGroup.size() > 0)
       {
-        text.append("COMBINE\t");
         Enumeration en = graphGroup.elements();
         while (en.hasMoreElements())
         {
+          text.append("COMBINE\t");
           text.append(en.nextElement());
           text.append(newline);
         }