From 54ee3e95ec4f21a301e458f8b7f22876ae70a017 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Thu, 26 Jul 2018 14:36:40 +0100 Subject: [PATCH] JAL-3070 use ArgumentI in all public constructors, convert to service specific argument object only when needed --- src/jalview/ws/jws2/AAConClient.java | 4 ++-- src/jalview/ws/jws2/AADisorderClient.java | 4 ++-- src/jalview/ws/jws2/AbstractJabaCalcWorker.java | 17 +++++++---------- src/jalview/ws/jws2/JabawsCalcWorker.java | 4 ++-- .../ws/jws2/JabawsMsaInterfaceAlignCalcWorker.java | 4 ++-- src/jalview/ws/jws2/Jws2Client.java | 6 ++---- src/jalview/ws/jws2/MsaWSClient.java | 4 ++-- src/jalview/ws/jws2/MsaWSThread.java | 11 ++++++----- src/jalview/ws/jws2/RNAalifoldClient.java | 4 ++-- src/jalview/ws/jws2/SequenceAnnotationWSClient.java | 2 +- test/jalview/ws/jabaws/RNAStructExportImport.java | 4 +++- 11 files changed, 31 insertions(+), 33 deletions(-) diff --git a/src/jalview/ws/jws2/AAConClient.java b/src/jalview/ws/jws2/AAConClient.java index 327864a..ddd69a7 100644 --- a/src/jalview/ws/jws2/AAConClient.java +++ b/src/jalview/ws/jws2/AAConClient.java @@ -24,6 +24,7 @@ import jalview.datamodel.AlignmentAnnotation; import jalview.gui.AlignFrame; import jalview.util.MessageManager; import jalview.ws.jws2.jabaws2.Jws2Instance; +import jalview.ws.params.ArgumentI; import jalview.ws.params.WsParamSetI; import jalview.ws.uimodel.AlignAnalysisUIText; @@ -35,13 +36,12 @@ import java.util.TreeSet; import compbio.data.sequence.FastaSequence; import compbio.data.sequence.Score; -import compbio.metadata.Argument; public class AAConClient extends JabawsCalcWorker { public AAConClient(Jws2Instance service, AlignFrame alignFrame, - WsParamSetI preset, List paramset) + WsParamSetI preset, List paramset) { super(service, alignFrame, preset, paramset); submitGaps = true; diff --git a/src/jalview/ws/jws2/AADisorderClient.java b/src/jalview/ws/jws2/AADisorderClient.java index bd4e0ea..9cec97b 100644 --- a/src/jalview/ws/jws2/AADisorderClient.java +++ b/src/jalview/ws/jws2/AADisorderClient.java @@ -30,6 +30,7 @@ import jalview.gui.AlignFrame; import jalview.schemes.FeatureColour; import jalview.util.ColorUtils; import jalview.ws.jws2.jabaws2.Jws2Instance; +import jalview.ws.params.ArgumentI; import jalview.ws.params.WsParamSetI; import java.awt.Color; @@ -44,7 +45,6 @@ import compbio.data.sequence.FastaSequence; import compbio.data.sequence.Range; import compbio.data.sequence.Score; import compbio.data.sequence.ScoreManager.ScoreHolder; -import compbio.metadata.Argument; public class AADisorderClient extends JabawsCalcWorker { @@ -62,7 +62,7 @@ public class AADisorderClient extends JabawsCalcWorker AlignFrame af; public AADisorderClient(Jws2Instance sh, AlignFrame alignFrame, - WsParamSetI thePreset, List paramset) + WsParamSetI thePreset, List paramset) { super(sh, alignFrame, thePreset, paramset); af = alignFrame; diff --git a/src/jalview/ws/jws2/AbstractJabaCalcWorker.java b/src/jalview/ws/jws2/AbstractJabaCalcWorker.java index dd64e77..1a361c4 100644 --- a/src/jalview/ws/jws2/AbstractJabaCalcWorker.java +++ b/src/jalview/ws/jws2/AbstractJabaCalcWorker.java @@ -36,6 +36,7 @@ import jalview.workers.AlignCalcWorker; import jalview.ws.jws2.dm.AAConSettings; import jalview.ws.jws2.dm.JabaWsParamSet; import jalview.ws.jws2.jabaws2.Jws2Instance; +import jalview.ws.params.ArgumentI; import jalview.ws.params.WsParamSetI; import java.util.ArrayList; @@ -44,7 +45,6 @@ import java.util.List; import java.util.Map; import compbio.data.sequence.FastaSequence; -import compbio.metadata.Argument; import compbio.metadata.ChunkHolder; import compbio.metadata.JobStatus; import compbio.metadata.JobSubmissionException; @@ -58,7 +58,7 @@ public abstract class AbstractJabaCalcWorker extends AlignCalcWorker protected WsParamSetI preset; - protected List arguments; + protected List arguments; protected IProgressIndicator guiProgress; @@ -78,10 +78,7 @@ public abstract class AbstractJabaCalcWorker extends AlignCalcWorker { ((jalview.gui.AlignViewport) alignViewport).setCalcIdSettingsFor( getCalcId(), - new AAConSettings(true, service, this.preset, - (arguments != null) - ? JabaParamStore.getJwsArgsfromJaba(arguments) - : null), + new AAConSettings(true, service, this.preset, arguments), true); } } @@ -98,7 +95,7 @@ public abstract class AbstractJabaCalcWorker extends AlignCalcWorker return preset; } - public List getArguments() + public List getArguments() { return arguments; } @@ -112,7 +109,7 @@ public abstract class AbstractJabaCalcWorker extends AlignCalcWorker * @param newarguments */ public void updateParameters(final WsParamSetI newpreset, - final List newarguments) + final List newarguments) { preset = newpreset; arguments = newarguments; @@ -129,7 +126,7 @@ public abstract class AbstractJabaCalcWorker extends AlignCalcWorker } if (arguments != null && arguments.size() > 0) { - for (Argument rg : arguments) + for (Object rg : JabaParamStore.getJabafromJwsArgs(arguments)) { if (Option.class.isAssignableFrom(rg.getClass())) { @@ -168,7 +165,7 @@ public abstract class AbstractJabaCalcWorker extends AlignCalcWorker } public AbstractJabaCalcWorker(Jws2Instance service, AlignFrame alignFrame, - WsParamSetI preset, List paramset) + WsParamSetI preset, List paramset) { this(alignFrame.getCurrentView(), alignFrame.alignPanel); this.guiProgress = alignFrame; diff --git a/src/jalview/ws/jws2/JabawsCalcWorker.java b/src/jalview/ws/jws2/JabawsCalcWorker.java index fc36205..c70e721 100644 --- a/src/jalview/ws/jws2/JabawsCalcWorker.java +++ b/src/jalview/ws/jws2/JabawsCalcWorker.java @@ -26,6 +26,7 @@ import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; import jalview.util.MessageManager; import jalview.ws.jws2.jabaws2.Jws2Instance; +import jalview.ws.params.ArgumentI; import jalview.ws.params.WsParamSetI; import java.util.Iterator; @@ -34,7 +35,6 @@ import java.util.List; import compbio.data.msa.SequenceAnnotation; import compbio.data.sequence.Score; import compbio.data.sequence.ScoreManager; -import compbio.metadata.Argument; import compbio.metadata.ChunkHolder; import compbio.metadata.JobStatus; import compbio.metadata.JobSubmissionException; @@ -50,7 +50,7 @@ public abstract class JabawsCalcWorker extends AbstractJabaCalcWorker protected ScoreManager scoremanager; public JabawsCalcWorker(Jws2Instance service, AlignFrame alignFrame, - WsParamSetI preset, List paramset) + WsParamSetI preset, List paramset) { super(service, alignFrame, preset, paramset); aaservice = (SequenceAnnotation) service.service; diff --git a/src/jalview/ws/jws2/JabawsMsaInterfaceAlignCalcWorker.java b/src/jalview/ws/jws2/JabawsMsaInterfaceAlignCalcWorker.java index ee36d4a..5ccef8a 100644 --- a/src/jalview/ws/jws2/JabawsMsaInterfaceAlignCalcWorker.java +++ b/src/jalview/ws/jws2/JabawsMsaInterfaceAlignCalcWorker.java @@ -28,6 +28,7 @@ import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; import jalview.util.MessageManager; import jalview.ws.jws2.jabaws2.Jws2Instance; +import jalview.ws.params.ArgumentI; import jalview.ws.params.WsParamSetI; import java.util.Iterator; @@ -36,7 +37,6 @@ import java.util.List; import compbio.data.msa.MsaWS; import compbio.data.sequence.Alignment; import compbio.data.sequence.Score; -import compbio.metadata.Argument; import compbio.metadata.ChunkHolder; import compbio.metadata.JobStatus; import compbio.metadata.JobSubmissionException; @@ -60,7 +60,7 @@ public abstract class JabawsMsaInterfaceAlignCalcWorker public JabawsMsaInterfaceAlignCalcWorker(Jws2Instance service, AlignFrame alignFrame, WsParamSetI preset, - List paramset) + List paramset) { this(alignFrame.getCurrentView(), alignFrame.alignPanel); this.guiProgress = alignFrame; diff --git a/src/jalview/ws/jws2/Jws2Client.java b/src/jalview/ws/jws2/Jws2Client.java index f233030..334f3c3 100644 --- a/src/jalview/ws/jws2/Jws2Client.java +++ b/src/jalview/ws/jws2/Jws2Client.java @@ -45,8 +45,6 @@ import javax.swing.JMenuItem; import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; -import compbio.metadata.Argument; - /** * provides metadata for a jabaws2 service instance - resolves names, etc. * @@ -57,10 +55,10 @@ public abstract class Jws2Client extends jalview.ws.WSClient { protected WsParamSetI preset; - protected List paramset; + protected List paramset; public Jws2Client(AlignFrame _alignFrame, WsParamSetI preset, - List arguments) + List arguments) { alignFrame = _alignFrame; this.preset = preset; diff --git a/src/jalview/ws/jws2/MsaWSClient.java b/src/jalview/ws/jws2/MsaWSClient.java index bbeefc6..dccdcea 100644 --- a/src/jalview/ws/jws2/MsaWSClient.java +++ b/src/jalview/ws/jws2/MsaWSClient.java @@ -28,6 +28,7 @@ import jalview.gui.JvOptionPane; import jalview.gui.JvSwingUtils; import jalview.util.MessageManager; import jalview.ws.jws2.jabaws2.Jws2Instance; +import jalview.ws.params.ArgumentI; import jalview.ws.params.WsParamSetI; import java.awt.event.ActionEvent; @@ -41,7 +42,6 @@ import javax.swing.JMenuItem; import javax.swing.ToolTipManager; import compbio.data.msa.MsaWS; -import compbio.metadata.Argument; /** * DOCUMENT ME! @@ -93,7 +93,7 @@ public class MsaWSClient extends Jws2Client */ public MsaWSClient(Jws2Instance sh, WsParamSetI preset, - List arguments, boolean editParams, String altitle, + List arguments, boolean editParams, String altitle, jalview.datamodel.AlignmentView msa, boolean submitGaps, boolean preserveOrder, AlignmentI seqdataset, AlignFrame _alignFrame) diff --git a/src/jalview/ws/jws2/MsaWSThread.java b/src/jalview/ws/jws2/MsaWSThread.java index c4fc66b..a0cd0f4 100644 --- a/src/jalview/ws/jws2/MsaWSThread.java +++ b/src/jalview/ws/jws2/MsaWSThread.java @@ -38,6 +38,7 @@ import jalview.ws.AWsJob; import jalview.ws.JobStateSummary; import jalview.ws.WSClientI; import jalview.ws.jws2.dm.JabaWsParamSet; +import jalview.ws.params.ArgumentI; import jalview.ws.params.WsParamSetI; import java.util.ArrayList; @@ -70,7 +71,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI WsParamSetI preset = null; - List arguments = null; + List arguments = null; /** * input @@ -385,7 +386,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI } if (arguments != null && arguments.size() > 0) { - newargs.addAll(arguments); + newargs.addAll(JabaParamStore.getJabafromJwsArgs(arguments)); } return newargs; } @@ -402,7 +403,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI + "Preset: " + preset.getName()); if (preset instanceof JabaWsParamSet) { - for (Argument opt : ((JabaWsParamSet) preset).getjabaArguments()) + for (Argument opt : getJabaArguments()) { jobProgress.append( opt.getName() + " " + opt.getDefaultValue() + "\n"); @@ -413,7 +414,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI { jobProgress.append("With custom parameters : \n"); // merge arguments with preset's own arguments. - for (Argument opt : arguments) + for (Argument opt : getJabaArguments()) { jobProgress.append( opt.getName() + " " + opt.getDefaultValue() + "\n"); @@ -474,7 +475,7 @@ class MsaWSThread extends AWS2Thread implements WSClientI * @param seqset * Alignment */ - MsaWSThread(MsaWS server2, WsParamSetI preset, List paramset, + MsaWSThread(MsaWS server2, WsParamSetI preset, List paramset, String wsUrl, WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame, String wsname, String title, AlignmentView _msa, boolean subgaps, boolean presorder, diff --git a/src/jalview/ws/jws2/RNAalifoldClient.java b/src/jalview/ws/jws2/RNAalifoldClient.java index 32ae38f..1c4e192 100644 --- a/src/jalview/ws/jws2/RNAalifoldClient.java +++ b/src/jalview/ws/jws2/RNAalifoldClient.java @@ -25,6 +25,7 @@ import jalview.datamodel.Annotation; import jalview.gui.AlignFrame; import jalview.util.MessageManager; import jalview.ws.jws2.jabaws2.Jws2Instance; +import jalview.ws.params.ArgumentI; import jalview.ws.params.WsParamSetI; import jalview.ws.uimodel.AlignAnalysisUIText; @@ -40,7 +41,6 @@ import compbio.data.sequence.RNAStructReader.AlifoldResult; import compbio.data.sequence.RNAStructScoreManager; import compbio.data.sequence.Range; import compbio.data.sequence.Score; -import compbio.metadata.Argument; /** * Client for the JABA RNA Alifold Service @@ -61,7 +61,7 @@ public class RNAalifoldClient extends JabawsCalcWorker boolean bpScores; public RNAalifoldClient(Jws2Instance sh, AlignFrame alignFrame, - WsParamSetI preset, List paramset) + WsParamSetI preset, List paramset) { super(sh, alignFrame, preset, paramset); af = alignFrame; diff --git a/src/jalview/ws/jws2/SequenceAnnotationWSClient.java b/src/jalview/ws/jws2/SequenceAnnotationWSClient.java index 8befb2a..eb08848 100644 --- a/src/jalview/ws/jws2/SequenceAnnotationWSClient.java +++ b/src/jalview/ws/jws2/SequenceAnnotationWSClient.java @@ -145,7 +145,7 @@ public class SequenceAnnotationWSClient extends Jws2Client public SequenceAnnotationWSClient(AAConSettings fave, AlignFrame alignFrame, boolean b) { - super(alignFrame, fave.getPreset(), fave.getJobArgset()); + super(alignFrame, fave.getPreset(), fave.getArgumentSet()); initSequenceAnnotationWSClient(fave.getService(), alignFrame, fave.getPreset(), b); } diff --git a/test/jalview/ws/jabaws/RNAStructExportImport.java b/test/jalview/ws/jabaws/RNAStructExportImport.java index ee07335..d5a7e99 100644 --- a/test/jalview/ws/jabaws/RNAStructExportImport.java +++ b/test/jalview/ws/jabaws/RNAStructExportImport.java @@ -33,6 +33,7 @@ import jalview.io.DataSourceType; import jalview.io.FileFormat; import jalview.io.FormatAdapter; import jalview.io.StockholmFileTest; +import jalview.ws.jws2.JabaParamStore; import jalview.ws.jws2.Jws2Discoverer; import jalview.ws.jws2.RNAalifoldClient; import jalview.ws.jws2.SequenceAnnotationWSClient; @@ -280,7 +281,8 @@ public class RNAStructExportImport opts.add(rg); } } - alifoldClient = new RNAalifoldClient(rnaalifoldws, af, null, opts); + alifoldClient = new RNAalifoldClient(rnaalifoldws, af, null, + JabaParamStore.getJwsArgsfromJaba(opts)); af.getViewport().getCalcManager().startWorker(alifoldClient); -- 1.7.10.2