From 6e6734420cf5c85cc4d2b0b2730142b0dd8431a5 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 2 Oct 2019 15:19:41 +0100 Subject: [PATCH] JAL-3070 JAL-3062 tidy up slivka ws menu builder and add in AACons style service UI --- .../slivkaws/SlivkaAnnotationServiceInstance.java | 18 ++++- src/jalview/ws/slivkaws/SlivkaWSDiscoverer.java | 83 +++++++++++--------- 2 files changed, 62 insertions(+), 39 deletions(-) diff --git a/src/jalview/ws/slivkaws/SlivkaAnnotationServiceInstance.java b/src/jalview/ws/slivkaws/SlivkaAnnotationServiceInstance.java index 4aaae6a..80e44ec 100644 --- a/src/jalview/ws/slivkaws/SlivkaAnnotationServiceInstance.java +++ b/src/jalview/ws/slivkaws/SlivkaAnnotationServiceInstance.java @@ -8,10 +8,12 @@ import jalview.datamodel.features.FeatureMatcherSetI; import jalview.io.AnnotationFile; import jalview.io.DataSourceType; import jalview.io.FeaturesFile; +import jalview.util.MessageManager; import jalview.ws.api.JobId; import jalview.ws.api.SequenceAnnotationServiceI; import jalview.ws.params.ArgumentI; import jalview.ws.params.WsParamSetI; +import jalview.ws.uimodel.AlignAnalysisUIText; import java.io.BufferedReader; import java.io.ByteArrayInputStream; @@ -32,9 +34,21 @@ import uk.ac.dundee.compbio.slivkaclient.SlivkaService; public class SlivkaAnnotationServiceInstance extends SlivkaWSInstance implements SequenceAnnotationServiceI { - public SlivkaAnnotationServiceInstance(SlivkaClient client, SlivkaService service) + public SlivkaAnnotationServiceInstance(SlivkaClient client, + SlivkaService service, boolean conservation) { - super(client, service, "Annotations disorder"); + super(client, service, !conservation ? "Annotations disorder" + : "Alignment Conservation"); + if (conservation) + { + setAlignAnalysisUI(new AlignAnalysisUIText(getServiceType(), + SlivkaAnnotationServiceInstance.class, + "Slivka.AACons", false, true, true, true, true, 2, + MessageManager.getString("label.aacon_calculations"), + MessageManager.getString("tooltip.aacon_calculations"), + MessageManager.getString("label.aacon_settings"), + MessageManager.getString("tooltip.aacon_settings"))); + } } @Override diff --git a/src/jalview/ws/slivkaws/SlivkaWSDiscoverer.java b/src/jalview/ws/slivkaws/SlivkaWSDiscoverer.java index 56f7b9f..993d8ed8 100644 --- a/src/jalview/ws/slivkaws/SlivkaWSDiscoverer.java +++ b/src/jalview/ws/slivkaws/SlivkaWSDiscoverer.java @@ -40,6 +40,36 @@ public class SlivkaWSDiscoverer implements Runnable, WSMenuEntryProviderI return instance; } + private void addMsaServiceClient(JMenu alignmentMenu, + SlivkaService service, AlignFrame alignFrame) + { + SlivkaMsaServiceInstance instance = new SlivkaMsaServiceInstance( + slivkaClient, service); + MsaWSClient client = new MsaWSClient(); + client.attachWSMenuEntry(alignmentMenu, instance, alignFrame); + alignmentMenu.addSeparator(); + } + + private void addDisorderServiceClient(JMenu disorderMenu, + SlivkaService service, AlignFrame alignFrame) + { + SlivkaAnnotationServiceInstance serviceInstance = new SlivkaAnnotationServiceInstance( + slivkaClient, service, false); + SequenceAnnotationWSClient client = new SequenceAnnotationWSClient(); + client.attachWSMenuEntry(disorderMenu, serviceInstance, alignFrame); + disorderMenu.addSeparator(); + } + + private void addConservationServiceClient(JMenu conservationMenu, + SlivkaService service, AlignFrame alignFrame) + { + SlivkaAnnotationServiceInstance serviceInstance = new SlivkaAnnotationServiceInstance( + slivkaClient, service, true); + SequenceAnnotationWSClient client = new SequenceAnnotationWSClient(); + client.attachWSMenuEntry(conservationMenu, serviceInstance, alignFrame); + conservationMenu.addSeparator(); + } + @Override public void attachWSMenuEntry(JMenu wsmenu, final AlignFrame alignFrame) { @@ -48,53 +78,32 @@ public class SlivkaWSDiscoverer implements Runnable, WSMenuEntryProviderI JMenu alignmentMenu = new JMenu("Sequence Alignment"); slivkaMenu.add(alignmentMenu); - try - { - for (SlivkaService service : slivkaClient.getServices()) - { - msaClassifier: - { - for (String classifier : service.classifiers) - { - if (classifier.contains("Multiple sequence alignment")) - { - break msaClassifier; - } - } - continue; - } - SlivkaMsaServiceInstance instance = new SlivkaMsaServiceInstance(slivkaClient, service); - MsaWSClient client = new MsaWSClient(); - client.attachWSMenuEntry(alignmentMenu, instance, alignFrame); - alignmentMenu.addSeparator(); - } - } catch (IOException e) - { - // TODO Auto-generated catch block - e.printStackTrace(); - } - JMenu disorderMenu = new JMenu("Protein sequence analysis"); slivkaMenu.add(disorderMenu); + JMenu conservationMenu = new JMenu("Conservation"); + slivkaMenu.add(conservationMenu); try { for (SlivkaService service : slivkaClient.getServices()) { - msaClassifier: + for (String classifier : service.classifiers) { - for (String classifier : service.classifiers) + if (classifier.contains("Multiple sequence alignment")) + { + addMsaServiceClient(alignmentMenu, service, alignFrame); + } + else if (classifier.contains("Protein sequence analysis")) { - if (classifier.contains("Protein sequence analysis")) - { - break msaClassifier; - } + addDisorderServiceClient(disorderMenu, service, alignFrame); } - continue; + else if (classifier + .contains("Sequence alignment analysis (conservation)")) + { + addConservationServiceClient(conservationMenu, service, + alignFrame); + } + } - SlivkaAnnotationServiceInstance serviceInstance = new SlivkaAnnotationServiceInstance(slivkaClient, service); - SequenceAnnotationWSClient client = new SequenceAnnotationWSClient(); - client.attachWSMenuEntry(disorderMenu, serviceInstance, alignFrame); - disorderMenu.addSeparator(); } } catch (IOException e) { -- 1.7.10.2