Webservice working with ScoreManager
authorDaniel Barton <daluke.barton@gmail.com>
Fri, 16 Aug 2013 15:25:31 +0000 (16:25 +0100)
committerDaniel Barton <daluke.barton@gmail.com>
Fri, 16 Aug 2013 15:25:31 +0000 (16:25 +0100)
testsrc/compbio/ws/client/TestRNAalifoldWS.java
webservices/compbio/ws/server/RNAalifoldWS.java
webservices/compbio/ws/server/WSUtil.java

index 5e66f43..c5f3f6d 100644 (file)
@@ -1,4 +1,4 @@
-package compbio.ws.client;
+       package compbio.ws.client;
 
 import compbio.metadata.AllTestSuit;
 import static org.testng.Assert.assertEquals;
@@ -45,7 +45,7 @@ import compbio.ws.server.RNAalifoldWS;
 
 public class TestRNAalifoldWS {
        
-       FoldWS<RNAalifoldWS> foldws;
+       SequenceAnnotation<RNAalifoldWS> foldws;
        
        @BeforeTest(groups = {AllTestSuit.test_group_webservices})
        void initConnection() {
@@ -53,7 +53,7 @@ public class TestRNAalifoldWS {
                try {
                        JABAService client = Jws2Client.connect(
                                        "http://localhost:8080/jabaws", Services.RNAalifoldWS);
-                       foldws = (FoldWS<RNAalifoldWS>) client;
+                       foldws = (SequenceAnnotation<RNAalifoldWS>) client;
                } catch (ConnectException e) {
                        e.printStackTrace();
                        fail(e.getMessage());
@@ -74,14 +74,20 @@ public class TestRNAalifoldWS {
                Alignment aln = ClustalAlignmentUtil.readClustalFile(new FileInputStream(
                                AllTestSuit.test_input_aln));
                
+               List<FastaSequence> fsl = aln.getSequences();
+               
                try {
                        List<Option<RNAalifoldWS>> options  = new ArrayList<Option<RNAalifoldWS>>();
                        options.add(foldws.getRunnerOptions().getArgumentByOptionName("--mis"));
+                       options.add(foldws.getRunnerOptions().getArgumentByOptionName("-p"));
+                       options.add(foldws.getRunnerOptions().getArgumentByOptionName("--MEA"));
+                       
                        System.out.println("TestRNAalifoldWS: print options: " + options.toString());
-                       String jobId = foldws.customFold(aln, options);
+                       
+                       String jobId = foldws.customAnalize(fsl, options);
                        System.out.println("J: " + jobId);
-                       String result = foldws.getResult(jobId);
-                       System.out.println("fold results: \n" + result);
+                       ScoreManager result = foldws.getAnnotation(jobId);
+                       System.out.println("fold results: \n" + result.asRNAStruct().toString());
                        assertNotNull(result);
                        
                } catch (UnsupportedRuntimeException e) {
index b05c973..34f0aaf 100644 (file)
@@ -48,18 +48,6 @@ public class RNAalifoldWS extends SequenceAnnotationService<RNAalifold>
                super (new RNAalifold(), log);
        }
 
-       /*
-        * No options are supported, thus the result of this call will be as simple
-        * call to analize without parameters
-        */
-       @Override
-       public String customAnalize(List<FastaSequence> sequences,
-                       List<Option<RNAalifold>> options) throws UnsupportedRuntimeException,
-                       LimitExceededException, JobSubmissionException,
-                       WrongParameterException {
-               
-               return analize(sequences);
-       }
 
        /*
         * No presets are supported, thus the result of this call will be as simple
index 9d81a6a..7646747 100644 (file)
@@ -153,8 +153,9 @@ public final class WSUtil {
                        throw LimitExceededException.newLimitExceeded(limit, sequences);\r
                }\r
                log.debug("Method: " + method + " with task: " + confExec.getTaskId());\r
-\r
-               compbio.runner.Util.writeInput(sequences, confExec);\r
+               // Change this line for RNAalifold testing\r
+               // compbio.runner.Util.writeInput(sequences, confExec);\r
+               compbio.runner.Util.writeClustalInput(sequences, confExec, '-');\r
                AsyncExecutor engine = Configurator.getAsyncEngine(confExec);\r
                String jobId = engine.submitJob(confExec);\r
                reportUsage(confExec, log);\r