From: jprocter Date: Thu, 3 Nov 2011 18:15:42 +0000 (+0000) Subject: (JAL-975) client for amino acid conservation service that allows dynamic recalculatio... X-Git-Tag: Jalview_2_9~564^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=3cd1d1bf65a80f981c3f9e50d037a3589244edef;p=jalview.git (JAL-975) client for amino acid conservation service that allows dynamic recalculation if alignment is changed or service parameters reconfigured --- diff --git a/src/jalview/ws/jws2/AAConsClient.java b/src/jalview/ws/jws2/AAConsClient.java new file mode 100644 index 0000000..4b5a440 --- /dev/null +++ b/src/jalview/ws/jws2/AAConsClient.java @@ -0,0 +1,450 @@ +package jalview.ws.jws2; + +import groovy.swing.impl.Startable; + +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.TreeSet; + +import sun.tools.tree.AssignAddExpression; + +import compbio.data.msa.SequenceAnnotation; +import compbio.data.sequence.Range; +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; +import compbio.metadata.Option; +import compbio.metadata.ResultNotAvailableException; +import compbio.metadata.WrongParameterException; + +import jalview.analysis.AlignSeq; +import jalview.analysis.SeqsetUtils; +import jalview.analysis.StructureFrequency; +import jalview.api.AlignViewportI; +import jalview.api.AlignmentViewPanel; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.Annotation; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.gui.AlignFrame; +import jalview.workers.AlignCalcWorker; +import jalview.ws.jws2.dm.JabaWsParamSet; +import jalview.ws.jws2.jabaws2.Jws2Instance; +import jalview.ws.params.WsParamSetI; + +public class AAConsClient extends AlignCalcWorker +{ + + public AAConsClient(AlignViewportI alignViewport, + AlignmentViewPanel alignPanel) + { + super(alignViewport, alignPanel); + } + + @SuppressWarnings("unchecked") + SequenceAnnotation aaservice; + + private ScoreManager scoremanager; + + private WsParamSetI preset; + + private List arguments; + + public WsParamSetI getPreset() + { + return preset; + } + public List getArguments() + { + return arguments; + } + /** + * reconfigure and restart the AAConsClient. 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) + { + if (calcMan.isWorking(this)) + { + new Thread(new Runnable() { + @Override + public void run() + { + + try {Thread.sleep(200); + } catch (InterruptedException x) {}; + updateParameters(newpreset, newarguments); + } + } + ).start(); + } else { + preset=newpreset; + arguments=newarguments; + calcMan.startWorker(this); + } + } + + + public AAConsClient(Jws2Instance service, AlignFrame alignFrame, + WsParamSetI preset, List paramset) + { + this(alignFrame.getCurrentView(), alignFrame.alignPanel); + this.preset = preset; + this.arguments = paramset; + aaservice = (SequenceAnnotation) service.service; + + } + + public List