label.trim_termini = Trim Non-Matching Termini
label.trim_termini_desc = If true, non-matching regions on either end of the resulting alignment are removed.
label.no_of_sequences = Number of sequences returned
+label.reporting_cutoff = Reporting Cut-off
label.freq_alignment = Use alignment background frequencies
label.freq_uniprot = Use Uniprot background frequencies
label.hmmalign_options = hmmalign options
label.number_of_results = Number of Results to Return
label.auto_align_seqs = Automatically Align Fetched Sequences
label.use_accessions = Return Accessions
-label.seq_e_value = Sequence E-value Cutoff
+label.seq_evalue = Sequence E-value Cut-off
label.seq_score = Sequence Score Threshold
-label.dom_e_value = Domain E-value Cutoff
+label.dom_evalue = Domain E-value Cut-off
label.dom_score = Domain Score Threshold
label.number_of_results_desc = The maximum number of hmmsearch results to display
label.auto_align_seqs_desc = If true, all fetched sequences will be aligned to the hidden Markov model with which the search was performed
label.use_accessions_desc = If true, the accession number of each sequence is returned, rather than that sequence's name
label.seq_e_value_desc = The E-value cutoff for returned sequences (hmmsearch -E)
-label.seq_score_desc = The score threshold for returned sequences
-label.dom_e_value_desc = The E-value cutoff for returned domains (hmmsearch -domE)
-label.dom_score_desc = The score threshold for returned domains
+label.seq_score_desc = The score threshold for returned sequences (hmmsearch -T)
+label.dom_e_value_desc = The E-value cutoff for returned domains (hmmsearch --domE)
+label.dom_score_desc = The score threshold for returned domains (hmmsearch --domT)
label.add_database = Add Database
label.this_alignment = This alignment
warn.invalid_format = This is not a valid database file format. The current supported formats are Fasta, Stockholm and Pfam.
{
System.err.println(
"Quaqua LaF not available. Using VAqua(4).");
- UIManager.setLookAndFeel("org.violetlib.aqua.AquaLookAndFeel");
+ // UIManager.setLookAndFeel("org.violetlib.aqua.AquaLookAndFeel");
} catch (Throwable e)
{
System.err.println(
public class OptionBox extends JPanel
implements MouseListener, ActionListener
{
- JCheckBox enabled = new JCheckBox();
+ JCheckBox enabled;
final URL finfo;
OptionI option;
- JLabel optlabel = new JLabel();
-
- JComboBox<String> val = new JComboBox<>();
+ JComboBox<String> val;
public OptionBox(OptionI opt)
{
option = opt;
setLayout(new FlowLayout(FlowLayout.LEFT));
+ enabled = new JCheckBox();
enabled.setSelected(opt.isRequired()); // TODO: lock required options
enabled.setFont(new Font("Verdana", Font.PLAIN, 11));
enabled.setText("");
}
}
add(enabled);
+
+ // todo combo or radio buttons?
+ val = new JComboBox<>();
for (String str : opt.getPossibleValues())
{
val.addItem(str);
* ensure slider has an integer range corresponding to
* the min-max range of the parameter
*/
- if (validator.getMin() != null && !isIntegerParameter
+ if (validator.getMin() != null && validator.getMax() != null
+ // && !isIntegerParameter
&& !isStringParameter)
{
double min = validator.getMin().doubleValue();
// todo scaleMin, scaleMax could also be final fields
}
}
- else
- {
- isChoiceParameter = parameter.getPossibleValues() != null;
- }
+
+ List<String> possibleValues = parameter.getPossibleValues();
+ isChoiceParameter = possibleValues != null
+ && possibleValues.size() > 1;
if (compact)
{
import jalview.ws.params.ParamDatastoreI;
import jalview.ws.params.WsParamSetI;
import jalview.ws.params.simple.BooleanOption;
+import jalview.ws.params.simple.DoubleParameter;
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.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Scanner;
*/
private void getHMMSearchParams(List<ArgumentI> args)
{
+ /*
+ * 'Options'
+ */
addChoiceOfHmm(args);
- args.add(new IntegerParameter(
- MessageManager.getString("label.number_of_results"),
- MessageManager.getString("label.number_of_results_desc"), true,
- 100, 0, 100000));
String names = Cache.getProperty(Preferences.HMMSEARCH_DBS);
if (names != null && !names.isEmpty())
{
List<String> databases = new ArrayList<>();
- databases.add(MessageManager.getString("label.this_alignment"));
+ databases.add(MessageManager.getString(HMMSearch.THIS_ALIGNMENT_KEY));
Scanner nameScanner = new Scanner(names);
if (nameScanner.hasNext())
}
}
nameScanner.close();
- args.add(new Option(MessageManager.getString("label.database"),
+ args.add(new Option(MessageManager.getString(HMMSearch.DATABASE_KEY),
MessageManager.getString("label.database_for_hmmsearch"),
- true, MessageManager.getString("label.this_alignment"),
- MessageManager.getString("label.this_alignment"), databases,
- null));
+ true, MessageManager.getString(HMMSearch.THIS_ALIGNMENT_KEY),
+ MessageManager.getString(HMMSearch.THIS_ALIGNMENT_KEY),
+ databases, null));
}
args.add(new BooleanOption(
- MessageManager.getString("label.auto_align_seqs"),
+ MessageManager.getString(HMMSearch.AUTO_ALIGN_SEQS_KEY),
MessageManager.getString("label.auto_align_seqs_desc"), false,
false, true, null));
args.add(new BooleanOption(
- MessageManager.getString("label.use_accessions"),
+ MessageManager.getString(HMMSearch.USE_ACCESSIONS_KEY),
MessageManager.getString("label.use_accessions_desc"), false,
false, true, null));
args.add(new BooleanOption(
- MessageManager.getString("label.trim_termini"),
+ MessageManager.getString(HMMSearch.TRIM_TERMINI_KEY),
MessageManager.getString("label.trim_termini_desc"), false,
false, true, null));
+
+ /*
+ * 'Parameters'
+ */
+ args.add(new IntegerParameter(
+ MessageManager.getString(HMMSearch.NUMBER_OF_RESULTS_KEY),
+ MessageManager.getString("label.number_of_results_desc"), true,
+ 100, 0, 100000));
+ args.add(new StringParameter(
+ MessageManager.getString(HMMSearch.REPORTING_CUTOFF_KEY), null,
+ true, HMMSearch.CUTOFF_NONE, HMMSearch.CUTOFF_NONE,
+ Arrays.asList(HMMSearch.CUTOFF_NONE, HMMSearch.CUTOFF_EVALUE,
+ HMMSearch.CUTOFF_SCORE)));
args.add(new LogarithmicParameter(
- MessageManager.getString("label.seq_e_value"),
+ MessageManager.getString(HMMSearch.SEQ_EVALUE_KEY),
MessageManager.getString("label.seq_e_value_desc"), false, 1D,
- 1E-38, 10D, 10D));
- /*
- args.add(new DoubleParameter(
- MessageManager.getString("label.seq_score"),
- MessageManager.getString("label.seq_score_desc"), false,
- 0d, 0d, 10000d));
- */
+ 1E-38, 10D));
args.add(new LogarithmicParameter(
- MessageManager.getString("label.dom_e_value"),
+ MessageManager.getString(HMMSearch.DOM_EVALUE_KEY),
MessageManager.getString("label.dom_e_value_desc"), false, 1D,
- 1E-38, 10D, 10D));
- /*
- args.add(new DoubleParameter(
- MessageManager.getString("label.dom_score"),
- MessageManager.getString("label.dom_score_desc"), false, 0d,
- 0d,
- 10000d));
- */
+ 1E-38, 10D));
+ args.add(
+ new DoubleParameter(
+ MessageManager.getString(HMMSearch.SEQ_SCORE_KEY),
+ MessageManager.getString("label.seq_score_desc"), false,
+ 0d, 0d, 1000d));
+ args.add(
+ new DoubleParameter(
+ MessageManager.getString(HMMSearch.DOM_SCORE_KEY),
+ MessageManager.getString("label.dom_score_desc"), false,
+ 0d, 0d, 1000d));
}
/**
public class HMMSearch extends HmmerCommand
{
- private static final String PARAMNAME_NO_OF_RESULTS = MessageManager.getString("label.number_of_results");
-
static final String HMMSEARCH = "hmmsearch";
+ /*
+ * constants for i18n lookup of passed parameter names
+ */
+ static final String DATABASE_KEY = "label.database";
+
+ static final String THIS_ALIGNMENT_KEY = "label.this_alignment";
+
+ static final String USE_ACCESSIONS_KEY = "label.use_accessions";
+
+ static final String AUTO_ALIGN_SEQS_KEY = "label.auto_align_seqs";
+
+ static final String NUMBER_OF_RESULTS_KEY = "label.number_of_results";
+
+ static final String TRIM_TERMINI_KEY = "label.trim_termini";
+
+ static final String REPORTING_CUTOFF_KEY = "label.reporting_cutoff";
+
+ static final String CUTOFF_NONE = "None";
+
+ static final String CUTOFF_SCORE = "Score";
+
+ static final String CUTOFF_EVALUE = "E-Value";
+
+ static final String SEQ_EVALUE_KEY = "label.seq_evalue";
+
+ static final String DOM_EVALUE_KEY = "label.dom_evalue";
+
+ static final String SEQ_SCORE_KEY = "label.seq_score";
+
+ static final String DOM_SCORE_KEY = "label.dom_score";
+
boolean realign = false;
boolean trim = false;
String dbPath = "";
File databaseFile = null;
+ boolean useEvalueCutoff = false;
+ boolean useScoreCutoff = false;
+ String seqEvalueCutoff = null;
+ String domEvalueCutoff = null;
+ String seqScoreCutoff = null;
+ String domScoreCutoff = null;
+
if (params != null)
{
for (ArgumentI arg : params)
{
String name = arg.getName();
- if (MessageManager.getString("label.number_of_results")
+ if (MessageManager.getString(NUMBER_OF_RESULTS_KEY)
.equals(name))
{
seqsToReturn = Integer.parseInt(arg.getValue());
}
- else if (MessageManager.getString("label.auto_align_seqs")
+ else if (MessageManager.getString(AUTO_ALIGN_SEQS_KEY)
.equals(name))
{
realign = true; // TODO: not used
}
- else if (MessageManager.getString("label.use_accessions")
+ else if (MessageManager.getString(USE_ACCESSIONS_KEY)
.equals(name))
{
args.add("--acc");
}
- else if (MessageManager.getString("label.seq_e_value").equals(name))
+ else if (MessageManager.getString(REPORTING_CUTOFF_KEY)
+ .equals(name))
+ {
+ if (CUTOFF_EVALUE.equals(arg.getValue()))
+ {
+ useEvalueCutoff = true;
+ }
+ else if (CUTOFF_SCORE.equals(arg.getValue()))
+ {
+ useScoreCutoff = true;
+ }
+ }
+ else if (MessageManager.getString(SEQ_EVALUE_KEY).equals(name))
{
- args.add("-E");
- args.add(arg.getValue());
+ seqEvalueCutoff = arg.getValue();
}
- else if (MessageManager.getString("label.seq_score").equals(name))
+ else if (MessageManager.getString(SEQ_SCORE_KEY).equals(name))
{
- args.add("-incT");
- args.add(arg.getValue());
+ seqScoreCutoff = arg.getValue();
}
- else if (MessageManager.getString("label.dom_e_value")
+ else if (MessageManager.getString(DOM_EVALUE_KEY)
.equals(name))
{
- args.add("--domE");
- args.add(arg.getValue());
+ domEvalueCutoff = arg.getValue();
}
- else if (MessageManager.getString("label.dom_score").equals(name))
+ else if (MessageManager.getString(DOM_SCORE_KEY).equals(name))
{
- args.add("--incdomT");
- args.add(arg.getValue());
+ domScoreCutoff = arg.getValue();
}
- else if (MessageManager.getString("label.trim_termini")
+ else if (MessageManager.getString(TRIM_TERMINI_KEY)
.equals(name))
{
trim = true;
}
- else if (MessageManager.getString("label.database").equals(name))
+ else if (MessageManager.getString(DATABASE_KEY).equals(name))
{
dbFound = true;
dbPath = arg.getValue();
- if (!MessageManager.getString("label.this_alignment")
+ if (!MessageManager.getString(THIS_ALIGNMENT_KEY)
.equals(dbPath))
{
databaseFile = new File(dbPath);
}
}
- if (!dbFound || MessageManager.getString("label.this_alignment")
+ if (useEvalueCutoff)
+ {
+ args.add("-E");
+ args.add(seqEvalueCutoff);
+ args.add("--domE");
+ args.add(domEvalueCutoff);
+ }
+ else if (useScoreCutoff)
+ {
+ args.add("-T");
+ args.add(seqScoreCutoff);
+ args.add("--domT");
+ args.add(domScoreCutoff);
+ }
+
+ if (!dbFound || MessageManager.getString(THIS_ALIGNMENT_KEY)
.equals(dbPath))
{
/*
copy.deleteSequence(hmmSeq);
}
exportStockholm(copy.getSequencesArray(), databaseFile, null);
- // StockholmFile stoFile = new StockholmFile(copy);
- // stoFile.setSeqs(copy.getSequencesArray());
- // String alignmentString = stoFile.print();
- // PrintWriter writer = new PrintWriter(databaseFile);
- // writer.print(alignmentString);
- // writer.close();
}
args.add(getFilePath(hmmFile));
if (trim)
{
alignArgs.add(new BooleanOption(
- MessageManager.getString("label.trim_termini"),
+ MessageManager.getString(TRIM_TERMINI_KEY),
MessageManager.getString("label.trim_termini_desc"), true,
true, true, null));
}
final double max;
- final double base; // todo is this even needed?
-
@Override
public ValueConstrainI getValidValue()
{
max = parm.max;
min = parm.min;
defval = 0D;
- base = parm.base;
}
public LogarithmicParameter(String name, String description,
- boolean required, Double defValue, double min, double max,
- double base)
+ boolean required, Double defValue, double min, double max)
{
super(name, description, required, String.valueOf(defValue), null, null,
null);
defval = defValue;
this.min = min;
this.max = max;
- this.base = base;
}
public LogarithmicParameter(String name, String description,
boolean required, Double defValue, double value, double min,
- double max, double base)
+ double max)
{
super(name, description, required, String.valueOf(defValue),
String.valueOf(value), null, null);
defval = defValue;
this.min = min;
this.max = max;
- this.base = base;
}
@Override
{
return new LogarithmicParameter(this);
}
-
- public double getBase()
- {
- return base;
- }
}
+++ /dev/null
-/*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
- * This file is part of Jalview.
- *
- * Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation, either version 3
- * of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
- * The Jalview Authors are detailed in the 'AUTHORS' file.
- */
-package jalview.ws.params.simple;
-
-import jalview.ws.params.OptionI;
-import jalview.ws.params.ParameterI;
-import jalview.ws.params.ValueConstrainI;
-
-public abstract class Parameter extends Option
- implements OptionI, ParameterI
-{
- ValueConstrainI validator;
-
- @Override
- public ValueConstrainI getValidValue()
- {
- return validator;
- }
-
- public Parameter(Parameter parm)
- {
- super(parm);
- }
-
- public Parameter(ValueConstrainI validator)
- {
- super();
- this.validator = validator;
- }
-
- @Override
- public abstract Parameter copy();
-}
*/
package jalview.ws.params.simple;
+import java.util.List;
+
+/**
+ * A parameter with options intended to be rendered as radio buttons
+ */
public class StringChoiceParameter extends Option
{
+ /**
+ * Constructor
+ *
+ * @param name
+ * @param description
+ * @param options
+ * @param def
+ */
+ public StringChoiceParameter(String name, String description,
+ List<String> options, String def)
+ {
+ super(name, description, true, def, def, options, null);
+ }
}
import jalview.ws.params.ParameterI;
import jalview.ws.params.ValueConstrainI;
-import java.net.URL;
-import java.util.List;
+import java.util.Collection;
public class StringParameter extends Option implements ParameterI
{
-
- @Override
- public URL getFurtherDetails()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean isRequired()
- {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public String getDescription()
- {
- // TODO Auto-generated method stub
- return description;
- }
-
- @Override
- public List<String> getPossibleValues()
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getName()
- {
- // TODO Auto-generated method stub
- return name;
- }
-
- @Override
- public String getValue()
- {
- // TODO Auto-generated method stub
- return value;
- }
-
- @Override
- public void setValue(String selectedItem)
- {
- value = selectedItem;
-
- }
-
@Override
public ValueConstrainI getValidValue()
{
- // TODO Auto-generated method stub
return new StringValueConstrain();
}
String.valueOf(value), null, null);
this.defvalue = defValue;
}
+
+ /**
+ * Constructor for a parameter with a list of possible values
+ *
+ * @param name2
+ * @param description2
+ * @param isrequired
+ * @param defValue
+ * @param value
+ * @param possibleVals
+ */
+ public StringParameter(String name2, String description2,
+ boolean isrequired, String defValue, String value,
+ Collection<String> possibleVals)
+ {
+ super(name2, description2, isrequired, defValue, value, possibleVals,
+ null);
+ }
}