From c2bf9f8908abdf8e3604800b20e443f5bc73393b Mon Sep 17 00:00:00 2001 From: Mateusz Warowny Date: Thu, 5 Oct 2023 15:10:21 +0200 Subject: [PATCH] JAL-1601 Implement JPred4 client and discoverer --- j11lib/jpred-client-1.0-SNAPSHOT.jar | Bin 0 -> 13237 bytes src/jalview/ws2/client/jpred4/JPred4WSClient.java | 115 ++++++++++++++++++++ .../ws2/client/jpred4/JPred4WSDiscoverer.java | 97 +++++++++++++++++ 3 files changed, 212 insertions(+) create mode 100644 j11lib/jpred-client-1.0-SNAPSHOT.jar create mode 100644 src/jalview/ws2/client/jpred4/JPred4WSClient.java create mode 100644 src/jalview/ws2/client/jpred4/JPred4WSDiscoverer.java diff --git a/j11lib/jpred-client-1.0-SNAPSHOT.jar b/j11lib/jpred-client-1.0-SNAPSHOT.jar new file mode 100644 index 0000000000000000000000000000000000000000..826f02835ba8ff8dd8220b1c18ba8aae7a22dfd3 GIT binary patch literal 13237 zcmb8W1yo(hwl$2qyA#|Uf(8xl?(XjH?(PsExVuXT?sjkq5Znpw@{!klZ>RI_-|zl4 z#@VL^W39RB)ShLlCUTOXU@$;HP*6bjCS0mOZw2J%NGUdUEG=L>R*`(}Xs_CfpAP+CAnTtrw=iC$XdQhIDuN|KHq053^LJux;}ufRCV@_lD> z2jn-fH~)V}1%0bKTmG+jznVb&VWMyNk5=&iwlZ?IF)}v(M`QHgjSX$B?F`Iq|K{|2 z2mSp0Z%ut`$Da}YsvS2_h#F8<*gf>> zISHi=Ts_D*3@gRdCw_bXO%O6L2`E;Esg3|}aB*-~>{;QNZ585j%*c+C?*xJD>CFxv z;@!l7o@6;2a1tF>Ml9b9%-F^RTN@^v@6oi@=5vlR;uowYS(zLXm^!r909OquRGHWl zjZVC(V)BbF-J96f=Fz7|PwMHIlAw7Y=N+;}$|3O~=}j`5)cyGRHSY;c^Nf_id zOcS9RU_`dzvNlrOpD4aQF0#QU)@3VgznZ0FW~Eh|cZMdaS^tg+D2%Z%4kmVOK3BBj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@-SE&-C z85&``h8W2Y^XKe|?BjhWNl>}(T9cSlSUuz=uX}^bYJH2^ph`84I-aGFWyV{WQ`!+W z+R(*0TN9w%!$q)(tdDUy%aPOc8pgZ?mlb@qy?&Skc(nYSn?SCWXA+@2tRqgMOpB^A zM1z#4^{$qB%rw&XjYhyAXrTY!%JMfZy%i*&6M>)K|JIrR>h_;>=0A;pmI8mOx97jz zeo>wOj_}j^ZL0a7@>5*?M?nI57I1m1zUjCB$>FEe{Eza}A^olThv564e0~bg|0q9w zzP?reCKCTA*Pk-qsn{}tjtiPHaqAbK0R{}JL3iTbZV|4E|$XJddG z{I&iW=-09T$Cl)G=-)-We?cd|-3b0e8~>N2_jlyqm6LxVd%P*_{{i{eM*m$$`Fn`p z^(TLYNJaSXL;R{n`8C3Sk_G$~!2tRHj_~Jh@K=$*uK|9(+TZVA{|cb-_Wv9IZ7=yCO#0_~^lPjC(`Mu^Y(wgQ#QtS# o@;m15OXgpg$ZzWP|F)<9-C*$lnS+plkby+s&IW2f4+lX152o~2r2qf` literal 0 HcmV?d00001 diff --git a/src/jalview/ws2/client/jpred4/JPred4WSClient.java b/src/jalview/ws2/client/jpred4/JPred4WSClient.java new file mode 100644 index 0000000..36cc6c2 --- /dev/null +++ b/src/jalview/ws2/client/jpred4/JPred4WSClient.java @@ -0,0 +1,115 @@ +package jalview.ws2.client.jpred4; + +import java.io.IOException; +import java.util.List; + +import jalview.datamodel.SequenceI; +import jalview.io.AlignFile; +import jalview.io.DataSourceType; +import jalview.io.FastaFile; +import jalview.io.FileFormat; +import jalview.io.FormatAdapter; +import jalview.io.JPredFile; +import jalview.ws.params.ArgumentI; +import jalview.ws2.api.Credentials; +import jalview.ws2.api.JobStatus; +import jalview.ws2.api.WebServiceJobHandle; +import jalview.ws2.client.api.SecStructPredWebServiceClientI; +import uk.ac.dundee.compbio.jpred.JPredClient; +import uk.ac.dundee.compbio.jpred.JPredRequest; +import uk.ac.dundee.compbio.jpred.ResultTypes; + +public class JPred4WSClient implements SecStructPredWebServiceClientI +{ + final JPredClient client; + + JPred4WSClient(JPredClient client) + { + this.client = client; + } + + @Override + public String getUrl() + { + return client.getURL().toString(); + } + + @Override + public String getClientName() + { + return "jpred4"; + } + + @Override + public WebServiceJobHandle submit(List sequences, + List args, Credentials credentials) throws IOException + { + var input = FileFormat.Fasta + .getWriter(null) + .print(sequences.toArray(SequenceI[]::new), false); + JPredRequest request = JPredRequest + .newBuilder() + .mode(JPredRequest.Mode.MSA) + .format(JPredRequest.Format.FASTA) + .input(input) + .build(); + var jobId = client.submit(request); + return new WebServiceJobHandle(getClientName(), "jpred4", getUrl(), jobId); + } + + @Override + public JobStatus getStatus(WebServiceJobHandle job) throws IOException + { + var status = client.getStatus(job.getJobId()); + switch (status) + { + case RUNNING: + return JobStatus.RUNNING; + case FINISHED: + return JobStatus.COMPLETED; + case NO_JOB: + return JobStatus.SERVER_ERROR; + case MALFORMED: + return JobStatus.INVALID; + case NOT_EXIST: + return JobStatus.SERVER_ERROR; + default: + return JobStatus.UNKNOWN; + } + } + + @Override + public String getLog(WebServiceJobHandle job) throws IOException + { + var stream = client.getResultStream(job.getJobId(), ResultTypes.LOG); + // FIXME: potential OOM + return new String(stream.readAllBytes()); + } + + @Override + public String getErrorLog(WebServiceJobHandle job) throws IOException + { + return ""; + } + + @Override + 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 + { + var url = client.getResultURL(job.getJobId(), ResultTypes.CONCISE); + return new JPredFile(url.toString(), DataSourceType.URL); + } +} diff --git a/src/jalview/ws2/client/jpred4/JPred4WSDiscoverer.java b/src/jalview/ws2/client/jpred4/JPred4WSDiscoverer.java new file mode 100644 index 0000000..99c3f28 --- /dev/null +++ b/src/jalview/ws2/client/jpred4/JPred4WSDiscoverer.java @@ -0,0 +1,97 @@ +package jalview.ws2.client.jpred4; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Collections; +import java.util.List; + +import jalview.ws.params.ArgumentI; +import jalview.ws.params.ParamManager; +import jalview.ws2.actions.secstructpred.SecStructPredAction; +import jalview.ws2.api.WebService; +import jalview.ws2.client.api.AbstractWebServiceDiscoverer; +import jalview.ws2.client.ebi.JobDispatcherWSDiscoverer; +import jalview.ws2.params.SimpleParamDatastore; +import uk.ac.dundee.compbio.jpred.JPredClient; + +public class JPred4WSDiscoverer extends AbstractWebServiceDiscoverer +{ + private static final URL DEFAULT_URL; + static + { + try + { + DEFAULT_URL = new URL("https://www.compbio.dundee.ac.uk/jpred4/"); + } catch (MalformedURLException e) + { + throw new ExceptionInInitializerError(e); + } + } + + private static JPred4WSDiscoverer instance = null; + + private static ParamManager paramManager = null; + + private JPred4WSDiscoverer() + { + } + + public static JPred4WSDiscoverer getInstance() + { + if (instance == null) + instance = new JPred4WSDiscoverer(); + return instance; + } + + public static void setParamManager(ParamManager manager) + { + paramManager = manager; + } + + @Override + public int getStatusForUrl(URL url) + { + // TODO: implement actual status check + return STATUS_OK; + } + + @Override + public String getUrlsPropertyKey() + { + return null; + } + + @Override + protected URL getDefaultUrl() + { + return DEFAULT_URL; + } + + @Override + protected List> fetchServices(URL url) throws IOException + { + JPredClient client = new JPredClient(url); + var wsBuilder = WebService. newBuilder(); + wsBuilder.url(url); + wsBuilder.clientName("jpred4"); + wsBuilder.category("Secondary structure prediction"); + wsBuilder.name("jpred4"); + wsBuilder.description("JPred4 Secondary Structure Prediction."); + wsBuilder.interactive(false); + + wsBuilder + .paramDatastore(new SimpleParamDatastore(url, Collections.emptyList(), + Collections.emptyList(), paramManager)); + wsBuilder.actionClass(SecStructPredAction.class); + var webService = wsBuilder.build(); + + var wsClient = new JPred4WSClient(client); + var actionBuilder = SecStructPredAction.newBuilder(wsClient); + actionBuilder.webService(webService); + actionBuilder.name(""); + webService.addAction(actionBuilder.build()); + + return List.of(webService); + } +} -- 1.7.10.2