From ab58313e7bb31264ddb2715a1c548cdc789d7fa6 Mon Sep 17 00:00:00 2001 From: Mateusz Warowny Date: Fri, 28 Jul 2023 12:37:32 +0200 Subject: [PATCH] --- Adding issue comments --- .../ws/jws2/SeqAnnotationServiceCalcWorker.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/jalview/ws/jws2/SeqAnnotationServiceCalcWorker.java b/src/jalview/ws/jws2/SeqAnnotationServiceCalcWorker.java index 3253f43..fee2b38 100644 --- a/src/jalview/ws/jws2/SeqAnnotationServiceCalcWorker.java +++ b/src/jalview/ws/jws2/SeqAnnotationServiceCalcWorker.java @@ -712,11 +712,18 @@ public class SeqAnnotationServiceCalcWorker extends AlignCalcWorker SequenceI seq = running.getSeqNames() .get(ala.sequenceRef.getName()); aseq = seq; + // This part doesn't do anything. I suppose bad merge. while (seq.getDatasetSequence() != null) { seq = seq.getDatasetSequence(); } } + /* Prepare an array for annotations and copy returned annotations to it. + * Similar process happens in develop:JabawsCalcWorker#constructAnnotationFromScore. + * However, JabawsCalcWorker fills the array form the beginning, not + * the start position (start - column of the submitted region). + * Also, JabawsCalcWorker adds those annotations to an AlignmentAnnotation + * retrieved from the current alignment. */ Annotation[] resAnnot = ala.annotations, gappedAnnot = new Annotation[Math.max( alignViewport.getAlignment().getWidth(), @@ -732,6 +739,10 @@ public class SeqAnnotationServiceCalcWorker extends AlignCalcWorker gappedAnnot[ap] = resAnnot[p++]; } } + /* Annotations are set in-place on the AlignmentAnnotation object returned by the service. + * First, if #updateResultAnnotation is called again the output will be mangled + * Second, the mapping of positions to annotations held internally by + * the `ala` object is now incorrect. */ ala.sequenceRef = aseq; ala.annotations = gappedAnnot; AlignmentAnnotation newAnnot = getAlignViewport().getAlignment() @@ -740,6 +751,12 @@ public class SeqAnnotationServiceCalcWorker extends AlignCalcWorker { aseq.addAlignmentAnnotation(newAnnot); + /* adjustForAlignment is meant to move annotations to their columns + * according to the sequenceMapping. + * Since the mapping is carried from the alignment returned by the + * service it simply maps annotations to consecutive positions 1, 2, 3... + * Resulting in the annotation row being always aligned to the beginning + * of the alignment. */ newAnnot.adjustForAlignment(); AlignmentAnnotationUtils.replaceAnnotationOnAlignmentWith( -- 1.7.10.2