From bbc8fc127287ad3a11f0b470d37d741ddca162ff Mon Sep 17 00:00:00 2001 From: Mateusz Warowny Date: Mon, 8 May 2023 16:23:35 +0200 Subject: [PATCH] JAL-3954 Create ParamDatastore builder for phmmer --- src/jalview/ws2/client/ebi/ParamStores.java | 285 +++++++++++++++++++++++++++ 1 file changed, 285 insertions(+) create mode 100644 src/jalview/ws2/client/ebi/ParamStores.java diff --git a/src/jalview/ws2/client/ebi/ParamStores.java b/src/jalview/ws2/client/ebi/ParamStores.java new file mode 100644 index 0000000..ffd338d --- /dev/null +++ b/src/jalview/ws2/client/ebi/ParamStores.java @@ -0,0 +1,285 @@ +package jalview.ws2.client.ebi; + +import jalview.ws.params.ArgumentI; +import jalview.ws.params.ParamDatastoreI; +import jalview.ws.params.ParamManager; +import jalview.ws.params.simple.*; +import jalview.ws2.params.SimpleParamDatastore; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +class ParamStores +{ + static final List phmmerParameters; + + /** + * Set up phmmer parameters list. + */ + static + { + var parameters = new ArrayList(); + URL baseURL; + try + { + baseURL = new URL( "https://www.ebi.ac.uk/Tools/services/rest/hmmer3_phmmer/"); + } catch (MalformedURLException e) + { + throw new ExceptionInInitializerError(e); + } + { + var builder = StringParameter.newBuilder(); + builder.setName("cut-offs"); + builder.setLabel("Cut-offs"); + builder.setDescription("Set the method of controlling which target sequences match your query."); + builder.setRequired(true); + builder.setValue("E"); + builder.setDefaultValue("E"); + builder.setPossibleValues(List.of("E", "T")); + builder.setDisplayValues(List.of("E-values", "Bit scores")); + parameters.add(builder.build()); + } + { + var builder = DoubleParameter.newBuilder(); + builder.setName("incE"); + builder.setLabel("Significance E-values[Sequence]"); + builder.setDescription("Significance E-values[Sequence]"); + builder.setRequired(false); + builder.setValue(0.01); + builder.setDefaultValue(0.01); + builder.setMin(0.); + builder.setMax(10.); + builder.setDetailsUrl(resolveURL(baseURL, "parameterdetails/incE")); + parameters.add(builder.build()); + } + { + var builder = DoubleParameter.newBuilder(); + builder.setName("incdomE"); + builder.setLabel("Significance E-values[Hit]"); + builder.setDescription("Significance E-values[Hit]"); + builder.setRequired(false); + builder.setValue(0.03); + builder.setDefaultValue(0.03); + builder.setMin(0.); + builder.setMax(10.); + builder.setDetailsUrl(resolveURL(baseURL, "parameterdetails/incdomE")); + parameters.add(builder.build()); + } + { + var builder = DoubleParameter.newBuilder(); + builder.setName("E"); + builder.setLabel("Report E-values[Sequence]"); + builder.setDescription("Report E-values[Sequence]"); + builder.setRequired(false); + builder.setValue(1.0); + builder.setDefaultValue(1.0); + builder.setMin(0.); + builder.setMax(10.); + builder.setDetailsUrl(resolveURL(baseURL, "parameterdetails/E")); + parameters.add(builder.build()); + } + { + var builder = DoubleParameter.newBuilder(); + builder.setName("domE"); + builder.setLabel("Report E-values[Hit]"); + builder.setDescription("Report E-values[Hit]"); + builder.setRequired(false); + builder.setValue(1.0); + builder.setDefaultValue(1.0); + builder.setMin(0.); + builder.setMax(10.); + builder.setDetailsUrl(resolveURL(baseURL, "parameterdetails/domE")); + parameters.add(builder.build()); + } + { + var builder = DoubleParameter.newBuilder(); + builder.setName("incT"); + builder.setLabel("Significance bit scores[Sequence]"); + builder.setDescription("Significance bit scores[Sequence]"); + builder.setRequired(false); + builder.setValue(25.0); + builder.setDefaultValue(25.0); + builder.setMin(0.); + builder.setDetailsUrl(resolveURL(baseURL, "parameterdetails/incT")); + parameters.add(builder.build()); + } + { + var builder = DoubleParameter.newBuilder(); + builder.setName("incdomT"); + builder.setLabel("Significance bit scores[Hit]"); + builder.setDescription("Significance bit scores[Hit]"); + builder.setRequired(false); + builder.setValue(22.0); + builder.setDefaultValue(22.0); + builder.setMin(0.); + builder.setDetailsUrl(resolveURL(baseURL, "parameterdetails/incdomT")); + parameters.add(builder.build()); + } + { + var builder = DoubleParameter.newBuilder(); + builder.setName("T"); + builder.setLabel("Report bit scores[Sequence]"); + builder.setDescription("Report bit scores[Sequence]"); + builder.setRequired(false); + builder.setValue(7.0); + builder.setDefaultValue(7.0); + builder.setMin(0.); + builder.setDetailsUrl(resolveURL(baseURL, "parameterdetails/T")); + parameters.add(builder.build()); + } + { + var builder = DoubleParameter.newBuilder(); + builder.setName("domT"); + builder.setLabel("Report bit scores[Hit]"); + builder.setDescription("Report bit scores[Hit]"); + builder.setRequired(false); + builder.setValue(5.0); + builder.setDefaultValue(5.0); + builder.setMin(0.); + builder.setDetailsUrl(resolveURL(baseURL, "parameterdetails/domT")); + parameters.add(builder.build()); + } + { + var builder = DoubleParameter.newBuilder(); + builder.setName("popen"); + builder.setLabel("Gap Penalties[open]"); + builder.setDescription("Gap Penalties[open]"); + builder.setRequired(false); + builder.setValue(0.02); + builder.setDefaultValue(0.02); + builder.setMin(0.); + builder.setMax(0.5); + builder.setDetailsUrl(resolveURL(baseURL, "parameterdetails/popen")); + parameters.add(builder.build()); + } + { + var builder = DoubleParameter.newBuilder(); + builder.setName("pextend"); + builder.setLabel("Gap Penalties[extend]"); + builder.setDescription("Gap Penalties[extend]"); + builder.setRequired(false); + builder.setValue(0.4); + builder.setDefaultValue(0.4); + builder.setMin(0.); + builder.setMax(1.); + builder.setDetailsUrl(resolveURL(baseURL, "parameterdetails/pextend")); + parameters.add(builder.build()); + } + { + var builder = StringParameter.newBuilder(); + builder.setName("mx"); + builder.setLabel("Gap Penalties[Substitution scoring matrix]"); + builder.setDescription("Gap Penalties[Substitution scoring matrix]"); + builder.setRequired(false); + builder.setValue("BLOSUM62"); + builder.setDefaultValue("BLOSUM62"); + builder.setPossibleValues(List.of("BLOSUM45", "BLOSUM62", "BLOSUM90", "PAM30", "PAM70")); + builder.setDisplayValues(List.of("BLOSUM45", "BLOSUM62", "BLOSUM90", "PAM30", "PAM70")); + builder.setDetailsUrl(resolveURL(baseURL, "parameterdetails/mx")); + parameters.add(builder.build()); + } + { + var builder = BooleanOption.newBuilder(); + builder.setName("nobias"); + builder.setLabel("No bias filter"); + builder.setDescription( + "The '--nobias' option turns off (bypasses) the biased composition filter which is on by default."); + builder.setRequired(false); + builder.setValue(false); + builder.setDefaultValue(false); + builder.setDetailsUrl(resolveURL(baseURL, "parameterdetails/nobias")); + parameters.add(builder.build()); + } + { + var builder = BooleanOption.newBuilder(); + builder.setName("compressedout"); + builder.setLabel("Compressed Output"); + builder.setDescription( + "By default it runs hmm2c plus post-processing (default output), whereas with compressedout, it gets compressed output only."); + builder.setRequired(false); + builder.setValue(false); + builder.setDefaultValue(false); + builder.setDetailsUrl(resolveURL(baseURL, "parameterdetails/compressedout")); + parameters.add(builder.build()); + } + { + var builder = BooleanOption.newBuilder(); + builder.setName("alignView"); + builder.setLabel("Output Alignment"); + builder.setDescription("Output alignment in result"); + builder.setRequired(false); + builder.setValue(true); + builder.setDefaultValue(true); + builder.setDetailsUrl(resolveURL(baseURL, "parameterdetails/alignView")); + parameters.add(builder.build()); + } + { + var builder = StringParameter.newBuilder(); + builder.setName("database"); + builder.setLabel("Sequence Database"); + builder.setDescription("Sequence Database Selection"); + builder.setRequired(true); + builder.setValue("uniprotkb"); + builder.setDefaultValue("uniprotkb"); + builder.setPossibleValues(List.of("swissprot", "uniprotrefprot", "uniprotkb", "pdb", "rp75", "rp55", "rp35", "rp15", "ensembl", "merops", "qfo", "chembl")); + builder.setDisplayValues(List.of("SwissProt", "Reference Proteomes", "UniProtKB", "PDB", "rp75", "rp55", "rp35", "rp15", "Ensembl", "MEROPS", "Quest for Orthologs", "ChEMBL")); + builder.setDetailsUrl(resolveURL(baseURL, "parameterdetails/database")); + parameters.add(builder.build()); + } + { + var builder = DoubleParameter.newBuilder(); + builder.setName("evalue"); + builder.setLabel("Expectation Value Threshold"); + builder.setDescription( + "Expectation value cut-off for reporting target profiles in the per-target output."); + builder.setRequired(false); + builder.setValue(0.01); + builder.setDefaultValue(0.01); + builder.setDetailsUrl(resolveURL(baseURL, "parameterdetails/evalue")); + parameters.add(builder.build()); + } +// { +// var builder = StringParameter.newBuilder(); +// builder.setName("sequence"); +// builder.setLabel("Input Sequence"); +// builder.setDescription( +// "The input sequence can be entered directly into this form. The sequence can be be in FASTA or UniProtKB/Swiss-Prot format. A partially formatted sequence is not accepted. Adding a return to the end of the sequence may help certain applications understand the input. Note that directly using data from word processors may yield unpredictable results as hidden/control characters may be present."); +// builder.setRequired(false); +// +// builder.setDetailsUrl(resolveURL(baseURL, "parameterdetails/sequence")); +// parameters.add(builder.build()); +// } + { + var builder = IntegerParameter.newBuilder(); + builder.setName("nhits"); + builder.setLabel("Number of Hits Displayed"); + builder.setDescription("Number of hits to be displayed."); + builder.setRequired(false); + builder.setValue(100); + builder.setDefaultValue(100); + builder.setDetailsUrl(resolveURL(baseURL, "parameterdetails/nhits")); + parameters.add(builder.build()); + } + phmmerParameters = Collections.unmodifiableList(parameters); + } + + private static URL resolveURL(URL base, String spec) + { + try + { + return new URL(base, spec); + } catch (MalformedURLException e) + { + throw new ExceptionInInitializerError(e); + } + } + + public static ParamDatastoreI newPhmmerDatastore(URL url, ParamManager manager) + { + return new SimpleParamDatastore(url, phmmerParameters, + Collections.emptyList(), manager); + } +} -- 1.7.10.2