From 47ecacc91ed5d80b59b42d255ef5c13e79d3dfa0 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 20 Sep 2019 17:01:57 +0100 Subject: [PATCH] JAL-3070 rough-and-ready refactor of JABA SequenceAnnotation style services - needs some review and refinement --- src/jalview/workers/AlignCalcWorker.java | 4 + src/jalview/ws/api/SequenceAnnotationServiceI.java | 40 ++ src/jalview/ws/api/WSAnnotationCalcManagerI.java | 6 + src/jalview/ws/gui/AnnotationWsJob.java | 106 +++++ src/jalview/ws/gui/MsaWSJob.java | 16 +- src/jalview/ws/gui/WsJob.java | 24 ++ src/jalview/ws/jws2/AAConClient.java | 131 ------ src/jalview/ws/jws2/AADisorderClient.java | 382 ----------------- src/jalview/ws/jws2/AbstractJabaCalcWorker.java | 451 ++++++++++++-------- src/jalview/ws/jws2/Jws2Client.java | 294 +------------ src/jalview/ws/jws2/Jws2ClientFactory.java | 273 ++++++++++++ src/jalview/ws/jws2/MsaWSClient.java | 2 +- .../ws/jws2/SequenceAnnotationWSClient.java | 13 +- src/jalview/ws/jws2/jabaws2/AAConClient.java | 102 +++++ src/jalview/ws/jws2/jabaws2/AADisorderClient.java | 340 +++++++++++++++ .../JabawsAnnotationInstance.java} | 189 ++++---- src/jalview/ws/jws2/jabaws2/JabawsMsaInstance.java | 184 +------- .../jabaws2/JabawsMsaInterfaceAlignCalcWorker.java | 281 ++++-------- .../ws/jws2/jabaws2/JabawsServiceInstance.java | 212 +++++++++ src/jalview/ws/jws2/jabaws2/Jws2Instance.java | 48 ++- .../ws/jws2/jabaws2/Jws2InstanceFactory.java | 10 +- .../ws/jws2/{ => jabaws2}/RNAalifoldClient.java | 168 +++----- src/jalview/ws/uimodel/AlignAnalysisUIText.java | 50 ++- .../ws/jabaws/DisorderAnnotExportImport.java | 7 +- test/jalview/ws/jabaws/RNAStructExportImport.java | 14 +- 25 files changed, 1773 insertions(+), 1574 deletions(-) create mode 100644 src/jalview/ws/api/SequenceAnnotationServiceI.java create mode 100644 src/jalview/ws/api/WSAnnotationCalcManagerI.java create mode 100644 src/jalview/ws/gui/AnnotationWsJob.java delete mode 100644 src/jalview/ws/jws2/AAConClient.java delete mode 100644 src/jalview/ws/jws2/AADisorderClient.java create mode 100644 src/jalview/ws/jws2/Jws2ClientFactory.java create mode 100644 src/jalview/ws/jws2/jabaws2/AAConClient.java create mode 100644 src/jalview/ws/jws2/jabaws2/AADisorderClient.java rename src/jalview/ws/jws2/{JabawsCalcWorker.java => jabaws2/JabawsAnnotationInstance.java} (51%) create mode 100644 src/jalview/ws/jws2/jabaws2/JabawsServiceInstance.java rename src/jalview/ws/jws2/{ => jabaws2}/RNAalifoldClient.java (72%) diff --git a/src/jalview/workers/AlignCalcWorker.java b/src/jalview/workers/AlignCalcWorker.java index 0ad8726..cf4805d 100644 --- a/src/jalview/workers/AlignCalcWorker.java +++ b/src/jalview/workers/AlignCalcWorker.java @@ -136,4 +136,8 @@ public abstract class AlignCalcWorker implements AlignCalcWorkerI } } + public AlignViewportI getAlignViewport() + { + return alignViewport; + } } diff --git a/src/jalview/ws/api/SequenceAnnotationServiceI.java b/src/jalview/ws/api/SequenceAnnotationServiceI.java new file mode 100644 index 0000000..d0965e5 --- /dev/null +++ b/src/jalview/ws/api/SequenceAnnotationServiceI.java @@ -0,0 +1,40 @@ +package jalview.ws.api; + +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.SequenceI; +import jalview.ws.gui.AnnotationWsJob; +import jalview.ws.jws2.AbstractJabaCalcWorker; +import jalview.ws.params.ArgumentI; +import jalview.ws.params.WsParamSetI; + +import java.util.List; + +public interface SequenceAnnotationServiceI extends JalviewWebServiceI +{ + + + /** + * submit sequences to service with no parameters, or preset or parameter set. + * Nb- almost the same as the 'align' method in the Msa service :) + * + * @param seqs + * @param preset + * @param paramset + * @return + * @throws Throwable + */ + JobId submitToService(List seqs, WsParamSetI preset, + List paramset) throws Throwable; + + /** + * todo: move to SequenceAnnotationResult + * + * @param running + * @param abstractJabaCalcWorker + * @return + */ + List getAlignmentAnnotation(AnnotationWsJob running, + AbstractJabaCalcWorker abstractJabaCalcWorker) throws Throwable; + + +} diff --git a/src/jalview/ws/api/WSAnnotationCalcManagerI.java b/src/jalview/ws/api/WSAnnotationCalcManagerI.java new file mode 100644 index 0000000..47e3195 --- /dev/null +++ b/src/jalview/ws/api/WSAnnotationCalcManagerI.java @@ -0,0 +1,6 @@ +package jalview.ws.api; + +public interface WSAnnotationCalcManagerI +{ + +} diff --git a/src/jalview/ws/gui/AnnotationWsJob.java b/src/jalview/ws/gui/AnnotationWsJob.java new file mode 100644 index 0000000..3381138 --- /dev/null +++ b/src/jalview/ws/gui/AnnotationWsJob.java @@ -0,0 +1,106 @@ +package jalview.ws.gui; + +import jalview.api.FeatureRenderer; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.SequenceI; + +import java.util.List; +import java.util.Map; + +public class AnnotationWsJob extends WsJob +{ + /** + * sequences (anonymised) + */ + List seqs; + + /** + * mapping to original sequences + */ + Map seqNames; + + /** + * first column in the segment of the alignment view that was submitted + */ + int startPos; + + public int getStartPos() + { + return startPos; + } + + public void setStartPos(int startPos) + { + this.startPos = startPos; + } + + /** + * outputs + */ + List annotation = null; + + boolean transferSequenceFeatures = false; + + public boolean isTransferSequenceFeatures() + { + return transferSequenceFeatures; + } + + public void setTransferSequenceFeatures(boolean transferSequenceFeatures) + { + this.transferSequenceFeatures = transferSequenceFeatures; + } + + public List getAnnotation() + { + return annotation; + } + + public void setAnnotation(List annotation) + { + this.annotation = annotation; + } + + @Override + public boolean hasResults() + { + return (isSubmitted() && isFinished() + && (annotation != null || transferSequenceFeatures)); + } + + public List getSeqs() + { + return seqs; + } + + public void setSeqs(List seqs) + { + this.seqs = seqs; + } + + public Map getSeqNames() + { + return seqNames; + } + + public void setSeqNames(Map seqNames) + { + this.seqNames = seqNames; + } + + /** + * configured by the WS framework just before results are collected + */ + FeatureRenderer featureRenderer; + + public void setFeatureRenderer(FeatureRenderer fr) + { + this.featureRenderer = fr; + } + public FeatureRenderer getFeatureRenderer() + { + // TODO Auto-generated method stub + return featureRenderer; + } + +} diff --git a/src/jalview/ws/gui/MsaWSJob.java b/src/jalview/ws/gui/MsaWSJob.java index b27222f..d8cae20 100644 --- a/src/jalview/ws/gui/MsaWSJob.java +++ b/src/jalview/ws/gui/MsaWSJob.java @@ -6,7 +6,6 @@ import jalview.datamodel.AlignmentOrder; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; import jalview.util.MessageManager; -import jalview.ws.api.JobId; import jalview.ws.jws2.dm.JabaWsParamSet; import jalview.ws.params.ArgumentI; @@ -278,6 +277,7 @@ class MsaWSJob extends WsJob { // TODO: get attributes for this MsaWS instance to check if it can do two // sequence alignment. + // TODO: check type of sequences are valid for this service if (seqs != null && seqs.size() >= 2) // two or more sequences is valid ? { return true; @@ -367,18 +367,4 @@ class MsaWSJob extends WsJob jobProgress.append("\nJob Output:\n"); } } - - JobId jobHandle = null; - public void setJobHandle(JobId align) - { - jobHandle = align; - setJobId(jobHandle.getJobId()); - - } - - public JobId getJobHandle() - { - return jobHandle; - } - } \ No newline at end of file diff --git a/src/jalview/ws/gui/WsJob.java b/src/jalview/ws/gui/WsJob.java index 05379d7..e5af8c1 100644 --- a/src/jalview/ws/gui/WsJob.java +++ b/src/jalview/ws/gui/WsJob.java @@ -4,6 +4,7 @@ package jalview.ws.gui; import jalview.ws.AWsJob; +import jalview.ws.api.JobId; /** * Bean that holds state for a job @@ -173,4 +174,27 @@ public class WsJob extends AWsJob } + /* + * bean holding submission info for a next-gen ws job + */ + JobId jobHandle = null; + + /** + * stash the handle for the job and mark it as submitted + * + * @param align + */ + public void setJobHandle(JobId align) + { + jobHandle = align; + setJobId(jobHandle.getJobId()); + submitted = true; + + } + + public JobId getJobHandle() + { + return jobHandle; + } + } diff --git a/src/jalview/ws/jws2/AAConClient.java b/src/jalview/ws/jws2/AAConClient.java deleted file mode 100644 index ddd69a7..0000000 --- a/src/jalview/ws/jws2/AAConClient.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. - */ -package jalview.ws.jws2; - -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; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -import compbio.data.sequence.FastaSequence; -import compbio.data.sequence.Score; - -public class AAConClient extends JabawsCalcWorker -{ - - public AAConClient(Jws2Instance service, AlignFrame alignFrame, - WsParamSetI preset, List paramset) - { - super(service, alignFrame, preset, paramset); - submitGaps = true; - alignedSeqs = true; - nucleotidesAllowed = false; - proteinAllowed = true; - filterNonStandardResidues = true; - gapMap = new boolean[0]; - initViewportParams(); - } - - @Override - public String getServiceActionText() - { - return "calculating Amino acid consensus using AACon service"; - } - - /** - * update the consensus annotation from the sequence profile data using - * current visualization settings. - */ - - @Override - public void updateResultAnnotation(boolean immediate) - { - if (immediate || !calcMan.isWorking(this) && scoremanager != null) - { - Map> scoremap = scoremanager.asMap(); - int alWidth = alignViewport.getAlignment().getWidth(); - ArrayList ourAnnot = new ArrayList<>(); - for (String score : scoremap.keySet()) - { - Set scores = scoremap.get(score); - for (Score scr : scores) - { - if (scr.getRanges() != null && scr.getRanges().size() > 0) - { - /** - * annotation in range annotation = findOrCreate(scr.getMethod(), - * true, null, null); Annotation[] elm = new Annotation[alWidth]; - * Iterator vals = scr.getScores().iterator(); for (Range rng - * : scr.getRanges()) { float val = vals.next().floatValue(); for - * (int i = rng.from; i <= rng.to; i++) { elm[i] = new - * Annotation("", "", ' ', val); } } annotation.annotations = elm; - * annotation.validateRangeAndDisplay(); - */ - } - else - { - createAnnotationRowsForScores(ourAnnot, getCalcId(), alWidth, - scr); - } - } - } - - if (ourAnnot.size() > 0) - { - updateOurAnnots(ourAnnot); - } - } - } - - @Override - boolean checkValidInputSeqs(boolean dynamic, List seqs) - { - return (seqs.size() > 1); - } - - @Override - public String getCalcId() - { - return CALC_ID; - } - - private static String CALC_ID = "jabaws2.AACon"; - - public static AlignAnalysisUIText getAlignAnalysisUITest() - { - return new AlignAnalysisUIText( - compbio.ws.client.Services.AAConWS.toString(), - jalview.ws.jws2.AAConClient.class, CALC_ID, false, true, true, - MessageManager.getString("label.aacon_calculations"), - MessageManager.getString("tooltip.aacon_calculations"), - MessageManager.getString("label.aacon_settings"), - MessageManager.getString("tooltip.aacon_settings")); - } -} diff --git a/src/jalview/ws/jws2/AADisorderClient.java b/src/jalview/ws/jws2/AADisorderClient.java deleted file mode 100644 index 91db7c3..0000000 --- a/src/jalview/ws/jws2/AADisorderClient.java +++ /dev/null @@ -1,382 +0,0 @@ -/* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors - * - * This file is part of Jalview. - * - * Jalview is free software: you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 - * of the License, or (at your option) any later version. - * - * Jalview is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Jalview. If not, see . - * The Jalview Authors are detailed in the 'AUTHORS' file. - */ -package jalview.ws.jws2; - -import jalview.api.FeatureColourI; -import jalview.bin.Cache; -import jalview.datamodel.AlignmentAnnotation; -import jalview.datamodel.GraphLine; -import jalview.datamodel.SequenceFeature; -import jalview.datamodel.SequenceI; -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; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Hashtable; -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; - -public class AADisorderClient extends JabawsCalcWorker -{ - - private static final String THRESHOLD = "THRESHOLD"; - - private static final String RANGE = "RANGE"; - - String typeName; - - String methodName; - - String groupName; - - AlignFrame af; - - public AADisorderClient(Jws2Instance sh, AlignFrame alignFrame, - WsParamSetI thePreset, List paramset) - { - super(sh, alignFrame, thePreset, paramset); - af = alignFrame; - typeName = sh.getAction(); - methodName = sh.getName(); - - submitGaps = false; - alignedSeqs = false; - nucleotidesAllowed = false; - proteinAllowed = true; - bySequence = true; - } - - @Override - public String getServiceActionText() - { - 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; - - private static String DONTCOMBINE = "DONTCOMBINE"; - - private static String INVISIBLE = "INVISIBLE"; - static - { - // TODO: turn this into some kind of configuration file that's a bit easier - // to edit - featureMap = new HashMap<>(); - Map fmap; - featureMap.put(compbio.ws.client.Services.IUPredWS.toString(), - fmap = new HashMap<>()); - fmap.put("Glob", - new String[] - { "Globular Domain", "Predicted globular domain" }); - featureMap.put(compbio.ws.client.Services.JronnWS.toString(), - fmap = new HashMap<>()); - featureMap.put(compbio.ws.client.Services.DisemblWS.toString(), - fmap = new HashMap<>()); - fmap.put("REM465", new String[] { "REM465", "Missing density" }); - fmap.put("HOTLOOPS", new String[] { "HOTLOOPS", "Flexible loops" }); - fmap.put("COILS", new String[] { "COILS", "Random coil" }); - featureMap.put(compbio.ws.client.Services.GlobPlotWS.toString(), - fmap = new HashMap<>()); - fmap.put("GlobDoms", - new String[] - { "Globular Domain", "Predicted globular domain" }); - fmap.put("Disorder", - new String[] - { "Protein Disorder", "Probable unstructured peptide region" }); - Map> amap; - annotMap = new HashMap<>(); - annotMap.put(compbio.ws.client.Services.GlobPlotWS.toString(), - amap = new HashMap<>()); - amap.put("Dydx", new HashMap()); - amap.get("Dydx").put(DONTCOMBINE, DONTCOMBINE); - amap.get("Dydx").put(THRESHOLD, new double[] { 1, 0 }); - amap.get("Dydx").put(RANGE, new float[] { -1, +1 }); - - amap.put("SmoothedScore", new HashMap()); - amap.get("SmoothedScore").put(INVISIBLE, INVISIBLE); - amap.put("RawScore", new HashMap()); - amap.get("RawScore").put(INVISIBLE, INVISIBLE); - annotMap.put(compbio.ws.client.Services.DisemblWS.toString(), - amap = new HashMap<>()); - amap.put("COILS", new HashMap()); - amap.put("HOTLOOPS", new HashMap()); - amap.put("REM465", new HashMap()); - amap.get("COILS").put(THRESHOLD, new double[] { 1, 0.516 }); - amap.get("COILS").put(RANGE, new float[] { 0, 1 }); - - amap.get("HOTLOOPS").put(THRESHOLD, new double[] { 1, 0.6 }); - amap.get("HOTLOOPS").put(RANGE, new float[] { 0, 1 }); - amap.get("REM465").put(THRESHOLD, new double[] { 1, 0.1204 }); - amap.get("REM465").put(RANGE, new float[] { 0, 1 }); - - annotMap.put(compbio.ws.client.Services.IUPredWS.toString(), - amap = new HashMap<>()); - amap.put("Long", new HashMap()); - amap.put("Short", new HashMap()); - amap.get("Long").put(THRESHOLD, new double[] { 1, 0.5 }); - amap.get("Long").put(RANGE, new float[] { 0, 1 }); - amap.get("Short").put(THRESHOLD, new double[] { 1, 0.5 }); - amap.get("Short").put(RANGE, new float[] { 0, 1 }); - annotMap.put(compbio.ws.client.Services.JronnWS.toString(), - amap = new HashMap<>()); - amap.put("JRonn", new HashMap()); - amap.get("JRonn").put(THRESHOLD, new double[] { 1, 0.5 }); - amap.get("JRonn").put(RANGE, new float[] { 0, 1 }); - } - - @Override - public void updateResultAnnotation(boolean immediate) - { - - if (immediate || !calcMan.isWorking(this) && scoremanager != null) - { - Map featureTypeMap = featureMap - .get(service.getName()); - Map> annotTypeMap = annotMap - .get(service.getName()); - boolean dispFeatures = false; - Map fc = new Hashtable<>(); - List ourAnnot = new ArrayList<>(); - /** - * grouping for any annotation rows created - */ - int graphGroup = 1; - if (alignViewport.getAlignment().getAlignmentAnnotation() != null) - { - for (AlignmentAnnotation ala : alignViewport.getAlignment() - .getAlignmentAnnotation()) - { - if (ala.graphGroup > graphGroup) - { - graphGroup = ala.graphGroup; - } - } - } - - for (String seqId : seqNames.keySet()) - { - boolean sameGroup = false; - SequenceI dseq, aseq, seq = seqNames.get(seqId); - int base = seq.findPosition(start) - 1; - aseq = seq; - while ((dseq = seq).getDatasetSequence() != null) - { - seq = seq.getDatasetSequence(); - } - ScoreHolder scores = null; - try - { - scores = scoremanager.getAnnotationForSequence(seqId); - } catch (Exception q) - { - Cache.log - .info("Couldn't recover disorder prediction for sequence " - + seq.getName() + "(Prediction name was " + seqId - + ")" - + "\nSee http://issues.jalview.org/browse/JAL-1319 for one possible reason why disorder predictions might fail."); - } - float last = Float.NaN, val = Float.NaN; - int lastAnnot = ourAnnot.size(); - if (scores != null && scores.scores != null) - { - for (Score scr : scores.scores) - { - - if (scr.getRanges() != null && scr.getRanges().size() > 0) - { - Iterator vals = scr.getScores().iterator(); - // make features on sequence - for (Range rn : scr.getRanges()) - { - - SequenceFeature sf; - String[] type = featureTypeMap.get(scr.getMethod()); - if (type == null) - { - // create a default type for this feature - type = new String[] { - typeName + " (" + scr.getMethod() + ")", - service.getActionText() }; - } - if (vals.hasNext()) - { - val = vals.next().floatValue(); - sf = new SequenceFeature(type[0], type[1], - base + rn.from, base + rn.to, val, methodName); - } - else - { - sf = new SequenceFeature(type[0], type[1], - base + rn.from, base + rn.to, methodName); - } - dseq.addSequenceFeature(sf); - if (last != val && !Float.isNaN(last)) - { - fc.put(sf.getType(), sf); - } - last = val; - dispFeatures = true; - } - } - else - { - if (scr.getScores().size() == 0) - { - continue; - } - String typename, calcName; - AlignmentAnnotation annot = createAnnotationRowsForScores( - ourAnnot, - typename = service.getName() + " (" - + scr.getMethod() + ")", - calcName = service.getNameURI() + "/" - + scr.getMethod(), - aseq, base + 1, scr); - annot.graph = AlignmentAnnotation.LINE_GRAPH; - - Map styleMap = (annotTypeMap == null) ? null - : annotTypeMap.get(scr.getMethod()); - - annot.visible = (styleMap == null - || styleMap.get(INVISIBLE) == null); - double[] thrsh = (styleMap == null) ? null - : (double[]) styleMap.get(THRESHOLD); - float[] range = (styleMap == null) ? null - : (float[]) styleMap.get(RANGE); - if (range != null) - { - annot.graphMin = range[0]; - annot.graphMax = range[1]; - } - if (styleMap == null || styleMap.get(DONTCOMBINE) == null) - { - { - if (!sameGroup) - { - graphGroup++; - sameGroup = true; - } - - annot.graphGroup = graphGroup; - } - } - - annot.description = "" + service.getActionText() - + " - raw scores"; - if (thrsh != null) - { - String threshNote = (thrsh[0] > 0 ? "Above " : "Below ") - + thrsh[1] + " indicates disorder"; - annot.threshold = new GraphLine((float) thrsh[1], - threshNote, Color.red); - annot.description += "
" + threshNote; - } - annot.description += ""; - Color col = ColorUtils - .createColourFromName(typeName + scr.getMethod()); - for (int p = 0, ps = annot.annotations.length; p < ps; p++) - { - if (annot.annotations[p] != null) - { - annot.annotations[p].colour = col; - } - } - annot._linecolour = col; - // finally, update any dataset annotation - replaceAnnotationOnAlignmentWith(annot, typename, calcName, - aseq); - } - } - } - if (lastAnnot + 1 == ourAnnot.size()) - { - // remove singleton alignment annotation row - ourAnnot.get(lastAnnot).graphGroup = -1; - } - } - { - if (dispFeatures) - { - jalview.api.FeatureRenderer fr = ((jalview.gui.AlignmentPanel) ap) - .cloneFeatureRenderer(); - for (String ft : fc.keySet()) - { - FeatureColourI gc = fr.getFeatureStyle(ft); - if (gc.isSimpleColour()) - { - // set graduated color as fading to white for minimum, and - // autoscaling to values on alignment - FeatureColourI ggc = new FeatureColour(gc.getColour(), - Color.white, gc.getColour(), Color.white, - Float.MIN_VALUE, Float.MAX_VALUE); - ggc.setAutoScaled(true); - fr.setColour(ft, ggc); - } - } - // TODO: JAL-1150 - create sequence feature settings API for defining - // styles and enabling/disabling feature overlay on alignment panel - ((jalview.gui.AlignmentPanel) ap).updateFeatureRendererFrom(fr); - if (af.alignPanel == ap) - { - // only do this if the alignFrame is currently showing this view. - af.setShowSeqFeatures(true); - } - } - if (ourAnnot.size() > 0) - { - // Modify the visible annotation on the alignment viewport with the - // new alignment annotation rows created. - updateOurAnnots(ourAnnot); - ap.adjustAnnotationHeight(); - ap.paintAlignment(true, true); - } - } - } - } - - @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 index 1a361c4..422b4ef 100644 --- a/src/jalview/ws/jws2/AbstractJabaCalcWorker.java +++ b/src/jalview/ws/jws2/AbstractJabaCalcWorker.java @@ -24,17 +24,24 @@ import jalview.analysis.AlignSeq; import jalview.analysis.SeqsetUtils; import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; +import jalview.bin.Cache; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.AnnotatedCollectionI; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; +import jalview.gui.Desktop; import jalview.gui.IProgressIndicator; import jalview.gui.IProgressIndicatorHandler; +import jalview.gui.JvOptionPane; import jalview.schemes.ResidueProperties; +import jalview.util.MessageManager; import jalview.workers.AlignCalcWorker; +import jalview.ws.api.CancellableI; +import jalview.ws.api.JobId; +import jalview.ws.api.WSAnnotationCalcManagerI; +import jalview.ws.gui.AnnotationWsJob; 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; @@ -44,14 +51,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import compbio.data.sequence.FastaSequence; -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 +public class AbstractJabaCalcWorker extends AlignCalcWorker + implements WSAnnotationCalcManagerI { protected Jws2Instance service; @@ -88,7 +89,11 @@ public abstract class AbstractJabaCalcWorker extends AlignCalcWorker * @return null or a string used to recover all annotation generated by this * worker */ - public abstract String getCalcId(); + public String getCalcId() + { + return service.getAlignAnalysisUI() == null ? null + : service.getAlignAnalysisUI().getCalcId(); + } public WsParamSetI getPreset() { @@ -116,27 +121,6 @@ public abstract class AbstractJabaCalcWorker extends AlignCalcWorker calcMan.startWorker(this); initViewportParams(); } - - public List