private final AnnotationAction action;
- private final AlignViewportI viewport;
+ private final AlignmentI alignment;
+
+ private final AnnotatedCollectionI selectionGroup;
public AnnotationTask(AnnotationWebServiceClientI client,
AnnotationAction action, List<ArgumentI> args, Credentials credentials,
super(client, args, credentials);
this.client = client;
this.action = action;
- this.viewport = viewport;
+ this.alignment = viewport.getAlignment();
+ this.selectionGroup = viewport.getSelectionGroup();
}
/**
@Override
public List<AnnotationJob> prepareJobs() throws ServiceInputInvalidException
{
- AlignmentI alignment = viewport.getAlignment();
if (alignment == null || alignment.getWidth() <= 0 ||
alignment.getSequences() == null)
throw new ServiceInputInvalidException("Alignment does not contain sequences");
throw new ServiceInputInvalidException(
action.getFullName() + " does not allow protein sequences");
boolean bySequence = !action.isAlignmentAnalysis();
- AnnotatedCollectionI inputSeqs = bySequence ? viewport.getSelectionGroup() : null;
+ AnnotatedCollectionI inputSeqs = bySequence ? selectionGroup : null;
if (inputSeqs == null || inputSeqs.getWidth() <= 0 ||
inputSeqs.getSequences() == null || inputSeqs.getSequences().size() < 1)
inputSeqs = alignment;
* visibility */
udpateCalcId(returnedAnnot);
- int graphGroup = viewport.getAlignment().getLastGraphGroup();
- shiftGraphGroup(returnedAnnot, graphGroup);
- List<AlignmentAnnotation> annotations = new ArrayList<>();
for (AlignmentAnnotation ala : returnedAnnot)
{
SequenceI aseq = null;
- if (ala.sequenceRef != null) {
+ if (ala.sequenceRef != null)
+ {
SequenceI seq = job.seqNames.get(ala.sequenceRef.getName());
aseq = seq.getRootDatasetSequence();
}
ala.sequenceRef = aseq;
Annotation[] gappedAnnots = createGappedAnnotations(ala.annotations, job.start, job.gapMap);
ala.annotations = gappedAnnots;
-
- AlignmentAnnotation newAnnot = viewport.getAlignment()
- .updateFromOrCopyAnnotation(ala);
- if (aseq != null)
- {
- aseq.addAlignmentAnnotation(newAnnot);
- newAnnot.adjustForAlignment();
- AlignmentAnnotationUtils.replaceAnnotationOnAlignmentWith(
- newAnnot, newAnnot.label, newAnnot.getCalcId());
- }
- annotations.add(newAnnot);
}
boolean hasFeatures = false;
datasetSeq.transferAnnotation(sq, mp);
}
- return new AnnotationResult(annotations, hasFeatures, featureColours, featureFilters);
+ return new AnnotationResult(returnedAnnot, hasFeatures, featureColours, featureFilters);
}
/**
}
}
- private static void shiftGraphGroup(Iterable<AlignmentAnnotation> annotations, int shift)
- {
- for (AlignmentAnnotation ala : annotations)
- {
- if (ala.graphGroup > 0)
- {
- ala.graphGroup += shift;
- }
- }
- }
-
private Annotation[] createGappedAnnotations(Annotation[] annotations, int start, boolean[] gapMap)
{
- var size = Math.max(viewport.getAlignment().getWidth(), gapMap.length);
+ var size = Math.max(alignment.getWidth(), gapMap.length);
Annotation[] gappedAnnotations = new Annotation[size];
for (int p = 0, ap = start; ap < size; ap++)
{