From 65b94714ece0726653890609ed1136708cf77997 Mon Sep 17 00:00:00 2001 From: jprocter Date: Wed, 25 May 2005 13:00:33 +0000 Subject: [PATCH] Improved consistency between JPredWS and MsaWS --- src/jalview/ws/JPredClient.java | 49 ++++++++++++++++++++++---------------- src/jalview/ws/MsaWSClient.java | 28 +++++++--------------- src/jalview/ws/MsaWServices.java | 3 +++ 3 files changed, 41 insertions(+), 39 deletions(-) diff --git a/src/jalview/ws/JPredClient.java b/src/jalview/ws/JPredClient.java index a688de2..0d7145c 100755 --- a/src/jalview/ws/JPredClient.java +++ b/src/jalview/ws/JPredClient.java @@ -12,20 +12,25 @@ import jalview.analysis.AlignSeq; import ext.vamsas.*; -public class JPredClient +public class JPredClient extends WSClient { - int jobsRunning = 0; - ext.vamsas.JpredSoapBindingStub server; - WebserviceInfo wsInfo; + ext.vamsas.JPredWS server; String altitle = ""; java.util.Hashtable SequenceInfo = null; + private void setWebService() { + WebServiceName = "JNetWS"; + WebServiceJobTitle = "JNet secondary structure prediction"; + WebServiceReference="\"Cuff J. A and Barton G.J (1999) Application of enhanced " + + "multiple sequence alignment profiles to improve protein secondary structure prediction, " + + "Proteins 40:502-511\"."; + WsURL="http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred"; + } public JPredClient(String title, SequenceI[] msf) { - wsInfo = new WebserviceInfo("JNet secondary structure prediction on "+title, - "\"Cuff J. A and Barton G.J (1999) Application of enhanced multiple sequence alignment profiles to improve protein secondary structure prediction, Proteins 40:502-511\"."); - + wsInfo = new WebserviceInfo(WebServiceJobTitle, WebServiceReference); SequenceI seq = msf[0]; - altitle = "JNet prediction on "+seq.getName()+" using "+title; + altitle = "JNet prediction on "+seq.getName()+" using alignment from "+title; + wsInfo.setProgressText("Job details for MSA based prediction ("+title+") on sequence :\n>" + seq.getName() + "\n" + AlignSeq.extractGaps("-. ",seq.getSequence()) + "\n"); @@ -35,11 +40,14 @@ public class JPredClient JPredWSServiceLocator loc = new JPredWSServiceLocator(); // Default // JBPNote url will be set from properties try { - this.server = (JpredSoapBindingStub) loc.getjpred(new java.net.URL("http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred")); + this.server = loc.getjpred(new java.net.URL(WsURL)); } catch (Exception ex) { - wsInfo.setProgressText("Serious! JPred Service location failed\nfor URL :" - +loc.getjpredAddress()+"\n"+ex.getMessage()); + JOptionPane.showMessageDialog(Desktop.desktop, "The Secondary Structure Prediction Service named " + +WebServiceName+" at "+WsURL+" couldn't be located.", + "Internal Jalview Error", JOptionPane.WARNING_MESSAGE); + wsInfo.setProgressText("Serious! "+WebServiceName+" Service location failed\nfor URL :" + +WsURL+"\n"+ex.getMessage()); } JPredThread jthread = new JPredThread(msf); @@ -48,22 +56,23 @@ public class JPredClient public JPredClient(String title, SequenceI seq) { - wsInfo = new WebserviceInfo("JNet secondary structure prediction Job", - "\"Cuff J. A and Barton G.J (1999) Application of enhanced multiple sequence alignment profiles to improve protein secondary structure prediction, Proteins 40:502-511\"."); - - + setWebService(); + wsInfo = new WebserviceInfo(WebServiceJobTitle, WebServiceReference); wsInfo.setProgressText("Job details for prediction on sequence :\n>" + seq.getName() + "\n" + AlignSeq.extractGaps("-. ",seq.getSequence()) + "\n"); altitle = "JNet prediction for sequence "+seq.getName()+" from "+title; SequenceInfo = jalview.analysis.SeqsetUtils.SeqCharacterHash(seq); -// TODO: put proper url in + JPredWSServiceLocator loc = new JPredWSServiceLocator(); // Default try { - this.server = (JpredSoapBindingStub) loc.getjpred(new java.net.URL("http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred")); // JBPNote will be set from properties + this.server = loc.getjpred(new java.net.URL(WsURL)); // JBPNote will be set from properties } catch (Exception ex) { - wsInfo.setProgressText("Serious! JPred Service location failed\nfor URL :" - +loc.getjpredAddress()+"\n"+ex.getMessage()); + JOptionPane.showMessageDialog(Desktop.desktop, "The Secondary Structure Prediction Service named " + +WebServiceName+" at "+WsURL+" couldn't be located.", + "Internal Jalview Error", JOptionPane.WARNING_MESSAGE); + wsInfo.setProgressText("Serious! "+WebServiceName+" Service location failed\nfor URL :" + +WsURL+"\n"+ex.getMessage()); } JPredThread jthread = new JPredThread(seq); @@ -157,7 +166,7 @@ public class JPredClient } else { jobId = server.predict(sequence); } - System.out.println(jobId); + System.out.println(WsURL+" Job Id '"+jobId+"'"); } catch (Exception e) { diff --git a/src/jalview/ws/MsaWSClient.java b/src/jalview/ws/MsaWSClient.java index 1507c12..876c0c1 100755 --- a/src/jalview/ws/MsaWSClient.java +++ b/src/jalview/ws/MsaWSClient.java @@ -16,20 +16,13 @@ import vamsas.objects.*; public class MsaWSClient + extends WSClient { - int jobsRunning = 0; - ext.vamsas.MuscleWS server; - WebserviceInfo wsInfo; - /** - * MsaWSClient - * - * @param msa SequenceI[] - */ - - String WebServiceName; - String WebServiceJobTitle; - String WebServiceReference; - String WsURL; + /** + * server is a WSDL2Java generated stub for an archetypal MsaWSI service. + */ + ext.vamsas.MuscleWS server; + private boolean setWebService(String MsaWSName) { if (MsaWServices.info.containsKey(MsaWSName)) { WebServiceName = MsaWSName; @@ -43,9 +36,6 @@ public class MsaWSClient } } -// public MsaWSClient(String MsaWSName, SequenceI[] msa) { -// MsaWSClient(MsaWSName, msa, true); -// } public MsaWSClient(String MsaWSName, String altitle, SequenceI[] msa, boolean submitGaps, boolean preserveOrder) { @@ -62,8 +52,7 @@ public class MsaWSClient // TODO: MuscleWS transmuted to generic MsaWS client MuscleWSServiceLocator loc = new MuscleWSServiceLocator(); // Default try { - this.server = (MuscleWS) loc.getMuscleWS(// JBPNote will be set from properties - new java.net.URL(WsURL)); + this.server = (MuscleWS) loc.getMuscleWS(new java.net.URL(WsURL)); } catch (Exception ex) { wsInfo.setProgressText("Serious! "+WebServiceName+" Service location failed\nfor URL :" @@ -213,7 +202,8 @@ public class MsaWSClient { vamsas.objects.simple.WsJobId jobsubmit = server.align(seqs); if (jobsubmit.getStatus()==1) { - System.out.println(jobId=jobsubmit.getJobId()); + jobId=jobsubmit.getJobId(); + System.out.println(WsURL+" Job Id '"+jobId+"'"); } else { throw new Exception(jobsubmit.getJobId()); } diff --git a/src/jalview/ws/MsaWServices.java b/src/jalview/ws/MsaWServices.java index 8ea666b..69b5e23 100755 --- a/src/jalview/ws/MsaWServices.java +++ b/src/jalview/ws/MsaWServices.java @@ -12,6 +12,9 @@ import java.util.Hashtable; * @author not attributable * @version 1.0 */ +/** + * TODO: MsaWServices will be set from properties and be dynamically discovered. + */ public class MsaWServices { public static Hashtable info; static -- 1.7.10.2