JAL-2629 selected HMM is now a sequence, not a HMM
authortzvanaalten <tzvanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Wed, 23 Aug 2017 14:39:03 +0000 (15:39 +0100)
committertzvanaalten <tzvanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Wed, 23 Aug 2017 14:39:03 +0000 (15:39 +0100)
src/jalview/gui/AlignFrame.java
src/jalview/gui/PopupMenu.java
src/jalview/io/FileLoader.java

index 99124f8..abecd10 100644 (file)
@@ -181,7 +181,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   /*
    * The selected HMM for this align frame
    */
-  HiddenMarkovModel selectedHMM = null;
+  SequenceI selectedHMMSequence;
 
   List<AlignmentPanel> alignPanels = new ArrayList<>();
 
@@ -1054,13 +1054,6 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
   }
 
   @Override
-  public void autoAlignSeqs_actionPerformed(boolean autoAlignSeqs)
-  {
-    autoAlignNewSequences = autoAlignSeqs;
-    alignPanel.repaint();
-  }
-
-  @Override
   public void hmmSearch_actionPerformed(ActionEvent e)
   {
     alignPanel.repaint();
@@ -5698,7 +5691,21 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
    */
   public HiddenMarkovModel getSelectedHMM()
   {
-    return selectedHMM;
+    if (selectedHMMSequence == null)
+    {
+      return null;
+    }
+    return selectedHMMSequence.getHMM();
+  }
+
+  /**
+   * Returns the selected hidden Markov model.
+   * 
+   * @return
+   */
+  public SequenceI getSelectedHMMSequence()
+  {
+    return selectedHMMSequence;
   }
 
   /**
@@ -5706,13 +5713,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
    * 
    * @param selectedHMM
    */
-  public void setSelectedHMM(HiddenMarkovModel selectedHMM)
+  public void setSelectedHMMSequence(SequenceI selectedHMM)
   {
-    this.selectedHMM = selectedHMM;
+    this.selectedHMMSequence = selectedHMM;
     hmmAlign.setText(MessageManager.getString("label.hmmalign") + " to "
-            + selectedHMM.getName() + "_HMM");
+            + selectedHMM.getHMM().getName() + "_HMM");
     hmmSearch.setText(MessageManager.getString("label.hmmsearch") + " with "
-            + selectedHMM.getName() + "_HMM");
+            + selectedHMM.getHMM().getName() + "_HMM");
   }
 
   @Override
index 6ad1dd2..97ce501 100644 (file)
@@ -33,7 +33,6 @@ import jalview.datamodel.AlignmentI;
 import jalview.datamodel.Annotation;
 import jalview.datamodel.DBRefEntry;
 import jalview.datamodel.HiddenColumns;
-import jalview.datamodel.HiddenMarkovModel;
 import jalview.datamodel.PDBEntry;
 import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceFeature;
@@ -1295,13 +1294,13 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener
 
   protected void selectHMM_actionPerformed(ActionEvent e)
   {
-    HiddenMarkovModel hmm = ap.av.getSequenceSelection()[0].getHMM();
-    ap.alignFrame.setSelectedHMM(hmm);
+    SequenceI hmm = ap.av.getSequenceSelection()[0];
+    ap.alignFrame.setSelectedHMMSequence(hmm);
   }
 
   protected void hmmAlign_actionPerformed(ActionEvent e)
   {
-    ap.alignFrame.setSelectedHMM(this.sequence.getHMM());
+    ap.alignFrame.setSelectedHMMSequence(this.sequence);
     new Thread(new HMMAlignThread(ap.alignFrame, true)).start();
     ap.repaint();
   }
index 977cc12..b07e125 100755 (executable)
@@ -455,7 +455,7 @@ public class FileLoader implements Runnable
                       .getSelectedHMM() == null)
               {
                 viewport.getAlignPanel().alignFrame
-                        .setSelectedHMM(seq.getHMM());
+                        .setSelectedHMMSequence(seq);
               }
 
             }