From: Jim Procter Date: Tue, 10 Jun 2014 16:20:49 +0000 (+0100) Subject: JAL-1379 refactor Jws2 service client so dynamic services can be of any type of JABA... X-Git-Tag: Jalview_2_9~182^2~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=2b8cf92a2483d206d9e574bbe8306ad845a308d8;p=jalview.git JAL-1379 refactor Jws2 service client so dynamic services can be of any type of JABA client interface --- diff --git a/src/jalview/ws/jws2/AAConClient.java b/src/jalview/ws/jws2/AAConClient.java index 676b3ba..66338b1 100644 --- a/src/jalview/ws/jws2/AAConClient.java +++ b/src/jalview/ws/jws2/AAConClient.java @@ -34,10 +34,11 @@ import java.util.Map; import java.util.Set; import java.util.TreeSet; +import compbio.data.sequence.FastaSequence; import compbio.data.sequence.Score; import compbio.metadata.Argument; -public class AAConClient extends JabawsAlignCalcWorker +public class AAConClient extends JabawsCalcWorker { public AAConClient(Jws2Instance service, AlignFrame alignFrame, @@ -102,6 +103,12 @@ public class AAConClient extends JabawsAlignCalcWorker } @Override + boolean checkValidInputSeqs(boolean dynamic, List seqs) + { + return (seqs.size() > 1); + } + + @Override public String getCalcId() { return CALC_ID; diff --git a/src/jalview/ws/jws2/AADisorderClient.java b/src/jalview/ws/jws2/AADisorderClient.java index 34969d1..83eebdf 100644 --- a/src/jalview/ws/jws2/AADisorderClient.java +++ b/src/jalview/ws/jws2/AADisorderClient.java @@ -40,6 +40,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import compbio.data.sequence.FastaSequence; import compbio.data.sequence.Range; import compbio.data.sequence.Score; import compbio.data.sequence.ScoreManager.ScoreHolder; @@ -82,6 +83,12 @@ public class AADisorderClient extends JabawsCalcWorker implements return "Submitting amino acid sequences for disorder prediction."; } + @Override + boolean checkValidInputSeqs(boolean dynamic, List seqs) + { + return (seqs.size() > 0); + } + private static Map> featureMap; private static Map>> annotMap; @@ -374,4 +381,11 @@ public class AADisorderClient extends JabawsCalcWorker implements } } + @Override + public String getCalcId() + { + // Disorder predictions are not dynamically updated so we return null + return null; + } + } diff --git a/src/jalview/ws/jws2/AbstractJabaCalcWorker.java b/src/jalview/ws/jws2/AbstractJabaCalcWorker.java new file mode 100644 index 0000000..a7cc5b6 --- /dev/null +++ b/src/jalview/ws/jws2/AbstractJabaCalcWorker.java @@ -0,0 +1,599 @@ +package jalview.ws.jws2; + +import jalview.analysis.AlignSeq; +import jalview.analysis.SeqsetUtils; +import jalview.api.AlignViewportI; +import jalview.api.AlignmentViewPanel; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.AnnotatedCollectionI; +import jalview.datamodel.SequenceI; +import jalview.gui.AlignFrame; +import jalview.gui.IProgressIndicator; +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.WsParamSetI; + +import java.util.ArrayList; +import java.util.HashMap; +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; +import compbio.metadata.Option; +import compbio.metadata.ResultNotAvailableException; + +public abstract class AbstractJabaCalcWorker extends AlignCalcWorker +{ + + protected Jws2Instance service; + + protected WsParamSetI preset; + + protected List arguments; + + protected IProgressIndicator guiProgress; + + protected boolean submitGaps = true; + + /** + * Recover any existing parameters for this service + */ + protected void initViewportParams() + { + if (getCalcId() != null) + { + ((jalview.gui.AlignViewport) alignViewport).setCalcIdSettingsFor( + getCalcId(), + new AAConSettings(true, service, this.preset, + (arguments != null) ? JabaParamStore + .getJwsArgsfromJaba(arguments) : null), true); + } + } + + /** + * + * @return null or a string used to recover all annotation generated by this + * worker + */ + public abstract String getCalcId(); + + public WsParamSetI getPreset() + { + return preset; + } + + public List getArguments() + { + return arguments; + } + + /** + * reconfigure and restart the AAConClient. This method will spawn a new + * thread that will wait until any current jobs are finished, modify the + * parameters and restart the conservation calculation with the new values. + * + * @param newpreset + * @param newarguments + */ + public void updateParameters(final WsParamSetI newpreset, + final List newarguments) + { + preset = newpreset; + arguments = newarguments; + calcMan.startWorker(this); + initViewportParams(); + } + + public List