From 5c7ed97187f95fffe2bf97b5d7b5fec206e79ecc Mon Sep 17 00:00:00 2001 From: gmungoc Date: Wed, 30 May 2018 12:16:32 +0100 Subject: [PATCH] JAL-3005 JAL-2629 file chooser argument for HMM search database --- resources/lang/Messages.properties | 1 + resources/lang/Messages_es.properties | 1 + src/jalview/hmmer/HMMERParamStore.java | 22 ++++++++++++++++------ src/jalview/hmmer/HMMSearch.java | 18 ++++++++++++++++-- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties index 4a5059e..c25cda8 100644 --- a/resources/lang/Messages.properties +++ b/resources/lang/Messages.properties @@ -1421,3 +1421,4 @@ label.groups_and_alignment = All groups and alignment label.groups = All groups label.selected_group = Selected group label.use_info_for_height = Use Information Content as Letter Height +action.search = Search \ No newline at end of file diff --git a/resources/lang/Messages_es.properties b/resources/lang/Messages_es.properties index e0e0a4a..eb217bd 100644 --- a/resources/lang/Messages_es.properties +++ b/resources/lang/Messages_es.properties @@ -1362,3 +1362,4 @@ label.most_bound_molecules = M label.most_polymer_residues = Más Residuos de Polímeros label.cached_structures = Estructuras en Caché label.free_text_search = Búsqueda de texto libre +action.search = Buscar \ No newline at end of file diff --git a/src/jalview/hmmer/HMMERParamStore.java b/src/jalview/hmmer/HMMERParamStore.java index 00cae85..452097b 100644 --- a/src/jalview/hmmer/HMMERParamStore.java +++ b/src/jalview/hmmer/HMMERParamStore.java @@ -10,9 +10,11 @@ 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.FileParameter; import jalview.ws.params.simple.IntegerParameter; import jalview.ws.params.simple.LogarithmicParameter; import jalview.ws.params.simple.Option; +import jalview.ws.params.simple.RadioChoiceParameter; import jalview.ws.params.simple.StringParameter; import java.io.File; @@ -104,7 +106,7 @@ public final class HMMERParamStore implements ParamDatastoreI args.add(new BooleanOption( MessageManager.getString(HMMSearch.AUTO_ALIGN_SEQS_KEY), MessageManager.getString("label.auto_align_seqs_desc"), false, - false, true, null)); + false, false, null)); args.add(new BooleanOption( MessageManager.getString(HMMSearch.USE_ACCESSIONS_KEY), MessageManager.getString("label.use_accessions_desc"), false, @@ -119,18 +121,26 @@ public final class HMMERParamStore implements ParamDatastoreI */ addChoiceOfHmm(args); - addChoiceOfDatabase(args); - + // addChoiceOfDatabase(args); + + String thisAlignment = MessageManager + .getString(HMMSearch.THIS_ALIGNMENT_KEY); + String database = MessageManager.getString("label.database"); + args.add(new RadioChoiceParameter( + MessageManager.getString("action.search"), null, + Arrays.asList(thisAlignment, + database), + thisAlignment)); + args.add(new FileParameter(database, "", false, "", "")); 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( + args.add(new RadioChoiceParameter( 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), - null)); + HMMSearch.CUTOFF_EVALUE)); args.add(new LogarithmicParameter( MessageManager.getString(HMMSearch.SEQ_EVALUE_KEY), MessageManager.getString("label.seq_e_value_desc"), false, 1D, diff --git a/src/jalview/hmmer/HMMSearch.java b/src/jalview/hmmer/HMMSearch.java index a58b949..6cda421 100644 --- a/src/jalview/hmmer/HMMSearch.java +++ b/src/jalview/hmmer/HMMSearch.java @@ -195,6 +195,7 @@ public class HMMSearch extends HmmerCommand String seqScoreCutoff = null; String domScoreCutoff = null; databaseName = "Alignment"; + boolean searchAlignment = false; if (params != null) { @@ -206,6 +207,18 @@ public class HMMSearch extends HmmerCommand { seqsToReturn = Integer.parseInt(arg.getValue()); } + else if (MessageManager.getString("action.search").equals(name)) + { + searchAlignment = arg.getValue().equals( + MessageManager.getString(HMMSearch.THIS_ALIGNMENT_KEY)); + } + else if (MessageManager.getString(DATABASE_KEY).equals(name)) + { + dbPath = arg.getValue(); + int pos = dbPath.lastIndexOf(File.separator); + databaseName = dbPath.substring(pos + 1); + databaseFile = new File(dbPath); + } else if (MessageManager.getString(AUTO_ALIGN_SEQS_KEY) .equals(name)) { @@ -280,8 +293,9 @@ public class HMMSearch extends HmmerCommand args.add(domScoreCutoff); } - if (!dbFound || MessageManager.getString(THIS_ALIGNMENT_KEY) - .equals(dbPath)) +// if (!dbFound || MessageManager.getString(THIS_ALIGNMENT_KEY) +// .equals(dbPath)) + if (searchAlignment) { /* * no external database specified for search, so -- 1.7.10.2