--- /dev/null
+package jalview.ws.slivkaws;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.SequenceI;
+import jalview.ws.api.JobId;
+import jalview.ws.api.SequenceAnnotationServiceI;
+import jalview.ws.gui.AnnotationWsJob;
+import jalview.ws.jws2.SeqAnnotationServiceCalcWorker;
+import jalview.ws.params.ArgumentI;
+import jalview.ws.params.WsParamSetI;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+
+import uk.ac.dundee.compbio.slivkaclient.FormField;
+import uk.ac.dundee.compbio.slivkaclient.RemoteFile;
+import uk.ac.dundee.compbio.slivkaclient.SlivkaClient;
+import uk.ac.dundee.compbio.slivkaclient.SlivkaForm;
+import uk.ac.dundee.compbio.slivkaclient.SlivkaService;
+
+public class SlivkaAnnotationServiceInstance extends SlivkaWSInstance implements SequenceAnnotationServiceI
+{
+ public SlivkaAnnotationServiceInstance(SlivkaClient client, SlivkaService service)
+ {
+ super(client, service, "Annotations");
+ }
+
+ @Override
+ public JobId submitToService(List<SequenceI> seqs, WsParamSetI preset, List<ArgumentI> paramset) throws Throwable
+ {
+ StringBuilder builder = new StringBuilder();
+ for (SequenceI seq : seqs)
+ {
+ builder.append(">").append(seq.getName()).append("\n");
+ builder.append(seq.getSequence()).append("\n");
+ }
+ InputStream stream = new ByteArrayInputStream(builder.toString().getBytes());
+ RemoteFile file = client.uploadFile(stream, "input.fasta", "application/fasta");
+ SlivkaForm form = service.getForm();
+ HashMap<String, String> values = new HashMap<>(paramset != null ? paramset.size() : 0);
+ if (paramset != null)
+ {
+ for (ArgumentI arg : paramset)
+ {
+ values.put(arg.getName(), arg.getValue());
+ }
+ }
+ for (FormField field : form.getFields())
+ {
+ switch (field.getType())
+ {
+ case FILE:
+ form.insert(field.getName(), file);
+ break;
+ case BOOLEAN:
+ String value = values.get(field.getName());
+ form.insert(field.getName(), value != null && !value.isBlank() ? true : false);
+ break;
+ default:
+ form.insert(field.getName(), field.valueOf(values.get(field.getName())));
+ }
+ }
+ return new JobId(service.getName(), service.getName(), form.submit());
+ }
+
+ @Override
+ public List<AlignmentAnnotation> getAlignmentAnnotation(AnnotationWsJob running,
+ SeqAnnotationServiceCalcWorker abstractJabaCalcWorker) throws Throwable
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}