From: Sasha Sherstnev Date: Fri, 6 Sep 2013 09:29:59 +0000 (+0100) Subject: Fix problem with test data for RNAalifold X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7b5d0822e864d35c099a9b3b9e463c59dfdd091e;p=jabaws.git Fix problem with test data for RNAalifold --- diff --git a/webservices/compbio/ws/client/WSTester.java b/webservices/compbio/ws/client/WSTester.java index fd98f33..483c162 100644 --- a/webservices/compbio/ws/client/WSTester.java +++ b/webservices/compbio/ws/client/WSTester.java @@ -74,9 +74,10 @@ public class WSTester { + "ASDAAPEH------------PGIALWLHALE-DAGQAEAAA---AYTRAHQLLPEEPYITAQLLNAVA\n" + ""; - - - static final List seqs = loadSeqs(); + public static final String fastaRNAAlignment = ">Foo\n" + + "C-UUGCGUUAAUGAGAACAGAAACG-UAAA--CUAUAA-CCUAG-G-GGUUUCUGUUGGAUGGUUG----GCAAC\n" + + ">Bar\n" + + "G-UGGCGCUUAUGACGCAGUUGUCU-UAAA-CUCGAAC--UCGA-GCGGGCAAUUGCUGAU-UACGAUUAACCAC\n"; private static final String FAILED = "FAILED"; private static final String OK = "OK"; @@ -102,7 +103,7 @@ public class WSTester { /** * Converting input to a form accepted by WS * - * @return List of FastaSequence records + * @return List of FastaSequence records with aligned protein sequences */ private static List loadAlignment() { try { @@ -114,6 +115,20 @@ public class WSTester { } return null; } + /** + * Converting input to a form accepted by WS + * + * @return List of FastaSequence records with aligned RNA sequences + */ + private static List loadRNAAlignment() { + try { + return SequenceUtil.readFasta(new ByteArrayInputStream(fastaRNAAlignment.getBytes())); + } catch (IOException ignored) { + // Should not happen as a source is not a external stream + ignored.printStackTrace(); + } + return null; + } private final PrintWriter writer; private final String hostname; @@ -172,7 +187,7 @@ public class WSTester { writer.print("Aligning with preset '" + preset.getName() + "'... "); Alignment al = null; try { - String taskId = msaws.presetAlign(seqs, preset); + String taskId = msaws.presetAlign(loadSeqs(), preset); al = msaws.getResult(taskId); if (al != null) { writer.println(OK); @@ -248,8 +263,10 @@ public class WSTester { writer.print("Calling analyse........."); List input = loadSeqs(); - if (service == Services.AAConWS || service == Services.RNAalifoldWS) { + if (service == Services.AAConWS ) { input = loadAlignment(); + } else if (service == Services.RNAalifoldWS) { + input = loadRNAAlignment(); } boolean success = testDefaultAnalyse(input, wservice, null, null); @@ -347,7 +364,7 @@ public class WSTester { Alignment al = null; boolean succeed = false; - String taskId = msaws.align(seqs); + String taskId = msaws.align(loadSeqs()); writer.print("\nQuerying job status..."); JobStatus status = msaws.getJobStatus(taskId); while (status != JobStatus.FINISHED) { @@ -364,7 +381,6 @@ public class WSTester { return succeed; } - /** * Test JWS2 web services * @@ -414,7 +430,6 @@ public class WSTester { tester.writer.println(); tester.checkService(serv); } - } /** @@ -447,11 +462,9 @@ public class WSTester { private void reportResults(Services serv, boolean succeed) { if (succeed) { - writer.println("Check is completed. The Service " + serv - + " IS WORKING\n"); + writer.println("Check is completed. The Service " + serv + " IS WORKING\n"); } else { - writer.println("Check is aborted. The Service " + serv - + " HAS SOME PROBLEMS\n"); + writer.println("Check is aborted. The Service " + serv + " HAS SOME PROBLEMS\n"); } } }