1 package jalview.ws.jabaws;
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.fail;
6 import java.util.ArrayList;
11 import compbio.data.msa.MsaWS;
12 import compbio.data.msa.RegistryWS;
13 import compbio.data.sequence.FastaSequence;
14 import compbio.metadata.JobStatus;
15 import compbio.ws.client.Jws2Client;
16 import compbio.ws.client.Services;
18 public class MinJabawsClientTests {
21 * simple test for the benefit of JAL-1338
24 @SuppressWarnings("rawtypes")
26 public void msaTest() throws Exception {
28 RegistryWS registry = Jws2Client
29 .connectToRegistry(url = "http://www.compbio.dundee.ac.uk/jabaws");
33 MsaWS msaservice = null;
34 for (Services service : registry.getSupportedServices())
36 if (service.equals(Services.ClustalOWS))
38 msaservice = (MsaWS) Jws2Client.connect(url, service);
39 if (msaservice != null)
45 if (msaservice == null)
47 fail("couldn't find a clustalO service on the public registry");
49 FastaSequence fsq = new FastaSequence("seqA",
50 "SESESESESESESESSESESSESESESESESESESESESEEEEEESSESESESESSSSESESESESESESE");
51 List<FastaSequence> iseqs = new ArrayList<FastaSequence>();
52 for (int i = 0; i < 9; i++)
54 iseqs.add(new FastaSequence(fsq.getId() + i, fsq.getSequence()
55 + fsq.getSequence().substring(i + 3, i + 3 + i)));
58 String jobid = msaservice.align(iseqs);
67 } catch (InterruptedException q)
71 js = msaservice.getJobStatus(jobid);
72 } while (!js.equals(JobStatus.FAILED)
73 && !js.equals(JobStatus.CANCELLED)
74 && !js.equals(JobStatus.FINISHED));
75 assertEquals("Trial alignment failed. State was " + js.name(), js,
78 "Mismatch in number of input and result sequences - assume alignment service wasn't interacted with correctly",
79 msaservice.getResult(jobid).getSequences().size(),
82 List<FastaSequence> fastaSequences = msaservice.getResult(jobid).getSequences();
83 for(FastaSequence fastaSequence : fastaSequences){
84 System.out.println(">" + fastaSequence.getId());
85 System.out.println(fastaSequence.getFormattedFasta());
89 // msaservice.getResult(jobid).getSequences()
90 // .forEach(new Consumer<FastaSequence>()
93 // public void accept(FastaSequence t)
95 // System.out.println(">" + t.getId());
96 // System.out.println(t.getFormattedFasta());