package jalview.ws2;
import java.io.IOException;
+import java.util.List;
+
+import jalview.api.AlignViewportI;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
@FunctionalInterface
public interface ResultSupplier<T>
{
- public T getResult(WSJob job) throws IOException;
+ public T getResult(WSJob job, List<SequenceI> dataset, AlignViewportI viewport) throws IOException;
}
private final AlignmentI dataset;
+ private final AlignViewport viewport;
+
private final List<AlignedCodonFrame> codonFrame = new ArrayList<>();
private List<ArgumentI> args = Collections.emptyList();
this.alnTitle = alnTitle;
this.submitGaps = submitGaps;
this.preserveOrder = preserveOrder;
+ this.viewport = viewport;
this.gapCharacter = viewport.getGapCharacter();
String panelInfo = String.format("%s using service hosted at %s%n%s",
continue;
try
{
- AlignmentI alignment = supplier.getResult(job);
+ AlignmentI alignment = supplier.getResult(job, dataset.getSequences(), viewport);
if (alignment != null)
{
results.put(job.getUid(), alignment);
import java.util.List;
import java.util.Set;
+import jalview.api.AlignViewportI;
import jalview.bin.Cache;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceI;
import jalview.io.AnnotationFile;
return false;
}
- public AlignmentI getAlignment(WSJob job) throws IOException
+ public AlignmentI getAlignment(WSJob job, List<SequenceI> dataset,
+ AlignViewportI viewport) throws IOException
{
Collection<RemoteFile> files;
var slivkaJob = client.getJob(job.getJobId());
return null;
}
- public FeaturesFile getFeaturesFile(WSJob job) throws IOException
+ public FeaturesFile getFeaturesFile(WSJob job,
+ List<SequenceI> dataset, AlignViewportI viewport) throws IOException
{
var slivkaJob = client.getJob(job.getJobId());
Collection<RemoteFile> files = slivkaJob.getResults();
return null;
}
- public AnnotationFile getAnnotationFile(WSJob job) throws IOException
+ public List<AlignmentAnnotation> getAnnotationFile(WSJob job,
+ List<SequenceI> dataset, AlignViewportI viewport) throws IOException
{
var slivkaJob = client.getJob(job.getJobId());
Collection<RemoteFile> files = slivkaJob.getResults();
{
if (f.getMediaType().equals("application/jalview-annotations"))
{
- // return new AnnorationFile(...);
+ Alignment aln = new Alignment(dataset.toArray(new SequenceI[0]));
+ AnnotationFile af = new AnnotationFile();
+ boolean valid = af.readAnnotationFileWithCalcId(aln, service.getId(),
+ f.getContentUrl().toString(), DataSourceType.URL);
+ if (valid)
+ {
+ return Arrays.asList(aln.getAlignmentAnnotation());
+ }
+ else
+ {
+ throw new IOException("Unable to read annotations from file " +
+ f.getContentUrl().toString());
+ }
}
}
return null;