X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2FMsaWSClient.java;h=63e60d7c2bcf997cec1729cb93caad2520ea3ee4;hb=25ae256a88bf092f45a78b649a48f41e6fd5d70b;hp=03a801effca126e07a36adc80db6a33eb08f599f;hpb=7bc226b58110fa26d9dbd3f0c78095d06909ffc3;p=jalview.git diff --git a/src/jalview/ws/MsaWSClient.java b/src/jalview/ws/MsaWSClient.java index 03a801e..63e60d7 100755 --- a/src/jalview/ws/MsaWSClient.java +++ b/src/jalview/ws/MsaWSClient.java @@ -18,6 +18,9 @@ */ package jalview.ws; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + import javax.swing.*; import ext.vamsas.*; @@ -83,6 +86,12 @@ public class MsaWSClient } + public MsaWSClient() + { + super(); + // add a class reference to the list + } + private void startMsaWSClient(String altitle, AlignmentView msa, boolean submitGaps, boolean preserveOrder, Alignment seqdataset) @@ -167,4 +176,55 @@ public class MsaWSClient { return "Multiple Sequence Alignment"; } + /** + * look at ourselves and work out if we are a service that can take a profile and align to it + * @return true if we can send gapped sequences to the alignment service + */ + private boolean canSubmitGaps() + { + // TODO: query service or extract service handle props to check if we can realign + return (WebServiceName.indexOf("lustal") > -1); // cheat! + } + public void attachWSMenuEntry(JMenu msawsmenu, final ServiceHandle serviceHandle, final AlignFrame alignFrame) + { + setWebService(serviceHandle, true); // headless + JMenuItem method = new JMenuItem(WebServiceName); + method.setToolTipText(WsURL); + method.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + AlignmentView msa = alignFrame.gatherSequencesForAlignment(); + new jalview.ws.MsaWSClient(serviceHandle, alignFrame.getTitle(), msa, + false, true, + alignFrame.getViewport().getAlignment().getDataset(), + alignFrame); + + } + + }); + msawsmenu.add(method); + if (canSubmitGaps()) + { + // We know that ClustalWS can accept partial alignments for refinement. + final JMenuItem methodR = new JMenuItem(serviceHandle.getName()+" Realign"); + methodR.setToolTipText(WsURL); + methodR.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + AlignmentView msa = alignFrame.gatherSequencesForAlignment(); + new jalview.ws.MsaWSClient(serviceHandle, alignFrame.getTitle(), msa, + true, true, + alignFrame.getViewport().getAlignment().getDataset(), + alignFrame); + + } + + }); + msawsmenu.add(methodR); + + } + + } }