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.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
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
-label.enter_location = Please enter the path of your HMMER binaries folder.
+label.enter_location = Please enter the path of your HMMER folder.
label.invalid_hmmer_folder = The folder that you selected does not contain the necessary HMMER binaries.
warn.no_selected_hmm = Please select a hidden Markov model sequence.
label.select_hmm = Select HMM
label.freq_uniprot = Use Uniprot Background Frequencies
label.hmmalign_label = hmmalign Options
label.hmmsearch_label = hmmsearch Options
+label.hmmbuild_not_found = The hmmbuild binary was not found.
+label.hmmalign_not_found = The hmmalign binary was not found.
+label.hmmsearch_not_found = The hmmsearch binary was not found.
+warn.hmmbuild_failed = hmmbuild was not found.
+warn.align_failed = hmmalign was not found.
+label.invalid_folder = Invalid Folder
+label.folder_not_exists = HMMER not found. \n Please enter the path to HMMER (if installed).
\ No newline at end of file
}
numberOfSequencesToKeepField
.setText(Cache.getProperty("SEQUENCES_TO_KEEP"));
- installationLocationField.setText(Cache.getProperty(HMMER_PATH));
+ hmmerPath.setText(Cache.getProperty(HMMER_PATH));
+ hmmerPath.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ validateHMMERPath();
+ }
+ });
/*
* Set Visual tab defaults
Cache.applicationProperties.setProperty("SEQUENCES_TO_KEEP",
numberOfSequencesToKeepField.getText());
Cache.applicationProperties.setProperty(HMMER_PATH,
- installationLocationField.getText());
+ hmmerPath.getText());
trimTermini.setSelected(Cache.getDefault("TRIM_TERMINI", false));
if (Cache.getDefault("USE_UNIPROT", false))
{
}
numberOfSequencesToKeepField
.setText(Cache.getProperty("SEQUENCES_TO_KEEP"));
- installationLocationField.setText(Cache.getProperty(HMMER_PATH));
+ hmmerPath.setText(Cache.getProperty(HMMER_PATH));
/*
* Save Structure settings
structureTab.requestFocusInWindow();
return false;
}
+ if (!validateHMMER())
+ {
+ hmmerTab.requestFocusInWindow();
+ return false;
+ }
return true;
}
}
+ @Override
+ protected boolean validateHMMER()
+ {
+ return validateHMMERPath();
+
+ }
+
/**
* DOCUMENT ME!
*/
*/
private boolean validateHMMERPath()
{
- String path = Cache.getProperty("HMMERPATH");
- if (path.length() > 0)
+ int missing = 0;
+ String message = "";
+ String path = hmmerPath.getText();
+ if (path.length() < 1)
+ {
+ return false;
+ }
+ else
{
File f = new File(path);
- if (!f.canExecute())
+ if (!f.exists())
{
JvOptionPane.showInternalMessageDialog(Desktop.desktop,
- MessageManager.getString("label.invalid_hmmer_folder"),
- MessageManager.getString("Invalid folder"),
+ MessageManager.getString("label.folder_not_exists"),
+ MessageManager.getString("label.invalid_folder"),
JvOptionPane.ERROR_MESSAGE);
return false;
}
+
+ File hmmbuild = new File(path + "/binaries/hmmbuild.exe");
+ {
+ if (!hmmbuild.canExecute())
+ {
+ message += MessageManager.getString("label.hmmbuild_not_found")
+ + "\n";
+ missing++;
+ }
+ }
+
+ File hmmalign = new File(path + "/binaries/hmmalign.exe");
+ {
+ if (!hmmalign.canExecute())
+ {
+ message += MessageManager.getString("label.hmmalign_not_found")
+ + "\n";
+ missing++;
+ }
+ }
+
+ File hmmsearch = new File(path + "/binaries/hmmsearch.exe");
+ {
+ if (!hmmsearch.canExecute())
+ {
+ message += MessageManager.getString("label.hmmsearch_not_found")
+ + "\n";
+ missing++;
+ }
+ }
+
+ if (missing > 0)
+ {
+ if (missing < 3)
+ {
+ JvOptionPane.showInternalMessageDialog(Desktop.desktop, message,
+ MessageManager.getString("label.invalid_folder"),
+ JvOptionPane.ERROR_MESSAGE);
+ return false;
+ }
+ else
+ {
+ JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ MessageManager.getString("label.no_binaries"),
+ MessageManager.getString("label.invalid_folder"),
+ JvOptionPane.ERROR_MESSAGE);
+ return false;
+ }
+ }
+
}
return true;
}
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
import jalview.gui.Desktop;
+import jalview.gui.JvOptionPane;
import jalview.gui.Preferences;
import jalview.gui.SplitFrame;
import jalview.io.DataSourceType;
}
try
{
- runCommand();
+ boolean ran = runCommand();
+ if (!ran)
+ {
+ JvOptionPane.showInternalMessageDialog(af,
+ MessageManager.getString("warn.hmmalign_failed"));
+ return;
+ }
} catch (IOException | InterruptedException e)
{
e.printStackTrace();
inputTemp.deleteOnExit();
}
- private void runCommand() throws IOException, InterruptedException
+ private boolean runCommand() throws IOException, InterruptedException
{
+ File file = new File(cmds.HMMERFOLDER + "/binaries/hmmalign.exe");
+ if (!file.canExecute())
+ {
+ return false;
+ }
String command = cmds.HMMERFOLDER + cmds.HMMALIGN;
if (!hmm.getFileHeader().contains("HMMER3/f"))
{
command += " -o" + inputTemp.getAbsolutePath() + cmds.SPACE
+ hmmTemp.getAbsolutePath() + cmds.SPACE
+ outTemp.getAbsolutePath();
- cmds.runCommand(command);
+ return cmds.runCommand(command);
}
private void importData(int index)
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
+import jalview.gui.JvOptionPane;
import jalview.gui.Preferences;
import jalview.io.DataSourceType;
import jalview.io.FileFormat;
}
try
{
- runCommand();
+ boolean ran = runCommand();
+ if (!ran)
+ {
+ JvOptionPane.showInternalMessageDialog(af,
+ MessageManager.getString("warn.hmmbuild_failed"));
+ return;
+ }
} catch (IOException | InterruptedException e)
{
// TODO Auto-generated catch block
- private void runCommand() throws IOException, InterruptedException
+ private boolean runCommand() throws IOException, InterruptedException
{
+ File file = new File(cmds.HMMERFOLDER + "/binaries/hmmbuild.exe");
+ if (!file.canExecute())
+ {
+ return false;
+ }
String command = cmds.HMMERFOLDER + cmds.HMMBUILD + cmds.NAME
+ af.getName() + cmds.SPACE;
if (!alignment.isNucleotide())
command += hmmTemp.getAbsolutePath()
+ cmds.SPACE + stoTemp.getAbsolutePath() + cmds.SPACE;
- cmds.runCommand(command);
+ return cmds.runCommand(command);
}
private void importData() throws IOException, InterruptedException
public String JALVIEWDIRECTORY = System.getProperty("user.dir")
+ "/";
- public final String HMMALIGN = "/hmmalign ";
+ public final String HMMALIGN = "/binaries/hmmalign ";
- public final String HMMBUILD = "/hmmbuild ";
+ public final String HMMBUILD = "/binaries/hmmbuild ";
- public final String HMMSEARCH = "/hmmsearch ";
+ public final String HMMSEARCH = "/binaries/hmmsearch ";
public String HMMBUFFER;
* @throws IOException
* @throws InterruptedException
*/
- public void runCommand(String command)
+ public boolean runCommand(String command)
throws IOException, InterruptedException
{
try
} catch (Exception e)
{
e.printStackTrace();
+ return false;
}
+ return true;
}
/**
protected JLabel installationLocation = new JLabel();
- protected JTextField installationLocationField = new JTextField();
+ protected JTextField hmmerPath = new JTextField();
protected JLabel hmmsearch = new JLabel();
return;
}
}
+ else if (lastTab == hmmerTab
+ && tabbedPane.getSelectedComponent() != hmmerTab)
+ {
+ if (!validateHMMER())
+ {
+ tabbedPane.setSelectedComponent(hmmerTab);
+ }
+ return;
+ }
lastTab = tabbedPane.getSelectedComponent();
}
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()
+ hmmerPath.setBounds(new Rectangle(22, 220, 200, 23));
+ hmmerPath.addMouseListener(new MouseAdapter()
{
@Override
public void mouseClicked(MouseEvent e)
String chosen = openFileChooser();
if (chosen != null)
{
- installationLocationField.setText(chosen);
+ hmmerPath.setText(chosen);
}
}
}
hmmerTab.add(hmmalign);
hmmerTab.add(hmmsearch);
hmmerTab.add(installationLocation);
- hmmerTab.add(installationLocationField);
+ hmmerTab.add(hmmerPath);
hmmerTab.add(trimTermini);
hmmerTab.add(sequencesToKeep);
hmmerTab.add(sequencesToKeep);
return true;
}
+ /**
+ * Validate the hmmer tab preferences; if invalid, set focus on this tab.
+ *
+ * @param e
+ */
+ protected boolean validateHMMER(FocusEvent e)
+ {
+ if (!validateHMMER())
+ {
+ e.getComponent().requestFocusInWindow();
+ return false;
+ }
+ return true;
+ }
+
protected boolean validateStructure()
{
return false;
}
+ protected boolean validateHMMER()
+ {
+ return false;
+ }
+
/**
* Initialises the Visual tabbed panel.
*
}
}
+
+ public void hmmerPath_actionPerformed(ActionEvent e)
+ {
+
+ }
}