From c77528425d73a130247ceca7529f6688833b1f8a Mon Sep 17 00:00:00 2001 From: Mateusz Warowny Date: Thu, 6 Jul 2023 15:54:34 +0200 Subject: [PATCH] JAL-4199 Remove utility methods moved to other classes from AnnotationTask --- .../ws2/actions/annotation/AnnotationTask.java | 25 +++----------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/src/jalview/ws2/actions/annotation/AnnotationTask.java b/src/jalview/ws2/actions/annotation/AnnotationTask.java index 238439a..ed67643 100644 --- a/src/jalview/ws2/actions/annotation/AnnotationTask.java +++ b/src/jalview/ws2/actions/annotation/AnnotationTask.java @@ -150,13 +150,13 @@ public class AnnotationTask extends BaseTask * visibility */ udpateCalcId(returnedAnnot); - int graphGroup = getNextGraphGroup(viewport.getAlignment()); + int graphGroup = viewport.getAlignment().getLastGraphGroup(); shiftGraphGroup(returnedAnnot, graphGroup); List annotations = new ArrayList<>(); for (AlignmentAnnotation ala : returnedAnnot) { SequenceI seq = job.seqNames.get(ala.sequenceRef.getName()); - SequenceI aseq = getRootDatasetSequence(seq); + SequenceI aseq = seq.getRootDatasetSequence(); Annotation[] gappedAnnots = createGappedAnnotations(ala.annotations, job.start, job.gapMap); ala.sequenceRef = aseq; ala.annotations = gappedAnnots; @@ -180,7 +180,7 @@ public class AnnotationTask extends BaseTask continue; hasFeatures = true; SequenceI seq = job.seqNames.get(sq.getName()); - SequenceI datasetSeq = getRootDatasetSequence(seq); + SequenceI datasetSeq = seq.getRootDatasetSequence(); List sourceRange = findContiguousRanges(datasetSeq, job.gapMap, job.start, job.end); int[] sourceStartEnd = ContiguousI.toStartEndArray(sourceRange); Mapping mp = new Mapping(new MapList( @@ -208,16 +208,6 @@ public class AnnotationTask extends BaseTask } } - private static int getNextGraphGroup(AlignmentI alignment) - { - if (alignment == null || alignment.getAlignmentAnnotation() == null) - return 1; - int graphGroup = 1; - for (AlignmentAnnotation ala : alignment.getAlignmentAnnotation()) - graphGroup = Math.max(graphGroup, ala.graphGroup); - return graphGroup; - } - private static void shiftGraphGroup(Iterable annotations, int shift) { for (AlignmentAnnotation ala : annotations) @@ -229,15 +219,6 @@ public class AnnotationTask extends BaseTask } } - private static SequenceI getRootDatasetSequence(SequenceI sequence) - { - while (sequence.getDatasetSequence() != null) - { - sequence = sequence.getDatasetSequence(); - } - return sequence; - } - private Annotation[] createGappedAnnotations(Annotation[] annotations, int start, boolean[] gapMap) { var size = Math.max(viewport.getAlignment().getWidth(), gapMap.length); -- 1.7.10.2