JAL-2629 fix for NPE caused by incorrect initiation of HMM annotation
authorTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Thu, 24 Aug 2017 13:13:30 +0000 (14:13 +0100)
committerTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Fri, 25 Aug 2017 16:21:01 +0000 (17:21 +0100)
src/jalview/hmmer/HMMERCommands.java
src/jalview/io/FileLoader.java
src/jalview/viewmodel/AlignmentViewport.java

index 913eee8..6b81b65 100644 (file)
@@ -173,7 +173,6 @@ public class HMMERCommands
     af.alignPanel.adjustAnnotationHeight();
     af.getViewport().updateSequenceIdColours();
     af.buildSortByAnnotationScoresMenu();
-    af.getViewport().initInformation();
   }
 
   /**
index b07e125..f3a4a1c 100755 (executable)
@@ -29,8 +29,6 @@ import jalview.bin.Jalview;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.HiddenColumns;
 import jalview.datamodel.PDBEntry;
-import jalview.datamodel.Profile;
-import jalview.datamodel.Profiles;
 import jalview.datamodel.SequenceGroup;
 import jalview.datamodel.SequenceI;
 import jalview.gui.AlignFrame;
@@ -428,6 +426,7 @@ public class FileLoader implements Runnable
               AlignmentI alignment = viewport.getAlignment();
               SequenceI seq = alignment
                       .getSequenceAt(alignment.getAbsoluteHeight() - 1);
+              seq.setIsHMMConsensusSequence(true);
               alignment.deleteSequence(alignment.getAbsoluteHeight() - 1);
               SequenceGroup sg = viewport.getSelectionGroup();
               if (sg != null)
@@ -445,10 +444,6 @@ public class FileLoader implements Runnable
               {
                 alignment.insertSequenceAt(0, seq);
               }
-              viewport.initInformation();
-              viewport.setSequenceInformationHash(
-                      new Profiles(new Profile[1]), 0);
-              viewport.updateInformation(viewport.getAlignPanel());
               viewport.getAlignPanel().adjustAnnotationHeight();
               viewport.updateSequenceIdColours();
               if (viewport.getAlignPanel().alignFrame
index a4b494a..eeea831 100644 (file)
@@ -779,6 +779,10 @@ public abstract class AlignmentViewport
   @Override
   public void setSequenceInformationHash(ProfilesI info, int index)
   {
+    if (hinformation.size() < index + 1)
+    {
+      return;
+    }
     hinformation.set(index, info);
   }
 
@@ -1997,6 +2001,7 @@ public abstract class AlignmentViewport
     {
       updateStrucConsensus(ap);
     }
+    initInformation();
     updateInformation(ap);
 
     List<SequenceI> hmmSequences;