Reverted some changes I made for testing back to their original states.
authorDaniel Barton <daluke.barton@gmail.com>
Wed, 21 Aug 2013 11:13:40 +0000 (12:13 +0100)
committerDaniel Barton <daluke.barton@gmail.com>
Wed, 21 Aug 2013 11:13:40 +0000 (12:13 +0100)
runner/compbio/runner/Util.java
webservices/compbio/ws/client/Jws2Client.java
webservices/compbio/ws/server/RNAalifoldWS.java
webservices/compbio/ws/server/WSUtil.java

index f9106ca..6f0ec09 100644 (file)
@@ -38,12 +38,13 @@ import java.util.Scanner;
 \r
 \r
 \r
+\r
 import org.apache.log4j.Logger;\r
 \r
 import compbio.data.sequence.Alignment;\r
 import compbio.data.sequence.ClustalAlignmentUtil;\r
 import compbio.data.sequence.FastaSequence;\r
-import compbio.data.sequence.RNAStruct;\r
+import compbio.data.sequence.RNAStructScoreManager;\r
 import compbio.data.sequence.Score;\r
 import compbio.data.sequence.ScoreManager;\r
 import compbio.data.sequence.Range;\r
@@ -167,7 +168,7 @@ public final class Util {
        }\r
 \r
        \r
