Visible state of annotation
authoramwaterhouse <Andrew Waterhouse>
Thu, 10 May 2007 07:14:18 +0000 (07:14 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 10 May 2007 07:14:18 +0000 (07:14 +0000)
src/jalview/gui/Jalview2XML.java

index 9bf6a21..aa1abb3 100755 (executable)
@@ -520,6 +520,8 @@ public class Jalview2XML
           continue;
         }
 
+        an.setVisible(aa[i].visible);
+
         an.setDescription(aa[i].description);
 
         if (aa[i].sequenceRef != null)
@@ -1361,6 +1363,9 @@ public class Jalview2XML
 
           for (int aa = 0; aa < ae.length && aa < anot.length; aa++)
           {
+            if(ae[aa].getPosition()>=anot.length)
+              continue;
+
             anot[ae[aa].getPosition()] = new jalview.datamodel.Annotation(
 
                     ae[aa].getDisplayCharacter(),
@@ -1411,15 +1416,22 @@ public class Jalview2XML
 
         if (an[i].getSequenceRef() != null)
         {
-          jaa.createSequenceMapping(
-              al.findName(an[i].getSequenceRef()), 1, true
-              );
-          al.findName(an[i].getSequenceRef()).addAlignmentAnnotation(jaa);
+          if (al.findName(an[i].getSequenceRef()) != null)
+          {
+            jaa.createSequenceMapping(
+                al.findName(an[i].getSequenceRef()), 1, true
+                );
+            al.findName(an[i].getSequenceRef()).addAlignmentAnnotation(jaa);
+          }
         }
         if (an[i].hasScore())
         {
           jaa.setScore(an[i].getScore());
         }
+
+        if(an[i].hasVisible())
+          jaa.visible =  an[i].getVisible();
+
         al.addAnnotation(jaa);
       }
     }