RNAStruct replaced by RNAStructScoreManager. Why does webservice
[jabaws.git] / runner / compbio / runner / structure / RNAalifold.java
index 0e9e20f..c6c79ec 100644 (file)
-package compbio.runner.structure;
-
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-
-
-
-
-
-import org.apache.log4j.Logger;
-
-import compbio.data.sequence.ScoreManager;
-import compbio.data.sequence.RNAStruct;
-import compbio.data.sequence.UnknownFileFormatException;
-import compbio.engine.client.PipedExecutable;
-import compbio.engine.client.SkeletalExecutable;
-import compbio.metadata.ResultNotAvailableException;
-import compbio.runner.Util;
-
-
-import compbio.engine.client.CommandBuilder;
-
-public class RNAalifold extends SkeletalExecutable<RNAalifold> 
-               implements PipedExecutable<RNAalifold> {
-       
-       
-       private static Logger log = Logger.getLogger(RNAalifold.class);
-
-       // May not be necessary as defult is "<space>" but still dont know
-       // How to deal with different key value separators for different params
-       public static final String KEY_VALUE_SEPARATOR = " ";
-       
-       public RNAalifold() {
-               super(KEY_VALUE_SEPARATOR);
-       }
-       
-       @Override
-       public RNAalifold setOutput(String outFile) {
-               super.setOutput(outFile);
-               return this;
-       }
-       
-       @Override
-       public RNAalifold setInput(String inFile) {
-               cbuilder.setLast(inFile);
-               super.setInput(inFile);
-               return this;
-       }
-       
-       @SuppressWarnings("unchecked")
-       @Override
-       public Class<RNAalifold> getType() {
-               return (Class<RNAalifold>) this.getClass();
-       }
-       
-       @SuppressWarnings("unchecked")
-       @Override
-       // PlaceHolder method
-       public ScoreManager getResults(String workDirectory)
-                       throws ResultNotAvailableException {
-               try {
-                       return Util.readRNAStruct(workDirectory, getOutput());
-                       
-               } catch (FileNotFoundException e) {
-                       log.error(e.getMessage(), e.getCause());
-                       throw new ResultNotAvailableException(e);
-               } catch (IOException e) {
-                       log.error(e.getMessage(), e.getCause());
-                       throw new ResultNotAvailableException(e);
-               }
-       }
-
-
-       // the new currently used methods for reading are found in 
-       // - compbio.data.sequence.SequenceUtil and 
-       // - compbio.runner.Util
-       
-       // Simple and generic methods for reading a whole file
-//     private static String readRNAStruct(String workDirectory,
-//                     String structFile) throws IOException, FileNotFoundException {
-//             assert !compbio.util.Util.isEmpty(workDirectory);
-//             assert !compbio.util.Util.isEmpty(structFile);
-//             File sfile = new File(compbio.engine.client.Util.getFullPath(
-//                             workDirectory, structFile));
-//             log.trace("RNAALIFOLD OUTPUT FILE PATH: " + sfile.getAbsolutePath());
-//             if(!(sfile.exists() && sfile.length() > 0)) {
-//                     throw new FileNotFoundException("Result for the jobId "
-//                                     + workDirectory + "with file name " + structFile
-//                                     + " is not found!");
-//             }
-//             return readFile(sfile);
-//     }
-//     
-//     private static BufferedReader input;
-//     public static String readFile(File inputFile) throws 
-//                     FileNotFoundException, IOException {
-//             
-//             input   = new BufferedReader(new FileReader(inputFile));
-//             
-//             String file = new String();
-//             String line = new String();
-//             
-//             while (true) {
-//                     line = input.readLine();
-//                     
-//                     if (line != null) {
-//                             file = file + line + "\r\n";
-//                     } else break;
-//             }
-//             // Close file
-//             input.close();
-//             return file;
-//     }
-       
-}
+package compbio.runner.structure;\r
+\r
+\r
+import java.io.FileNotFoundException;\r
+import java.io.IOException;\r
+import java.util.Arrays;\r
+import java.util.List;\r
+\r
+\r
+\r
+\r
+\r
+import org.apache.log4j.Logger;\r
+\r
+import compbio.data.sequence.ScoreManager;\r
+import compbio.data.sequence.RNAStructScoreManager;\r
+import compbio.data.sequence.UnknownFileFormatException;\r
+import compbio.engine.client.PipedExecutable;\r
+import compbio.engine.client.SkeletalExecutable;\r
+import compbio.metadata.ResultNotAvailableException;\r
+import compbio.runner.Util;\r
+\r
+\r
+import compbio.engine.client.CommandBuilder;\r
+\r
+public class RNAalifold extends SkeletalExecutable<RNAalifold> \r
+               implements PipedExecutable<RNAalifold> {\r
+       \r
+       \r
+       private static Logger log = Logger.getLogger(RNAalifold.class);\r
+\r
+       // May not be necessary as defult is "<space>" but still dont know\r
+       // How to deal with different key value separators for different params\r
+       public static final String KEY_VALUE_SEPARATOR = " ";\r
+       \r
+       public RNAalifold() {\r
+               super(KEY_VALUE_SEPARATOR);\r
+       }\r
+       \r
+       @Override\r
+       public RNAalifold setOutput(String outFile) {\r
+               super.setOutput(outFile);\r
+               return this;\r
+       }\r
+       \r
+       @Override\r
+       public RNAalifold setInput(String inFile) {\r
+               cbuilder.setLast(inFile);\r
+               super.setInput(inFile);\r
+               return this;\r
+       }\r
+       \r
+       @SuppressWarnings("unchecked")\r
+       @Override\r
+       public Class<RNAalifold> getType() {\r
+               return (Class<RNAalifold>) this.getClass();\r
+       }\r
+       \r
+       @SuppressWarnings("unchecked")\r
+       @Override\r
+       public RNAStructScoreManager getResults(String workDirectory)\r
+                       throws ResultNotAvailableException {\r
+               try {\r
+                       return Util.readRNAStruct(workDirectory, getOutput());\r
+                       \r
+               } catch (FileNotFoundException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               } catch (IOException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               }\r
+       }\r
+\r
+}\r