From 5ce879f136eba981bd2eccc6a2649e0c3a430b33 Mon Sep 17 00:00:00 2001 From: TZVanaalten Date: Tue, 25 Jul 2017 12:34:26 +0100 Subject: [PATCH] JAL-2629 add non-functional HMMER menu --- resources/lang/Messages.properties | 7 +++++ src/jalview/gui/AlignFrame.java | 15 +++++++++++ src/jalview/gui/AnnotationLabels.java | 4 +-- src/jalview/gui/PopupMenu.java | 18 ++++++------- src/jalview/gui/Preferences.java | 11 +++++++- src/jalview/jbgui/GAlignFrame.java | 46 +++++++++++++++++++++++++++++++++ src/jalview/jbgui/GPreferences.java | 27 +++++++++++-------- 7 files changed, 105 insertions(+), 23 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index a24e768..f05f7bc 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -11,6 +11,7 @@ action.paste = Paste action.show_html_source = Show HTML Source action.print = Print... action.web_service = Web Service +action.hmmer = HMMER action.cancel_job = Cancel Job action.start_job = Start Job action.revert = Revert @@ -1311,3 +1312,9 @@ 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.change_hmmer_directory = Change HMMER suite location +label.auto_align_seqs = Automatically Align New Sequences +label.hmmalign = Align Sequences to HMM +label.hmmbuild = Build HMM From Alignment +label.hmmsearch = Search for Related Sequences + diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 9e4f37b..b14423c 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -383,6 +383,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } }); buildColourMenu(); + buildHMMERMenu(); if (Desktop.desktop != null) { @@ -489,6 +490,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } + private void buildHMMERMenu() + { + hmmerMenu.removeAll(); + + hmmerMenu.add(autoAlignSeqs); + hmmerMenu.addSeparator(); + + hmmerMenu.add(hmmAlign); + hmmerMenu.add(hmmBuild); + hmmerMenu.add(hmmSearch); + + } + /** * Change the filename and format for the alignment, and enable the 'reload' * button functionality. @@ -4680,6 +4694,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, newAlignment.append(getViewport().getAlignment()); getViewport().setAlignment(newAlignment); isAnnotation = true; + alignPanel.repaint(); } else if (FileFormat.Jnet.equals(format)) diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 445ee11..30b52f1 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -422,8 +422,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, if (selectedRow < aa.length) { final String label = aa[selectedRow].label; - if (!(aa[selectedRow].autoCalculated - || label.indexOf("Information Content") > -1)) + if (!(aa[selectedRow].autoCalculated) + && !(label.indexOf("Information Content") > -1)) { if (aa[selectedRow].graph == AlignmentAnnotation.NO_GRAPH) { diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 3de7c3c..0ebd271 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -451,7 +451,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener buildGroupURLMenu(sg, groupLinks); } // Add a 'show all structures' for the current selection - Hashtable pdbe = new Hashtable(), reppdb = new Hashtable(); + Hashtable pdbe = new Hashtable<>(), reppdb = new Hashtable<>(); SequenceI sqass = null; for (SequenceI sq : ap.av.getSequenceSelection()) { @@ -518,7 +518,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener void addFeatureLinks(final SequenceI seq, List links) { JMenu linkMenu = new JMenu(MessageManager.getString("action.link")); - Map> linkset = new LinkedHashMap>(); + Map> linkset = new LinkedHashMap<>(); for (String link : links) { @@ -602,8 +602,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener * the insertion order, which is the order of the annotations on the * alignment. */ - Map>> shownTypes = new LinkedHashMap>>(); - Map>> hiddenTypes = new LinkedHashMap>>(); + Map>> shownTypes = new LinkedHashMap<>(); + Map>> hiddenTypes = new LinkedHashMap<>(); AlignmentAnnotationUtils.getShownHiddenTypes(shownTypes, hiddenTypes, AlignmentAnnotationUtils.asList(annotations), forSequences); @@ -709,7 +709,7 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener SequenceI[] seqs = ap.av.getSelectionAsNewSequence(); String[][] idandseqs = GroupUrlLink.formStrings(seqs); - Hashtable commonDbrefs = new Hashtable(); + Hashtable commonDbrefs = new Hashtable<>(); for (int sq = 0; sq < seqs.length; sq++) { @@ -1368,8 +1368,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener * Temporary store to hold distinct calcId / type pairs for the tooltip. * Using TreeMap means calcIds are shown in alphabetical order. */ - SortedMap tipEntries = new TreeMap(); - final Map> candidates = new LinkedHashMap>(); + SortedMap tipEntries = new TreeMap<>(); + final Map> candidates = new LinkedHashMap<>(); AlignmentI al = this.ap.av.getAlignment(); AlignmentUtils.findAddableReferenceAnnotations(forSequences, tipEntries, candidates, al); @@ -1889,8 +1889,8 @@ public class PopupMenu extends JPopupMenu implements ColourChangeListener return; } - List seqs = new ArrayList(); - List features = new ArrayList(); + List seqs = new ArrayList<>(); + List features = new ArrayList<>(); /* * assemble dataset sequences, and template new sequence features, diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index cccdd2e..8b4f85f 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -155,7 +155,7 @@ public class Preferences extends GPreferences * .properties file as '|' separated strings */ - groupURLLinks = new ArrayList(); + groupURLLinks = new ArrayList<>(); } JInternalFrame frame; @@ -221,6 +221,9 @@ public class Preferences extends GPreferences "SHOW_CONSENSUS_HISTOGRAM", true)); showConsensLogo.setSelected(Cache.getDefault("SHOW_CONSENSUS_LOGO", false)); + showInformationHistogram.setSelected( + Cache.getDefault("SHOW_INFORMATION_HISTOGRAM", true)); + showHMMLogo.setSelected(Cache.getDefault("SHOW_HMM_LOGO", false)); showNpTooltip.setSelected(Cache .getDefault("SHOW_NPFEATS_TOOLTIP", true)); showDbRefTooltip.setSelected(Cache.getDefault("SHOW_DBREFS_TOOLTIP", @@ -585,6 +588,10 @@ public class Preferences extends GPreferences Boolean.toString(showConsensHistogram.isSelected())); Cache.applicationProperties.setProperty("SHOW_CONSENSUS_LOGO", Boolean.toString(showConsensLogo.isSelected())); + Cache.applicationProperties.setProperty("SHOW_INFORMATION_HISTOGRAM", + Boolean.toString(showConsensHistogram.isSelected())); + Cache.applicationProperties.setProperty("SHOW_HMM_LOGO", + Boolean.toString(showHMMLogo.isSelected())); Cache.applicationProperties.setProperty("ANTI_ALIAS", Boolean.toString(smoothFont.isSelected())); Cache.applicationProperties.setProperty(SCALE_PROTEIN_TO_CDNA, @@ -863,6 +870,8 @@ public class Preferences extends GPreferences && (identity.isSelected() || showGroupConsensus.isSelected())); showConsensLogo.setEnabled(annotations.isSelected() && (identity.isSelected() || showGroupConsensus.isSelected())); + showInformationHistogram.setEnabled(annotations.isSelected()); + showHMMLogo.setEnabled(annotations.isSelected()); } @Override diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 085e9fc..ea56bbb 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -67,6 +67,16 @@ public class GAlignFrame extends JInternalFrame protected JMenu webService = new JMenu(); + protected JMenu hmmerMenu = new JMenu(); + + protected JCheckBoxMenuItem autoAlignSeqs = new JCheckBoxMenuItem(); + + protected JMenuItem hmmAlign = new JMenuItem(); + + protected JMenuItem hmmSearch = new JMenuItem(); + + protected JMenuItem hmmBuild = new JCheckBoxMenuItem(); + protected JMenuItem webServiceNoServices; protected JCheckBoxMenuItem viewBoxesMenuItem = new JCheckBoxMenuItem(); @@ -253,6 +263,7 @@ public class GAlignFrame extends JInternalFrame private void jbInit() throws Exception { initColourMenu(); + initHMMERMenu(); JMenuItem saveAs = new JMenuItem( MessageManager.getString("action.save_as")); @@ -293,6 +304,7 @@ public class GAlignFrame extends JInternalFrame JMenu calculateMenu = new JMenu( MessageManager.getString("action.calculate")); webService.setText(MessageManager.getString("action.web_service")); + hmmerMenu.setText(MessageManager.getString("action.hmmer")); JMenuItem selectAllSequenceMenuItem = new JMenuItem( MessageManager.getString("action.select_all")); keyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_A, Toolkit @@ -1696,6 +1708,7 @@ public class GAlignFrame extends JInternalFrame alignFrameMenuBar.add(colourMenu); alignFrameMenuBar.add(calculateMenu); alignFrameMenuBar.add(webService); + alignFrameMenuBar.add(hmmerMenu); fileMenu.add(fetchSequence); fileMenu.add(addSequenceMenu); @@ -1863,6 +1876,23 @@ public class GAlignFrame extends JInternalFrame * Constructs the entries on the Colour menu (but does not add them to the * menu). */ + protected void initHMMERMenu() + { + autoAlignSeqs = new JCheckBoxMenuItem( + MessageManager.getString("label.auto_align_seqs")); + hmmAlign = new JMenuItem(MessageManager.getString("label.hmmalign")); + hmmBuild = new JMenuItem(MessageManager.getString("label.hmmbuild")); + hmmSearch = new JMenuItem(MessageManager.getString("label.hmmsearch")); + autoAlignSeqs.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + autoAlignSeqs_actionPerformed(autoAlignSeqs.isSelected()); + } + }); + + } protected void initColourMenu() { applyToAllGroups = new JCheckBoxMenuItem( @@ -2342,6 +2372,22 @@ public class GAlignFrame extends JInternalFrame { } + protected void autoAlignSeqs_actionPerformed(boolean selected) + { + } + + protected void hmmAlign_actionPerformed(ActionEvent e) + { + } + + protected void hmmBuild_actionPerformed(ActionEvent e) + { + } + + protected void hmmSearch_actionPerformed(ActionEvent e) + { + } + public void createPNG(java.io.File f) { } diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 1ad95dd..20b97b2 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -95,11 +95,11 @@ public class GPreferences extends JPanel protected JCheckBox rightAlign = new JCheckBox(); - protected JComboBox fontSizeCB = new JComboBox(); + protected JComboBox fontSizeCB = new JComboBox<>(); - protected JComboBox fontStyleCB = new JComboBox(); + protected JComboBox fontStyleCB = new JComboBox<>(); - protected JComboBox fontNameCB = new JComboBox(); + protected JComboBox fontNameCB = new JComboBox<>(); protected JCheckBox showOccupancy = new JCheckBox(); @@ -111,15 +111,15 @@ public class GPreferences extends JPanel protected JCheckBox scaleProteinToCdna = new JCheckBox(); - protected JComboBox gapSymbolCB = new JComboBox(); + protected JComboBox gapSymbolCB = new JComboBox<>(); protected JCheckBox wrap = new JCheckBox(); - protected JComboBox sortby = new JComboBox(); + protected JComboBox sortby = new JComboBox<>(); - protected JComboBox sortAnnBy = new JComboBox(); + protected JComboBox sortAnnBy = new JComboBox<>(); - protected JComboBox sortAutocalc = new JComboBox(); + protected JComboBox sortAutocalc = new JComboBox<>(); protected JCheckBox startupCheckbox = new JCheckBox(); @@ -142,10 +142,15 @@ public class GPreferences extends JPanel protected JCheckBox showConsensLogo = new JCheckBox(); + protected JCheckBox showInformationHistogram = new JCheckBox(); + + protected JCheckBox showHMMLogo = new JCheckBox(); + protected JCheckBox showDbRefTooltip = new JCheckBox(); protected JCheckBox showNpTooltip = new JCheckBox(); + /* * Structure tab and components */ @@ -159,7 +164,7 @@ public class GPreferences extends JPanel protected JCheckBox addTempFactor = new JCheckBox(); - protected JComboBox structViewer = new JComboBox(); + protected JComboBox structViewer = new JComboBox<>(); protected JTextField chimeraPath = new JTextField(); @@ -176,9 +181,9 @@ public class GPreferences extends JPanel protected JPanel maxColour = new JPanel(); - protected JComboBox protColour = new JComboBox(); + protected JComboBox protColour = new JComboBox<>(); - protected JComboBox nucColour = new JComboBox(); + protected JComboBox nucColour = new JComboBox<>(); /* * Connections tab components @@ -216,7 +221,7 @@ public class GPreferences extends JPanel /* * Output tab components */ - protected JComboBox epsRendering = new JComboBox(); + protected JComboBox epsRendering = new JComboBox<>(); protected JLabel userIdWidthlabel = new JLabel(); -- 1.7.10.2