From: TZVanaalten Date: Sun, 13 Aug 2017 10:55:28 +0000 (+0100) Subject: JAL-2629 add HMMER tab in preferences menu X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=59966a539ede214a603388470433779bb7ea5d47;p=jalview.git JAL-2629 add HMMER tab in preferences menu --- diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 96612f9..2499e79 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -1318,9 +1318,10 @@ label.warning_hidden = Warning: {0} {1} is currently hidden label.auto_align_seqs = Automatically Align New Sequences label.hmmalign = Align Sequences to HMM label.hmmbuild = Build HMM from Alignment +label.hmmbuild_group = Build HMM from Selected Group label.group_hmmbuild = Build HMM from Group label.hmmsearch = Search for Related Sequences -label.change_hmmer_location = Set HMMER Installation Location +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 label.information_description = Information content, measured in bits @@ -1329,3 +1330,10 @@ label.invalid_hmmer_folder = The folder that you selected does not contain the n warn.no_selected_hmm = Please select a hidden Markov model sequence. label.select_hmm = Select HMM warn.no_sequence_data = No sequence data found. +label.hmmer = HMMER +label.trim_termini = Trim Non-Matching Termini +label.no_of_sequences = Sequences Returned +label.freq_alignment = Use Alignment Background Frequencies +label.freq_uniprot = Use Uniprot Background Frequencies +label.hmmalign_label = hmmalign Options +label.hmmsearch_label = hmmsearch Options diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index b5fa4e8..c25fc2f 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -201,6 +201,22 @@ public class Preferences extends GPreferences frame.setMinimumSize(new Dimension(width, height)); /* + * Set HMMER tab defaults + */ + trimTermini.setSelected(Cache.getDefault("TRIM_TERMINI", false)); + if (Cache.getDefault("USE_UNIPROT", false)) + { + uniprot.setSelected(true); + } + else + { + alignment.setSelected(true); + } + numberOfSequencesToKeepField + .setText(Cache.getProperty("SEQUENCES_TO_KEEP")); + installationLocationField.setText(Cache.getProperty(HMMER_PATH)); + + /* * Set Visual tab defaults */ seqLimit.setSelected(Cache.getDefault("SHOW_JVSUFFIX", true)); @@ -640,6 +656,30 @@ public class Preferences extends GPreferences maxColour.getBackground()); /* + * Save HMMER settings + */ + Cache.applicationProperties.setProperty("TRIM_TERMINI", + Boolean.toString(trimTermini.isSelected())); + Cache.applicationProperties.setProperty("USE_UNIPROT", + Boolean.toString(uniprot.isSelected())); + Cache.applicationProperties.setProperty("SEQUENCES_TO_KEEP", + numberOfSequencesToKeepField.getText()); + Cache.applicationProperties.setProperty(HMMER_PATH, + installationLocationField.getText()); + trimTermini.setSelected(Cache.getDefault("TRIM_TERMINI", false)); + if (Cache.getDefault("USE_UNIPROT", false)) + { + uniprot.setSelected(true); + } + else + { + alignment.setSelected(true); + } + numberOfSequencesToKeepField + .setText(Cache.getProperty("SEQUENCES_TO_KEEP")); + installationLocationField.setText(Cache.getProperty(HMMER_PATH)); + + /* * Save Structure settings */ Cache.applicationProperties.setProperty(ADD_TEMPFACT_ANN, diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 20b97b2..40f8616 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -45,6 +45,7 @@ import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import javax.swing.AbstractButton; import javax.swing.AbstractCellEditor; import javax.swing.BorderFactory; import javax.swing.ButtonGroup; @@ -257,6 +258,31 @@ public class GPreferences extends JPanel protected JCheckBox sortByTree = new JCheckBox(); /* + * hmmer tab and components + */ + protected JPanel hmmerTab = new JPanel(); + + protected JCheckBox trimTermini = new JCheckBox(); + + protected ButtonGroup backgroundFreqSource = new ButtonGroup(); + + protected AbstractButton uniprot = new JCheckBox(); + + protected AbstractButton alignment = new JCheckBox(); + + protected JLabel sequencesToKeep = new JLabel(); + + protected JTextField numberOfSequencesToKeepField = new JTextField(); + + protected JLabel installationLocation = new JLabel(); + + protected JTextField installationLocationField = new JTextField(); + + protected JLabel hmmsearch = new JLabel(); + + protected JLabel hmmalign = new JLabel(); + + /* * DAS Settings tab */ protected JPanel dasTab = new JPanel(); @@ -266,6 +292,8 @@ public class GPreferences extends JPanel */ protected JPanel wsTab = new JPanel(); + + /** * Creates a new GPreferences object. */ @@ -314,6 +342,8 @@ public class GPreferences extends JPanel tabbedPane.add(initEditingTab(), MessageManager.getString("label.editing")); + tabbedPane.add(initHMMERTab(), MessageManager.getString("label.hmmer")); + /* * See DasSourceBrowser for the real work of configuring this tab. */ @@ -382,6 +412,80 @@ public class GPreferences extends JPanel } /** + * Initialises the hmmer tabbed panel. + * + * @return + */ + private JPanel initHMMERTab() + { + JPanel hmmerTab = new JPanel(); + hmmerTab.setLayout(null); + + hmmalign.setFont(LABEL_FONT); + hmmalign.setText(MessageManager.getString("label.hmmalign_label")); + hmmalign.setBounds(new Rectangle(22, 10, 200, 23)); + + trimTermini.setFont(LABEL_FONT); + trimTermini.setText(MessageManager.getString("label.trim_termini")); + trimTermini.setBounds(new Rectangle(22, 30, 200, 23)); + + hmmsearch.setFont(LABEL_FONT); + hmmsearch.setText(MessageManager.getString("label.hmmsearch_label")); + hmmsearch.setBounds(new Rectangle(250, 10, 200, 23)); + + sequencesToKeep.setFont(LABEL_FONT); + sequencesToKeep + .setText(MessageManager.getString("label.no_of_sequences")); + sequencesToKeep.setBounds(new Rectangle(250, 30, 125, 23)); + numberOfSequencesToKeepField.setBounds(new Rectangle(375, 30, 40, 23)); + + installationLocation.setFont(LABEL_FONT); + installationLocation.setText( + MessageManager.getString("label.change_hmmer_location")); + installationLocation.setBounds(new Rectangle(22, 200, 200, 23)); + installationLocationField.setBounds(new Rectangle(22, 220, 200, 23)); + installationLocationField.addMouseListener(new MouseAdapter() + { + @Override + public void mouseClicked(MouseEvent e) + { + if (e.getClickCount() == 2) + { + String chosen = openFileChooser(); + if (chosen != null) + { + installationLocationField.setText(chosen); + } + } + } + }); + + backgroundFreqSource.add(uniprot); + backgroundFreqSource.add(alignment); + backgroundFreqSource.setSelected(uniprot.getModel(), true); + + uniprot.setText(MessageManager.getString("label.freq_uniprot")); + uniprot.setFont(LABEL_FONT); + uniprot.setBounds(new Rectangle(22, 260, 255, 23)); + + alignment.setText(MessageManager.getString("label.freq_alignment")); + alignment.setFont(LABEL_FONT); + alignment.setBounds(new Rectangle(22, 280, 255, 23)); + + hmmerTab.add(uniprot); + hmmerTab.add(alignment); + hmmerTab.add(hmmalign); + hmmerTab.add(hmmsearch); + hmmerTab.add(installationLocation); + hmmerTab.add(installationLocationField); + hmmerTab.add(trimTermini); + hmmerTab.add(sequencesToKeep); + hmmerTab.add(sequencesToKeep); + hmmerTab.add(numberOfSequencesToKeepField); + return hmmerTab; + } + + /** * Initialises the Output tabbed panel. * * @return