Change the way to deal with Limits to simplify wrapper writing and enable couping...
[jabaws.git] / runner / compbio / runner / msa / Probcons.java
index ea9fa1d..2df7f92 100644 (file)
@@ -30,102 +30,69 @@ import compbio.data.sequence.UnknownFileFormatException;
 import compbio.engine.client.Executable;\r
 import compbio.engine.client.PipedExecutable;\r
 import compbio.engine.client.SkeletalExecutable;\r
-import compbio.metadata.Limit;\r
-import compbio.metadata.LimitsManager;\r
 import compbio.metadata.ResultNotAvailableException;\r
 import compbio.runner.Util;\r
 \r
-public class Probcons extends SkeletalExecutable<Probcons> implements\r
-       PipedExecutable<Probcons> {\r
+public class Probcons extends SkeletalExecutable<Probcons>\r
+               implements\r
+                       PipedExecutable<Probcons> {\r
 \r
-    private static Logger log = Logger.getLogger(Probcons.class);\r
+       private static Logger log = Logger.getLogger(Probcons.class);\r
 \r
-    // Cache for Limits information\r
-    private static LimitsManager<Probcons> limits;\r
-    private final static String ANNOTATION = "annotation.txt";\r
+       private final static String ANNOTATION = "annotation.txt";\r
 \r
-    public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
+       public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
 \r
-    /**\r
-     * \r
-     * @param workDirectory\r
-     */\r
-    public Probcons() {\r
-       addParameters(Arrays.asList("-v", "-clustalw", "-annot", ANNOTATION));\r
-       /*\r
-        * Could either have probabilities or the alignment, but not both "-t",\r
-        * "probabilities"\r
+       /**\r
+        * \r
+        * @param workDirectory\r
         */\r
-    }\r
-\r
-    @SuppressWarnings("unchecked")\r
-    @Override\r
-    public Alignment getResults(String workDirectory)\r
-           throws ResultNotAvailableException {\r
-       try {\r
-           return Util.readClustalFile(workDirectory, getOutput());\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
-       } catch (UnknownFileFormatException e) {\r
-           log.error(e.getMessage(), e.getCause());\r
-           throw new ResultNotAvailableException(e);\r
-       } catch (NullPointerException e) {\r
-           log.error(e.getMessage(), e.getCause());\r
-           throw new ResultNotAvailableException(e);\r
+       public Probcons() {\r
+               addParameters(Arrays.asList("-v", "-clustalw", "-annot", ANNOTATION));\r
+               /*\r
+                * Could either have probabilities or the alignment, but not both "-t",\r
+                * "probabilities"\r
+                */\r
        }\r
-    }\r
-\r
-    @Override\r
-    public List<String> getCreatedFiles() {\r
-       return Arrays.asList(getOutput(), ANNOTATION, getError());\r
-    }\r
-\r
-    @Override\r
-    public Probcons setInput(String inFile) {\r
-       String input = getInput();\r
-       super.setInput(inFile);\r
-       // TODO replace with setLast\r
-       cbuilder.setParam(inFile);\r
-       return this;\r
-    }\r
 \r
-    @Override\r
-    public Limit<Probcons> getLimit(String presetName) {\r
-       if (limits == null) {\r
-           limits = getLimits();\r
+       @SuppressWarnings("unchecked")\r
+       @Override\r
+       public Alignment getResults(String workDirectory)\r
+                       throws ResultNotAvailableException {\r
+               try {\r
+                       return Util.readClustalFile(workDirectory, getOutput());\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
+               } catch (UnknownFileFormatException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               } catch (NullPointerException e) {\r
+                       log.error(e.getMessage(), e.getCause());\r
+                       throw new ResultNotAvailableException(e);\r
+               }\r
        }\r
-       Limit<Probcons> limit = null;\r
-       if (limits != null) {\r
-           // this returns default limit if preset is undefined!\r
-           limit = limits.getLimitByName(presetName);\r
-       }\r
-       // If limit is not defined for a particular preset, then return default\r
-       // limit\r
-       if (limit == null) {\r
-           log.debug("Limit for the preset " + presetName\r
-                   + " is not found. Using default");\r
-           limit = limits.getDefaultLimit();\r
+\r
+       @Override\r
+       public List<String> getCreatedFiles() {\r
+               return Arrays.asList(getOutput(), ANNOTATION, getError());\r
        }\r
-       return limit;\r
-    }\r
 \r
-    @Override\r
-    public LimitsManager<Probcons> getLimits() {\r
-       // synchronise on static field\r
-       synchronized (log) {\r
-           if (limits == null) {\r
-               limits = Util.getLimits(this.getClass());\r
-           }\r
+       @Override\r
+       public Probcons setInput(String inFile) {\r
+               String input = getInput();\r
+               super.setInput(inFile);\r
+               // TODO replace with setLast\r
+               cbuilder.setParam(inFile);\r
+               return this;\r
        }\r
-       return limits;\r
-    }\r
 \r
-    @Override\r
-    public Class<? extends Executable<?>> getType() {\r
-       return this.getClass();\r
-    }\r
+       @SuppressWarnings("unchecked")\r
+       @Override\r
+       public Class<Executable<Probcons>> getType() {\r
+               return (Class<Executable<Probcons>>) this.getClass();\r
+       }\r
 }\r