Update the last commit which missed some files. RNAStructScoreManager
authorDaniel Barton <daluke.barton@gmail.com>
Wed, 21 Aug 2013 10:55:21 +0000 (11:55 +0100)
committerDaniel Barton <daluke.barton@gmail.com>
Wed, 21 Aug 2013 10:55:21 +0000 (11:55 +0100)
replacing RNAStruct. Webservices returns ScoreManager!?!-

webservices/compbio/ws/server/WSUtil.java

index 7646747..a3f96d8 100644 (file)
@@ -27,6 +27,7 @@ import org.apache.log4j.Logger;
 \r
 import compbio.data.sequence.Alignment;\r
 import compbio.data.sequence.FastaSequence;\r
+import compbio.data.sequence.RNAStructScoreManager;\r
 import compbio.data.sequence.ScoreManager;\r
 import compbio.engine.AsyncExecutor;\r
 import compbio.engine.Configurator;\r
@@ -115,27 +116,27 @@ public final class WSUtil {
        \r
        // Hardcoded gapchar '-' in this method\r
        \r
-       public static <T> String fold(Alignment alignment,\r
-                       ConfiguredExecutable<T> confExec, Logger logger,\r
-                       String callingMethod, Limit<T> limit)\r
-                       throws LimitExceededException, JobSubmissionException {\r
-               \r
-               List<FastaSequence> sequences = alignment.getSequences();\r
-               if (limit != null && limit.isExceeded(sequences)) {\r
-                       throw LimitExceededException.newLimitExceeded(limit, sequences);\r
-               }\r
-               compbio.runner.Util.writeClustalInput(sequences, confExec, '-');\r
-               System.out.println("WSUtil-fold: Writing the clustal input file on the server: to file: "\r
-                               + confExec.getInput());\r
-               System.out.println("WSUtil-fold: The executable is configured with parameters: " \r
-                               + confExec.getParameters());\r
-//             System.out.println("WSUTil-fold: Dump the configured executable:\n" \r
-//                             + confExec.toString());\r
-               AsyncExecutor engine = Configurator.getAsyncEngine(confExec);\r
-               String jobId = engine.submitJob(confExec);\r
-               reportUsage(confExec, logger);\r
-               return jobId;\r
-       }\r
+//     public static <T> String fold(Alignment alignment,\r
+//                     ConfiguredExecutable<T> confExec, Logger logger,\r
+//                     String callingMethod, Limit<T> limit)\r
+//                     throws LimitExceededException, JobSubmissionException {\r
+//             \r
+//             List<FastaSequence> sequences = alignment.getSequences();\r
+//             if (limit != null && limit.isExceeded(sequences)) {\r
+//                     throw LimitExceededException.newLimitExceeded(limit, sequences);\r
+//             }\r
+//             compbio.runner.Util.writeClustalInput(sequences, confExec, '-');\r
+//             System.out.println("WSUtil-fold: Writing the clustal input file on the server: to file: "\r
+//                             + confExec.getInput());\r
+//             System.out.println("WSUtil-fold: The executable is configured with parameters: " \r
+//                             + confExec.getParameters());\r
+////           System.out.println("WSUTil-fold: Dump the configured executable:\n" \r
+////                           + confExec.toString());\r
+//             AsyncExecutor engine = Configurator.getAsyncEngine(confExec);\r
+//             String jobId = engine.submitJob(confExec);\r
+//             reportUsage(confExec, logger);\r
+//             return jobId;\r
+//     }\r
 \r
        static <T> void reportUsage(ConfiguredExecutable<T> confExec, Logger logger) {\r
                if (GAUtils.IS_GA_ENABLED) {\r
@@ -153,8 +154,23 @@ public final class WSUtil {
                        throw LimitExceededException.newLimitExceeded(limit, sequences);\r
                }\r
                log.debug("Method: " + method + " with task: " + confExec.getTaskId());\r
-               // Change this line for RNAalifold testing\r
-               // compbio.runner.Util.writeInput(sequences, confExec);\r
+               compbio.runner.Util.writeInput(sequences, confExec);\r
+               AsyncExecutor engine = Configurator.getAsyncEngine(confExec);\r
+               String jobId = engine.submitJob(confExec);\r
+               reportUsage(confExec, log);\r
+               return jobId;\r
+       }\r
+       \r
+       // Same as analize but Alifold takes clustal input not fasta\r
+       \r
+       public static <T> String fold(List<FastaSequence> sequences,\r
+                       ConfiguredExecutable<T> confExec, Logger log, String method,\r
+                       Limit<T> limit) throws JobSubmissionException {\r
+               if (limit != null && limit.isExceeded(sequences)) {\r
+                       throw LimitExceededException.newLimitExceeded(limit, sequences);\r
+               }\r
+               log.debug("Method: " + method + " with task: " + confExec.getTaskId());\r
+               // This line is different from the above method\r
                compbio.runner.Util.writeClustalInput(sequences, confExec, '-');\r
                AsyncExecutor engine = Configurator.getAsyncEngine(confExec);\r
                String jobId = engine.submitJob(confExec);\r
@@ -193,13 +209,21 @@ public final class WSUtil {
                }\r
        }\r
 \r
-       public static <T> ScoreManager getAnnotation(String jobId, Logger log)\r
+       // test\r
+       // set return type back to ScoreManager\r
+       public static <T> RNAStructScoreManager getAnnotation(String jobId, Logger log)\r
                        throws ResultNotAvailableException {\r
                WSUtil.validateJobId(jobId);\r
                AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
                ConfiguredExecutable<T> aacon = (ConfiguredExecutable<T>) asyncEngine\r
                                .getResults(jobId);\r
-               ScoreManager mas = aacon.getResults();\r
+               \r
+               \r
+               // test RNAalifold\r
+//             ScoreManager mas = aacon.getResults();\r
+               \r
+               RNAStructScoreManager mas = aacon.getResults();\r
+               \r
                log.trace(jobId + " getConservation : " + mas);\r
                return mas;\r
        }\r