X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=15cbf01120e7eebd8a857cb6558fadf4f81a519d;hb=942de34caf73a7d61104783c8d278c32eaf6b65d;hp=f53638234f3579da27b8edd81759cba378f60a59;hpb=fd29e047719a470cf304c5a41abfff5c1eac3ee8;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index f536382..15cbf01 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -3270,7 +3270,7 @@ public class AlignFrame * or just the selected set will be submitted for multiple alignment. * */ - private jalview.datamodel.AlignmentView gatherSequencesForAlignment() + public jalview.datamodel.AlignmentView gatherSequencesForAlignment() { // Now, check we have enough sequences AlignmentView msa = null; @@ -3308,12 +3308,14 @@ public class AlignFrame } /** - * Decides what is submitted to a secondary structure prediction service, - * the currently selected sequence, or the currently selected alignment + * Decides what is submitted to a secondary structure prediction service: + * the first sequence in the alignment, or in the current selection, + * or, if the alignment is 'aligned' (ie padded with gaps), then the + * currently selected region or the whole alignment. * (where the first sequence in the set is the one that the prediction * will be for). */ - AlignmentView gatherSeqOrMsaForSecStrPrediction() + public AlignmentView gatherSeqOrMsaForSecStrPrediction() { AlignmentView seqs = null; @@ -3475,43 +3477,9 @@ public class AlignFrame { final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) msaws. get(i); - final JMenuItem method = new JMenuItem(sh.getName()); - method.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - AlignmentView msa = gatherSequencesForAlignment(); - new jalview.ws.MsaWSClient(sh, title, msa, - false, true, - viewport.getAlignment().getDataset(), - af); - - } - - }); - msawsmenu.add(method); - // Deal with services that we know accept partial alignments. - // TODO: this should be a service property - ie sh.getProperty("submitGaps")==Boolean.true - if (sh.getName().indexOf("lustal") > -1) - { - // We know that ClustalWS can accept partial alignments for refinement. - final JMenuItem methodR = new JMenuItem(sh.getName()+" Realign"); - methodR.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - AlignmentView msa = gatherSequencesForAlignment(); - new jalview.ws.MsaWSClient(sh, title, msa, - true, true, - viewport.getAlignment().getDataset(), - af); - - } - - }); - msawsmenu.add(methodR); - - } + jalview.ws.WSClient impl = jalview.ws.Discoverer.getServiceClient(sh); + impl.attachWSMenuEntry(msawsmenu, this); + } wsmenu.add(msawsmenu); } @@ -3523,105 +3491,24 @@ public class AlignFrame { final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) secstrpr.get(i); - final JMenuItem method = new JMenuItem(sh.getName()); - method.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - AlignmentView msa = gatherSeqOrMsaForSecStrPrediction(); - if (msa.getSequences().length == 1) - { - // Single Sequence prediction - new jalview.ws.JPredClient(sh, title, false, msa, af, true); - } - else - { - if (msa.getSequences().length > 1) - { - // Sequence profile based prediction - new jalview.ws.JPredClient(sh, - title, true, msa, af, true); - } - } - } - }); - secstrmenu.add(method); + jalview.ws.WSClient impl = jalview.ws.Discoverer.getServiceClient(sh); + impl.attachWSMenuEntry(secstrmenu, this); } wsmenu.add(secstrmenu); -/* } + } if (seqsrch!=null) { - // Add any secondary structure prediction services + // Add any sequence search services final JMenu seqsrchmenu = new JMenu("Sequence Database Search"); - Hashtable dbsrchs = new Hashtable(); - JMenu defmenu; - dbsrchs.put("", defmenu = new JMenu("Default Database")); for (int i = 0, j = seqsrch.size(); i < j; i++) { final ext.vamsas.ServiceHandle sh = (ext.vamsas.ServiceHandle) seqsrch.elementAt(i); - - String dbs[] = null; - try { - dbs = new jalview.ws.SeqSearchWSClient(sh).getSupportedDatabases(); - } catch (Exception e) - { - jalview.bin.Cache.log.warn("Database list request failed, so disabling SeqSearch Service client "+sh.getName()+" at "+sh.getEndpointURL(), e); - continue; - } - JMenuItem method; - // do default entry - defmenu.add(method = new JMenuItem(sh.getName())); - method.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - // use same input gatherer as for secondary structure prediction - // we could actually parameterise the gatherer method here... - AlignmentView msa = gatherSeqOrMsaForSecStrPrediction(); - new jalview.ws.SeqSearchWSClient(sh, title, msa, null, - viewport.getAlignment().getDataset(), - af); - } - } - ); - // add entry for each database the service supports - for (int db=0; dbs!=null && db