FUTURE TODO\r
-Registry for jalview WS - gives list of web services providers\r
+\r
Registry for jalview WS - gives list of web services providers\r
- checks the status of the web services\r
- web service providers gives list of available WS\r
Prepare HMM profile for the user alignment and call jnet - instead of jpred. \r
JPRED REWRITING Wrap Jpred\r
Wrap scanPS \r
-Look at SIFTS at EBI \r
+\r
+CBS soft: \r
+Transmembrane regions\r
+Phosphorilation sites\r
+Glycozilation sites\r
+Signal P\r
+\r
+They all have SOAP WS...\r
+ \r
+CDD domains\r
+PFAM domains\r
\r
JPRED IMPROVEMENTS\r
1) Make sure PSIBLAST does not generate large output (e.g. one approach is to stop on the first iteration\r
at compbio.ws.client.Jws2Client.<init>(Jws2Client.java:179)\r
at compbio.ws.client.Jws2Client.main(Jws2Client.java:483)\r
\r
- \r
-Need to pass predicted ranges to the client too - some are not straightforward to devise. \r
-This may require changes to SequenceAnnotation\r
+ScoreManager should output scores properly \r
+\r
+Check the WS input and reject it on submission rather then of access with error message\r
\r
Globprot need a proper reference to bio python and sav_gol binaries -> they should be \r
somehow taken from disembl. \r
\r
import compbio.engine.client.CommandBuilder.Parameter;\r
import compbio.engine.conf.PropertyHelperManager;\r
+import compbio.metadata.Limit;\r
+import compbio.metadata.LimitsManager;\r
import compbio.util.PropertyHelper;\r
import compbio.util.Util;\r
\r
public abstract class SkeletalExecutable<T> implements Executable<T> {\r
\r
- protected static final PropertyHelper ph = PropertyHelperManager\r
- .getPropertyHelper();\r
+ protected static final PropertyHelper ph = PropertyHelperManager\r
+ .getPropertyHelper();\r
\r
- private static Logger log = Logger.getLogger(SkeletalExecutable.class);\r
+ private static Logger log = Logger.getLogger(SkeletalExecutable.class);\r
\r
- protected String inputFile = "input.txt";\r
- protected String outputFile = "output.txt";\r
- protected String errorFile = "error.txt";\r
+ // Cache for Limits information\r
+ private LimitsManager<T> limits;\r
\r
- private boolean isInputSet = false;\r
- private boolean isOutputSet = false;\r
- private boolean isErrorSet = false;\r
+ protected String inputFile = "input.txt";\r
+ protected String outputFile = "output.txt";\r
+ protected String errorFile = "error.txt";\r
\r
- /**\r
- * This has to allow duplicate parameters as different options may have the\r
- * same value e.g. Muscle -weight1 clustalw -weight2 clustalw\r
- */\r
- protected CommandBuilder<T> cbuilder;\r
+ private boolean isInputSet = false;\r
+ private boolean isOutputSet = false;\r
+ private boolean isErrorSet = false;\r
\r
- public SkeletalExecutable() {\r
- cbuilder = new CommandBuilder<T>(" ");\r
- }\r
+ /**\r
+ * This has to allow duplicate parameters as different options may have the\r
+ * same value e.g. Muscle -weight1 clustalw -weight2 clustalw\r
+ */\r
+ protected CommandBuilder<T> cbuilder;\r
+\r
+ public SkeletalExecutable() {\r
+ cbuilder = new CommandBuilder<T>(" ");\r
+ }\r
\r
- public SkeletalExecutable(String parameterKeyValueDelimiter) {\r
- assert parameterKeyValueDelimiter != null;\r
- cbuilder = new CommandBuilder<T>(parameterKeyValueDelimiter);\r
- }\r
+ public SkeletalExecutable(String parameterKeyValueDelimiter) {\r
+ assert parameterKeyValueDelimiter != null;\r
+ cbuilder = new CommandBuilder<T>(parameterKeyValueDelimiter);\r
+ }\r
\r
- public SkeletalExecutable<T> setInput(String inFile) {\r
- if (compbio.util.Util.isEmpty(inFile)) {\r
- throw new IllegalArgumentException("Input file must not be NULL");\r
+ public SkeletalExecutable<T> setInput(String inFile) {\r
+ if (compbio.util.Util.isEmpty(inFile)) {\r
+ throw new IllegalArgumentException("Input file must not be NULL");\r
+ }\r
+ this.inputFile = inFile;\r
+ this.isInputSet = true;\r
+ return this;\r
}\r
- this.inputFile = inFile;\r
- this.isInputSet = true;\r
- return this;\r
- }\r
-\r
- public SkeletalExecutable<T> setOutput(String outFile) {\r
- if (compbio.util.Util.isEmpty(outFile)\r
- || PathValidator.isAbsolutePath(outFile)) {\r
- throw new IllegalArgumentException(\r
- "Output file must not be NULL and Absolute path could not be used! Please provide the filename only. Value provided: "\r
- + outFile);\r
+\r
+ public SkeletalExecutable<T> setOutput(String outFile) {\r
+ if (compbio.util.Util.isEmpty(outFile)\r
+ || PathValidator.isAbsolutePath(outFile)) {\r
+ throw new IllegalArgumentException(\r
+ "Output file must not be NULL and Absolute path could not be used! Please provide the filename only. Value provided: "\r
+ + outFile);\r
+ }\r
+ this.outputFile = outFile;\r
+ this.isOutputSet = true;\r
+ return this;\r
}\r
- this.outputFile = outFile;\r
- this.isOutputSet = true;\r
- return this;\r
- }\r
-\r
- public SkeletalExecutable<T> setError(String errFile) {\r
- if (compbio.util.Util.isEmpty(errFile)\r
- || PathValidator.isAbsolutePath(errFile)) {\r
- throw new IllegalArgumentException(\r
- "Error file must not be NULL and Absolute path could not be used! Please provide the filename only. Value provided: "\r
- + errFile);\r
+\r
+ public SkeletalExecutable<T> setError(String errFile) {\r
+ if (compbio.util.Util.isEmpty(errFile)\r
+ || PathValidator.isAbsolutePath(errFile)) {\r
+ throw new IllegalArgumentException(\r
+ "Error file must not be NULL and Absolute path could not be used! Please provide the filename only. Value provided: "\r
+ + errFile);\r
+ }\r
+ this.errorFile = errFile;\r
+ this.isErrorSet = true;\r
+ return this;\r
+ }\r
+\r
+ @Override\r
+ public CommandBuilder<T> getParameters(ExecProvider provider) {\r
+ /*\r
+ * Prevent modification of the parameters unintentionally. This is\r
+ * important to preserve executable parameters intact as engine could\r
+ * add things into the array as it see fit. For instance\r
+ * ExecutableWrapper (part of local engines) add command line as the\r
+ * first element of an array.\r
+ */\r
+ paramValueUpdater();\r
+ return cbuilder;\r
+ }\r
+\r
+ @Override\r
+ public Executable<T> addParameters(List<String> parameters) {\r
+ cbuilder.addParams(parameters);\r
+ return this;\r
+ }\r
+\r
+ public Executable<T> setParameter(String parameter) {\r
+ cbuilder.setParam(parameter);\r
+ return this;\r
}\r
- this.errorFile = errFile;\r
- this.isErrorSet = true;\r
- return this;\r
- }\r
-\r
- @Override\r
- public CommandBuilder<T> getParameters(ExecProvider provider) {\r
- /*\r
- * Prevent modification of the parameters unintentionally. This is\r
- * important to preserve executable parameters intact as engine could\r
- * add things into the array as it see fit. For instance\r
- * ExecutableWrapper (part of local engines) add command line as the\r
- * first element of an array.\r
+\r
+ /**\r
+ * This is a generic method of changing values of the parameters with\r
+ * properties\r
+ * \r
+ * This method iterates via commands for an executable finding matches from\r
+ * the Executable.properties file and replacing values in CommandBuilder\r
+ * with a combination of value from CommandBuilder to merge path from\r
+ * properties\r
*/\r
- paramValueUpdater();\r
- return cbuilder;\r
- }\r
-\r
- @Override\r
- public Executable<T> addParameters(List<String> parameters) {\r
- cbuilder.addParams(parameters);\r
- return this;\r
- }\r
-\r
- public Executable<T> setParameter(String parameter) {\r
- cbuilder.setParam(parameter);\r
- return this;\r
- }\r
-\r
- /**\r
- * This is a generic method of changing values of the parameters with\r
- * properties\r
- * \r
- * This method iterates via commands for an executable finding matches from\r
- * the Executable.properties file and replacing values in CommandBuilder\r
- * with a combination of value from CommandBuilder to merge path from\r
- * properties\r
- */\r
- void paramValueUpdater() {\r
- for (Parameter command : cbuilder.getCommandList()) {\r
- if (command.value == null) {\r
- continue;\r
- }\r
- String propertyPath = compbio.engine.client.Util.getExecProperty(\r
- command.name + ".path", getType());\r
- if (Util.isEmpty(propertyPath)) {\r
- continue;\r
- }\r
- if (new File(command.value).isAbsolute()) {\r
- // Matrix can be found so no actions necessary\r
- // This method has been called already and the matrix name\r
- // is modified to contain full path // no further actions is\r
- // necessary\r
- continue;\r
- }\r
- String absMatrixPath = compbio.engine.client.Util\r
- .convertToAbsolute(propertyPath);\r
- command.value = absMatrixPath + File.separator + command.value;\r
- cbuilder.setParam(command);\r
+ void paramValueUpdater() {\r
+ for (Parameter command : cbuilder.getCommandList()) {\r
+ if (command.value == null) {\r
+ continue;\r
+ }\r
+ String propertyPath = compbio.engine.client.Util.getExecProperty(\r
+ command.name + ".path", getType());\r
+ if (Util.isEmpty(propertyPath)) {\r
+ continue;\r
+ }\r
+ if (new File(command.value).isAbsolute()) {\r
+ // Matrix can be found so no actions necessary\r
+ // This method has been called already and the matrix name\r
+ // is modified to contain full path // no further actions is\r
+ // necessary\r
+ continue;\r
+ }\r
+ String absMatrixPath = compbio.engine.client.Util\r
+ .convertToAbsolute(propertyPath);\r
+ command.value = absMatrixPath + File.separator + command.value;\r
+ cbuilder.setParam(command);\r
+ }\r
}\r
- }\r
-\r
- /**\r
- * This method cannot really tell whether the files has actually been\r
- * created or not. It must be overridden as required.\r
- * \r
- * @see compbio.engine.client.Executable#getCreatedFiles()\r
- */\r
- @Override\r
- public List<String> getCreatedFiles() {\r
- return Arrays.asList(getOutput(), getError());\r
- }\r
-\r
- @Override\r
- public String getInput() {\r
- return inputFile;\r
- }\r
-\r
- protected boolean isInputSet() {\r
- return isInputSet;\r
- }\r
-\r
- protected boolean isOutputSet() {\r
- return isOutputSet;\r
- }\r
-\r
- protected boolean isErrorSet() {\r
- return isErrorSet;\r
- }\r
-\r
- @Override\r
- public String getOutput() {\r
- return outputFile;\r
- }\r
-\r
- @Override\r
- public String getError() {\r
- return errorFile;\r
- }\r
-\r
- @Override\r
- public String toString() {\r
- String value = "Input: " + this.getInput() + "\n";\r
- value += "Output: " + this.getOutput() + "\n";\r
- value += "Error: " + this.getError() + "\n";\r
- value += "Class: " + this.getClass() + "\n";\r
- value += "Params: " + cbuilder + "\n";\r
- return value;\r
- }\r
-\r
- @Override\r
- public Executable<?> loadRunConfiguration(RunConfiguration rconfig) {\r
- if (!compbio.util.Util.isEmpty(rconfig.getOutput())) {\r
- setOutput(rconfig.getOutput());\r
+\r
+ /**\r
+ * This method cannot really tell whether the files has actually been\r
+ * created or not. It must be overridden as required.\r
+ * \r
+ * @see compbio.engine.client.Executable#getCreatedFiles()\r
+ */\r
+ @Override\r
+ public List<String> getCreatedFiles() {\r
+ return Arrays.asList(getOutput(), getError());\r
}\r
- if (!compbio.util.Util.isEmpty(rconfig.getError())) {\r
- setError(rconfig.getError());\r
+\r
+ @Override\r
+ public String getInput() {\r
+ return inputFile;\r
}\r
- if (!compbio.util.Util.isEmpty(rconfig.getInput())) {\r
- setInput(rconfig.getInput());\r
+\r
+ protected boolean isInputSet() {\r
+ return isInputSet;\r
}\r
- this.cbuilder = (CommandBuilder<T>) rconfig.getParameters();\r
- return this;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (obj == null) {\r
- return false;\r
+\r
+ protected boolean isOutputSet() {\r
+ return isOutputSet;\r
}\r
- if (!(obj instanceof SkeletalExecutable<?>)) {\r
- return false;\r
+\r
+ protected boolean isErrorSet() {\r
+ return isErrorSet;\r
}\r
- SkeletalExecutable<?> exec = (SkeletalExecutable<?>) obj;\r
- if (!Util.isEmpty(this.inputFile) && !Util.isEmpty(exec.inputFile)) {\r
- if (!this.inputFile.equals(exec.inputFile)) {\r
- return false;\r
- }\r
+\r
+ @Override\r
+ public String getOutput() {\r
+ return outputFile;\r
}\r
- if (!Util.isEmpty(this.outputFile) && !Util.isEmpty(exec.outputFile)) {\r
- if (!this.outputFile.equals(exec.outputFile)) {\r
- return false;\r
- }\r
+\r
+ @Override\r
+ public String getError() {\r
+ return errorFile;\r
}\r
- if (!Util.isEmpty(this.errorFile) && !Util.isEmpty(exec.errorFile)) {\r
- if (!this.errorFile.equals(exec.errorFile)) {\r
- return false;\r
- }\r
+\r
+ @Override\r
+ public String toString() {\r
+ String value = "Input: " + this.getInput() + "\n";\r
+ value += "Output: " + this.getOutput() + "\n";\r
+ value += "Error: " + this.getError() + "\n";\r
+ value += "Class: " + this.getClass() + "\n";\r
+ value += "Params: " + cbuilder + "\n";\r
+ return value;\r
}\r
- if (!this.cbuilder.equals(exec.cbuilder)) {\r
- return false;\r
+\r
+ @Override\r
+ public Executable<?> loadRunConfiguration(RunConfiguration rconfig) {\r
+ if (!compbio.util.Util.isEmpty(rconfig.getOutput())) {\r
+ setOutput(rconfig.getOutput());\r
+ }\r
+ if (!compbio.util.Util.isEmpty(rconfig.getError())) {\r
+ setError(rconfig.getError());\r
+ }\r
+ if (!compbio.util.Util.isEmpty(rconfig.getInput())) {\r
+ setInput(rconfig.getInput());\r
+ }\r
+ this.cbuilder = (CommandBuilder<T>) rconfig.getParameters();\r
+ return this;\r
+ }\r
+\r
+ @Override\r
+ public boolean equals(Object obj) {\r
+ if (obj == null) {\r
+ return false;\r
+ }\r
+ if (!(obj instanceof SkeletalExecutable<?>)) {\r
+ return false;\r
+ }\r
+ SkeletalExecutable<?> exec = (SkeletalExecutable<?>) obj;\r
+ if (!Util.isEmpty(this.inputFile) && !Util.isEmpty(exec.inputFile)) {\r
+ if (!this.inputFile.equals(exec.inputFile)) {\r
+ return false;\r
+ }\r
+ }\r
+ if (!Util.isEmpty(this.outputFile) && !Util.isEmpty(exec.outputFile)) {\r
+ if (!this.outputFile.equals(exec.outputFile)) {\r
+ return false;\r
+ }\r
+ }\r
+ if (!Util.isEmpty(this.errorFile) && !Util.isEmpty(exec.errorFile)) {\r
+ if (!this.errorFile.equals(exec.errorFile)) {\r
+ return false;\r
+ }\r
+ }\r
+ if (!this.cbuilder.equals(exec.cbuilder)) {\r
+ return false;\r
+ }\r
+ return true;\r
+ }\r
+\r
+ @Override\r
+ public int hashCode() {\r
+ int code = inputFile.hashCode();\r
+ code += outputFile.hashCode();\r
+ code += errorFile.hashCode();\r
+ code *= this.cbuilder.hashCode();\r
+ return code;\r
+ }\r
+\r
+ public String getClusterSettings() {\r
+ String settings = ph.getProperty(getType().getSimpleName()\r
+ .toLowerCase() + ".cluster.settings");\r
+ return settings == null ? "" : settings;\r
}\r
- return true;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- int code = inputFile.hashCode();\r
- code += outputFile.hashCode();\r
- code += errorFile.hashCode();\r
- code *= this.cbuilder.hashCode();\r
- return code;\r
- }\r
-\r
- public String getClusterSettings() {\r
- String settings = ph.getProperty(getType().getSimpleName()\r
- .toLowerCase()\r
- + ".cluster.settings");\r
- return settings == null ? "" : settings;\r
- }\r
-\r
- /**\r
+\r
+ /**\r
* \r
* @return number of cpus to use on the cluster or 0 if the value is\r
* undefined\r
*/\r
public static int getClusterCpuNum(Class<? extends Executable<?>> type) {\r
int cpus = 0;\r
- String cpuNum = ph.getProperty(type.getSimpleName().toLowerCase()+ ".cluster.cpunum");\r
+ String cpuNum = ph.getProperty(type.getSimpleName().toLowerCase()\r
+ + ".cluster.cpunum");\r
if (compbio.util.Util.isEmpty(cpuNum)) {\r
return 0;\r
}\r
cpus = Integer.parseInt(cpuNum);\r
} catch (NumberFormatException e) {\r
// safe to ignore\r
- log\r
- .debug("Number of cpus to use for cluster execution is defined but could not be parsed as integer! Given value is: "\r
+ log.debug("Number of cpus to use for cluster execution is defined but could not be parsed as integer! Given value is: "\r
+ cpuNum);\r
return 0;\r
}\r
if (cpus < 1 || cpus > 100) {\r
throw new InvalidParameterException(\r
"Number of cpu for cluster execution must be within 1 and 100! "\r
- + "Look at the value of 'tcoffee.cluster.cpunum' property. Given value is "\r
- + cpus);\r
+ + "Look at the value of 'tcoffee.cluster.cpunum' property. Given value is "\r
+ + cpus);\r
}\r
return cpus;\r
}\r
\r
- public abstract Class<? extends Executable<?>> getType();\r
+ @Override\r
+ public Limit<T> getLimit(String presetName) {\r
+\r
+ if (limits == null) {\r
+ limits = getLimits();\r
+ }\r
+\r
+ Limit<T> 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
+ return limit;\r
+ }\r
+\r
+ @Override\r
+ public LimitsManager<T> getLimits() {\r
+ synchronized (SkeletalExecutable.class) {\r
+ if (limits == null) {\r
+ limits = compbio.runner.Util.getLimits(this.getType());\r
+ }\r
+ }\r
+ return limits;\r
+ }\r
+\r
+ /**\r
+ * \r
+ * @return subclasses must return their type\r
+ */\r
+ public abstract Class<Executable<T>> getType();\r
\r
}\r
* separate options options.add(option); } return options; }\r
*/\r
\r
- public static <T> LimitsManager<T> getLimits(\r
- Class<? extends Executable<T>> clazz) {\r
- LimitsManager<T> limits = null;\r
+ public static <T> LimitsManager<T> getLimits(Class<Executable<T>> clazz) {\r
+ LimitsManager<T> limits = new LimitsManager<T>();\r
try {\r
limits = ConfExecutable.getRunnerLimits(clazz);\r
- if (limits == null) {\r
- return null;\r
- }\r
} catch (FileNotFoundException e) {\r
log.warn(\r
"No limits are found for " + clazz + " executable! "\r
+ e.getLocalizedMessage(), e.getCause());\r
- return null;\r
+ // its ok, limit may not be initialized\r
} catch (IOException e) {\r
log.warn("IO exception while attempting to read limits for "\r
+ clazz + " executable! " + e.getLocalizedMessage(),\r
import compbio.engine.client.CommandBuilder;\r
import compbio.engine.client.Executable;\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
/**\r
* Command line\r
\r
private final String ncorePrm = "-t=";\r
\r
- // Cache for Limits information\r
- private static LimitsManager<AACon> limits;\r
-\r
public static final String KEY_VALUE_SEPARATOR = "=";\r
public static final String STAT_FILE = "stat.txt";\r
\r
return this;\r
}\r
\r
+ @SuppressWarnings("unchecked")\r
@Override\r
- public Limit<AACon> getLimit(String presetName) {\r
- if (limits == null) {\r
- limits = getLimits();\r
- }\r
- Limit<AACon> 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
- return limit;\r
- }\r
-\r
- @Override\r
- public LimitsManager<AACon> getLimits() {\r
- // synchronise on static field\r
- synchronized (log) {\r
- if (limits == null) {\r
- limits = Util.getLimits(this.getClass());\r
- }\r
- }\r
- return limits;\r
- }\r
-\r
- @Override\r
- public Class<? extends Executable<?>> getType() {\r
- return this.getClass();\r
+ public Class<Executable<AACon>> getType() {\r
+ return (Class<Executable<AACon>>) this.getClass();\r
}\r
\r
public static String getStatFile() {\r
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
\r
private static Logger log = Logger.getLogger(Disembl.class);\r
\r
- // Cache for Limits information\r
- private static LimitsManager<Disembl> limits;\r
-\r
public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
\r
/**\r
return this;\r
}\r
\r
+ @SuppressWarnings("unchecked")\r
@Override\r
- public Limit<Disembl> getLimit(String presetName) {\r
- if (limits == null) {\r
- limits = getLimits();\r
- }\r
-\r
- Limit<Disembl> 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
- return limit;\r
- }\r
-\r
- @Override\r
- public LimitsManager<Disembl> getLimits() {\r
- // synchronise on static field\r
- synchronized (log) {\r
- if (limits == null) {\r
- limits = Util.getLimits(this.getClass());\r
- }\r
- }\r
- return limits;\r
- }\r
-\r
- @Override\r
- public Class<? extends Executable<?>> getType() {\r
- return this.getClass();\r
+ public Class<Executable<Disembl>> getType() {\r
+ return (Class<Executable<Disembl>>) this.getClass();\r
}\r
\r
}\r
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
\r
private static Logger log = Logger.getLogger(GlobPlot.class);\r
\r
- // Cache for Limits information\r
- private static LimitsManager<GlobPlot> limits;\r
-\r
public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
\r
/* The parameter list there must not contain same values! */\r
return this;\r
}\r
\r
+ @SuppressWarnings("unchecked")\r
@Override\r
- public Limit<GlobPlot> getLimit(String presetName) {\r
- if (limits == null) {\r
- limits = getLimits();\r
- }\r
-\r
- Limit<GlobPlot> 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
- return limit;\r
- }\r
-\r
- @Override\r
- public LimitsManager<GlobPlot> getLimits() {\r
- // synchronise on static field\r
- synchronized (log) {\r
- if (limits == null) {\r
- limits = Util.getLimits(this.getClass());\r
- }\r
- }\r
- return limits;\r
- }\r
-\r
- @Override\r
- public Class<? extends Executable<?>> getType() {\r
- return this.getClass();\r
+ public Class<Executable<GlobPlot>> getType() {\r
+ return (Class<Executable<GlobPlot>>) this.getClass();\r
}\r
\r
}\r
import compbio.engine.client.CommandBuilder;\r
import compbio.engine.client.Executable;\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
\r
private final String ncorePrm = "-n=";\r
\r
- // Cache for Limits information\r
- private static LimitsManager<Jronn> limits;\r
-\r
public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
public static final String STAT_FILE = "stat.txt";\r
\r
return this;\r
}\r
\r
+ @SuppressWarnings("unchecked")\r
@Override\r
- public Limit<Jronn> getLimit(String presetName) {\r
- if (limits == null) {\r
- limits = getLimits();\r
- }\r
- Limit<Jronn> 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
- return limit;\r
- }\r
-\r
- @Override\r
- public LimitsManager<Jronn> getLimits() {\r
- // synchronise on static field\r
- synchronized (log) {\r
- if (limits == null) {\r
- limits = Util.getLimits(this.getClass());\r
- }\r
- }\r
- return limits;\r
- }\r
-\r
- @Override\r
- public Class<? extends Executable<?>> getType() {\r
- return this.getClass();\r
+ public Class<Executable<Jronn>> getType() {\r
+ return (Class<Executable<Jronn>>) this.getClass();\r
}\r
\r
public static String getStatFile() {\r
import compbio.data.sequence.UnknownFileFormatException;\r
import compbio.engine.client.Executable;\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 ClustalW extends SkeletalExecutable<ClustalW> {\r
\r
- private static Logger log = Logger.getLogger(ClustalW.class);\r
- private static final String EXEC_STAT_FILE = "stat.log";\r
- private static final String TREE_FILE_EXT = ".dnd";\r
-\r
- public static final String KEY_VALUE_SEPARATOR = "=";\r
-\r
- // Cache for Limits information\r
- private static LimitsManager<ClustalW> limits;\r
-\r
- public ClustalW() {\r
- super(KEY_VALUE_SEPARATOR);\r
- addParameters(Arrays.asList("-OUTORDER=ALIGNED", "-QUIET", "-STATS="\r
- + EXEC_STAT_FILE));\r
- // set default in, outs and err files\r
- this.setInput(super.inputFile);\r
- this.setOutput(super.outputFile);\r
- this.setError(super.errorFile);\r
- }\r
-\r
- @Override\r
- public ClustalW setOutput(String outFile) {\r
- super.setOutput(outFile);\r
- cbuilder.setParam("-OUTFILE=" + outFile);\r
- return this;\r
- }\r
-\r
- @Override\r
- public ClustalW setInput(String inFile) {\r
- super.setInput(inFile);\r
- cbuilder.setParam("-INFILE=" + inFile);\r
- return this;\r
- }\r
-\r
- @SuppressWarnings("unchecked")\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
-\r
- @Override\r
- public List<String> getCreatedFiles() {\r
- return Arrays.asList(getOutput(), EXEC_STAT_FILE,\r
- convertInputNameToTreeName());\r
- }\r
-\r
- /*\r
- * Clustal output tree with same name as input file but .dnd extension e.g.\r
- * this methods do similar conversion TO122.fasta -> TO122.dnd or\r
- * TO122.fasta.in -> TO122.fasta.dnd It does not seems that there is any\r
- * limits on the name length\r
- * \r
- * @return\r
- */\r
- private String convertInputNameToTreeName() {\r
- assert super.getInput() != null;\r
- int dotIdx = getInput().lastIndexOf(".");\r
- String treeFileName = "";\r
- if (dotIdx > 0) {\r
- treeFileName = getInput().substring(0, dotIdx);\r
+ private static Logger log = Logger.getLogger(ClustalW.class);\r
+ private static final String EXEC_STAT_FILE = "stat.log";\r
+ private static final String TREE_FILE_EXT = ".dnd";\r
+\r
+ public static final String KEY_VALUE_SEPARATOR = "=";\r
+\r
+ public ClustalW() {\r
+ super(KEY_VALUE_SEPARATOR);\r
+ addParameters(Arrays.asList("-OUTORDER=ALIGNED", "-QUIET", "-STATS="\r
+ + EXEC_STAT_FILE));\r
+ // set default in, outs and err files\r
+ this.setInput(super.inputFile);\r
+ this.setOutput(super.outputFile);\r
+ this.setError(super.errorFile);\r
}\r
- return treeFileName + TREE_FILE_EXT;\r
- }\r
\r
- public static String getStatFile() {\r
- return EXEC_STAT_FILE;\r
- }\r
+ @Override\r
+ public ClustalW setOutput(String outFile) {\r
+ super.setOutput(outFile);\r
+ cbuilder.setParam("-OUTFILE=" + outFile);\r
+ return this;\r
+ }\r
\r
- @Override\r
- public Limit<ClustalW> getLimit(String presetName) {\r
+ @Override\r
+ public ClustalW setInput(String inFile) {\r
+ super.setInput(inFile);\r
+ cbuilder.setParam("-INFILE=" + inFile);\r
+ return this;\r
+ }\r
\r
- if (limits == null) {\r
- limits = getLimits();\r
+ @SuppressWarnings("unchecked")\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
\r
- Limit<ClustalW> limit = null;\r
- if (limits != null) {\r
- // this returns default limit if preset is undefined!\r
- limit = limits.getLimitByName(presetName);\r
+ @Override\r
+ public List<String> getCreatedFiles() {\r
+ return Arrays.asList(getOutput(), EXEC_STAT_FILE,\r
+ convertInputNameToTreeName());\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
+ /*\r
+ * Clustal output tree with same name as input file but .dnd extension e.g.\r
+ * this methods do similar conversion TO122.fasta -> TO122.dnd or\r
+ * TO122.fasta.in -> TO122.fasta.dnd It does not seems that there is any\r
+ * limits on the name length\r
+ * \r
+ * @return\r
+ */\r
+ private String convertInputNameToTreeName() {\r
+ assert super.getInput() != null;\r
+ int dotIdx = getInput().lastIndexOf(".");\r
+ String treeFileName = "";\r
+ if (dotIdx > 0) {\r
+ treeFileName = getInput().substring(0, dotIdx);\r
+ }\r
+ return treeFileName + TREE_FILE_EXT;\r
}\r
- return limit;\r
- }\r
-\r
- @Override\r
- public LimitsManager<ClustalW> getLimits() {\r
- // synchronise on static field\r
- synchronized (log) {\r
- if (limits == null) {\r
- limits = Util.getLimits(this.getClass());\r
- }\r
+\r
+ public static String getStatFile() {\r
+ return EXEC_STAT_FILE;\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<ClustalW>> getType() {\r
+ return (Class<Executable<ClustalW>>) this.getClass();\r
+ }\r
\r
}\r
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 Mafft extends SkeletalExecutable<Mafft> implements\r
- PipedExecutable<Mafft> {\r
+public class Mafft extends SkeletalExecutable<Mafft>\r
+ implements\r
+ PipedExecutable<Mafft> {\r
\r
- private static Logger log = Logger.getLogger(Mafft.class);\r
+ private static Logger log = Logger.getLogger(Mafft.class);\r
\r
- // Cache for Limits information\r
- private static LimitsManager<Mafft> limits;\r
+ private static String autoOption = "--auto";\r
\r
- private static String autoOption = "--auto";\r
+ private final String MATRIX_PAR_NAME = "--aamatrix";\r
\r
- private final String MATRIX_PAR_NAME = "--aamatrix";\r
+ public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
\r
- public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
-\r
- public Mafft() {\r
- // remove default input to prevent it to appear in the parameters list\r
- // that could happen if the parameters are set first\r
- // super.setInput("");\r
- addParameters(Arrays.asList("--clustalout", autoOption));\r
- }\r
-\r
- @SuppressWarnings("unchecked")\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 Mafft() {\r
+ // remove default input to prevent it to appear in the parameters list\r
+ // that could happen if the parameters are set first\r
+ // super.setInput("");\r
+ addParameters(Arrays.asList("--clustalout", autoOption));\r
}\r
- }\r
-\r
- @Override\r
- public Mafft setInput(String inFile) {\r
- super.setInput(inFile);\r
- cbuilder.setLast(inFile);\r
- return this;\r
- }\r
\r
- /**\r
- * Mafft input must always be the last parameter!\r
- */\r
- @Override\r
- public Mafft addParameters(List<String> parameters) {\r
- cbuilder.addParams(parameters);\r
- cbuilder.removeParam(autoOption);\r
- return this;\r
- }\r
-\r
- @Override\r
- public Limit<Mafft> getLimit(String presetName) {\r
- if (limits == null) {\r
- limits = getLimits();\r
+ @SuppressWarnings("unchecked")\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
\r
- Limit<Mafft> 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
+ @Override\r
+ public Mafft setInput(String inFile) {\r
+ super.setInput(inFile);\r
+ cbuilder.setLast(inFile);\r
+ return this;\r
}\r
- return limit;\r
- }\r
\r
- @Override\r
- public LimitsManager<Mafft> getLimits() {\r
- // synchronise on static field\r
- synchronized (log) {\r
- if (limits == null) {\r
- limits = Util.getLimits(this.getClass());\r
- }\r
+ /**\r
+ * Mafft input must always be the last parameter!\r
+ */\r
+ @Override\r
+ public Mafft addParameters(List<String> parameters) {\r
+ cbuilder.addParams(parameters);\r
+ cbuilder.removeParam(autoOption);\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<Mafft>> getType() {\r
+ return (Class<Executable<Mafft>>) this.getClass();\r
+ }\r
\r
- /*\r
- * @Override public List<String> getParameters(\r
- * compbio.runner.Executable.ExecProvider provider) { for (int i = 0; i <\r
- * param.size(); i++) { String par = param.get(i); if\r
- * (isMatrixParameter(par)) { String matrixName = getValue(i); if (new\r
- * File(matrixName).isAbsolute()) { // Matrix can be found so no actions\r
- * necessary // This method has been called already and the matrix name //\r
- * is modified to contain full path // no further actions is necessary\r
- * break; } String matrixPath = Util.getExecProperty("matrix.path", this);\r
- * String absMatrixPath = Util.convertToAbsolute(matrixPath); param.remove(i\r
- * + 1); param.remove(i); super.addParameter(MATRIX_PAR_NAME);\r
- * super.addParameter(absMatrixPath + File.separator + matrixName); break; }\r
- * } return super.getParameters(provider); }\r
- * \r
- * boolean isMatrixParameter(String parameter) { assert\r
- * !compbio.util.Util.isEmpty(parameter); if\r
- * (parameter.toUpperCase().startsWith(MATRIX_PAR_NAME)) { return true; }\r
- * return false; }\r
- * \r
- * String getValue(int i) { return param.get(i + 1); }\r
- */\r
+ /*\r
+ * @Override public List<String> getParameters(\r
+ * compbio.runner.Executable.ExecProvider provider) { for (int i = 0; i <\r
+ * param.size(); i++) { String par = param.get(i); if\r
+ * (isMatrixParameter(par)) { String matrixName = getValue(i); if (new\r
+ * File(matrixName).isAbsolute()) { // Matrix can be found so no actions\r
+ * necessary // This method has been called already and the matrix name //\r
+ * is modified to contain full path // no further actions is necessary\r
+ * break; } String matrixPath = Util.getExecProperty("matrix.path", this);\r
+ * String absMatrixPath = Util.convertToAbsolute(matrixPath); param.remove(i\r
+ * + 1); param.remove(i); super.addParameter(MATRIX_PAR_NAME);\r
+ * super.addParameter(absMatrixPath + File.separator + matrixName); break; }\r
+ * } return super.getParameters(provider); }\r
+ * \r
+ * boolean isMatrixParameter(String parameter) { assert\r
+ * !compbio.util.Util.isEmpty(parameter); if\r
+ * (parameter.toUpperCase().startsWith(MATRIX_PAR_NAME)) { return true; }\r
+ * return false; }\r
+ * \r
+ * String getValue(int i) { return param.get(i + 1); }\r
+ */\r
}\r
import compbio.data.sequence.UnknownFileFormatException;\r
import compbio.engine.client.Executable;\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 Muscle extends SkeletalExecutable<Muscle> {\r
\r
- /*\r
- * Tell JAXB to ignore this while marshalling\r
- */\r
- @XmlTransient\r
- private static Logger log = Logger.getLogger(Muscle.class);\r
-\r
- // Cache for Limits information\r
- private static LimitsManager<Muscle> limits;\r
+ /*\r
+ * Tell JAXB to ignore this while marshalling\r
+ */\r
+ @XmlTransient\r
+ private static Logger log = Logger.getLogger(Muscle.class);\r
\r
- private static final String EXEC_STAT_FILE = "stat.log";\r
+ private static final String EXEC_STAT_FILE = "stat.log";\r
\r
- public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
+ public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
\r
- /**\r
- * Default options are\r
- * \r
- * -clwstrict - write output in clustal format\r
- * \r
- * @param workDirectory\r
- */\r
- public Muscle() {\r
- /*\r
- * The –quiet command-line option disables writing progress messages to\r
- * standard error. If the –verbose command-line option is specified, a\r
- * progress message will be written to the log file when each iteration\r
- * completes. So –quiet and –verbose are not contradictory."-quiet",\r
- * "-verbose"\r
+ /**\r
+ * Default options are\r
+ * \r
+ * -clwstrict - write output in clustal format\r
+ * \r
+ * @param workDirectory\r
*/\r
- addParameters(Arrays.asList("-clwstrict", "-quiet", "-verbose"));\r
- cbuilder.setParam("-log", EXEC_STAT_FILE);\r
- }\r
-\r
- @Override\r
- public Muscle setOutput(String outFile) {\r
- super.setOutput(outFile);\r
- cbuilder.setParam("-out", outFile);\r
- return this;\r
- }\r
-\r
- @Override\r
- public Muscle setInput(String inFile) {\r
- super.setInput(inFile);\r
- cbuilder.setParam("-in", inFile);\r
- return this;\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 Muscle() {\r
+ /*\r
+ * The –quiet command-line option disables writing progress messages to\r
+ * standard error. If the –verbose command-line option is specified, a\r
+ * progress message will be written to the log file when each iteration\r
+ * completes. So –quiet and –verbose are not contradictory."-quiet",\r
+ * "-verbose"\r
+ */\r
+ addParameters(Arrays.asList("-clwstrict", "-quiet", "-verbose"));\r
+ cbuilder.setParam("-log", EXEC_STAT_FILE);\r
}\r
- }\r
-\r
- @Override\r
- public List<String> getCreatedFiles() {\r
- return Arrays.asList(getOutput(), EXEC_STAT_FILE);\r
- }\r
\r
- public static String getStatFile() {\r
- return EXEC_STAT_FILE;\r
- }\r
-\r
- @Override\r
- public Limit<Muscle> getLimit(String presetName) {\r
+ @Override\r
+ public Muscle setOutput(String outFile) {\r
+ super.setOutput(outFile);\r
+ cbuilder.setParam("-out", outFile);\r
+ return this;\r
+ }\r
\r
- if (limits == null) {\r
- limits = getLimits();\r
+ @Override\r
+ public Muscle setInput(String inFile) {\r
+ super.setInput(inFile);\r
+ cbuilder.setParam("-in", inFile);\r
+ return this;\r
}\r
\r
- Limit<Muscle> limit = null;\r
- if (limits != null) {\r
- // this returns default limit if preset is undefined!\r
- limit = limits.getLimitByName(presetName);\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
- // 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(), EXEC_STAT_FILE);\r
}\r
- return limit;\r
- }\r
-\r
- @Override\r
- public LimitsManager<Muscle> getLimits() {\r
- // synchronise on static field\r
- synchronized (log) {\r
- if (limits == null) {\r
- limits = Util.getLimits(this.getClass());\r
- }\r
+\r
+ public static String getStatFile() {\r
+ return EXEC_STAT_FILE;\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<Muscle>> getType() {\r
+ return (Class<Executable<Muscle>>) this.getClass();\r
+ }\r
\r
}\r
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
\r
import java.io.FileNotFoundException;\r
import java.io.IOException;\r
-import java.security.InvalidParameterException;\r
import java.util.Arrays;\r
import java.util.List;\r
\r
import compbio.engine.client.PipedExecutable;\r
import compbio.engine.client.SkeletalExecutable;\r
import compbio.engine.conf.PropertyHelperManager;\r
-import compbio.metadata.Limit;\r
-import compbio.metadata.LimitsManager;\r
import compbio.metadata.ResultNotAvailableException;\r
import compbio.runner.Util;\r
import compbio.util.PropertyHelper;\r
\r
-public class Tcoffee extends SkeletalExecutable<Tcoffee> implements\r
-PipedExecutable<Tcoffee>, ClusterNativeSpecExecutable<Tcoffee> {\r
+public class Tcoffee extends SkeletalExecutable<Tcoffee>\r
+ implements\r
+ PipedExecutable<Tcoffee>,\r
+ ClusterNativeSpecExecutable<Tcoffee> {\r
\r
private static Logger log = Logger.getLogger(Tcoffee.class);\r
\r
private static PropertyHelper ph = PropertyHelperManager\r
- .getPropertyHelper();\r
-\r
- // Cache for Limits information\r
- private static LimitsManager<Tcoffee> limits;\r
+ .getPropertyHelper();\r
\r
public static final String KEY_VALUE_SEPARATOR = "=";\r
\r
@SuppressWarnings("unchecked")\r
@Override\r
public Alignment getResults(String workDirectory)\r
- throws ResultNotAvailableException {\r
+ throws ResultNotAvailableException {\r
try {\r
return Util.readClustalFile(workDirectory, getOutput());\r
} catch (FileNotFoundException e) {\r
}\r
\r
@Override\r
- public Limit<Tcoffee> getLimit(String presetName) {\r
- if (limits == null) {\r
- limits = getLimits();\r
- }\r
-\r
- Limit<Tcoffee> 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
- return limit;\r
- }\r
-\r
- @Override\r
- public LimitsManager<Tcoffee> getLimits() {\r
- // synchronise on static field\r
- synchronized (log) {\r
- if (limits == null) {\r
- limits = Util.getLimits(this.getClass());\r
- }\r
- }\r
- return limits;\r
- }\r
-\r
- @Override\r
public String getNativeSpecs() {\r
return getClusterSettings();\r
}\r
\r
-\r
+ @SuppressWarnings("unchecked")\r
@Override\r
- public Class<? extends Executable<?>> getType() {\r
- return this.getClass();\r
+ public Class<Executable<Tcoffee>> getType() {\r
+ return (Class<Executable<Tcoffee>>) this.getClass();\r
}\r
}\r
\r
import compbio.engine.client.Executable;\r
import compbio.engine.client.SkeletalExecutable;\r
-import compbio.metadata.Limit;\r
-import compbio.metadata.LimitsManager;\r
import compbio.metadata.ResultNotAvailableException;\r
\r
public class PsiBlast extends SkeletalExecutable<PsiBlast> {\r
\r
- public PsiBlast() {\r
+ public PsiBlast() {\r
\r
- }\r
+ }\r
\r
- void getSupportedDatabases() {\r
+ void getSupportedDatabases() {\r
\r
- }\r
+ }\r
\r
- @Override\r
- public <V> V getResults(String directory)\r
- throws ResultNotAvailableException {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
+ @Override\r
+ public <V> V getResults(String directory)\r
+ throws ResultNotAvailableException {\r
+ // TODO Auto-generated method stub\r
+ return null;\r
+ }\r
\r
- @Override\r
- public Limit<PsiBlast> getLimit(String presetName) {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public LimitsManager<PsiBlast> getLimits() {\r
- // TODO Auto-generated method stub\r
- return null;\r
- }\r
-\r
- @Override\r
- public Class<? extends Executable<?>> getType() {\r
- return this.getClass();\r
- }\r
+ @Override\r
+ public Class<Executable<PsiBlast>> getType() {\r
+ // TODO Auto-generated method stub\r
+ return null;\r
+ }\r
\r
}\r
public static final RunnerConfig<ClustalW> CLUSTAL_PARAMETERS = Util\r
.getSupportedOptions(ClustalW.class);\r
public static final LimitsManager<ClustalW> CLUSTAL_LIMITS = Util\r
- .getLimits(ClustalW.class);\r
+ .getLimits(new ClustalW().getType());\r
\r
public static final PresetManager<Tcoffee> TCOFFEE_PRESETS = Util\r
.getPresets(Tcoffee.class);\r
public static final RunnerConfig<Tcoffee> TCOFFEE_PARAMETERS = Util\r
.getSupportedOptions(Tcoffee.class);\r
public static final LimitsManager<Tcoffee> TCOFFEE_LIMITS = Util\r
- .getLimits(Tcoffee.class);\r
+ .getLimits(new Tcoffee().getType());\r
\r
public static final PresetManager<Muscle> MUSCLE_PRESETS = Util\r
.getPresets(Muscle.class);\r
public static final RunnerConfig<Muscle> MUSCLE_PARAMETERS = Util\r
.getSupportedOptions(Muscle.class);\r
public static final LimitsManager<Muscle> MUSCLE_LIMITS = Util\r
- .getLimits(Muscle.class);\r
+ .getLimits(new Muscle().getType());\r
\r
public final static String test_group_cluster = "cluster";\r
public final static String test_group_runner = "runner";\r
import static compbio.ws.client.Constraints.pseparator;\r
\r
import java.util.ArrayList;\r
+import java.util.Collections;\r
import java.util.List;\r
\r
import compbio.data.msa.Metadata;\r
*/\r
static <T> List<Option<T>> getParametersList(Metadata<T> msaws) {\r
assert msaws != null;\r
- return msaws.getRunnerOptions().getArguments();\r
+ RunnerConfig<T> config = msaws.getRunnerOptions();\r
+ if (config == null) {\r
+ return Collections.emptyList();\r
+ }\r
+ return config.getArguments();\r
}\r
\r
/**\r
private static final PresetManager<AACon> aaconPresets = Util\r
.getPresets(AACon.class);\r
\r
+ private static final LimitsManager<AACon> limitMan = compbio.runner.Util\r
+ .getLimits(new AACon().getType());\r
+\r
ConfiguredExecutable<AACon> init(List<FastaSequence> sequences)\r
throws JobSubmissionException {\r
AACon aacon = new AACon();\r
\r
@Override\r
public Limit<AACon> getLimit(String presetName) {\r
- return new AACon().getLimit(presetName);\r
+ return limitMan.getLimitByName(presetName);\r
}\r
\r
@Override\r
public LimitsManager<AACon> getLimits() {\r
- return new AACon().getLimits();\r
+ return limitMan;\r
}\r
\r
@Override\r
@WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = "http://msa.data.compbio/01/01/2010/", serviceName = "ClustalWS")\r
public class ClustalWS implements MsaWS<ClustalW> {\r
\r
- // Ask for resource injection\r
- @Resource\r
- private WebServiceContext wsContext;\r
+ // Ask for resource injection\r
+ @Resource\r
+ private WebServiceContext wsContext;\r
\r
- private static Logger log = Logger.getLogger(ClustalWS.class);\r
+ private static Logger log = Logger.getLogger(ClustalWS.class);\r
\r
- private static volatile WSLogger logger;\r
+ private static volatile WSLogger logger;\r
\r
- private static final RunnerConfig<ClustalW> clustalOptions = Util\r
- .getSupportedOptions(ClustalW.class);\r
+ private static final RunnerConfig<ClustalW> clustalOptions = Util\r
+ .getSupportedOptions(ClustalW.class);\r
\r
- private static final PresetManager<ClustalW> clustalPresets = Util\r
- .getPresets(ClustalW.class);\r
+ private static final PresetManager<ClustalW> clustalPresets = Util\r
+ .getPresets(ClustalW.class);\r
\r
- /*\r
- * Initialise the logger. This cannot be done in the constructor as the\r
- * WebServiceContext is not available at the object construction time\r
- */\r
- private WSLogger getLogger() {\r
- if (logger == null) {\r
- synchronized (ClustalWS.class) {\r
+ private static final LimitsManager<ClustalW> limitMan = compbio.runner.Util\r
+ .getLimits(new ClustalW().getType());\r
+\r
+ /*\r
+ * Initialise the logger. This cannot be done in the constructor as the\r
+ * WebServiceContext is not available at the object construction time\r
+ */\r
+ private WSLogger getLogger() {\r
if (logger == null) {\r
- logger = WSLogger.getStatLogger(Services.ClustalWS,\r
- wsContext);\r
+ synchronized (ClustalWS.class) {\r
+ if (logger == null) {\r
+ logger = WSLogger.getStatLogger(Services.ClustalWS,\r
+ wsContext);\r
+ }\r
+ }\r
}\r
- }\r
+ return logger;\r
+ }\r
+\r
+ @Override\r
+ public String align(List<FastaSequence> sequences)\r
+ throws JobSubmissionException {\r
+\r
+ WSUtil.validateFastaInput(sequences);\r
+ ConfiguredExecutable<ClustalW> confClust = init(sequences);\r
+ return WSUtil.align(sequences, confClust, getLogger(), "align",\r
+ getLimit(""));\r
+ }\r
+\r
+ ConfiguredExecutable<ClustalW> init(List<FastaSequence> dataSet)\r
+ throws JobSubmissionException {\r
+ ClustalW clustal = new ClustalW();\r
+ ConfiguredExecutable<ClustalW> confClust = Configurator\r
+ .configureExecutable(clustal, dataSet);\r
+ return confClust;\r
+ }\r
+\r
+ @Override\r
+ public String presetAlign(List<FastaSequence> sequences,\r
+ Preset<ClustalW> preset) throws JobSubmissionException,\r
+ WrongParameterException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ if (preset == null) {\r
+ throw new WrongParameterException("Preset must be provided!");\r
+ }\r
+ Limit<ClustalW> limit = getLimit(preset.getName());\r
+ ConfiguredExecutable<ClustalW> confClust = init(sequences);\r
+ confClust.addParameters(preset.getOptions());\r
+ return WSUtil.align(sequences, confClust, getLogger(), "presetAlign",\r
+ limit);\r
+ }\r
+\r
+ @Override\r
+ public String customAlign(List<FastaSequence> sequences,\r
+ List<Option<ClustalW>> options) throws JobSubmissionException,\r
+ WrongParameterException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ ConfiguredExecutable<ClustalW> confClust = init(sequences);\r
+ List<String> params = WSUtil.getCommands(options,\r
+ ClustalW.KEY_VALUE_SEPARATOR);\r
+ confClust.addParameters(params);\r
+ log.info("Setting parameters: " + params);\r
+ return WSUtil.align(sequences, confClust, getLogger(), "customAlign",\r
+ getLimit(""));\r
+ }\r
+\r
+ @Override\r
+ public RunnerConfig<ClustalW> getRunnerOptions() {\r
+ Timer timer = Timer.getMilliSecondsTimer();\r
+ getLogger().logAll(timer, "getRunnerOptions");\r
+ return clustalOptions;\r
}\r
- return logger;\r
- }\r
-\r
- @Override\r
- public String align(List<FastaSequence> sequences)\r
- throws JobSubmissionException {\r
- WSUtil.validateFastaInput(sequences);\r
- ConfiguredExecutable<ClustalW> confClust = init(sequences);\r
- return WSUtil.align(sequences, confClust, getLogger(), "align",\r
- getLimit(""));\r
- }\r
-\r
- ConfiguredExecutable<ClustalW> init(List<FastaSequence> dataSet)\r
- throws JobSubmissionException {\r
- ClustalW clustal = new ClustalW();\r
- ConfiguredExecutable<ClustalW> confClust = Configurator\r
- .configureExecutable(clustal, dataSet);\r
- return confClust;\r
- }\r
-\r
- @Override\r
- public String presetAlign(List<FastaSequence> sequences,\r
- Preset<ClustalW> preset) throws JobSubmissionException,\r
- WrongParameterException {\r
- WSUtil.validateFastaInput(sequences);\r
- if (preset == null) {\r
- throw new WrongParameterException("Preset must be provided!");\r
+\r
+ @SuppressWarnings("unchecked")\r
+ @Override\r
+ public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
+ Timer timer = Timer.getMilliSecondsTimer();\r
+ WSUtil.validateJobId(jobId);\r
+ AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
+ ConfiguredExecutable<ClustalW> clustal = (ConfiguredExecutable<ClustalW>) asyncEngine\r
+ .getResults(jobId);\r
+ Alignment al = clustal.getResults();\r
+ getLogger().log(timer, "getResults", jobId);\r
+ return al;\r
+ }\r
+\r
+ @Override\r
+ public Limit<ClustalW> getLimit(String presetName) {\r
+ Timer timer = Timer.getMilliSecondsTimer();\r
+ Limit<ClustalW> limit = limitMan.getLimitByName(presetName);\r
+ getLogger().logAll(timer, "getLimit");\r
+ return limit;\r
+ }\r
+ @Override\r
+ public LimitsManager<ClustalW> getLimits() {\r
+ return limitMan;\r
+ }\r
+\r
+ @Override\r
+ public boolean cancelJob(String jobId) {\r
+ Timer timer = Timer.getMilliSecondsTimer();\r
+ WSUtil.validateJobId(jobId);\r
+ boolean result = WSUtil.cancelJob(jobId);\r
+ getLogger().logFine(timer, "Cancel");\r
+ return result;\r
+ }\r
+\r
+ @Override\r
+ public JobStatus getJobStatus(String jobId) {\r
+ Timer timer = Timer.getMilliSecondsTimer();\r
+ WSUtil.validateJobId(jobId);\r
+ JobStatus status = WSUtil.getJobStatus(jobId);\r
+ getLogger().logFine(timer, "getJobStatus");\r
+ return status;\r
+ }\r
+\r
+ @Override\r
+ public PresetManager<ClustalW> getPresets() {\r
+ Timer timer = Timer.getMilliSecondsTimer();\r
+ getLogger().logAll(timer, "pullExecStatistics");\r
+ return clustalPresets;\r
+ }\r
+\r
+ @Override\r
+ public ChunkHolder pullExecStatistics(String jobId, long position) {\r
+ Timer timer = Timer.getMilliSecondsTimer();\r
+ WSUtil.validateJobId(jobId);\r
+ String file = Configurator.getWorkDirectory(jobId) + File.separator\r
+ + ClustalW.getStatFile();\r
+ ChunkHolder cholder = WSUtil.pullFile(file, position);\r
+ getLogger().logFine(timer, "pullExecStatistics");\r
+ return cholder;\r
}\r
- Limit<ClustalW> limit = getLimit(preset.getName());\r
- ConfiguredExecutable<ClustalW> confClust = init(sequences);\r
- confClust.addParameters(preset.getOptions());\r
- return WSUtil.align(sequences, confClust, getLogger(), "presetAlign",\r
- limit);\r
- }\r
-\r
- @Override\r
- public String customAlign(List<FastaSequence> sequences,\r
- List<Option<ClustalW>> options) throws JobSubmissionException,\r
- WrongParameterException {\r
- WSUtil.validateFastaInput(sequences);\r
- ConfiguredExecutable<ClustalW> confClust = init(sequences);\r
- List<String> params = WSUtil.getCommands(options,\r
- ClustalW.KEY_VALUE_SEPARATOR);\r
- confClust.addParameters(params);\r
- log.info("Setting parameters: " + params);\r
- return WSUtil.align(sequences, confClust, getLogger(), "customAlign",\r
- getLimit(""));\r
- }\r
-\r
- @Override\r
- public RunnerConfig<ClustalW> getRunnerOptions() {\r
- Timer timer = Timer.getMilliSecondsTimer();\r
- getLogger().logAll(timer, "getRunnerOptions");\r
- return clustalOptions;\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- @Override\r
- public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
- Timer timer = Timer.getMilliSecondsTimer();\r
- WSUtil.validateJobId(jobId);\r
- AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
- ConfiguredExecutable<ClustalW> clustal = (ConfiguredExecutable<ClustalW>) asyncEngine\r
- .getResults(jobId);\r
- Alignment al = clustal.getResults();\r
- getLogger().log(timer, "getResults", jobId);\r
- return al;\r
- }\r
-\r
- @Override\r
- public Limit<ClustalW> getLimit(String presetName) {\r
- Timer timer = Timer.getMilliSecondsTimer();\r
- Limit<ClustalW> limit = new ClustalW().getLimit(presetName);\r
- getLogger().logAll(timer, "getLimit");\r
- return limit;\r
- }\r
-\r
- @Override\r
- public LimitsManager<ClustalW> getLimits() {\r
- Timer timer = Timer.getMilliSecondsTimer();\r
- LimitsManager<ClustalW> limits = new ClustalW().getLimits();\r
- getLogger().logAll(timer, "getLimits");\r
- return limits;\r
- }\r
-\r
- @Override\r
- public boolean cancelJob(String jobId) {\r
- Timer timer = Timer.getMilliSecondsTimer();\r
- WSUtil.validateJobId(jobId);\r
- boolean result = WSUtil.cancelJob(jobId);\r
- getLogger().logFine(timer, "Cancel");\r
- return result;\r
- }\r
-\r
- @Override\r
- public JobStatus getJobStatus(String jobId) {\r
- Timer timer = Timer.getMilliSecondsTimer();\r
- WSUtil.validateJobId(jobId);\r
- JobStatus status = WSUtil.getJobStatus(jobId);\r
- getLogger().logFine(timer, "getJobStatus");\r
- return status;\r
- }\r
-\r
- @Override\r
- public PresetManager<ClustalW> getPresets() {\r
- Timer timer = Timer.getMilliSecondsTimer();\r
- getLogger().logAll(timer, "pullExecStatistics");\r
- return clustalPresets;\r
- }\r
-\r
- @Override\r
- public ChunkHolder pullExecStatistics(String jobId, long position) {\r
- Timer timer = Timer.getMilliSecondsTimer();\r
- WSUtil.validateJobId(jobId);\r
- String file = Configurator.getWorkDirectory(jobId) + File.separator\r
- + ClustalW.getStatFile();\r
- ChunkHolder cholder = WSUtil.pullFile(file, position);\r
- getLogger().logFine(timer, "pullExecStatistics");\r
- return cholder;\r
- }\r
\r
}\r
private static final PresetManager<Disembl> disemblPresets = Util\r
.getPresets(Disembl.class);\r
\r
+ private static final LimitsManager<Disembl> limitMan = compbio.runner.Util\r
+ .getLimits(new Disembl().getType());\r
+\r
ConfiguredExecutable<Disembl> init(List<FastaSequence> sequences)\r
throws JobSubmissionException {\r
Disembl disembl = new Disembl();\r
\r
@Override\r
public Limit<Disembl> getLimit(String presetName) {\r
- return new Disembl().getLimit(presetName);\r
+ return limitMan.getLimitByName(presetName);\r
}\r
\r
@Override\r
public LimitsManager<Disembl> getLimits() {\r
- return new Disembl().getLimits();\r
+ return limitMan;\r
}\r
\r
@Override\r
private static final PresetManager<GlobPlot> globPlotPresets = Util\r
.getPresets(GlobPlot.class);\r
\r
+ private static final LimitsManager<GlobPlot> limitMan = compbio.runner.Util\r
+ .getLimits(new GlobPlot().getType());\r
+\r
ConfiguredExecutable<GlobPlot> init(List<FastaSequence> sequences)\r
throws JobSubmissionException {\r
GlobPlot globPlot = new GlobPlot();\r
\r
@Override\r
public Limit<GlobPlot> getLimit(String presetName) {\r
- return new GlobPlot().getLimit(presetName);\r
+ return limitMan.getLimitByName(presetName);\r
}\r
\r
@Override\r
public LimitsManager<GlobPlot> getLimits() {\r
- return new GlobPlot().getLimits();\r
+ return limitMan;\r
}\r
\r
@Override\r
private static final PresetManager<Jronn> jronnPresets = Util\r
.getPresets(Jronn.class);\r
\r
+ private static final LimitsManager<Jronn> limitMan = compbio.runner.Util\r
+ .getLimits(new Jronn().getType());\r
+\r
ConfiguredExecutable<Jronn> init(List<FastaSequence> sequences)\r
throws JobSubmissionException {\r
Jronn jronn = new Jronn();\r
\r
@Override\r
public Limit<Jronn> getLimit(String presetName) {\r
- return new Jronn().getLimit(presetName);\r
+ return limitMan.getLimitByName(presetName);\r
}\r
\r
@Override\r
public LimitsManager<Jronn> getLimits() {\r
- return new Jronn().getLimits();\r
+ return limitMan;\r
}\r
\r
@Override\r
@WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = "http://msa.data.compbio/01/01/2010/", serviceName = "MafftWS")\r
public class MafftWS implements MsaWS<Mafft> {\r
\r
- // Ask for resource injection\r
- @Resource\r
- WebServiceContext wsContext;\r
-\r
- private static Logger statLog = Logger.getLogger("MafftWS-stats");\r
-\r
- private static Logger log = Logger.getLogger(MafftWS.class);\r
-\r
- private static final RunnerConfig<Mafft> mafftOptions = Util\r
- .getSupportedOptions(Mafft.class);\r
-\r
- private static final PresetManager<Mafft> mafftPresets = Util\r
- .getPresets(Mafft.class);\r
-\r
- @Override\r
- public String align(List<FastaSequence> sequences)\r
- throws JobSubmissionException {\r
- WSUtil.validateFastaInput(sequences);\r
- ConfiguredExecutable<Mafft> confMafft = init(sequences);\r
- return WSUtil.align(sequences, confMafft, null, "align", getLimit(""));\r
- }\r
-\r
- ConfiguredExecutable<Mafft> init(List<FastaSequence> dataSet)\r
- throws JobSubmissionException {\r
- Mafft mafft = new Mafft();\r
- mafft.setInput("fasta.in").setOutput("fasta.out");\r
- return Configurator.configureExecutable(mafft, dataSet);\r
- }\r
-\r
- @Override\r
- public String customAlign(List<FastaSequence> sequences,\r
- List<Option<Mafft>> options) throws JobSubmissionException,\r
- WrongParameterException {\r
- WSUtil.validateFastaInput(sequences);\r
- ConfiguredExecutable<Mafft> confMafft = init(sequences);\r
- List<String> params = WSUtil.getCommands(options,\r
- Mafft.KEY_VALUE_SEPARATOR);\r
- log.info("Setting parameters: " + params);\r
- confMafft.addParameters(params);\r
- return WSUtil.align(sequences, confMafft, null, "customAlign",\r
- getLimit(""));\r
- }\r
-\r
- @Override\r
- public String presetAlign(List<FastaSequence> sequences,\r
- Preset<Mafft> preset) throws JobSubmissionException,\r
- WrongParameterException {\r
- WSUtil.validateFastaInput(sequences);\r
- if (preset == null) {\r
- throw new WrongParameterException("Preset must be provided!");\r
+ // Ask for resource injection\r
+ @Resource\r
+ WebServiceContext wsContext;\r
+\r
+ private static Logger statLog = Logger.getLogger("MafftWS-stats");\r
+\r
+ private static Logger log = Logger.getLogger(MafftWS.class);\r
+\r
+ private static final RunnerConfig<Mafft> mafftOptions = Util\r
+ .getSupportedOptions(Mafft.class);\r
+\r
+ private static final PresetManager<Mafft> mafftPresets = Util\r
+ .getPresets(Mafft.class);\r
+\r
+ private static final LimitsManager<Mafft> limitMan = compbio.runner.Util\r
+ .getLimits(new Mafft().getType());\r
+\r
+ @Override\r
+ public String align(List<FastaSequence> sequences)\r
+ throws JobSubmissionException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ ConfiguredExecutable<Mafft> confMafft = init(sequences);\r
+ return WSUtil.align(sequences, confMafft, null, "align", getLimit(""));\r
+ }\r
+\r
+ ConfiguredExecutable<Mafft> init(List<FastaSequence> dataSet)\r
+ throws JobSubmissionException {\r
+ Mafft mafft = new Mafft();\r
+ mafft.setInput("fasta.in").setOutput("fasta.out");\r
+ return Configurator.configureExecutable(mafft, dataSet);\r
+ }\r
+\r
+ @Override\r
+ public String customAlign(List<FastaSequence> sequences,\r
+ List<Option<Mafft>> options) throws JobSubmissionException,\r
+ WrongParameterException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ ConfiguredExecutable<Mafft> confMafft = init(sequences);\r
+ List<String> params = WSUtil.getCommands(options,\r
+ Mafft.KEY_VALUE_SEPARATOR);\r
+ log.info("Setting parameters: " + params);\r
+ confMafft.addParameters(params);\r
+ return WSUtil.align(sequences, confMafft, null, "customAlign",\r
+ getLimit(""));\r
+ }\r
+\r
+ @Override\r
+ public String presetAlign(List<FastaSequence> sequences,\r
+ Preset<Mafft> preset) throws JobSubmissionException,\r
+ WrongParameterException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ if (preset == null) {\r
+ throw new WrongParameterException("Preset must be provided!");\r
+ }\r
+ ConfiguredExecutable<Mafft> confMafft = init(sequences);\r
+ confMafft.addParameters(preset.getOptions());\r
+ // This will return default limit if a specific the limit for a\r
+ // particular preset is not found\r
+ Limit<Mafft> limit = getLimit(preset.getName());\r
+\r
+ return WSUtil.align(sequences, confMafft, null, "presetAlign", limit);\r
+ }\r
+\r
+ @SuppressWarnings("unchecked")\r
+ @Override\r
+ public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
+ WSUtil.validateJobId(jobId);\r
+ AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
+ ConfiguredExecutable<Mafft> mafft = (ConfiguredExecutable<Mafft>) asyncEngine\r
+ .getResults(jobId);\r
+ Alignment al = mafft.getResults();\r
+ // log(jobId, "getResults");\r
+ return al;\r
+ }\r
+\r
+ @Override\r
+ public Limit<Mafft> getLimit(String presetName) {\r
+ return limitMan.getLimitByName(presetName);\r
+ }\r
+\r
+ @Override\r
+ public LimitsManager<Mafft> getLimits() {\r
+ return limitMan;\r
+ }\r
+\r
+ @Override\r
+ public ChunkHolder pullExecStatistics(String jobId, long position) {\r
+ WSUtil.validateJobId(jobId);\r
+ String file = Configurator.getWorkDirectory(jobId) + File.separator\r
+ + new Mafft().getError();\r
+ return WSUtil.pullFile(file, position);\r
+ }\r
+\r
+ @Override\r
+ public boolean cancelJob(String jobId) {\r
+ WSUtil.validateJobId(jobId);\r
+ return WSUtil.cancelJob(jobId);\r
+ }\r
+\r
+ @Override\r
+ public JobStatus getJobStatus(String jobId) {\r
+ WSUtil.validateJobId(jobId);\r
+ return WSUtil.getJobStatus(jobId);\r
+ }\r
+\r
+ @Override\r
+ public PresetManager<Mafft> getPresets() {\r
+ return mafftPresets;\r
+ }\r
+\r
+ @Override\r
+ public RunnerConfig<Mafft> getRunnerOptions() {\r
+ return mafftOptions;\r
}\r
- ConfiguredExecutable<Mafft> confMafft = init(sequences);\r
- confMafft.addParameters(preset.getOptions());\r
- // This will return default limit if a specific the limit for a\r
- // particular preset is not found\r
- Limit<Mafft> limit = getLimit(preset.getName());\r
-\r
- return WSUtil.align(sequences, confMafft, null, "presetAlign", limit);\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- @Override\r
- public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
- WSUtil.validateJobId(jobId);\r
- AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
- ConfiguredExecutable<Mafft> mafft = (ConfiguredExecutable<Mafft>) asyncEngine\r
- .getResults(jobId);\r
- Alignment al = mafft.getResults();\r
- //log(jobId, "getResults");\r
- return al;\r
- }\r
-\r
- @Override\r
- public Limit<Mafft> getLimit(String presetName) {\r
- return new Mafft().getLimit(presetName);\r
- }\r
-\r
- @Override\r
- public LimitsManager<Mafft> getLimits() {\r
- return new Mafft().getLimits();\r
- }\r
-\r
- @Override\r
- public ChunkHolder pullExecStatistics(String jobId, long position) {\r
- WSUtil.validateJobId(jobId);\r
- String file = Configurator.getWorkDirectory(jobId) + File.separator\r
- + new Mafft().getError();\r
- return WSUtil.pullFile(file, position);\r
- }\r
-\r
- @Override\r
- public boolean cancelJob(String jobId) {\r
- WSUtil.validateJobId(jobId);\r
- return WSUtil.cancelJob(jobId);\r
- }\r
-\r
- @Override\r
- public JobStatus getJobStatus(String jobId) {\r
- WSUtil.validateJobId(jobId);\r
- return WSUtil.getJobStatus(jobId);\r
- }\r
-\r
- @Override\r
- public PresetManager<Mafft> getPresets() {\r
- return mafftPresets;\r
- }\r
-\r
- @Override\r
- public RunnerConfig<Mafft> getRunnerOptions() {\r
- return mafftOptions;\r
- }\r
\r
}\r
@WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = "http://msa.data.compbio/01/01/2010/", serviceName = "MuscleWS")\r
public class MuscleWS implements MsaWS<Muscle> {\r
\r
- // Ask for resource injection\r
- @Resource\r
- WebServiceContext wsContext;\r
-\r
- private static Logger statLog = Logger.getLogger("MuscleWS-stats");\r
-\r
- private static Logger log = Logger.getLogger(MuscleWS.class);\r
-\r
- private static final RunnerConfig<Muscle> muscleOptions = Util\r
- .getSupportedOptions(Muscle.class);\r
-\r
- private static final PresetManager<Muscle> musclePresets = Util\r
- .getPresets(Muscle.class);\r
-\r
- @Override\r
- public String align(List<FastaSequence> sequences)\r
- throws JobSubmissionException {\r
- WSUtil.validateFastaInput(sequences);\r
- ConfiguredExecutable<Muscle> confMuscle = init(sequences);\r
- return WSUtil.align(sequences, confMuscle, null, "align", getLimit(""));\r
- }\r
-\r
- ConfiguredExecutable<Muscle> init(List<FastaSequence> sequences)\r
- throws JobSubmissionException {\r
- Muscle muscle = new Muscle();\r
- muscle.setInput("fasta.in").setOutput("fasta.out");\r
- return Configurator.configureExecutable(muscle, sequences);\r
- }\r
-\r
- @Override\r
- public String customAlign(List<FastaSequence> sequences,\r
- List<Option<Muscle>> options) throws JobSubmissionException,\r
- WrongParameterException {\r
- WSUtil.validateFastaInput(sequences);\r
- ConfiguredExecutable<Muscle> confMuscle = init(sequences);\r
- // Could not do that! Space separated values\r
- // will all be treated as keys! thus duplicates removed\r
- // String params = cbuilder.getCommand();\r
- List<String> params = WSUtil.getCommands(options,\r
- Muscle.KEY_VALUE_SEPARATOR);\r
- confMuscle.addParameters(params);\r
- return WSUtil.align(sequences, confMuscle, null, "customAlign",\r
- getLimit(""));\r
- }\r
-\r
- @Override\r
- public String presetAlign(List<FastaSequence> sequences,\r
- Preset<Muscle> preset) throws JobSubmissionException,\r
- WrongParameterException {\r
- WSUtil.validateFastaInput(sequences);\r
- if (preset == null) {\r
- throw new WrongParameterException("Preset must be provided!");\r
+ // Ask for resource injection\r
+ @Resource\r
+ WebServiceContext wsContext;\r
+\r
+ private static Logger statLog = Logger.getLogger("MuscleWS-stats");\r
+\r
+ private static Logger log = Logger.getLogger(MuscleWS.class);\r
+\r
+ private static final RunnerConfig<Muscle> muscleOptions = Util\r
+ .getSupportedOptions(Muscle.class);\r
+\r
+ private static final PresetManager<Muscle> musclePresets = Util\r
+ .getPresets(Muscle.class);\r
+\r
+ private static final LimitsManager<Muscle> limitMan = compbio.runner.Util\r
+ .getLimits(new Muscle().getType());\r
+\r
+ @Override\r
+ public String align(List<FastaSequence> sequences)\r
+ throws JobSubmissionException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ ConfiguredExecutable<Muscle> confMuscle = init(sequences);\r
+ return WSUtil.align(sequences, confMuscle, null, "align", getLimit(""));\r
+ }\r
+\r
+ ConfiguredExecutable<Muscle> init(List<FastaSequence> sequences)\r
+ throws JobSubmissionException {\r
+ Muscle muscle = new Muscle();\r
+ muscle.setInput("fasta.in").setOutput("fasta.out");\r
+ return Configurator.configureExecutable(muscle, sequences);\r
+ }\r
+\r
+ @Override\r
+ public String customAlign(List<FastaSequence> sequences,\r
+ List<Option<Muscle>> options) throws JobSubmissionException,\r
+ WrongParameterException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ ConfiguredExecutable<Muscle> confMuscle = init(sequences);\r
+ // Could not do that! Space separated values\r
+ // will all be treated as keys! thus duplicates removed\r
+ // String params = cbuilder.getCommand();\r
+ List<String> params = WSUtil.getCommands(options,\r
+ Muscle.KEY_VALUE_SEPARATOR);\r
+ confMuscle.addParameters(params);\r
+ return WSUtil.align(sequences, confMuscle, null, "customAlign",\r
+ getLimit(""));\r
+ }\r
+\r
+ @Override\r
+ public String presetAlign(List<FastaSequence> sequences,\r
+ Preset<Muscle> preset) throws JobSubmissionException,\r
+ WrongParameterException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ if (preset == null) {\r
+ throw new WrongParameterException("Preset must be provided!");\r
+ }\r
+ ConfiguredExecutable<Muscle> confMuscle = init(sequences);\r
+ confMuscle.addParameters(preset.getOptions());\r
+ Limit<Muscle> limit = getLimit(preset.getName());\r
+ return WSUtil.align(sequences, confMuscle, null, "presetAlign", limit);\r
+ }\r
+\r
+ @SuppressWarnings("unchecked")\r
+ @Override\r
+ public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
+ WSUtil.validateJobId(jobId);\r
+ AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
+ ConfiguredExecutable<Muscle> muscle = (ConfiguredExecutable<Muscle>) asyncEngine\r
+ .getResults(jobId);\r
+ Alignment al = muscle.getResults();\r
+ // log(jobId, "getResults");\r
+ return al;\r
+ }\r
+\r
+ @Override\r
+ public Limit<Muscle> getLimit(String presetName) {\r
+ return limitMan.getLimitByName(presetName);\r
+ }\r
+\r
+ @Override\r
+ public LimitsManager<Muscle> getLimits() {\r
+ return limitMan;\r
+ }\r
+\r
+ @Override\r
+ public ChunkHolder pullExecStatistics(String jobId, long position) {\r
+ WSUtil.validateJobId(jobId);\r
+ String file = Configurator.getWorkDirectory(jobId) + File.separator\r
+ + Muscle.getStatFile();\r
+ return WSUtil.pullFile(file, position);\r
+ }\r
+\r
+ @Override\r
+ public boolean cancelJob(String jobId) {\r
+ WSUtil.validateJobId(jobId);\r
+ return WSUtil.cancelJob(jobId);\r
+ }\r
+\r
+ @Override\r
+ public JobStatus getJobStatus(String jobId) {\r
+ WSUtil.validateJobId(jobId);\r
+ return WSUtil.getJobStatus(jobId);\r
+ }\r
+\r
+ @Override\r
+ public PresetManager<Muscle> getPresets() {\r
+ return musclePresets;\r
+ }\r
+\r
+ @Override\r
+ public RunnerConfig<Muscle> getRunnerOptions() {\r
+ return muscleOptions;\r
}\r
- ConfiguredExecutable<Muscle> confMuscle = init(sequences);\r
- confMuscle.addParameters(preset.getOptions());\r
- Limit<Muscle> limit = getLimit(preset.getName());\r
- return WSUtil.align(sequences, confMuscle, null, "presetAlign", limit);\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- @Override\r
- public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
- WSUtil.validateJobId(jobId);\r
- AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
- ConfiguredExecutable<Muscle> muscle = (ConfiguredExecutable<Muscle>) asyncEngine\r
- .getResults(jobId);\r
- Alignment al = muscle.getResults();\r
- //log(jobId, "getResults");\r
- return al;\r
- }\r
-\r
- @Override\r
- public Limit<Muscle> getLimit(String presetName) {\r
- return new Muscle().getLimit(presetName);\r
- }\r
-\r
- @Override\r
- public LimitsManager<Muscle> getLimits() {\r
- return new Muscle().getLimits();\r
- }\r
-\r
- @Override\r
- public ChunkHolder pullExecStatistics(String jobId, long position) {\r
- WSUtil.validateJobId(jobId);\r
- String file = Configurator.getWorkDirectory(jobId) + File.separator\r
- + Muscle.getStatFile();\r
- return WSUtil.pullFile(file, position);\r
- }\r
-\r
- @Override\r
- public boolean cancelJob(String jobId) {\r
- WSUtil.validateJobId(jobId);\r
- return WSUtil.cancelJob(jobId);\r
- }\r
-\r
- @Override\r
- public JobStatus getJobStatus(String jobId) {\r
- WSUtil.validateJobId(jobId);\r
- return WSUtil.getJobStatus(jobId);\r
- }\r
-\r
- @Override\r
- public PresetManager<Muscle> getPresets() {\r
- return musclePresets;\r
- }\r
-\r
- @Override\r
- public RunnerConfig<Muscle> getRunnerOptions() {\r
- return muscleOptions;\r
- }\r
\r
}\r
@WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = "http://msa.data.compbio/01/01/2010/", serviceName = "ProbconsWS")\r
public class ProbconsWS implements MsaWS<Probcons> {\r
\r
- // Ask for resource injection\r
- @Resource\r
- WebServiceContext wsContext;\r
-\r
- private static Logger statLog = Logger.getLogger("ProbconsWS-stats");\r
-\r
- private static Logger log = Logger.getLogger(ProbconsWS.class);\r
-\r
- private static final RunnerConfig<Probcons> probconsOptions = Util\r
- .getSupportedOptions(Probcons.class);\r
-\r
- @Override\r
- public String align(List<FastaSequence> sequences)\r
- throws JobSubmissionException {\r
- WSUtil.validateFastaInput(sequences);\r
- ConfiguredExecutable<Probcons> confProbcons = init(sequences);\r
- return WSUtil.align(sequences, confProbcons, null, "align",\r
- getLimit(""));\r
- }\r
-\r
- ConfiguredExecutable<Probcons> init(List<FastaSequence> dataSet)\r
- throws JobSubmissionException {\r
- Probcons probcons = new Probcons();\r
- probcons.setInput("fasta.in").setOutput("alignment.out");\r
- return Configurator.configureExecutable(probcons, dataSet);\r
- }\r
-\r
- @Override\r
- public String customAlign(List<FastaSequence> sequences,\r
- List<Option<Probcons>> options) throws JobSubmissionException,\r
- WrongParameterException {\r
- WSUtil.validateFastaInput(sequences);\r
- ConfiguredExecutable<Probcons> confProbcons = init(sequences);\r
- List<String> params = WSUtil.getCommands(options,\r
- Probcons.KEY_VALUE_SEPARATOR);\r
- log.info("Setting parameters:" + params);\r
- confProbcons.addParameters(params);\r
- return WSUtil.align(sequences, confProbcons, null, "customAlign",\r
- getLimit(""));\r
- }\r
-\r
- @Override\r
- public String presetAlign(List<FastaSequence> sequences,\r
- Preset<Probcons> preset) throws JobSubmissionException,\r
- WrongParameterException {\r
- WSUtil.validateFastaInput(sequences);\r
- if (preset == null) {\r
- throw new WrongParameterException("Preset must be provided!");\r
+ // Ask for resource injection\r
+ @Resource\r
+ WebServiceContext wsContext;\r
+\r
+ private static Logger statLog = Logger.getLogger("ProbconsWS-stats");\r
+\r
+ private static Logger log = Logger.getLogger(ProbconsWS.class);\r
+\r
+ private static final RunnerConfig<Probcons> probconsOptions = Util\r
+ .getSupportedOptions(Probcons.class);\r
+\r
+ private static final LimitsManager<Probcons> limitMan = compbio.runner.Util\r
+ .getLimits(new Probcons().getType());\r
+\r
+ @Override\r
+ public String align(List<FastaSequence> sequences)\r
+ throws JobSubmissionException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ ConfiguredExecutable<Probcons> confProbcons = init(sequences);\r
+ return WSUtil.align(sequences, confProbcons, null, "align",\r
+ getLimit(""));\r
+ }\r
+\r
+ ConfiguredExecutable<Probcons> init(List<FastaSequence> dataSet)\r
+ throws JobSubmissionException {\r
+ Probcons probcons = new Probcons();\r
+ probcons.setInput("fasta.in").setOutput("alignment.out");\r
+ return Configurator.configureExecutable(probcons, dataSet);\r
+ }\r
+\r
+ @Override\r
+ public String customAlign(List<FastaSequence> sequences,\r
+ List<Option<Probcons>> options) throws JobSubmissionException,\r
+ WrongParameterException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ ConfiguredExecutable<Probcons> confProbcons = init(sequences);\r
+ List<String> params = WSUtil.getCommands(options,\r
+ Probcons.KEY_VALUE_SEPARATOR);\r
+ log.info("Setting parameters:" + params);\r
+ confProbcons.addParameters(params);\r
+ return WSUtil.align(sequences, confProbcons, null, "customAlign",\r
+ getLimit(""));\r
+ }\r
+\r
+ @Override\r
+ public String presetAlign(List<FastaSequence> sequences,\r
+ Preset<Probcons> preset) throws JobSubmissionException,\r
+ WrongParameterException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ if (preset == null) {\r
+ throw new WrongParameterException("Preset must be provided!");\r
+ }\r
+ ConfiguredExecutable<Probcons> confProbcons = init(sequences);\r
+ confProbcons.addParameters(preset.getOptions());\r
+ Limit<Probcons> limit = getLimit(preset.getName());\r
+ return WSUtil\r
+ .align(sequences, confProbcons, null, "presetAlign", limit);\r
+ }\r
+\r
+ @SuppressWarnings("unchecked")\r
+ @Override\r
+ public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
+ WSUtil.validateJobId(jobId);\r
+ AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
+ ConfiguredExecutable<Probcons> probcons = (ConfiguredExecutable<Probcons>) asyncEngine\r
+ .getResults(jobId);\r
+ Alignment al = probcons.getResults();\r
+ // log(jobId, "getResults");\r
+ return al;\r
+ }\r
+\r
+ @Override\r
+ public Limit<Probcons> getLimit(String presetName) {\r
+ return limitMan.getLimitByName(presetName);\r
+ }\r
+\r
+ @Override\r
+ public LimitsManager<Probcons> getLimits() {\r
+ return limitMan;\r
+ }\r
+\r
+ @Override\r
+ public ChunkHolder pullExecStatistics(String jobId, long position) {\r
+ WSUtil.validateJobId(jobId);\r
+ // TODO check if output is the one to return\r
+ String file = Configurator.getWorkDirectory(jobId) + File.separator\r
+ + new Probcons().getError();\r
+ return WSUtil.pullFile(file, position);\r
+ }\r
+\r
+ @Override\r
+ public boolean cancelJob(String jobId) {\r
+ WSUtil.validateJobId(jobId);\r
+ return WSUtil.cancelJob(jobId);\r
+ }\r
+\r
+ @Override\r
+ public JobStatus getJobStatus(String jobId) {\r
+ WSUtil.validateJobId(jobId);\r
+ return WSUtil.getJobStatus(jobId);\r
+ }\r
+\r
+ @Override\r
+ public PresetManager<Probcons> getPresets() {\r
+ return null;\r
+ }\r
+\r
+ @Override\r
+ public RunnerConfig<Probcons> getRunnerOptions() {\r
+ return probconsOptions;\r
}\r
- ConfiguredExecutable<Probcons> confProbcons = init(sequences);\r
- confProbcons.addParameters(preset.getOptions());\r
- Limit<Probcons> limit = getLimit(preset.getName());\r
- return WSUtil\r
- .align(sequences, confProbcons, null, "presetAlign", limit);\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- @Override\r
- public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
- WSUtil.validateJobId(jobId);\r
- AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
- ConfiguredExecutable<Probcons> probcons = (ConfiguredExecutable<Probcons>) asyncEngine\r
- .getResults(jobId);\r
- Alignment al = probcons.getResults();\r
- //log(jobId, "getResults");\r
- return al;\r
- }\r
-\r
- @Override\r
- public Limit<Probcons> getLimit(String presetName) {\r
- return new Probcons().getLimit(presetName);\r
- }\r
-\r
- @Override\r
- public LimitsManager<Probcons> getLimits() {\r
- return new Probcons().getLimits();\r
- }\r
-\r
- @Override\r
- public ChunkHolder pullExecStatistics(String jobId, long position) {\r
- WSUtil.validateJobId(jobId);\r
- // TODO check if output is the one to return\r
- String file = Configurator.getWorkDirectory(jobId) + File.separator\r
- + new Probcons().getError();\r
- return WSUtil.pullFile(file, position);\r
- }\r
-\r
- @Override\r
- public boolean cancelJob(String jobId) {\r
- WSUtil.validateJobId(jobId);\r
- return WSUtil.cancelJob(jobId);\r
- }\r
-\r
- @Override\r
- public JobStatus getJobStatus(String jobId) {\r
- WSUtil.validateJobId(jobId);\r
- return WSUtil.getJobStatus(jobId);\r
- }\r
-\r
- @Override\r
- public PresetManager<Probcons> getPresets() {\r
- return null;\r
- }\r
-\r
- @Override\r
- public RunnerConfig<Probcons> getRunnerOptions() {\r
- return probconsOptions;\r
- }\r
\r
}\r
@WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = "http://msa.data.compbio/01/01/2010/", serviceName = "TcoffeeWS")\r
public class TcoffeeWS implements MsaWS<Tcoffee> {\r
\r
- // Ask for resource injection\r
- @Resource\r
- WebServiceContext wsContext;\r
-\r
- private static Logger statLog = Logger.getLogger("TcoffeeWS-stats");\r
-\r
- private static Logger log = Logger.getLogger(TcoffeeWS.class);\r
-\r
- private static final RunnerConfig<Tcoffee> tcoffeeOptions = Util\r
- .getSupportedOptions(Tcoffee.class);\r
-\r
- private static final PresetManager<Tcoffee> tcoffeePresets = Util\r
- .getPresets(Tcoffee.class);\r
-\r
- @Override\r
- public String align(List<FastaSequence> sequences)\r
- throws JobSubmissionException {\r
- WSUtil.validateFastaInput(sequences);\r
- ConfiguredExecutable<Tcoffee> confTcoffee = init(sequences);\r
- return WSUtil\r
- .align(sequences, confTcoffee, null, "align", getLimit(""));\r
- }\r
-\r
- ConfiguredExecutable<Tcoffee> init(List<FastaSequence> sequences)\r
- throws JobSubmissionException {\r
- Tcoffee tcoffee = new Tcoffee();\r
- tcoffee.setInput("fasta.in").setOutput("fasta.out");\r
- ConfiguredExecutable<Tcoffee> confCoffee = Configurator\r
- .configureExecutable(tcoffee, sequences);\r
- if (confCoffee.getExecProvider() == Executable.ExecProvider.Cluster) {\r
- int clusterCpuNum = SkeletalExecutable.getClusterCpuNum(Tcoffee.class);\r
- if (clusterCpuNum != 0) {\r
- tcoffee.setNCore(clusterCpuNum);\r
- }\r
- }\r
- return confCoffee;\r
- }\r
-\r
- @Override\r
- public String customAlign(List<FastaSequence> sequences,\r
- List<Option<Tcoffee>> options) throws JobSubmissionException,\r
- WrongParameterException {\r
-\r
- WSUtil.validateFastaInput(sequences);\r
- ConfiguredExecutable<Tcoffee> confTcoffee = init(sequences);\r
- List<String> params = WSUtil.getCommands(options,\r
- Tcoffee.KEY_VALUE_SEPARATOR);\r
- log.info("Setting parameters:" + params);\r
- confTcoffee.addParameters(params);\r
- return WSUtil.align(sequences, confTcoffee, null, "customAlign",\r
- getLimit(""));\r
- }\r
-\r
- @Override\r
- public String presetAlign(List<FastaSequence> sequences,\r
- Preset<Tcoffee> preset) throws JobSubmissionException,\r
- WrongParameterException {\r
- WSUtil.validateFastaInput(sequences);\r
- if (preset == null) {\r
- throw new WrongParameterException("Preset must be provided!");\r
+ // Ask for resource injection\r
+ @Resource\r
+ WebServiceContext wsContext;\r
+\r
+ private static Logger statLog = Logger.getLogger("TcoffeeWS-stats");\r
+\r
+ private static Logger log = Logger.getLogger(TcoffeeWS.class);\r
+\r
+ private static final RunnerConfig<Tcoffee> tcoffeeOptions = Util\r
+ .getSupportedOptions(Tcoffee.class);\r
+\r
+ private static final PresetManager<Tcoffee> tcoffeePresets = Util\r
+ .getPresets(Tcoffee.class);\r
+\r
+ private static final LimitsManager<Tcoffee> limitMan = compbio.runner.Util\r
+ .getLimits(new Tcoffee().getType());\r
+\r
+ @Override\r
+ public String align(List<FastaSequence> sequences)\r
+ throws JobSubmissionException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ ConfiguredExecutable<Tcoffee> confTcoffee = init(sequences);\r
+ return WSUtil\r
+ .align(sequences, confTcoffee, null, "align", getLimit(""));\r
+ }\r
+\r
+ ConfiguredExecutable<Tcoffee> init(List<FastaSequence> sequences)\r
+ throws JobSubmissionException {\r
+ Tcoffee tcoffee = new Tcoffee();\r
+ tcoffee.setInput("fasta.in").setOutput("fasta.out");\r
+ ConfiguredExecutable<Tcoffee> confCoffee = Configurator\r
+ .configureExecutable(tcoffee, sequences);\r
+ if (confCoffee.getExecProvider() == Executable.ExecProvider.Cluster) {\r
+ int clusterCpuNum = SkeletalExecutable\r
+ .getClusterCpuNum(Tcoffee.class);\r
+ if (clusterCpuNum != 0) {\r
+ tcoffee.setNCore(clusterCpuNum);\r
+ }\r
+ }\r
+ return confCoffee;\r
+ }\r
+\r
+ @Override\r
+ public String customAlign(List<FastaSequence> sequences,\r
+ List<Option<Tcoffee>> options) throws JobSubmissionException,\r
+ WrongParameterException {\r
+\r
+ WSUtil.validateFastaInput(sequences);\r
+ ConfiguredExecutable<Tcoffee> confTcoffee = init(sequences);\r
+ List<String> params = WSUtil.getCommands(options,\r
+ Tcoffee.KEY_VALUE_SEPARATOR);\r
+ log.info("Setting parameters:" + params);\r
+ confTcoffee.addParameters(params);\r
+ return WSUtil.align(sequences, confTcoffee, null, "customAlign",\r
+ getLimit(""));\r
+ }\r
+\r
+ @Override\r
+ public String presetAlign(List<FastaSequence> sequences,\r
+ Preset<Tcoffee> preset) throws JobSubmissionException,\r
+ WrongParameterException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ if (preset == null) {\r
+ throw new WrongParameterException("Preset must be provided!");\r
+ }\r
+ ConfiguredExecutable<Tcoffee> confTcoffee = init(sequences);\r
+ confTcoffee.addParameters(preset.getOptions());\r
+ Limit<Tcoffee> limit = getLimit(preset.getName());\r
+ return WSUtil.align(sequences, confTcoffee, null, "presetAlign", limit);\r
+ }\r
+\r
+ @SuppressWarnings("unchecked")\r
+ @Override\r
+ public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
+ WSUtil.validateJobId(jobId);\r
+ AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
+ ConfiguredExecutable<Tcoffee> tcoffee = (ConfiguredExecutable<Tcoffee>) asyncEngine\r
+ .getResults(jobId);\r
+ Alignment al = tcoffee.getResults();\r
+ // log(jobId, "getResults");\r
+ return al;\r
+ }\r
+\r
+ @Override\r
+ public Limit<Tcoffee> getLimit(String presetName) {\r
+ return limitMan.getLimitByName(presetName);\r
+ }\r
+\r
+ @Override\r
+ public LimitsManager<Tcoffee> getLimits() {\r
+ return limitMan;\r
+ }\r
+\r
+ @Override\r
+ public ChunkHolder pullExecStatistics(String jobId, long position) {\r
+ WSUtil.validateJobId(jobId);\r
+ String file = Configurator.getWorkDirectory(jobId) + File.separator\r
+ + new Tcoffee().getError();\r
+ return WSUtil.pullFile(file, position);\r
+ }\r
+\r
+ @Override\r
+ public boolean cancelJob(String jobId) {\r
+ WSUtil.validateJobId(jobId);\r
+ return WSUtil.cancelJob(jobId);\r
+ }\r
+\r
+ @Override\r
+ public JobStatus getJobStatus(String jobId) {\r
+ WSUtil.validateJobId(jobId);\r
+ return WSUtil.getJobStatus(jobId);\r
+ }\r
+\r
+ @Override\r
+ public PresetManager<Tcoffee> getPresets() {\r
+ return tcoffeePresets;\r
+ }\r
+\r
+ @Override\r
+ public RunnerConfig<Tcoffee> getRunnerOptions() {\r
+ return tcoffeeOptions;\r
}\r
- ConfiguredExecutable<Tcoffee> confTcoffee = init(sequences);\r
- confTcoffee.addParameters(preset.getOptions());\r
- Limit<Tcoffee> limit = getLimit(preset.getName());\r
- return WSUtil.align(sequences, confTcoffee, null, "presetAlign", limit);\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- @Override\r
- public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
- WSUtil.validateJobId(jobId);\r
- AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
- ConfiguredExecutable<Tcoffee> tcoffee = (ConfiguredExecutable<Tcoffee>) asyncEngine\r
- .getResults(jobId);\r
- Alignment al = tcoffee.getResults();\r
- //log(jobId, "getResults");\r
- return al;\r
- }\r
-\r
- @Override\r
- public Limit<Tcoffee> getLimit(String presetName) {\r
- return new Tcoffee().getLimit(presetName);\r
- }\r
-\r
- @Override\r
- public LimitsManager<Tcoffee> getLimits() {\r
- return new Tcoffee().getLimits();\r
- }\r
-\r
- @Override\r
- public ChunkHolder pullExecStatistics(String jobId, long position) {\r
- WSUtil.validateJobId(jobId);\r
- String file = Configurator.getWorkDirectory(jobId) + File.separator\r
- + new Tcoffee().getError();\r
- return WSUtil.pullFile(file, position);\r
- }\r
-\r
- @Override\r
- public boolean cancelJob(String jobId) {\r
- WSUtil.validateJobId(jobId);\r
- return WSUtil.cancelJob(jobId);\r
- }\r
-\r
- @Override\r
- public JobStatus getJobStatus(String jobId) {\r
- WSUtil.validateJobId(jobId);\r
- return WSUtil.getJobStatus(jobId);\r
- }\r
-\r
- @Override\r
- public PresetManager<Tcoffee> getPresets() {\r
- return tcoffeePresets;\r
- }\r
-\r
- @Override\r
- public RunnerConfig<Tcoffee> getRunnerOptions() {\r
- return tcoffeeOptions;\r
- }\r
\r
}\r
\r
public final class WSUtil {\r
\r
+ private static final String CACHE_KEY = "LIMITS_CACHE";\r
+\r
private static Logger log = Logger.getLogger(WSUtil.class);\r
\r
public static final void validateJobId(String jobId)\r
return oList;\r
}\r
\r
+ /*\r
+ * UNUSED\r
+ * \r
+ * @SuppressWarnings("unchecked") static <T> LimitsManager<T>\r
+ * getLimits(Class<? extends Executable<T>> clazz, WebServiceContext\r
+ * wsContext) {\r
+ * \r
+ * String LIMIT_KEY = CACHE_KEY + clazz.getCanonicalName(); LimitsManager<T>\r
+ * limit = (LimitsManager<T>) getObjectFromApplContext( LIMIT_KEY,\r
+ * wsContext); if (limit == null) { synchronized (WSUtil.class) { limit =\r
+ * (LimitsManager<T>) getObjectFromApplContext(LIMIT_KEY, wsContext); if\r
+ * (limit == null) { limit = compbio.runner.Util\r
+ * .getLimits((Class<Executable<T>>) clazz);\r
+ * addObjectToApplContext(wsContext, LIMIT_KEY, limit); } } } return limit;\r
+ * }\r
+ * \r
+ * static void addObjectToApplContext(WebServiceContext wsContext, String\r
+ * objKey, Object obj) { assert !Util.isEmpty(objKey) :\r
+ * "Key for the object must not be empty! "; assert wsContext != null;\r
+ * \r
+ * ServletContext ctx = ((javax.servlet.ServletContext) wsContext\r
+ * .getMessageContext().get(MessageContext. SERVLET_CONTEXT)); assert ctx !=\r
+ * null; log.debug("Adding object with key '" + objKey + "' and value '" +\r
+ * obj + "' to the application context"); ctx.setAttribute(objKey, obj); }\r
+ * static Object getObjectFromApplContext(String objKey, WebServiceContext\r
+ * wsContext) { assert !Util.isEmpty(objKey) :\r
+ * "Key for the object must not be empty! "; assert wsContext != null;\r
+ * \r
+ * ServletContext ctx = ((javax.servlet.ServletContext) wsContext\r
+ * .getMessageContext().get(MessageContext. SERVLET_CONTEXT)); Object obj =\r
+ * ctx.getAttribute(objKey); log.trace("Retrieving object with key '" +\r
+ * objKey + "' and value '" + obj + "' from the application context");\r
+ * return obj; }\r
+ */\r
}\r