Changes which allow JpredWS test
authorSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Thu, 5 Sep 2013 09:46:52 +0000 (10:46 +0100)
committerSasha Sherstnev <a.sherstnev@dundee.ac.uk>
Thu, 5 Sep 2013 09:46:52 +0000 (10:46 +0100)
webservices/compbio/stat/collector/InputFilter.java
webservices/compbio/ws/client/WSTester.java

index f55e843..4c36445 100644 (file)
@@ -24,7 +24,7 @@ public class InputFilter {
                if (input == null)\r
                        return true;\r
                assert input.isFile() : "Input file is not a file! " + input;\r
-               String[] fastainput = WSTester.fastaInput.split("\n");\r
+               String[] fastainput = WSTester.fastaInput2records.split("\n");\r
                assert fastainput.length == 4;\r
                String[] aligninput = WSTester.fastaAlignment.split("\n");\r
                assert aligninput.length == 4;\r
index e9a349c..2f33cb1 100644 (file)
@@ -63,10 +63,13 @@ public class WSTester {
        /**\r
         * Sequences to be used as input for all WS\r
         */\r
-       public static final String fastaInput = ">Foo\n"\r
+       public static final String fastaInput2records = ">Foo\n"\r
                        + "MTADGPRELLQLRAAVRHRPQDFVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAV"\r
                        + "\n>Bar\n"\r
                        + "ASDAAPEHPGIALWLHALEDAGQAEAAAAYTRAHQLLPEEPYITAQLLNAVA\n";\r
+       public static final String fastaInput1record = ">Foo\n"\r
+                       + "MTADGPRELLQLRAAVRHRPQDFVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAV"\r
+                       + "\n";\r
 \r
        public static final String fastaAlignment = ">Foo\n"\r
                        + "MTADGPRELLQLRAAVRHRPQDFVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAV--------\n"\r
@@ -74,7 +77,7 @@ public class WSTester {
                        + "ASDAAPEH------------PGIALWLHALE-DAGQAEAAA---AYTRAHQLLPEEPYITAQLLNAVA\n"\r
                        + "";\r
 \r
-       static final List<FastaSequence> seqs = loadSeqs();\r
+       static final List<FastaSequence> seqs = loadSeqs(2);\r
 \r
        private static final String FAILED = "FAILED";\r
        private static final String OK = "OK";\r
@@ -86,10 +89,12 @@ public class WSTester {
         * \r
         * @return List of FastaSequence records\r
         */\r
-       private static List<FastaSequence> loadSeqs() {\r
+       private static List<FastaSequence> loadSeqs(int nLines) {\r
                try {\r
-                       return SequenceUtil.readFasta(new ByteArrayInputStream(fastaInput\r
-                                       .getBytes()));\r
+                       if (nLines == 1) {\r
+                               return SequenceUtil.readFasta(new ByteArrayInputStream(fastaInput1record.getBytes()));\r
+                       }\r
+                       return SequenceUtil.readFasta(new ByteArrayInputStream(fastaInput2records.getBytes()));\r
                } catch (IOException ignored) {\r
                        // Should not happen as a source is not a external stream\r
                        ignored.printStackTrace();\r
@@ -240,10 +245,13 @@ public class WSTester {
                        SequenceAnnotation<T> wservice, Services service) throws Exception {\r
                writer.print("Calling analyse.........");\r
 \r
-               List<FastaSequence> input = loadSeqs();\r
+               List<FastaSequence> input = loadSeqs(2);\r
                if (service == Services.AAConWS) {\r
                        input = loadAlignment();\r
                }\r
+               if (service == Services.JpredWS) {\r
+                       input = loadSeqs(1);\r
+               }\r
                boolean success = testDefaultAnalyse(input, wservice, null, null);\r
 \r
                PresetManager<T> presetman = wservice.getPresets();\r