From eb2a8a80d7e785f58b2e11edb8507a555affbdf0 Mon Sep 17 00:00:00 2001 From: jprocter Date: Mon, 7 Nov 2011 13:18:01 +0000 Subject: [PATCH] (JAL-976,JAL-975) disorder client menu items and check type of input sequence for aacons and disorder --- .../ws/jws2/SequenceAnnotationWSClient.java | 124 +++++++++++--------- 1 file changed, 69 insertions(+), 55 deletions(-) diff --git a/src/jalview/ws/jws2/SequenceAnnotationWSClient.java b/src/jalview/ws/jws2/SequenceAnnotationWSClient.java index fea8f2a..e3f3674 100644 --- a/src/jalview/ws/jws2/SequenceAnnotationWSClient.java +++ b/src/jalview/ws/jws2/SequenceAnnotationWSClient.java @@ -41,20 +41,21 @@ public class SequenceAnnotationWSClient extends Jws2Client AlignFrame alignFrame, WsParamSetI preset, boolean editParams) { super(alignFrame, preset, null); - if (sh.serviceType.toLowerCase().contains("aaconws")) + if (alignFrame.getViewport().getAlignment().isNucleotide()) { - // Build an AACons client - if (alignFrame.getViewport().getAlignment().isNucleotide()) - { - JOptionPane - .showMessageDialog( - Desktop.desktop, - "AACons can only be used\nfor amino acid alignments.\nSorry about that!", - "Wrong type of sequences!", - JOptionPane.WARNING_MESSAGE); - return; + JOptionPane + .showMessageDialog( + Desktop.desktop, + sh.serviceType+" can only be used\nfor amino acid alignments.", + "Wrong type of sequences!", + JOptionPane.WARNING_MESSAGE); + return; + + } + if (sh.action.toLowerCase().contains("conservation")) + { + // Build an AACons style client - take alignment, return annotation for columns - } List clnts = alignFrame.getViewport() .getCalcManager() .getRegisteredWorkersOfClass(AAConsClient.class); @@ -88,7 +89,21 @@ public class SequenceAnnotationWSClient extends Jws2Client } } - + if (sh.action.toLowerCase().contains("disorder")) + { + // build IUPred style client. take sequences, returns annotation per sequence. + if (!processParams(sh, editParams)) + { + return; + } + + alignFrame + .getViewport() + .getCalcManager() + .startWorker( + new AADisorderClient(sh, alignFrame, preset, paramset)); + } + } /* @@ -100,62 +115,61 @@ public class SequenceAnnotationWSClient extends Jws2Client public void attachWSMenuEntry(JMenu wsmenu, final Jws2Instance service, final AlignFrame alignFrame) { - if (service.serviceType.toLowerCase().contains("aaconws")) + boolean hasparams = service.hasParameters(); + // Assume name ends in WS + String calcName = service.serviceType.substring(0,service.serviceType.length()-2); + + JMenuItem aacons = new JMenuItem(calcName + " Defaults"); + aacons.addActionListener(new ActionListener() { - boolean hasparams = service.hasParameters(); - String calcName = "AACons"; - JMenuItem aacons = new JMenuItem("AACons Defaults"); - aacons.addActionListener(new ActionListener() + + @Override + public void actionPerformed(ActionEvent e) { + new SequenceAnnotationWSClient(service, alignFrame, null, false); + } + }); + wsmenu.add(aacons); + if (hasparams) + { + // only add these menu options if the service has user-modifiable + // arguments + aacons = new JMenuItem("Edit settings and run ..."); + aacons.setToolTipText("View and change parameters before running calculation"); - @Override + aacons.addActionListener(new ActionListener() + { public void actionPerformed(ActionEvent e) { - new SequenceAnnotationWSClient(service, alignFrame, null, false); + new SequenceAnnotationWSClient(service, alignFrame, null, true); } }); wsmenu.add(aacons); - if (hasparams) + List presets = service.getParamStore().getPresets(); + if (presets != null && presets.size() > 0) { - // only add these menu options if the service has user-modifiable - // arguments - aacons = new JMenuItem("Edit settings and run ..."); - aacons.setToolTipText("View and change the parameters before alignment."); + JMenu presetlist = new JMenu("Run " + calcName + "with preset"); - aacons.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - new SequenceAnnotationWSClient(service, alignFrame, null, true); - } - }); - wsmenu.add(aacons); - List presets = service.getParamStore().getPresets(); - if (presets != null && presets.size() > 0) + for (final WsParamSetI preset : presets) { - JMenu presetlist = new JMenu("Run " + calcName + "with preset"); - - for (final WsParamSetI preset : presets) + final JMenuItem methodR = new JMenuItem(preset.getName()); + methodR.setToolTipText("

" + + JvSwingUtils.wrapTooltip("" + + (preset.isModifiable() ? "User Preset" + : "Service Preset") + "
" + + preset.getDescription() + "

") + ""); + methodR.addActionListener(new ActionListener() { - final JMenuItem methodR = new JMenuItem(preset.getName()); - methodR.setToolTipText("

" - + JvSwingUtils.wrapTooltip("" - + (preset.isModifiable() ? "User Preset" - : "Service Preset") + "
" - + preset.getDescription() + "

") + ""); - methodR.addActionListener(new ActionListener() + public void actionPerformed(ActionEvent e) { - public void actionPerformed(ActionEvent e) - { - new SequenceAnnotationWSClient(service, alignFrame, preset, - false); - } - - }); - presetlist.add(methodR); - } - wsmenu.add(presetlist); + new SequenceAnnotationWSClient(service, alignFrame, preset, + false); + } + + }); + presetlist.add(methodR); } + wsmenu.add(presetlist); } } -- 1.7.10.2