label.seq_score_desc = The score threshold for returned sequences.
label.dom_e_value_desc = The E-value cutoff for returned domains.
label.dom_score_desc = The score threshold for returned domains.
-label.not_enough_sequences = There are not enough sequences to run {0}
\ No newline at end of file
+label.not_enough_sequences = There are not enough sequences to run {0}
+label.add_database = Add Database
+warn.file_not_exists = File does not exist
+warn.invalid_format = This is not a valid database file format. The current supported formats are Fasta, Stockholm and Pfam.
+label.database_for_hmmsearch = The database hmmsearch will search through.
\ No newline at end of file
import jalview.schemes.ResidueColourScheme;
import jalview.schemes.TCoffeeColourScheme;
import jalview.util.MessageManager;
+import jalview.util.StringUtils;
import jalview.viewmodel.AlignmentViewport;
import jalview.viewmodel.ViewportRanges;
import jalview.ws.DBRefFetcher;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
+import java.util.Scanner;
import java.util.Vector;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JEditorPane;
+import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JLayeredPane;
public static final int DEFAULT_HEIGHT = 500;
- boolean autoAlignNewSequences;
-
-
/*
* The currently displayed panel (selected tabbed view if more than one)
*/
}
@Override
+ public void addDatabase_actionPerformed(ActionEvent e) throws IOException
+ {
+ if (Cache.getProperty(Preferences.HMMSEARCH_DB_PATHS) == null)
+ {
+ Cache.setProperty(Preferences.HMMSEARCH_DBS, "");
+ Cache.setProperty(Preferences.HMMSEARCH_DB_PATHS, "");
+ }
+
+ String path = openFileChooser(false);
+ if (new File(path).exists())
+ {
+ IdentifyFile identifier = new IdentifyFile();
+ FileFormatI format = identifier.identify(path, DataSourceType.FILE);
+ if (format == FileFormat.Fasta || format == FileFormat.Stockholm
+ || format == FileFormat.Pfam)
+ {
+ String currentDbs = Cache.getProperty(Preferences.HMMSEARCH_DBS);
+ String currentDbPaths = Cache
+ .getProperty(Preferences.HMMSEARCH_DB_PATHS);
+ currentDbPaths += " " + path;
+
+ String fileName = StringUtils.getLastToken(path, new String("/"));
+ Scanner scanner = new Scanner(fileName).useDelimiter(".");
+ String name = scanner.next();
+ scanner.close();
+ currentDbs += " " + path; // TODO remove path from file name
+ scanner.close();
+
+ Cache.setProperty(Preferences.HMMSEARCH_DB_PATHS, currentDbPaths);
+ Cache.setProperty(Preferences.HMMSEARCH_DBS, currentDbPaths);
+ }
+ else
+ {
+ JOptionPane.showMessageDialog(this,
+ MessageManager.getString("warn.invalid_format"));
+ }
+ }
+ else
+ {
+ JOptionPane.showMessageDialog(this,
+ MessageManager.getString("warn.not_enough_sequences"));
+ }
+ }
+
+ /**
+ * Opens a file chooser
+ *
+ * @param forFolder
+ * @return
+ */
+ protected String openFileChooser(boolean forFolder)
+ {
+ String choice = null;
+ JFileChooser chooser = new JFileChooser();
+ if (forFolder)
+ {
+ chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ }
+ chooser.setDialogTitle(
+ MessageManager.getString("label.open_local_file"));
+ chooser.setToolTipText(MessageManager.getString("action.open"));
+
+ int value = chooser.showOpenDialog(this);
+
+ if (value == JFileChooser.APPROVE_OPTION)
+ {
+ choice = chooser.getSelectedFile().getPath();
+ }
+ return choice;
+ }
+
+ @Override
public void reload_actionPerformed(ActionEvent e)
{
if (fileName != null)
public static final String HMMER_PATH = "HMMER_PATH";
+ public static final String HMMSEARCH_DB_PATHS = "HMMSEARCH_DB_PATHS";
+
+ public static final String HMMSEARCH_DBS = "HMMSEARCH_DBS";
+
public static final String SORT_ANNOTATIONS = "SORT_ANNOTATIONS";
public static final String SHOW_AUTOCALC_ABOVE = "SHOW_AUTOCALC_ABOVE";
package jalview.hmmer;
+import jalview.bin.Cache;
+import jalview.gui.Preferences;
import jalview.util.MessageManager;
import jalview.ws.params.ArgumentI;
import jalview.ws.params.ParamDatastoreI;
import jalview.ws.params.simple.BooleanOption;
import jalview.ws.params.simple.IntegerParameter;
import jalview.ws.params.simple.LogarithmicParameter;
+import jalview.ws.params.simple.Option;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
+import java.util.Scanner;
public class HMMERParamStore implements ParamDatastoreI
MessageManager
.getString("label.number_of_results_desc"),
true, 100, 0, 100000));
+ String names = Cache.getProperty(Preferences.HMMSEARCH_DBS);
+ if (names != null && !names.isEmpty())
+ {
+ Collection<String> databases = new ArrayList<>();
+ databases.add("This Alignment");
+ Scanner nameScanner = new Scanner(names);
+
+ if (nameScanner.hasNext())
+ {
+ while (nameScanner.hasNext())
+ {
+ String next = nameScanner.next();
+ if (next == "null")
+ {
+ Cache.setProperty(Preferences.HMMSEARCH_DBS, "");
+ Cache.setProperty(Preferences.HMMSEARCH_DB_PATHS, "");
+ }
+ else
+ {
+ databases.add(next);
+ }
+ }
+ }
+ nameScanner.close();
+ args.add(new Option(MessageManager.getString("label.database"),
+ MessageManager.getString("label.database_for_hmmsearch"),
+ true, "This Alignment", "This Alignment", databases, null));
+ }
args.add(new BooleanOption(
MessageManager.getString("label.auto_align_seqs"),
MessageManager.getString("label.auto_align_seqs_desc"),
import jalview.bin.Cache;
import jalview.gui.JvSwingUtils;
import jalview.gui.Preferences;
+import jalview.io.FileFormatException;
import jalview.io.FileFormats;
import jalview.util.MessageManager;
import jalview.util.Platform;
protected JMenuItem hmmSearchSettings = new JMenuItem();
+ protected JMenuItem addDatabase = new JMenuItem();
+
protected JMenu hmmBuild = new JMenu();
protected JMenuItem hmmBuildRun = new JMenuItem();
}
});
+ addDatabase.setText(MessageManager.getString("label.add_database"));
+ addDatabase.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ try
+ {
+ addDatabase_actionPerformed(e);
+ } catch (IOException e1)
+ {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ }
+
+ });
hmmSearchSettings.setText(
MessageManager.getString("label.edit_settings_and_run"));
hmmSearchSettings.addActionListener(new ActionListener()
MessageManager.getString("label.edit_settings_and_run"));
hmmSearchRun = new JMenuItem(MessageManager.formatMessage(
"label.action_with_default_settings", "hmmsearch"));
+ addDatabase = new JMenuItem(
+ MessageManager.getString("label.add_database"));
hmmSearch.add(hmmSearchSettings);
hmmSearch.add(hmmSearchRun);
+ hmmSearch.add(addDatabase);
}
/**
{
}
+ protected void addDatabase_actionPerformed(ActionEvent e)
+ throws FileFormatException, IOException
+ {
+ }
+
protected void hmmAlignRun_actionPerformed(ActionEvent e)
throws IOException, InterruptedException
{