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