New EBI WS implementation
authoramwaterhouse <Andrew Waterhouse>
Thu, 24 Nov 2005 12:14:53 +0000 (12:14 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 24 Nov 2005 12:14:53 +0000 (12:14 +0000)
src/jalview/io/EBIFetchClient.java
src/jalview/io/WSWUBlastClient.java

index c1a0302..0012ffe 100755 (executable)
@@ -147,6 +147,7 @@ public class EBIFetchClient
       File outFile = null;\r
       try{\r
         outFile = File.createTempFile("jalview", ".xml");\r
+        outFile.deleteOnExit();\r
         PrintWriter out = new PrintWriter(new FileOutputStream(outFile));\r
         int index=0;\r
         while( index < data.length )\r
index e6800bc..0906d12 100755 (executable)
@@ -31,6 +31,7 @@ import javax.swing.*;
 import javax.xml.namespace.QName;\r
 import jalview.analysis.AlignSeq;\r
 \r
+import uk.ac.ebi.www.*;\r
 \r
 /**\r
  * DOCUMENT ME!\r
@@ -57,8 +58,13 @@ public class WSWUBlastClient
         this.ap = ap;\r
         this.al = al;\r
         output.setText(\r
-            "To display sequence features an exact Uniprot id with 100% sequence identity match must be entered." +\r
-            "\nIn order to display these features, try changing the names of your sequences to the ids suggested below.");\r
+            "To display sequence features an exact Uniprot id with 100% sequence identity match must be entered."\r
+            +"\nIn order to display these features, try changing the names of your sequences to the ids suggested below."\r
+            +"\n\nRunning WSWUBlast at EBI."\r
+            +"\nPlease quote Pillai S., Silventoinen V., Kallio K., Senger M., Sobhany S., Tate J., Velankar S., Golovin A., Henrick K., Rice P., Stoehr P., Lopez R."\r
+            +"\nSOAP-based services provided by the European Bioinformatics Institute."\r
+            +"\nNucleic Acids Res. 33(1):W25-W28 (2005));");\r
+\r
         Desktop.addInternalFrame(output,\r
             "BLASTing for unidentified sequences ", 800, 300);\r
 \r
@@ -89,7 +95,7 @@ public class WSWUBlastClient
         String data;\r
         String id2;\r
         int maxFound = 90;\r
-        StringBuffer buffer = new StringBuffer("\n\n" + seq.getShortName() + " :");\r
+        StringBuffer buffer = new StringBuffer("\n\n" + seq.getName() + " :");\r
 \r
         while (st.hasMoreTokens())\r
         {\r
@@ -238,26 +244,23 @@ public class WSWUBlastClient
             {\r
                 try\r
                 {\r
-                    Call call = (Call) new Service().createCall();\r
-                    call.setTargetEndpointAddress(new java.net.URL(\r
-                            "http://www.ebi.ac.uk/cgi-bin/webservices/WSWUBlast"));\r
-                    call.setOperationName(new QName("WSWUBlast", "polljob"));\r
-\r
-                    Object object = (String) call.invoke(new Object[]\r
-                            {\r
-                                jobid, "xml"\r
-                            });\r
-\r
-                    if(object instanceof String)\r
-                    {\r
-                      parseResult(sequence, (String)object);\r
+                  WSWUBlastService service =  new WSWUBlastServiceLocator();\r
+                  WSWUBlast wublast = service.getWSWUBlast();\r
+                  WSFile[] results = wublast.getResults(jobid);\r
+\r
+                  if(results!=null)\r
+                  {\r
+                      String result = new String(wublast.poll(jobid, "tooloutput"));\r
+                      parseResult(sequence, result);\r
                       jobComplete = true;\r
                       jobsRunning--;\r
-                    }\r
-\r
-                    Thread.sleep(5000);\r
-\r
-                    System.out.println("WSWuBlastClient: I'm alive "+sequence.getShortName()+" "+jobid); // log.debug\r
+                  }\r
+                  else\r
+                  {\r
+                    Thread.sleep(10000);\r
+                    System.out.println("WSWuBlastClient: I'm alive " +\r
+                                       sequence.getName() + " " + jobid); // log.debug\r
+                  }\r
                 }\r
                 catch (Exception ex)\r
                 {\r
@@ -267,46 +270,36 @@ public class WSWUBlastClient
 \r
         void StartJob()\r
         {\r
-            HashMap params = new HashMap();\r
-            params.put("database", "uniprot");\r
-            params.put("sensitivity", "low");\r
-            params.put("sort", "totalscore");\r
-            params.put("matrix", "pam10");\r
-            params.put("program", "blastp");\r
-            params.put("alignments", "5");\r
-            params.put("type", "xml");\r
-            params.put("async", "true");\r
-\r
-            byte[] seqbytes = AlignSeq.extractGaps("-. ",\r
-                                                  sequence.getSequence()).getBytes();\r
-\r
-            try\r
-            {\r
-                Call call = (Call) new Service().createCall();\r
-                call.setTargetEndpointAddress(new java.net.URL(\r
-                        "http://www.ebi.ac.uk/cgi-bin/webservices/WSWUBlast"));\r
-                call.setOperationName(new QName("WSWUBlast", "doWUBlast"));\r
-\r
-                Object object = call.invoke(new Object[]\r
-                        {\r
-                            params, seqbytes\r
-                        });\r
+          InputParams params = new InputParams();\r
 \r
-                if(object instanceof byte[])\r
-                  jobid = new String( (byte[])object);\r
+          params.setProgram("blastp");\r
+          params.setDatabase("uniprot");\r
+          params.setMatrix("pam10");\r
 \r
-                else\r
-                {\r
-                  jobComplete = true;\r
-                  jobsRunning--;\r
-                  parseResult(sequence, (String)object);\r
-                }\r
+          params.setNumal(5);\r
+          params.setSensitivity("low");\r
+          params.setSort("totalscore");\r
+          params.setOutformat("txt");\r
+          params.setAsync(true);\r
 \r
+            try\r
+            {\r
+              Data inputs[] = new Data[1];\r
+              Data input= new Data();\r
+              input.setType("sequence");\r
+              input.setContent(AlignSeq.extractGaps("-. ",sequence.getSequence()));\r
+              inputs[0]=input;\r
+\r
+              WSWUBlastService service = new WSWUBlastServiceLocator();\r
+              WSWUBlast wublast = service.getWSWUBlast();\r
+              jobid = wublast.runWUBlast(params, inputs);\r
             }\r
             catch (Exception exp)\r
             {\r
-                System.err.println("WSWUBlastClient error:\n" + exp.toString());\r
-                exp.printStackTrace();\r
+              jobComplete = true;\r
+              jobsRunning--;\r
+              System.err.println("WSWUBlastClient error:\n" + exp.toString());\r
+              exp.printStackTrace();\r
             }\r
         }\r
     }\r