Fix problem with test data for RNAalifold RNAalifold
authorSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Fri, 6 Sep 2013 09:29:59 +0000 (10:29 +0100)
committerSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Fri, 6 Sep 2013 09:29:59 +0000 (10:29 +0100)
webservices/compbio/ws/client/WSTester.java

index fd98f33..483c162 100644 (file)
@@ -74,9 +74,10 @@ public class WSTester {
                        + "ASDAAPEH------------PGIALWLHALE-DAGQAEAAA---AYTRAHQLLPEEPYITAQLLNAVA\n"\r
                        + "";\r
 \r
-       \r
-       \r
-       static final List<FastaSequence> seqs = loadSeqs();\r
+       public static final String fastaRNAAlignment = ">Foo\n"\r
+                       + "C-UUGCGUUAAUGAGAACAGAAACG-UAAA--CUAUAA-CCUAG-G-GGUUUCUGUUGGAUGGUUG----GCAAC\n"\r
+                       + ">Bar\n"\r
+                       + "G-UGGCGCUUAUGACGCAGUUGUCU-UAAA-CUCGAAC--UCGA-GCGGGCAAUUGCUGAU-UACGAUUAACCAC\n";\r
 \r
        private static final String FAILED = "FAILED";\r
        private static final String OK = "OK";\r
@@ -102,7 +103,7 @@ public class WSTester {
        /**\r
         * Converting input to a form accepted by WS\r
         * \r
-        * @return List of FastaSequence records\r
+        * @return List of FastaSequence records with aligned protein sequences\r
         */\r
        private static List<FastaSequence> loadAlignment() {\r
                try {\r
@@ -114,6 +115,20 @@ public class WSTester {
                }\r
                return null;\r
        }\r
+       /**\r
+        * Converting input to a form accepted by WS\r
+        * \r
+        * @return List of FastaSequence records with aligned RNA sequences\r
+        */\r
+       private static List<FastaSequence> loadRNAAlignment() {\r
+               try {\r
+                       return SequenceUtil.readFasta(new ByteArrayInputStream(fastaRNAAlignment.getBytes()));\r
+               } catch (IOException ignored) {\r
+                       // Should not happen as a source is not a external stream\r
+                       ignored.printStackTrace();\r
+               }\r
+               return null;\r
+       }\r
 \r
        private final PrintWriter writer;\r
        private final String hostname;\r
@@ -172,7 +187,7 @@ public class WSTester {
                        writer.print("Aligning with preset '" + preset.getName() + "'... ");\r
                        Alignment al = null;\r
                        try {\r
-                               String taskId = msaws.presetAlign(seqs, preset);\r
+                               String taskId = msaws.presetAlign(loadSeqs(), preset);\r
                                al = msaws.getResult(taskId);\r
                                if (al != null) {\r
                                        writer.println(OK);\r
@@ -248,8 +263,10 @@ public class WSTester {
                writer.print("Calling analyse.........");\r
 \r
                List<FastaSequence> input = loadSeqs();\r
-               if (service == Services.AAConWS || service == Services.RNAalifoldWS) {\r
+               if (service == Services.AAConWS ) {\r
                        input = loadAlignment();\r
+               } else if (service == Services.RNAalifoldWS) {\r
+                       input = loadRNAAlignment();\r
                }\r
                boolean success = testDefaultAnalyse(input, wservice, null, null);\r
 \r
@@ -347,7 +364,7 @@ public class WSTester {
                Alignment al = null;\r
                boolean succeed = false;\r
 \r
-               String taskId = msaws.align(seqs);\r
+               String taskId = msaws.align(loadSeqs());\r
                writer.print("\nQuerying job status...");\r
                JobStatus status = msaws.getJobStatus(taskId);\r
                while (status != JobStatus.FINISHED) {\r
@@ -364,7 +381,6 @@ public class WSTester {
                return succeed;\r
        }\r
        \r
-       \r
        /**\r
         * Test JWS2 web services\r
         * \r
@@ -414,7 +430,6 @@ public class WSTester {
                        tester.writer.println();\r
                        tester.checkService(serv);\r
                }\r
-\r
        }\r
 \r
        /**\r
@@ -447,11 +462,9 @@ public class WSTester {
 \r
        private void reportResults(Services serv, boolean succeed) {\r
                if (succeed) {\r
-                       writer.println("Check is completed. The Service " + serv\r
-                                       + " IS WORKING\n");\r
+                       writer.println("Check is completed. The Service " + serv + " IS WORKING\n");\r
                } else {\r
-                       writer.println("Check is aborted. The Service " + serv\r
-                                       + " HAS SOME PROBLEMS\n");\r
+                       writer.println("Check is aborted. The Service " + serv + " HAS SOME PROBLEMS\n");\r
                }\r
        }\r
 }\r