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
+label.change_hmmer_location = Set 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
+label.enter_location = Please enter the path of your HMMER binaries folder.
+label.invalid_hmmer_folder = The folder that you selected does not contain the necessary HMMER binaries.
private final static String DEFAULT_PDB_FILE_PARSER = StructureImportSettings.StructureParser.JMOL_PARSER
.toString();
+ private static String HMMER_PATH;
+
/*
* a date formatter using a fixed (rather than the user's) locale;
* this ensures that date properties can be written and re-read successfully
@Override
public synchronized Enumeration<Object> keys()
{
- return Collections.enumeration(new TreeSet<Object>(super.keySet()));
+ return Collections.enumeration(new TreeSet<>(super.keySet()));
}
};
import javax.swing.JLayeredPane;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
init();
}
+ public void setIsRecurring(boolean status)
+ {
+ recurring = status;
+ }
+
/**
* initalise the alignframe from the underlying viewport data and the
* configurations
{
hmmerMenu.removeAll();
+ hmmerMenu.add(changeHMMERLocation);
+ hmmerMenu.addSeparator();
+
hmmerMenu.add(autoAlignSeqs);
hmmerMenu.addSeparator();
public void hmmAlign_actionPerformed(ActionEvent e)
throws IOException, InterruptedException
{
- SequenceI seq = getViewport().getAlignment()
- .getHMMConsensusSequences(false).get(0);
new Thread(new HMMAlignThread(this, true)).start();
alignPanel.repaint();
}
@Override
+ public void changeHMMERLocation_actionPerformed(ActionEvent e)
+ {
+ String location = JOptionPane.showInputDialog(
+ MessageManager.getString("label.enter_location"));
+ Cache.setProperty(Preferences.HMMER_PATH, location);
+ }
+
+ @Override
public void autoAlignSeqs_actionPerformed(boolean autoAlignSeqs)
{
autoAlignNewSequences = autoAlignSeqs;
else
{
new FileLoader().LoadFile(viewport, file, sourceType, format);
+ if (autoAlignNewSequences && !recurring)
+ {
+ new Thread(new HMMAlignThread(this, false)).start();
+ }
}
}
}
+ (format != null ? "(parsing as '" + format
+ "' file)" : ""), oom, Desktop.desktop);
}
- if (autoAlignNewSequences && !recurring)
- {
- recurring = true;
- HiddenMarkovModel hmm = getViewport().getAlignment()
- .getHMMConsensusSequences(false).get(0).getHMM();
- new Thread(new HMMAlignThread(this, false)).start();
- }
- recurring = false;
}
/**
}
}
+
}
public static final String STRUCTURE_DISPLAY = "STRUCTURE_DISPLAY";
public static final String CHIMERA_PATH = "CHIMERA_PATH";
+
+ public static final String HMMER_PATH = "HMMER_PATH";
public static final String SORT_ANNOTATIONS = "SORT_ANNOTATIONS";
}
return true;
}
+
+ /**
+ * Returns true if hmmer path contains the necessary valid executables, else show an error
+ * dialog.
+ */
+ private boolean validateHMMERPath()
+ {
+ String path = Cache.getProperty("HMMERPATH");
+ if (path.length() > 0)
+ {
+ File f = new File(path);
+ if (!f.canExecute())
+ {
+ JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ MessageManager.getString("label.invalid_hmmer_folder"),
+ MessageManager.getString("Invalid folder"),
+ JvOptionPane.ERROR_MESSAGE);
+ return false;
+ }
+ }
+ return true;
+ }
/**
* If Chimera is selected, check it can be found on default or user-specified
package jalview.hmmer;
+import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
+import jalview.datamodel.AlignmentOrder;
import jalview.datamodel.HiddenMarkovModel;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
+import jalview.gui.Preferences;
import jalview.io.DataSourceType;
import jalview.io.FileFormat;
import jalview.io.FileLoader;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.util.HashMap;
import java.util.Map;
public class HMMAlignThread implements Runnable
barID = System.currentTimeMillis();
af.setProgressBar(MessageManager.getString("status.running_hmmbuild"),
barID);
-
+ HMMERCommands.HMMERFOLDER = Cache.getProperty(Preferences.HMMER_PATH);
try
{
try
}
} catch (Exception e)
{
-
+ e.printStackTrace();
} finally
{
af.setProgressBar(MessageManager.getString("status.running_hmmalign"),
private void runCommand() throws IOException, InterruptedException
{
- String command = HMMERCommands.HMMALIGN;
+ String command = HMMERCommands.HMMERFOLDER + HMMERCommands.HMMALIGN;
if (!hmm.getFileHeader().contains("HMMER3/f"))
{
command += HMMERCommands.ALLCOL;
if (newFrame)
{
FileLoader loader = new FileLoader();
+ AlignmentOrder order = new AlignmentOrder(alignment);
AlignFrame newAFrame = loader.LoadFileWaitTillLoaded(
HMMERCommands.ALIGNMENTINPUT, DataSourceType.FILE);
- addSeqs(newAFrame);
+ Map<Integer, SequenceI> copy = new HashMap<>(
+ hmmSeqs);
+ addSeqs(newAFrame, copy);
+ SequenceI seq = newAFrame.getViewport().getAlignment()
+ .getSequenceAt(0);
+ hmm.mapToReferenceAnnotation(newAFrame, seq);
+ addSeqs(af, hmmSeqs);
}
else
{
af.getViewport().getAlignment().getSequences().clear();
+ af.setIsRecurring(true);
af.loadJalviewDataFile(HMMERCommands.ALIGNMENTBUFFER,
DataSourceType.FILE, FileFormat.Stockholm, null);
- addSeqs(af);
+ af.setIsRecurring(false);
+ addSeqs(af, hmmSeqs);
}
}
- private void addSeqs(AlignFrame alignFrame)
+ private void addSeqs(AlignFrame alignFrame, Map<Integer, SequenceI> map)
{
- for (Map.Entry<Integer, SequenceI> entry : hmmSeqs.entrySet())
+ for (Map.Entry<Integer, SequenceI> entry : map.entrySet())
{
SequenceI seq = entry.getValue();
Integer pos = entry.getKey();
package jalview.hmmer;
+import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.HiddenMarkovModel;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
+import jalview.gui.Preferences;
import jalview.io.DataSourceType;
import jalview.io.FileFormat;
import jalview.util.MessageManager;
barID = System.currentTimeMillis();
af.setProgressBar(MessageManager.getString("status.running_hmmbuild"),
barID);
+ HMMERCommands.HMMERFOLDER = Cache.getProperty(Preferences.HMMER_PATH);
try
{
private void runCommand() throws IOException, InterruptedException
{
- final String command = HMMERCommands.HMMBUILD + HMMERCommands.NAME
+ final String command = HMMERCommands.HMMERFOLDER
+ + HMMERCommands.HMMBUILD + HMMERCommands.NAME
+ af.getName() + HMMERCommands.SPACE
+ HMMERCommands.JALVIEWDIRECTORY + HMMERCommands.HMMBUFFER
+ HMMERCommands.JALVIEWDIRECTORY + HMMERCommands.ALIGNMENTBUFFER;
public class HMMERCommands
{
// Path of hmmer binaries directory
- static final String HMMERFOLDER = "H:/Documents/";
+ static String HMMERFOLDER = "/Documents/";
- static final String HMMALIGN = HMMERFOLDER + "hmmalign ";
+ static final String JALVIEWDIRECTORY = System.getProperty("user.dir")
+ + "/";
- static final String HMMBUILD = HMMERFOLDER + "hmmbuild ";
+ static String HMMALIGN = "/hmmalign ";
- static final String HMMSEARCH = HMMERFOLDER + "hmmsearch ";
+ static String HMMBUILD = "/hmmbuild ";
- static final String JALVIEWDIRECTORY = "C:/Users/TZVanaalten/git/jalview/";
+ static String HMMSEARCH = "/hmmsearch ";
static final String HMMBUFFER = "src/jalview/hmmer/hmm_buffer.hmm ";
protected JCheckBoxMenuItem autoAlignSeqs = new JCheckBoxMenuItem();
+ protected JMenuItem changeHMMERLocation = new JCheckBoxMenuItem();
+
protected JMenuItem hmmAlign = new JMenuItem();
protected JMenuItem hmmSearch = new JMenuItem();
}
});
+ changeHMMERLocation.setText(
+ MessageManager.getString("label.change_hmmer_location"));
+ changeHMMERLocation.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ changeHMMERLocation_actionPerformed(e);
+ }
+
+ });
selectHighlighted.addActionListener(al);
JMenu tooltipSettingsMenu = new JMenu(
MessageManager.getString("label.sequence_id_tooltip"));
{
}
+ protected void changeHMMERLocation_actionPerformed(ActionEvent e)
+ {
+ }
+
protected void hmmBuild_actionPerformed(ActionEvent e)
throws IOException, InterruptedException
{