{
final JPredClient client;
- JPred4WSClient(JPredClient client)
+ private final JPredRequest.Mode mode;
+
+ private final JPredRequest.Format format;
+
+ JPred4WSClient(JPredClient client, boolean msaMode)
{
+ this.mode = msaMode ? JPredRequest.Mode.MSA : JPredRequest.Mode.SINGLE;
+ this.format = msaMode ? JPredRequest.Format.FASTA : JPredRequest.Format.SEQ;
this.client = client;
}
public WebServiceJobHandle submit(List<SequenceI> sequences,
List<ArgumentI> args, Credentials credentials) throws IOException
{
- var input = FileFormat.Fasta
- .getWriter(null)
- .print(sequences.toArray(SequenceI[]::new), false);
+ var input = mode == JPredRequest.Mode.MSA
+ ? FileFormat.Fasta
+ .getWriter(null)
+ .print(sequences.toArray(SequenceI[]::new), false)
+ : sequences.get(0).getSequenceAsString();
+
JPredRequest request = JPredRequest
.newBuilder()
- .mode(JPredRequest.Mode.MSA)
- .format(JPredRequest.Format.FASTA)
+ .mode(mode)
+ .format(format)
.input(input)
.build();
var jobId = client.submit(request);
var status = client.getStatus(job.getJobId());
switch (status)
{
+ case PENDING:
+ return JobStatus.QUEUED;
case RUNNING:
return JobStatus.RUNNING;
case FINISHED:
public void cancel(WebServiceJobHandle job)
throws IOException, UnsupportedOperationException
{
-
+
}
-
+
@Override
public AlignFile getAlignmentFile(WebServiceJobHandle job) throws IOException
{
var url = client.getResultURL(job.getJobId(), ResultTypes.PSIBLAST_ALIGN);
return new FastaFile(url.toString(), DataSourceType.URL);
}
-
+
@Override
public JPredFile getPredictionFile(WebServiceJobHandle job) throws IOException
{
wsBuilder.actionClass(SecStructPredAction.class);
var webService = wsBuilder.build();
- var wsClient = new JPred4WSClient(client);
- var actionBuilder = SecStructPredAction.newBuilder(wsClient);
+ var actionBuilder = SecStructPredAction.newBuilder(
+ new JPred4WSClient(client, false));
actionBuilder.webService(webService);
- actionBuilder.name("");
+ actionBuilder.name("JPred4");
webService.addAction(actionBuilder.build());
+
+ var actionBuilderMsa = SecStructPredAction.newBuilder(
+ new JPred4WSClient(client, true));
+ actionBuilderMsa.webService(webService);
+ actionBuilderMsa.name("JPred4 (MSA)");
+ webService.addAction(actionBuilderMsa.build());
return List.of(webService);
}