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");
30 if (registry != null) {
32 MsaWS msaservice = null;
33 for (Services service : registry.getSupportedServices()) {
34 if (service.equals(Services.ClustalOWS)) {
35 msaservice = (MsaWS) Jws2Client.connect(url, service);
36 if (msaservice != null) {
41 if (msaservice == null) {
42 fail("couldn't find a clustalO service on the public registry");
44 FastaSequence fsq = new FastaSequence("seqA",
45 "SESESESESESESESSESESSESESESESESESESESESEEEEEESSESESESESSSSESESESESESESE");
46 List<FastaSequence> iseqs = new ArrayList<FastaSequence>();
47 for (int i = 0; i < 9; i++) {
48 iseqs.add(new FastaSequence(fsq.getId() + i, fsq.getSequence()
49 + fsq.getSequence().substring(i + 3, i + 3 + i)));
52 String jobid = msaservice.align(iseqs);
61 } catch (InterruptedException q)
65 js = msaservice.getJobStatus(jobid);
66 } while (!js.equals(JobStatus.FAILED)
67 && !js.equals(JobStatus.CANCELLED)
68 && !js.equals(JobStatus.FINISHED));
69 assertEquals("Trial alignment failed. State was " + js.name(), js,
72 "Mismatch in number of input and result sequences - assume alignment service wasn't interacted with correctly",
73 msaservice.getResult(jobid).getSequences().size(),
75 for (FastaSequence t : msaservice.getResult(jobid).getSequences())
77 System.out.println(">" + t.getId());
78 System.out.println(t.getFormattedFasta());
80 // .forEach(new Consumer<FastaSequence>() {
82 // public void accept(FastaSequence t) {
83 // System.out.println(">"+t.getId());
84 // System.out.println(t.getFormattedFasta());