From: Jim Procter Date: Mon, 17 Nov 2014 14:43:37 +0000 (+0000) Subject: JAL-1587 propagate results of JABA sequence based predictors to dataset X-Git-Tag: Jalview_2_9~149^2~5 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=4b31a57dbc12d26b92c31186ff3b953f0dd8dfcc;p=jalview.git JAL-1587 propagate results of JABA sequence based predictors to dataset --- diff --git a/src/jalview/ws/jws2/AADisorderClient.java b/src/jalview/ws/jws2/AADisorderClient.java index 83eebdf..6c438be 100644 --- a/src/jalview/ws/jws2/AADisorderClient.java +++ b/src/jalview/ws/jws2/AADisorderClient.java @@ -279,10 +279,13 @@ public class AADisorderClient extends JabawsCalcWorker implements { continue; } + String typename, calcName; AlignmentAnnotation annot = createAnnotationRowsForScores( ourAnnot, - service.serviceType + " (" + scr.getMethod() + ")", - service.getServiceTypeURI() + "/" + scr.getMethod(), + typename = service.serviceType + " (" + + scr.getMethod() + ")", + calcName = service.getServiceTypeURI() + "/" + + scr.getMethod(), aseq, base + 1, scr); annot.graph = AlignmentAnnotation.LINE_GRAPH; @@ -333,6 +336,9 @@ public class AADisorderClient extends JabawsCalcWorker implements } } annot._linecolour = col; + // finally, update any dataset annotation + replaceAnnotationOnAlignmentWith(annot, typename, calcName, + aseq); } } } diff --git a/src/jalview/ws/jws2/JabawsCalcWorker.java b/src/jalview/ws/jws2/JabawsCalcWorker.java index e966886..e01c648 100644 --- a/src/jalview/ws/jws2/JabawsCalcWorker.java +++ b/src/jalview/ws/jws2/JabawsCalcWorker.java @@ -158,6 +158,30 @@ public abstract class JabawsCalcWorker extends AbstractJabaCalcWorker return annotation; } + protected void replaceAnnotationOnAlignmentWith( + AlignmentAnnotation newAnnot, String typeName, String calcId, + SequenceI aSeq) + { + SequenceI dsseq = aSeq.getDatasetSequence(); + while (dsseq.getDatasetSequence() != null) + { + dsseq = dsseq.getDatasetSequence(); + } + // look for same annotation on dataset and lift this one over + List dsan = dsseq.getAlignmentAnnotations(calcId, + typeName); + if (dsan != null && dsan.size() > 0) + { + for (AlignmentAnnotation dssan : dsan) + { + dsseq.removeAlignmentAnnotation(dssan); + } + } + AlignmentAnnotation dssan = new AlignmentAnnotation(newAnnot); + dsseq.addAlignmentAnnotation(dssan); + dssan.adjustForAlignment(); + } + private void constructAnnotationFromScore(AlignmentAnnotation annotation, int base, int alWidth, Score scr) {