* 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;
}
/**
- * 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;
{
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);
}
{
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("<default>", 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<dbs.length; db++)
- {
- JMenu dbmenu = (JMenu) dbsrchs.get(dbs[db]);
- if (dbmenu==null)
- {
- dbsrchs.put(dbs[db], dbmenu = new JMenu(dbs[db]));
- }
- // add the client handler code for this service
- dbmenu.add(method = new JMenuItem(sh.getName()));
- final String searchdb = dbs[db];
- method.addActionListener(new ActionListener()
- {
- public void actionPerformed(ActionEvent e)
- {
- AlignmentView msa = gatherSeqOrMsaForSecStrPrediction();
- new jalview.ws.SeqSearchWSClient(sh, title, msa, searchdb,
- viewport.getAlignment().getDataset(),
- af);
- }
- });
- }
- }
- // add the databases onto the seqsearch menu
- Enumeration e = dbsrchs.elements();
- while (e.hasMoreElements())
- {
- Object el = e.nextElement();
- if (el instanceof JMenu)
- {
- seqsrchmenu.add((JMenu) el);
- } else {
- seqsrchmenu.add((JMenuItem) el);
- }
+ jalview.ws.WSClient impl = jalview.ws.Discoverer.getServiceClient(sh);
+ impl.attachWSMenuEntry(seqsrchmenu, this);
}
// finally, add the whole shebang onto the webservices menu
- wsmenu.add(seqsrchmenu); */
+ wsmenu.add(seqsrchmenu);
}
resetWebServiceMenu();
for (int i = 0, j = wsmenu.size(); i < j; i++)