From 6a7ffd7997c11b84a81acbdd83e462cac76f124b Mon Sep 17 00:00:00 2001 From: Mateusz Warowny Date: Fri, 27 Sep 2019 16:58:56 +0100 Subject: [PATCH] JAL-3066 Automatically discoverable Protein sequence analysis services --- j11lib/slivka-client.jar | Bin 145051 -> 145699 bytes .../slivkaws/SlivkaAnnotationServiceInstance.java | 36 ++++++++++++-- src/jalview/ws/slivkaws/SlivkaWSDiscoverer.java | 49 ++++++++++++++++++-- 3 files changed, 77 insertions(+), 8 deletions(-) diff --git a/j11lib/slivka-client.jar b/j11lib/slivka-client.jar index c990dd83429983ab161778250d6d23fca96db845..a8e499a2fb065d8333d7805a3a726294220ccf41 100644 GIT binary patch delta 1169 zcmZ9KU1*bM6vxkV-sU^$niy*XX?+b*^VPhmP1U$nJ9G$x4TnW0ND;RoyIR@Ko3J$Qy?EYpe&>14 z`9J48$6uJg`P1y^>QE}&U^bhfsxNugaq4E};ojty><-Uqw-vx`m0C1FlaED}T)JtY z-`j;zL}cbw@{lu1^ zt+WWp^t}U~2%o73A4DMt8YCbFEzkgIXp{^0+CS|F#rrB2bp9)<7*9B;} z0*Ri`MQEOd3Z7VI4`<(FV1^w^fV9ppGx3ZweooP8{98@0=0foRQv&h{70ba{T@hwV8$I{OEj5g-=zjsyaH>yL+%tEo-{E zJQ(@MWiQ!nVvXGWV9Jmm+mln}!WZtEve^ZKt(-+wKhf9E0}p2d55=af3O|V1VIMA< z{`VxPKZM)V*98Lizx;E~%dI#3`opo2DU4BcJ<@@kcx0!6FvjrbUrT=Mm@v=}VGLpD zS>e<~1Re6_Qv<~!3_mkbMngX_ZN($2i%zN@t+W_H4KY|EEqFGnJ8P#Vg@sPmbM(jf zf51VuC};aSQ2?aA5H89^aUJ?LmWYLJM_KD+N+)d;(>TMoZ|lwwF1$nY8aAP4v+nz4 z>Pb$;@F~0eJLnBDT4HI90SVpzXUlA*j%dVq*rmQQ!XRw yJoVKv9>I=LQZB6k)%Ul5KT&Gh=>^` zU0y8q!-6gpMKATx#Ruyl2<=7349mAJmPK?SjhLVdN&9GCqO&>dwZ65^zt_Ld)vwa| z&ypotm7=qOBuOwFS8rRc4_Fch)arYe9{!Sz05VNauu}eez^L1A0OSw8D}AMdN-FcBiJAf>>|nl2V}w;Sjo2xA7WYDo3Qi5u$!%!jiiK|<%y_* zxp_;X$5ANyiy#+@!2>b`L4h!Mp#pq7eI()pKxovaGyzBehK7&ZYvXNCtaP!o!j5Jk*HO~K}VChphLdTL! zq26MY@$?wQ`dEmbxzNntzO!sprk_%yd`AwfIv zcTstm8R*vZyv~eQd~mL8Nv*e+=_y(whLJXCxPZQFW|`!y6ZpP{-J2G07I}Pv?2gbb zABOO3M62ZU@-j1xhB1Sl`hQY6t)sJb|7Mm62&6yItP{o`# zH0o-cJL;7m*W=FkLSmt4K-|r~!*j~@dCTZ#00Zdk{0HdC5fp9hJ+v(-s)Hx!Xb_{= zeUiq4*onobXh#S;FzpOI4q;77EXnAiiYouBmq8t>nBNCa=|$z4r@eaUWW# pJuGGnnl&7rHyy~CT7}Tu6qnoL2cuQ`RPE1)#B$pJ_U59<{s3`6?tuUR diff --git a/src/jalview/ws/slivkaws/SlivkaAnnotationServiceInstance.java b/src/jalview/ws/slivkaws/SlivkaAnnotationServiceInstance.java index 4fb35a0..184ca2d 100644 --- a/src/jalview/ws/slivkaws/SlivkaAnnotationServiceInstance.java +++ b/src/jalview/ws/slivkaws/SlivkaAnnotationServiceInstance.java @@ -1,16 +1,23 @@ package jalview.ws.slivkaws; import jalview.api.FeatureColourI; +import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.SequenceI; import jalview.datamodel.features.FeatureMatcherSetI; +import jalview.io.AnnotationFile; import jalview.ws.api.JobId; import jalview.ws.api.SequenceAnnotationServiceI; import jalview.ws.params.ArgumentI; import jalview.ws.params.WsParamSetI; +import java.io.BufferedReader; import java.io.ByteArrayInputStream; +import java.io.IOError; +import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -25,7 +32,7 @@ public class SlivkaAnnotationServiceInstance extends SlivkaWSInstance implements { public SlivkaAnnotationServiceInstance(SlivkaClient client, SlivkaService service) { - super(client, service, "Annotations"); + super(client, service, "Annotations disorder"); } @Override @@ -71,7 +78,30 @@ public class SlivkaAnnotationServiceInstance extends SlivkaWSInstance implements List seqs, Map featureColours, Map featureFilters) throws Throwable { - // TODO Auto-generated method stub - return null; + RemoteFile annotFile = null; + RemoteFile featFile = null; + try + { + List files = client.getJobResults(job.getJobId()); + for (RemoteFile f : files) + { + if (f.getMimeType().equals("application/jalview-annotations")) + { + annotFile = f; + } + else if (f.getMimeType().equals("application/jalview-features")) + { + featFile = f; + } + } + } catch (IOException e) + { + throw new IOError(e); + } + Alignment aln = new Alignment(seqs.toArray(new SequenceI[0])); + BufferedReader in = new BufferedReader(new InputStreamReader(annotFile.getContent())); + AnnotationFile f = new AnnotationFile(); + f.parseAnnotationFrom(aln, null, in); + return Arrays.asList(aln.getAlignmentAnnotation()); } } diff --git a/src/jalview/ws/slivkaws/SlivkaWSDiscoverer.java b/src/jalview/ws/slivkaws/SlivkaWSDiscoverer.java index e9d0d53..6b3856a 100644 --- a/src/jalview/ws/slivkaws/SlivkaWSDiscoverer.java +++ b/src/jalview/ws/slivkaws/SlivkaWSDiscoverer.java @@ -4,6 +4,7 @@ import jalview.datamodel.AlignmentView; import jalview.gui.AlignFrame; import jalview.ws.WSMenuEntryProviderI; import jalview.ws.jws2.MsaWSClient; +import jalview.ws.jws2.SequenceAnnotationWSClient; import java.awt.event.ActionEvent; import java.io.IOError; @@ -47,9 +48,9 @@ public class SlivkaWSDiscoverer implements Runnable, WSMenuEntryProviderI { JMenu slivkaMenu = new JMenu("Slivka"); wsmenu.add(slivkaMenu); - JMenu categoryMenu = new JMenu("Alignment"); - slivkaMenu.add(categoryMenu); + JMenu alignmentMenu = new JMenu("Sequence Alignment"); + slivkaMenu.add(alignmentMenu); try { for (SlivkaService service : client.getServices()) @@ -75,7 +76,7 @@ public class SlivkaWSDiscoverer implements Runnable, WSMenuEntryProviderI alignFrame.getViewport().getAlignment().getDataset(), alignFrame); } }); - categoryMenu.add(defaultEntry); + alignmentMenu.add(defaultEntry); JMenuItem customEntry = new JMenuItem(String.format("%s with custom parameters", service.label)); customEntry.addActionListener((ActionEvent evt) -> { @@ -93,15 +94,53 @@ public class SlivkaWSDiscoverer implements Runnable, WSMenuEntryProviderI } } }); - categoryMenu.add(customEntry); + alignmentMenu.add(customEntry); - categoryMenu.addSeparator(); + alignmentMenu.addSeparator(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } + + JMenu disorderMenu = new JMenu("Protein sequence analysis"); + slivkaMenu.add(disorderMenu); + try + { + for (SlivkaService service : client.getServices()) + { + msaClassifier: + { + for (String classifier : service.classifiers) + { + if (classifier.contains("Protein sequence analysis")) + { + break msaClassifier; + } + } + continue; + } + JMenuItem menuEntry = new JMenuItem(String.format("%s with custom parameters", service.label)); + disorderMenu.add(menuEntry); + SlivkaAnnotationServiceInstance serviceInstance = new SlivkaAnnotationServiceInstance(client, service); + menuEntry.addActionListener((ActionEvent evt) -> { + try + { + SlivkaParamSet paramSet = new SlivkaParamSet(service); + SequenceAnnotationWSClient client = new SequenceAnnotationWSClient(); + client.initSequenceAnnotationWSClient(serviceInstance, alignFrame, paramSet, true); + } catch (IOException e) + { + throw new IOError(e); + } + + }); + } + } catch (IOException e) + { + throw new IOError(e); + } } @Override -- 1.7.10.2