From 2602928231027c3bd8acf11e86083cb8e0fb2259 Mon Sep 17 00:00:00 2001 From: TZVanaalten Date: Thu, 24 Aug 2017 15:07:36 +0100 Subject: [PATCH] JAL-2629 adjust parameter min and max to better suit HMMER ranges --- src/jalview/gui/OptsAndParamsPage.java | 20 ++-- src/jalview/hmmer/HMMERParamStore.java | 161 ++++++++++++++++---------------- 2 files changed, 96 insertions(+), 85 deletions(-) diff --git a/src/jalview/gui/OptsAndParamsPage.java b/src/jalview/gui/OptsAndParamsPage.java index 424d561..44acdab 100644 --- a/src/jalview/gui/OptsAndParamsPage.java +++ b/src/jalview/gui/OptsAndParamsPage.java @@ -599,15 +599,11 @@ public class OptsAndParamsPage public String formatDouble(Double value) { - String string = ""; - if (value < 0.0001) + String string = String.format("%2.3f", value); + if (value < 0.001) { string = String.format("%3.3e", value); } - else - { - string = value.toString(); - } return string; } @@ -681,7 +677,17 @@ public class OptsAndParamsPage } else { - valueField.setText(parm.getValue()); + if (parm instanceof LogarithmicParameter) + { + Double base = ((LogarithmicParameter) parm).getBase(); + Double value = Math.pow(base, + Double.parseDouble(parm.getValue())); + valueField.setText(formatDouble(value)); + } + else + { + valueField.setText(parm.getValue()); + } } } lastVal = updateSliderFromValueField(); diff --git a/src/jalview/hmmer/HMMERParamStore.java b/src/jalview/hmmer/HMMERParamStore.java index 4791626..ab33c95 100644 --- a/src/jalview/hmmer/HMMERParamStore.java +++ b/src/jalview/hmmer/HMMERParamStore.java @@ -51,96 +51,101 @@ public class HMMERParamStore implements ParamDatastoreI List args = new ArrayList<>(); if ("hmmsearch".equals(name)) { - 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()) - { - Collection databases = new ArrayList<>(); - databases.add(MessageManager.getString("label.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, MessageManager.getString("label.this_alignment"), - MessageManager.getString("label.this_alignment"), databases, - null)); - } - args.add(new BooleanOption( - MessageManager.getString("label.auto_align_seqs"), - MessageManager.getString("label.auto_align_seqs_desc"), - false, false, true, null)); - args.add(new BooleanOption( - MessageManager.getString("label.use_accessions"), - MessageManager.getString("label.use_accessions_desc"), - false, false, true, null)); - args.add(new BooleanOption( - MessageManager.getString("label.trim_termini"), - MessageManager.getString("label.trim_termini_desc"), false, - false, true, null)); - args.add(new LogarithmicParameter( - MessageManager.getString("label.seq_e_value"), - MessageManager.getString("label.seq_e_value_desc"), false, - 0.001d, -63d, 9d, 4d)); - /* - args.add(new DoubleParameter( - MessageManager.getString("label.seq_score"), - MessageManager.getString("label.seq_score_desc"), false, - 0d, 0d, 10000d)); - */ - args.add(new LogarithmicParameter( - MessageManager.getString("label.dom_e_value_desc"), - MessageManager.getString("label.dom_e_value_desc"), false, - 0.001d, -63d, 9d, 4d)); - /* - args.add(new DoubleParameter( - MessageManager.getString("label.dom_score"), - MessageManager.getString("label.dom_score_desc"), false, 0d, - 0d, - 10000d)); - */ + getHMMSearchParams(args); } if ("hmmalign".equals(name)) { - args.add(new BooleanOption( - MessageManager.getString("label.trim_termini"), - MessageManager.getString( - "label.trim_termini = Trim Non-Matching Termini_desc"), - false, false, true, null)); + getHMMAlignParams(args); } if ("hmmbuild".equals(name)) { - args.add(new BooleanOption( - MessageManager.getString("label.trim_termini"), - MessageManager.getString( - "label.trim_termini = Trim Non-Matching Termini_desc"), - false, false, true, null)); + } return args; } + private void getHMMSearchParams(List 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()) + { + Collection databases = new ArrayList<>(); + databases.add(MessageManager.getString("label.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, MessageManager.getString("label.this_alignment"), + MessageManager.getString("label.this_alignment"), databases, + null)); + } + args.add(new BooleanOption( + MessageManager.getString("label.auto_align_seqs"), + MessageManager.getString("label.auto_align_seqs_desc"), false, + false, true, null)); + args.add(new BooleanOption( + MessageManager.getString("label.use_accessions"), + MessageManager.getString("label.use_accessions_desc"), false, + false, true, null)); + args.add(new BooleanOption( + MessageManager.getString("label.trim_termini"), + MessageManager.getString("label.trim_termini_desc"), false, + false, true, null)); + args.add(new LogarithmicParameter( + MessageManager.getString("label.seq_e_value"), + MessageManager.getString("label.seq_e_value_desc"), false, + -9.96578, -126d, 3.3219d, 2d)); + /* + args.add(new DoubleParameter( + MessageManager.getString("label.seq_score"), + MessageManager.getString("label.seq_score_desc"), false, + 0d, 0d, 10000d)); + */ + args.add(new LogarithmicParameter( + MessageManager.getString("label.dom_e_value_desc"), + MessageManager.getString("label.dom_e_value_desc"), false, + -9.96578, -126d, 3.3219d, 2d)); + /* + args.add(new DoubleParameter( + MessageManager.getString("label.dom_score"), + MessageManager.getString("label.dom_score_desc"), false, 0d, + 0d, + 10000d)); + */ + } + + private void getHMMAlignParams(List args) + { + args.add(new BooleanOption( + MessageManager.getString("label.trim_termini"), + MessageManager.getString( + "label.trim_termini = Trim Non-Matching Termini_desc"), + false, false, true, null)); + } + @Override public boolean presetExists(String name) { -- 1.7.10.2