this.viewport = viewport;
}
- // public void start(AlignCalcManagerI2 calcManager)
- // {
- // if (this.worker != null)
- // throw new IllegalStateException("task already started");
- // this.worker = new AlignCalcWorkerAdapter(calcManager);
- // if (taskStatus != JobStatus.CANCELLED)
- // {
- // List<AlignCalcWorkerI> oldWorkers = calcManager.getWorkersOfClass(
- // AlignCalcWorkerAdapter.class);
- // for (var worker : oldWorkers)
- // {
- // if (action.getWebService().getName().equalsIgnoreCase(
- // ((AlignCalcWorkerAdapter) worker).getServiceName()))
- // {
- // // remove interactive workers for the same service.
- // calcManager.removeWorker(worker);
- // calcManager.cancelWorker(worker);
- // }
- // }
- // if (action.getWebService().isInteractive())
- // calcManager.registerWorker(worker);
- // else
- // calcManager.startWorker(worker);
- // }
- // }
-
/**
* Create and return a list of annotation jobs from the current state of the
* viewport. Returned job are not started by this method and should be stored
* visibility */
udpateCalcId(returnedAnnot);
- int graphGroup = getNextGraphGroup(viewport.getAlignment());
+ int graphGroup = viewport.getAlignment().getLastGraphGroup();
shiftGraphGroup(returnedAnnot, graphGroup);
List<AlignmentAnnotation> annotations = new ArrayList<>();
for (AlignmentAnnotation ala : returnedAnnot)
{
- SequenceI seq = job.seqNames.get(ala.sequenceRef.getName());
- SequenceI aseq = getRootDatasetSequence(seq);
- Annotation[] gappedAnnots = createGappedAnnotations(ala.annotations, job.start, job.gapMap);
+ SequenceI aseq = 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) // I suspect it's always true
+ if (aseq != null)
{
aseq.addAlignmentAnnotation(newAnnot);
newAnnot.adjustForAlignment();
continue;
hasFeatures = true;
SequenceI seq = job.seqNames.get(sq.getName());
- SequenceI datasetSeq = getRootDatasetSequence(seq);
+ SequenceI datasetSeq = seq.getRootDatasetSequence();
List<ContiguousI> sourceRange = findContiguousRanges(datasetSeq, job.gapMap, job.start, job.end);
int[] sourceStartEnd = ContiguousI.toStartEndArray(sourceRange);
Mapping mp = new Mapping(new MapList(
}
}
- 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<AlignmentAnnotation> annotations, int shift)
{
for (AlignmentAnnotation ala : annotations)
}
}
- 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);