-       public static ScoreManager readRNAStruct(String workDirectory,\r
+       public static RNAStructScoreManager readRNAStruct(String workDirectory,\r
                        String structFile) throws IOException, FileNotFoundException {\r
                \r
                assert !compbio.util.Util.isEmpty(workDirectory);\r
index ce4980d..ae38d9f 100644 (file)
@@ -50,7 +50,6 @@ import compbio.data.msa.RegistryWS;
 import compbio.data.msa.SequenceAnnotation;\r
 import compbio.data.sequence.Alignment;\r
 import compbio.data.sequence.FastaSequence;\r
-import compbio.data.sequence.RNAStruct;\r
 import compbio.data.sequence.ScoreManager;\r
 import compbio.data.sequence.ClustalAlignmentUtil;\r
 import compbio.data.sequence.SequenceUtil;\r
@@ -176,7 +175,9 @@ public class Jws2Client {
                                ScoreManager result = analize(inputFile,\r
                                                ((SequenceAnnotation<T>) msaws), preset, customOptions);\r
 \r
-                               System.out.println(result\.asRNAStruct().toString());\r
+                               // A System.out.println just for testing!\r
+                               System.out.println(result.toString());\r
+                               \r
                                IOHelper.writeOut(writer, result);\r
                        } else if (service.getServiceType() == MsaWS.class) {\r
                                alignment = align(inputFile, (MsaWS<T>) msaws, preset,\r
@@ -530,60 +531,60 @@ public class Jws2Client {
         * @return String\r
         */\r
        \r
-       static <T> String fold(File file, FoldWS<T> foldws, Preset<T> preset,\r
-                       List<Option<T>> customOptions) {\r
-               FileInputStream instream = null;\r
-               Alignment alignment = null;\r
-               String rnastruct = null;\r
-               try {\r
-                       instream = new FileInputStream(file);\r
-                       alignment = ClustalAlignmentUtil.readClustalFile(instream);\r
-                       instream.close();\r
-                       String jobId = null;\r
-                       if (customOptions != null && preset != null) {\r
-                               System.out.println("WARN: Parameters (-f) are defined together"\r
-                                               + "with a preset (-r), ignoring preset! ");\r
-                       }\r
-                       if (customOptions != null) {\r
-                               jobId = foldws.customFold(alignment, customOptions);\r
-                       } else if (preset != null) {\r
-                               jobId = foldws.presetFold(alignment, preset);\r
-                       } else {\r
-                               jobId = foldws.fold(alignment);\r
-                       }\r
-                       System.out.println("\n\ncalling fold.........");\r
-                       Thread.sleep(1000);\r
-                       rnastruct = foldws.getResult(jobId);\r
-                               \r
-               } catch (IOException e) {\r
-                       System.err.println("Exception while reading the input file. Exception details: ");\r
-                       e.printStackTrace();\r
-               } catch (UnknownFileFormatException e) {\r
-                       System.err.println("Exception while reading input file. Doesnt look like a Clustal format file");\r
-                       e.printStackTrace();\r
-               } catch (JobSubmissionException e) {\r
-                       System.err.println("Exception while submitting job to the web server. ");\r
-                       e.printStackTrace();\r
-               } catch (ResultNotAvailableException e) {\r
-                       System.err.println("Exception while waiting for results. Exception details: ");\r
-                       e.printStackTrace();\r
-               } catch (InterruptedException ignored) {\r
-                       // ignore and propagate an interruption\r
-                       Thread.currentThread().interrupt();\r
-               } catch (WrongParameterException e) {\r
-                       e.printStackTrace();\r
-               } finally {\r
-                       if (instream != null) {\r
-                               try {\r
-                                       instream.close();\r
-                               } catch (IOException ignored) {\r
-                                       // ignore\r
-                               }\r
-                       }\r
-               }\r
-               return rnastruct;\r
-       }\r
-               \r
+//     static <T> String fold(File file, FoldWS<T> foldws, Preset<T> preset,\r
+//                     List<Option<T>> customOptions) {\r
+//             FileInputStream instream = null;\r
+//             Alignment alignment = null;\r
+//             String rnastruct = null;\r
+//             try {\r
+//                     instream = new FileInputStream(file);\r
+//                     alignment = ClustalAlignmentUtil.readClustalFile(instream);\r
+//                     instream.close();\r
+//                     String jobId = null;\r
+//                     if (customOptions != null && preset != null) {\r
+//                             System.out.println("WARN: Parameters (-f) are defined together"\r
+//                                             + "with a preset (-r), ignoring preset! ");\r
+//                     }\r
+//                     if (customOptions != null) {\r
+//                             jobId = foldws.customFold(alignment, customOptions);\r
+//                     } else if (preset != null) {\r
+//                             jobId = foldws.presetFold(alignment, preset);\r
+//                     } else {\r
+//                             jobId = foldws.fold(alignment);\r
+//                     }\r
+//                     System.out.println("\n\ncalling fold.........");\r
+//                     Thread.sleep(1000);\r
+//                     rnastruct = foldws.getResult(jobId);\r
+//                             \r
+//             } catch (IOException e) {\r
+//                     System.err.println("Exception while reading the input file. Exception details: ");\r
+//                     e.printStackTrace();\r
+//             } catch (UnknownFileFormatException e) {\r
+//                     System.err.println("Exception while reading input file. Doesnt look like a Clustal format file");\r
+//                     e.printStackTrace();\r
+//             } catch (JobSubmissionException e) {\r
+//                     System.err.println("Exception while submitting job to the web server. ");\r
+//                     e.printStackTrace();\r
+//             } catch (ResultNotAvailableException e) {\r
+//                     System.err.println("Exception while waiting for results. Exception details: ");\r
+//                     e.printStackTrace();\r
+//             } catch (InterruptedException ignored) {\r
+//                     // ignore and propagate an interruption\r
+//                     Thread.currentThread().interrupt();\r
+//             } catch (WrongParameterException e) {\r
+//                     e.printStackTrace();\r
+//             } finally {\r
+//                     if (instream != null) {\r
+//                             try {\r
+//                                     instream.close();\r
+//                             } catch (IOException ignored) {\r
+//                                     // ignore\r
+//                             }\r
+//                     }\r
+//             }\r
+//             return rnastruct;\r
+//     }\r
+//             \r
        /**\r
         * Prints Jws2Client usage information to standard out\r
         * \r
index beca1dc..a6ed826 100644 (file)
@@ -9,7 +9,6 @@ import org.apache.log4j.Logger;
 import compbio.data.msa.JABAService;\r
 import compbio.data.msa.SequenceAnnotation;\r
 import compbio.data.sequence.FastaSequence;\r
-import compbio.data.sequence.RNAStructScoreManager;\r
 import compbio.engine.client.ConfiguredExecutable;\r
 import compbio.metadata.JobSubmissionException;\r
 import compbio.metadata.LimitExceededException;\r
@@ -32,40 +31,6 @@ public class RNAalifoldWS extends SequenceAnnotationService<RNAalifold>
                super (new RNAalifold(), log);\r
        }\r
 \r
-       \r
-       // for testing\r
-       @Override\r
-       public RNAStructScoreManager getAnnotation(String jobId) \r
-                       throws ResultNotAvailableException {\r
-               return WSUtil.getAnnotation(jobId, log);\r
-       }\r
-       \r
-       @Override\r
-       public String analize(List<FastaSequence> sequences)\r
-                       throws UnsupportedRuntimeException, LimitExceededException,\r
-                       JobSubmissionException {\r
-               WSUtil.validateFastaInput(sequences);\r
-               ConfiguredExecutable<RNAalifoldWS> confRNAalifold = init(sequences);\r
-               return WSUtil.fold(sequences, confRNAalifold, log, "analize",\r
-                               getLimit(""));\r
-       }\r
-\r
-       @Override\r
-       public String customAnalize(List<FastaSequence> sequences,\r
-                       List<Option<RNAalifold>> options) throws UnsupportedRuntimeException,\r
-                       LimitExceededException, JobSubmissionException,\r
-                       WrongParameterException {\r
-               WSUtil.validateFastaInput(sequences);\r
-               ConfiguredExecutable<RNAalifold> confRNAalifold = init(sequences);\r
-               \r
-               List<String> params = WSUtil.getCommands(options,\r
-                               AACon.KEY_VALUE_SEPARATOR);\r
-               confRNAalifold.addParameters(params);\r
-               return WSUtil.fold(sequences, confRNAalifold, log, "customAnalize",\r
-                               getLimit(""));\r
-       }\r
-       \r
-       \r
        /*\r
         * No presets are supported, thus the result of this call will be as simple\r
         * call to analize without parameters\r
index a3f96d8..e80b1e5 100644 (file)
@@ -27,7 +27,6 @@ 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
@@ -209,9 +208,7 @@ public final class WSUtil {
                }\r
        }\r
 \r
-       // test\r
-       // set return type back to ScoreManager\r
-       public static <T> RNAStructScoreManager getAnnotation(String jobId, Logger log)\r
+       public static <T> ScoreManager getAnnotation(String jobId, Logger log)\r
                        throws ResultNotAvailableException {\r
                WSUtil.validateJobId(jobId);\r
                AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
@@ -219,10 +216,7 @@ public final class WSUtil {
                                .getResults(jobId);\r
                \r
                \r
-               // test RNAalifold\r
-//             ScoreManager mas = aacon.getResults();\r
-               \r
-               RNAStructScoreManager mas = aacon.getResults();\r
+               ScoreManager mas = aacon.getResults();\r
                \r
                log.trace(jobId + " getConservation : " + mas);\r
                return mas;\r