From: TZVanaalten Date: Tue, 15 Aug 2017 11:21:15 +0000 (+0100) Subject: JAL-2629 selected HMM name now shown in HMMER menu X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=8af8526d7448904c67db19f41e237a0eedd55a74;p=jalview.git JAL-2629 selected HMM name now shown in HMMER menu --- diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index a03ab7f..891a8ac 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -1315,11 +1315,11 @@ label.occupancy_descr = Number of aligned positions label.show_experimental = Enable experimental features label.show_experimental_tip = Enable any new and currently 'experimental' features (see Latest Release Notes for details) label.warning_hidden = Warning: {0} {1} is currently hidden -label.hmmalign = Align Sequences to HMM -label.hmmbuild = Build HMM from Alignment +label.hmmalign = hmmalign +label.hmmbuild = hmmbuild label.hmmbuild_group = Build HMM from Selected Group label.group_hmmbuild = Build HMM from Group -label.hmmsearch = Search for Related Sequences +label.hmmsearch = hmmsearch label.change_hmmer_location = HMMER Installation Location warn.null_hmm = Please ensure the alignment contains a hidden Markov model. label.ignore_below_background_frequency = Ignore Below Background Frequency diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 9c4a75c..ed26833 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -54,6 +54,7 @@ import jalview.datamodel.AlignmentOrder; import jalview.datamodel.AlignmentView; import jalview.datamodel.ColumnSelection; import jalview.datamodel.HiddenColumns; +import jalview.datamodel.HiddenMarkovModel; import jalview.datamodel.HiddenSequences; import jalview.datamodel.PDBEntry; import jalview.datamodel.SeqCigar; @@ -178,6 +179,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public AlignViewControllerI avc; + HiddenMarkovModel selectedHMM = null; + List alignPanels = new ArrayList<>(); /** @@ -5698,6 +5701,42 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { hmmerMenu.setEnabled(status); } + + public HiddenMarkovModel getSelectedHMM() + { + return selectedHMM; + } + + /** + * Sets the selected hidden Markov model + * + * @param selectedHMM + */ + public void setSelectedHMM(HiddenMarkovModel selectedHMM) + { + this.selectedHMM = selectedHMM; + hmmAlign.setText(MessageManager.getString("label.hmmalign") + " to " + + selectedHMM.getName() + "_HMM"); + hmmSearch.setText(MessageManager.getString("label.hmmsearch") + " with " + + selectedHMM.getName() + "_HMM"); + } + + @Override + public void hmmerMenu_actionPerformed(ActionEvent e) + { + SequenceGroup grp = getViewport().getSelectionGroup(); + if (grp != null) + { + hmmBuild.setText(MessageManager.getString("label.hmmbuild") + " from " + + grp.getName()); + } + else + { + hmmBuild.setText(MessageManager.getString("label.hmmbuild") + + " from Alignment"); + } + } + } class PrintThread extends Thread @@ -5736,6 +5775,4 @@ class PrintThread extends Thread } } } - - } diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index fd652b2..73d7941 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -1295,12 +1295,12 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener protected void selectHMM_actionPerformed(ActionEvent e) { HiddenMarkovModel hmm = ap.av.getSequenceSelection()[0].getHMM(); - ap.av.setSelectedHMM(hmm); + ap.alignFrame.setSelectedHMM(hmm); } protected void hmmAlign_actionPerformed(ActionEvent e) { - ap.av.setSelectedHMM(this.sequence.getHMM()); + ap.alignFrame.setSelectedHMM(this.sequence.getHMM()); new Thread(new HMMAlignThread(ap.alignFrame, true)).start(); ap.repaint(); } diff --git a/src/jalview/hmmer/HMMAlignThread.java b/src/jalview/hmmer/HMMAlignThread.java index a778e14..d94ce97 100644 --- a/src/jalview/hmmer/HMMAlignThread.java +++ b/src/jalview/hmmer/HMMAlignThread.java @@ -80,7 +80,7 @@ public class HMMAlignThread implements Runnable @Override public void run() { - if (af.getViewport().getSelectedHMM() == null) + if (af.getSelectedHMM() == null) { JOptionPane.showMessageDialog(af, MessageManager.getString("warn.no_selected_hmm")); @@ -88,7 +88,7 @@ public class HMMAlignThread implements Runnable } else { - hmm = af.getViewport().getSelectedHMM(); + hmm = af.getSelectedHMM(); } barID = System.currentTimeMillis(); af.setProgressBar(MessageManager.getString("status.running_hmmalign"), diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index b861c07..f04b88d 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -413,7 +413,7 @@ public class FileLoader implements Runnable } else { - for (int i = 0; i < alignment.getAbsoluteHeight(); i++) + for (int i = 0; i < alignment.getAbsoluteHeight(); i++) { if (!alignment.getSequenceAt(i).isHMMConsensusSequence()) { @@ -427,8 +427,16 @@ public class FileLoader implements Runnable viewport.updateInformation(viewport.getAlignPanel()); viewport.getAlignPanel().adjustAnnotationHeight(); viewport.updateSequenceIdColours(); - viewport.getAlignPanel().paintAlignment(true); + if (viewport.getAlignPanel().alignFrame + .getSelectedHMM() == null) + { + viewport.getAlignPanel().alignFrame + .setSelectedHMM(seq.getHMM()); + } + viewport.getAlignPanel().repaint(); viewport.alignmentChanged(viewport.getAlignPanel()); + + } } else diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index e9dd53b..738d98f 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -313,7 +313,15 @@ public class GAlignFrame extends JInternalFrame { hmmerMenu.setEnabled(true); } + hmmerMenu.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + hmmerMenu_actionPerformed(e); + } + }); JMenuItem selectAllSequenceMenuItem = new JMenuItem( MessageManager.getString("action.select_all")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_A, Toolkit @@ -1946,6 +1954,11 @@ public class GAlignFrame extends JInternalFrame // selectMenu.add(listenToViewSelections); } + public void hmmerMenu_actionPerformed(ActionEvent e) + { + + } + /** * Constructs the entries on the Colour menu (but does not add them to the * menu). diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index aa3a22d..0eb13df 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -36,7 +36,6 @@ import jalview.datamodel.Annotation; import jalview.datamodel.CigarArray; import jalview.datamodel.ColumnSelection; import jalview.datamodel.HiddenColumns; -import jalview.datamodel.HiddenMarkovModel; import jalview.datamodel.HiddenSequences; import jalview.datamodel.ProfileI; import jalview.datamodel.Profiles; @@ -100,7 +99,6 @@ public abstract class AlignmentViewport protected Deque redoList = new ArrayDeque<>(); - HiddenMarkovModel selectedHMM; /** * alignment displayed in the viewport. Please use get/setter @@ -3057,19 +3055,6 @@ public abstract class AlignmentViewport * * @return */ - public HiddenMarkovModel getSelectedHMM() - { - return selectedHMM; - } - /** - * Sets the selected hidden Markov model - * - * @param selectedHMM - */ - public void setSelectedHMM(HiddenMarkovModel selectedHMM) - { - this.selectedHMM = selectedHMM; - } }