From 2cf151fe62bf1d49a36fa3afd4d964ee869764a5 Mon Sep 17 00:00:00 2001 From: Mateusz Warowny Date: Sat, 20 May 2023 23:57:52 +0200 Subject: [PATCH] JAL-3954 create primitive gui handler for search service --- j11lib/hmmer-client-1.0-SNAPSHOT.jar | Bin 16506 -> 16547 bytes src/jalview/ws2/actions/BaseJob.java | 2 + src/jalview/ws2/client/ebi/PhmmerWSClient.java | 16 +++- src/jalview/ws2/gui/SearchServiceGuiHandler.java | 95 ++++++++++++++++++++++ src/jalview/ws2/gui/WebServicesMenuManager.java | 7 ++ 5 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 src/jalview/ws2/gui/SearchServiceGuiHandler.java diff --git a/j11lib/hmmer-client-1.0-SNAPSHOT.jar b/j11lib/hmmer-client-1.0-SNAPSHOT.jar index 879f5b3e45002da41405e4c84d17312815b7fee7..1efea10456729913202d8039ba699fdc64af1e15 100644 GIT binary patch delta 4498 zcmV;D5pC}JfB~a{0S!<~0|W{H00;;G?{ToP4ITjl?{ToRE&=Ze1MhLLvmgsl77g!l zuvY8~?wsln008%seIY!53w%`Nl|Lsl$-NnFctk`3qC*Tg1j2xzU;+pU0Rjmi36F>m zZf0(h3zNCy%pC$gTCJ_MwpyzeZLN>i2Wqti#SoxMySugBZoBTT`*642?QZw|Z1>si z!@B?T-J6+72*@OM&CmJ1@7(j9_jk_uKK;(GPQF1z%lM5DRnuF46X^Ho_si*K`UClS zJ4Am-e-y&(k7fBMA$o`YbOJpBk|ONk5UrzlZ2Q=s$J(FOB{? zME^rS73BXFsy`EdoS%niBK<<6Uxp|`?`rg`5Y^IKIz2Aqdm2-So?#BrLN3ub5TeEO zmMnrgy&#L9>0BxpW#z1~F0*o-Lm{3Z)SqEP=L#7o>O4ut$vRJwu~O#?WSpw=g)&al z`63yo>s%${44r4nc(Km2WV}S@OUpUTy3Vs@T^-`fxJKuHIkK3m^W`!|1N4l86_>RD4B<(!50Dr8-|(Nz98Yse~IeUQtN_UInxAHS)810)3Ny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a0(tNiOSg9X60x z7th!Ra_eA>b$>?#dRoIAPJy4Jq;j{0 z@OyOismQ`A62f}!>`kRK&)``vC`#_4M3i0bIF9h%3-?05S8hd!oBS)~f zDR>-9`0--8oo*Sz(j5(z%M@^lqHL(Vl!VJ)#R@eec-b46(NNicq@W=*`^c3p@^S^` zk*i$f6$;8DSG&kH3d$o}Tx6?)^2oI=vQ0sGiiWvV=u$WW(7_GY) zY5j~l8&6|5BX$oXHjXzK)89b?KY)WDv9kOGd+}4Gq!ei}kdZma%K6wQ5e&-Z*e_S% zfb`&?+<+S;ftw_Yo8?wUxQhH$jG1}-dk##2lxh}Uz!w;QwTz>YGeF2c1BARYpvx_c z{4Y{J72UH?@e5q1p?+5GpH;I8qEzrDo)oY2{Fo<=+|jAB*1}`70Q15OW@?29Eb?>H z^=@w3*x+ZTxx={Ou!>zKnBJh9V7yNw`Gi~4F##;0A-yDVF1G=T$_yH@j@4la59d;* zi1IgIxKJxcp!JcJP3BN{vu{_6J#cyiI3KkU>k0JE2VvH`& zPr72%c!W7IDts{%bi|FHLZb}hxNnppFN2}cHOiu641eD$O+jTARmEtRhT_7NH%XNn zSOG%}b8^nf)R>d0(U(an^Q=4lj*`#4#pq!ikuB-F6@q4}~dyyuzf#iFcn^LQ* zSqb09J!R#Lj<@j?$D=$O$2fkI<8N{NJ|2`EY}0~xT5efgE%P|u%kd>SA}`a$3*7@9 zltmC}aDSJ|G6dujxm1?B^X6Z(pfauq15<{mvr#))0RvNpsI#p+AprwZhN!dAJ^cX< qQ--Kk3Zv2k!4LodT$9^BasqfVli?gAli)HNlZ`+S1{pg50001MI>MCz diff --git a/src/jalview/ws2/actions/BaseJob.java b/src/jalview/ws2/actions/BaseJob.java index 945c7b0..6a4a600 100644 --- a/src/jalview/ws2/actions/BaseJob.java +++ b/src/jalview/ws2/actions/BaseJob.java @@ -25,6 +25,7 @@ import jalview.ws2.api.WebServiceJobHandle; * * @author mmwarowny */ +// TODO: make class non-abstract by removing isInputValid() public abstract class BaseJob implements JobI { protected final long internalId = MathUtils.getUID(); @@ -70,6 +71,7 @@ public abstract class BaseJob implements JobI * * @return {@code true} if the input is valid. */ + // FIXME: method not necessary, may incorporate into task#prepare() public abstract boolean isInputValid(); /** diff --git a/src/jalview/ws2/client/ebi/PhmmerWSClient.java b/src/jalview/ws2/client/ebi/PhmmerWSClient.java index 5a51fcc..9c79644 100644 --- a/src/jalview/ws2/client/ebi/PhmmerWSClient.java +++ b/src/jalview/ws2/client/ebi/PhmmerWSClient.java @@ -2,10 +2,14 @@ package jalview.ws2.client.ebi; import java.io.IOException; import java.io.StringReader; +import java.net.URI; import java.util.List; +import jalview.datamodel.AlignmentI; import jalview.datamodel.SequenceI; +import jalview.io.DataSourceType; import jalview.io.FileFormat; +import jalview.io.FormatAdapter; import jalview.ws.params.ArgumentI; import jalview.ws.params.simple.BooleanOption; import jalview.ws.params.simple.DoubleParameter; @@ -13,13 +17,14 @@ import jalview.ws.params.simple.IntegerParameter; import jalview.ws2.api.Credentials; import jalview.ws2.api.JobStatus; import jalview.ws2.api.WebServiceJobHandle; +import jalview.ws2.client.api.AlignmentWebServiceClientI; import jalview.ws2.client.api.WebServiceClientI; import uk.ac.dundee.compbio.hmmerclient.PhmmerClient; import uk.ac.dundee.compbio.hmmerclient.PhmmerRequest; import uk.ac.dundee.compbio.hmmerclient.PhmmerRequest.SequenceDatabase; import uk.ac.dundee.compbio.hmmerclient.PhmmerRequest.SubstitutionMatrix; -public class PhmmerWSClient implements WebServiceClientI +public class PhmmerWSClient implements AlignmentWebServiceClientI { final PhmmerClient client; @@ -229,4 +234,13 @@ public class PhmmerWSClient implements WebServiceClientI "ebi job dispatcher does not support job cancellation"); } + /** + * FIXME: Temporary hack + */ + @Override + public AlignmentI getAlignment(WebServiceJobHandle job) throws IOException + { + URI url = client.getResultURL(job.getJobId(), "sto"); + return new FormatAdapter().readFile(url.toString(), DataSourceType.URL, FileFormat.Stockholm); + } } diff --git a/src/jalview/ws2/gui/SearchServiceGuiHandler.java b/src/jalview/ws2/gui/SearchServiceGuiHandler.java new file mode 100644 index 0000000..b3ae5c1 --- /dev/null +++ b/src/jalview/ws2/gui/SearchServiceGuiHandler.java @@ -0,0 +1,95 @@ +package jalview.ws2.gui; + +import java.util.List; + +import jalview.bin.Console; +import jalview.datamodel.AlignmentI; +import jalview.gui.AlignFrame; +import jalview.gui.Desktop; +import jalview.ws2.actions.api.JobI; +import jalview.ws2.actions.api.TaskEventListener; +import jalview.ws2.actions.api.TaskI; +import jalview.ws2.api.JobStatus; + +public class SearchServiceGuiHandler implements TaskEventListener +{ + private final AlignFrame parentFrame; + + public SearchServiceGuiHandler(AlignFrame parentFrame) + { + this.parentFrame = parentFrame; + } + + @Override + public void taskStarted(TaskI source, + List subJobs) + { + Console.info("task started with " + subJobs.size() + " jobs"); + // TODO Auto-generated method stub + + } + + @Override + public void taskStatusChanged(TaskI source, JobStatus status) + { + Console.info("task status " + status); + // TODO Auto-generated method stub + + } + + @Override + public void taskCompleted(TaskI source, AlignmentI result) + { + Console.info("task completed"); + displayResultsNewFrame(result); + } + + @Override + public void taskException(TaskI source, Exception e) + { + Console.info("task failed", e); + // TODO Auto-generated method stub + + } + + @Override + public void taskRestarted(TaskI source) + { + Console.info("task restarted"); + // TODO Auto-generated method stub + + } + + @Override + public void subJobStatusChanged(TaskI source, JobI job, + JobStatus status) + { + Console.info("sub-job " + job.getInternalId() + " status " + status); + // TODO Auto-generated method stub + + } + + @Override + public void subJobLogChanged(TaskI source, JobI job, + String log) + { + // TODO Auto-generated method stub + + } + + @Override + public void subJobErrorLogChanged(TaskI source, JobI job, + String log) + { + // TODO Auto-generated method stub + + } + + private void displayResultsNewFrame(AlignmentI aln) + { + AlignFrame frame = new AlignFrame(aln, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); + frame.getFeatureRenderer().transferSettings( + parentFrame.getFeatureRenderer().getSettings()); + Desktop.addInternalFrame(frame, "title", AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); + } +} diff --git a/src/jalview/ws2/gui/WebServicesMenuManager.java b/src/jalview/ws2/gui/WebServicesMenuManager.java index 8f48690..8e2dcee 100644 --- a/src/jalview/ws2/gui/WebServicesMenuManager.java +++ b/src/jalview/ws2/gui/WebServicesMenuManager.java @@ -39,6 +39,7 @@ import jalview.ws2.actions.annotation.AnnotationAction; import jalview.ws2.actions.api.ActionI; import jalview.ws2.actions.api.TaskEventListener; import jalview.ws2.actions.api.TaskI; +import jalview.ws2.actions.hmmer.PhmmerAction; import jalview.ws2.api.Credentials; import jalview.ws2.api.WebService; import jalview.ws2.client.api.WebServiceProviderI; @@ -470,6 +471,12 @@ public class WebServicesMenuManager var handler = new AnnotationServiceGuiHandler(_action, frame); return _action.perform(viewport, args, credentials, handler); } + if (action instanceof PhmmerAction) + { + var _action = (PhmmerAction) action; + var handler = new SearchServiceGuiHandler(frame); + return _action.perform(viewport, args, credentials, handler); + } Console.warn(String.format( "No known handler for action type %s. All output will be discarded.", action.getClass().getName())); -- 1.7.10.2