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);
58 } catch (InterruptedException q) {
61 js = msaservice.getJobStatus(jobid);
62 } while (!js.equals(JobStatus.FAILED)
63 && !js.equals(JobStatus.CANCELLED)
64 && !js.equals(JobStatus.FINISHED));
65 assertEquals("Trial alignment failed. State was " + js.name(),
66 js, JobStatus.FINISHED);
68 "Mismatch in number of input and result sequences - assume alignment service wasn't interacted with correctly",
69 msaservice.getResult(jobid).getSequences().size(),
71 List<FastaSequence> seqList = msaservice.getResult(jobid).getSequences();
72 for(FastaSequence fSeq : seqList){
73 System.out.println(">"+fSeq.getId());
74 System.out.println(fSeq.getFormattedFasta());