import compbio.runner.conservation.AACon;\r
\r
@WebService(endpointInterface = "compbio.data.msa.SequenceAnnotation", targetNamespace = "http://msa.data.compbio/01/12/2010/", serviceName = "AAConWS")\r
-public class AAConWS extends SAService<AACon>\r
+public class AAConWS extends SequenceAnnotationService<AACon>\r
implements\r
SequenceAnnotation<AACon> {\r
\r
import compbio.engine.AsyncExecutor;\r
import compbio.engine.Configurator;\r
import compbio.engine.client.ConfiguredExecutable;\r
+import compbio.engine.client.SkeletalExecutable;\r
import compbio.metadata.ChunkHolder;\r
import compbio.metadata.JobStatus;\r
import compbio.metadata.JobSubmissionException;\r
ConfiguredExecutable<ClustalW> init(List<FastaSequence> dataSet)\r
throws JobSubmissionException {\r
ClustalW clustal = new ClustalW();\r
+ clustal.setInput(SkeletalExecutable.INPUT)\r
+ .setOutput(SkeletalExecutable.OUTPUT)\r
+ .setError(SkeletalExecutable.ERROR);\r
ConfiguredExecutable<ClustalW> confClust = Configurator\r
.configureExecutable(clustal, dataSet);\r
return confClust;\r
import compbio.runner.disorder.Disembl;\r
\r
@WebService(endpointInterface = "compbio.data.msa.SequenceAnnotation", targetNamespace = "http://msa.data.compbio/01/12/2010/", serviceName = "DisemblWS")\r
-public class DisemblWS extends SAService<Disembl>\r
+public class DisemblWS extends SequenceAnnotationService<Disembl>\r
implements\r
SequenceAnnotation<Disembl> {\r
\r
import org.apache.log4j.Logger;\r
\r
import compbio.data.sequence.FastaSequence;\r
-import compbio.data.sequence.ScoreManager;\r
import compbio.engine.Configurator;\r
import compbio.engine.client.ConfiguredExecutable;\r
import compbio.engine.client.Executable;\r
import compbio.metadata.JobStatus;\r
import compbio.metadata.JobSubmissionException;\r
import compbio.metadata.Limit;\r
-import compbio.metadata.LimitExceededException;\r
import compbio.metadata.LimitsManager;\r
-import compbio.metadata.Option;\r
-import compbio.metadata.Preset;\r
import compbio.metadata.PresetManager;\r
-import compbio.metadata.ResultNotAvailableException;\r
import compbio.metadata.RunnerConfig;\r
-import compbio.metadata.UnsupportedRuntimeException;\r
-import compbio.metadata.WrongParameterException;\r
import compbio.runner.Util;\r
-import compbio.runner.conservation.AACon;\r
\r
-/**\r
- * Common methods for all SequenceAnnotation web services\r
- * \r
- * @author pvtroshin\r
- * \r
- * @param <T>\r
- * \r
- * @version 1.0 June 2011\r
- * @since 2.0\r
- */\r
-public abstract class SAService<T> {\r
+public abstract class GenericMetadataService<T> {\r
\r
private final RunnerConfig<T> aaconOptions;\r
private final PresetManager<T> aaconPresets;\r
private final LimitsManager<T> limitMan;\r
private SkeletalExecutable<T> exec;\r
- private final Logger log;\r
+ final Logger log;\r
\r
/*\r
* FIXME - instances of the Runner (?) and their types should be defined in\r
* Executable IF\r
*/\r
- SAService(SkeletalExecutable<T> exec, Logger log) {\r
+ GenericMetadataService(SkeletalExecutable<T> exec, Logger log) {\r
assert log != null;\r
assert exec != null;\r
this.log = log;\r
log.error(e.getLocalizedMessage(), e);\r
throw new JobSubmissionException(e.getLocalizedMessage(), e);\r
}\r
- exec.setInput(SkeletalExecutable.INPUT).setOutput(\r
- SkeletalExecutable.OUTPUT);\r
+ exec.setInput(SkeletalExecutable.INPUT)\r
+ .setOutput(SkeletalExecutable.OUTPUT)\r
+ .setError(SkeletalExecutable.ERROR);\r
return Configurator.configureExecutable(exec, sequences);\r
}\r
\r
- public ScoreManager getAnnotation(String jobId)\r
- throws ResultNotAvailableException {\r
- return WSUtil.getAnnotation(jobId, log);\r
- }\r
-\r
public boolean cancelJob(String jobId) {\r
WSUtil.validateJobId(jobId);\r
return WSUtil.cancelJob(jobId);\r
return aaconOptions;\r
}\r
\r
- public String analize(List<FastaSequence> sequences)\r
- throws UnsupportedRuntimeException, LimitExceededException,\r
- JobSubmissionException {\r
- WSUtil.validateFastaInput(sequences);\r
- ConfiguredExecutable<T> confIUPred = init(sequences);\r
- return WSUtil.analize(sequences, confIUPred, log, "analize",\r
- getLimit(""));\r
- }\r
-\r
- public String customAnalize(List<FastaSequence> sequences,\r
- List<Option<T>> options) throws UnsupportedRuntimeException,\r
- LimitExceededException, JobSubmissionException,\r
- WrongParameterException {\r
- WSUtil.validateAAConInput(sequences);\r
- ConfiguredExecutable<T> confAACon = 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
- AACon.KEY_VALUE_SEPARATOR);\r
- confAACon.addParameters(params);\r
- return WSUtil.analize(sequences, confAACon, log, "customAnalize",\r
- getLimit(""));\r
- }\r
-\r
- public String presetAnalize(List<FastaSequence> sequences, Preset<T> preset)\r
- throws UnsupportedRuntimeException, LimitExceededException,\r
- JobSubmissionException, WrongParameterException {\r
- WSUtil.validateAAConInput(sequences);\r
- if (preset == null) {\r
- throw new WrongParameterException("Preset must be provided!");\r
- }\r
- ConfiguredExecutable<T> confAAcon = init(sequences);\r
- confAAcon.addParameters(preset.getOptions());\r
- Limit<T> limit = getLimit(preset.getName());\r
- return WSUtil\r
- .analize(sequences, confAAcon, log, "presetAnalize", limit);\r
- }\r
-\r
/**\r
* Assume statistics is not supported\r
* \r
import compbio.runner.disorder.GlobPlot;\r
\r
@WebService(endpointInterface = "compbio.data.msa.SequenceAnnotation", targetNamespace = "http://msa.data.compbio/01/12/2010/", serviceName = "GlobPlotWS")\r
-public class GlobPlotWS extends SAService<GlobPlot>\r
+public class GlobPlotWS extends SequenceAnnotationService<GlobPlot>\r
implements\r
SequenceAnnotation<GlobPlot> {\r
\r
import compbio.runner.disorder.IUPred;\r
\r
@WebService(endpointInterface = "compbio.data.msa.SequenceAnnotation", targetNamespace = "http://msa.data.compbio/01/12/2010/", serviceName = "IUPredWS")\r
-public class IUPredWS extends SAService<IUPred>\r
+public class IUPredWS extends SequenceAnnotationService<IUPred>\r
implements\r
SequenceAnnotation<IUPred> {\r
\r
import compbio.runner.disorder.Jronn;\r
\r
@WebService(endpointInterface = "compbio.data.msa.SequenceAnnotation", targetNamespace = "http://msa.data.compbio/01/12/2010/", serviceName = "JronnWS")\r
-public class JronnWS extends SAService<Jronn>\r
+public class JronnWS extends SequenceAnnotationService<Jronn>\r
implements\r
SequenceAnnotation<Jronn> {\r
\r
import compbio.engine.AsyncExecutor;\r
import compbio.engine.Configurator;\r
import compbio.engine.client.ConfiguredExecutable;\r
+import compbio.engine.client.SkeletalExecutable;\r
import compbio.metadata.ChunkHolder;\r
import compbio.metadata.JobStatus;\r
import compbio.metadata.JobSubmissionException;\r
ConfiguredExecutable<Mafft> init(List<FastaSequence> dataSet)\r
throws JobSubmissionException {\r
Mafft mafft = new Mafft();\r
+ mafft.setInput(SkeletalExecutable.INPUT)\r
+ .setOutput(SkeletalExecutable.OUTPUT)\r
+ .setError(SkeletalExecutable.ERROR);\r
return Configurator.configureExecutable(mafft, dataSet);\r
}\r
\r
import compbio.engine.AsyncExecutor;\r
import compbio.engine.Configurator;\r
import compbio.engine.client.ConfiguredExecutable;\r
+import compbio.engine.client.SkeletalExecutable;\r
import compbio.metadata.ChunkHolder;\r
import compbio.metadata.JobStatus;\r
import compbio.metadata.JobSubmissionException;\r
ConfiguredExecutable<Probcons> init(List<FastaSequence> dataSet)\r
throws JobSubmissionException {\r
Probcons probcons = new Probcons();\r
+ probcons.setInput(SkeletalExecutable.INPUT)\r
+ .setOutput(SkeletalExecutable.OUTPUT)\r
+ .setError(SkeletalExecutable.ERROR);\r
return Configurator.configureExecutable(probcons, dataSet);\r
}\r
\r
--- /dev/null
+package compbio.ws.server;\r
+\r
+import java.util.List;\r
+\r
+import org.apache.log4j.Logger;\r
+\r
+import compbio.data.sequence.FastaSequence;\r
+import compbio.data.sequence.ScoreManager;\r
+import compbio.engine.client.ConfiguredExecutable;\r
+import compbio.engine.client.SkeletalExecutable;\r
+import compbio.metadata.JobSubmissionException;\r
+import compbio.metadata.Limit;\r
+import compbio.metadata.LimitExceededException;\r
+import compbio.metadata.Option;\r
+import compbio.metadata.Preset;\r
+import compbio.metadata.ResultNotAvailableException;\r
+import compbio.metadata.UnsupportedRuntimeException;\r
+import compbio.metadata.WrongParameterException;\r
+import compbio.runner.conservation.AACon;\r
+\r
+/**\r
+ * Common methods for all SequenceAnnotation web services\r
+ * \r
+ * @author pvtroshin\r
+ * \r
+ * @param <T>\r
+ * \r
+ * @version 1.0 June 2011\r
+ * @since 2.0\r
+ */\r
+public abstract class SequenceAnnotationService<T> extends GenericMetadataService {\r
+\r
+ /*\r
+ * FIXME - instances of the Runner (?) and their types should be defined in\r
+ * Executable IF\r
+ */\r
+ SequenceAnnotationService(SkeletalExecutable<T> exec, Logger log) {\r
+ super(exec, log);\r
+ }\r
+\r
+ public ScoreManager getAnnotation(String jobId)\r
+ throws ResultNotAvailableException {\r
+ return WSUtil.getAnnotation(jobId, log);\r
+ }\r
+\r
+ public String analize(List<FastaSequence> sequences)\r
+ throws UnsupportedRuntimeException, LimitExceededException,\r
+ JobSubmissionException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ ConfiguredExecutable<T> confIUPred = init(sequences);\r
+ return WSUtil.analize(sequences, confIUPred, log, "analize",\r
+ getLimit(""));\r
+ }\r
+\r
+ public String customAnalize(List<FastaSequence> sequences,\r
+ List<Option<T>> options) throws UnsupportedRuntimeException,\r
+ LimitExceededException, JobSubmissionException,\r
+ WrongParameterException {\r
+ WSUtil.validateAAConInput(sequences);\r
+ ConfiguredExecutable<T> confAACon = 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
+ AACon.KEY_VALUE_SEPARATOR);\r
+ confAACon.addParameters(params);\r
+ return WSUtil.analize(sequences, confAACon, log, "customAnalize",\r
+ getLimit(""));\r
+ }\r
+\r
+ public String presetAnalize(List<FastaSequence> sequences, Preset<T> preset)\r
+ throws UnsupportedRuntimeException, LimitExceededException,\r
+ JobSubmissionException, WrongParameterException {\r
+ WSUtil.validateAAConInput(sequences);\r
+ if (preset == null) {\r
+ throw new WrongParameterException("Preset must be provided!");\r
+ }\r
+ ConfiguredExecutable<T> confAAcon = init(sequences);\r
+ confAAcon.addParameters(preset.getOptions());\r
+ Limit<T> limit = getLimit(preset.getName());\r
+ return WSUtil\r
+ .analize(sequences, confAAcon, log, "presetAnalize", limit);\r
+ }\r
+\r
+}\r
*/\r
public class ShutdownEngines implements ServletContextListener {\r
\r
- private final Logger log = Logger.getLogger(ShutdownEngines.class);\r
-\r
- @Override\r
- public void contextDestroyed(ServletContextEvent ignored) {\r
- // Shutdown local engine\r
- log.info("JABAWS context is destroyed. Shutting down engines...");\r
- LocalExecutorService.shutDown();\r
- log.info("Local engine is shutdown OK");\r
- ExecutableWrapper.shutdownService();\r
- log.info("Individual executables stream engine is shutdown OK");\r
- }\r
-\r
- @Override\r
- public void contextInitialized(ServletContextEvent arg0) {\r
- // Do nothing\r
- }\r
+ private final Logger log = Logger.getLogger(ShutdownEngines.class);\r
+\r
+ @Override\r
+ public void contextDestroyed(ServletContextEvent ignored) {\r
+ // Shutdown local engine\r
+ log.info("JABAWS context is destroyed. Shutting down engines...");\r
+ LocalExecutorService.shutDown();\r
+ log.info("Local engine is shutdown OK");\r
+ ExecutableWrapper.shutdownService();\r
+ log.info("Individual executables stream engine is shutdown OK");\r
+ }\r
+\r
+ @Override\r
+ public void contextInitialized(ServletContextEvent arg0) {\r
+ // Do nothing\r
+ }\r
\r
}\r
ConfiguredExecutable<Tcoffee> init(List<FastaSequence> sequences)\r
throws JobSubmissionException {\r
Tcoffee tcoffee = new Tcoffee();\r
+ tcoffee.setInput(SkeletalExecutable.INPUT)\r
+ .setOutput(SkeletalExecutable.OUTPUT)\r
+ .setError(SkeletalExecutable.ERROR);\r
+\r
ConfiguredExecutable<Tcoffee> confCoffee = Configurator\r
.configureExecutable(tcoffee, sequences);\r
if (confCoffee.getExecProvider() == Executable.ExecProvider.Cluster) {\r
--- /dev/null
+package compbio.ws.server;\r
+\r
+import java.io.File;\r
+import java.util.List;\r
+\r
+import org.apache.log4j.Logger;\r
+\r
+import compbio.data.sequence.Alignment;\r
+import compbio.data.sequence.FastaSequence;\r
+import compbio.engine.AsyncExecutor;\r
+import compbio.engine.Configurator;\r
+import compbio.engine.client.ConfiguredExecutable;\r
+import compbio.engine.client.SkeletalExecutable;\r
+import compbio.metadata.ChunkHolder;\r
+import compbio.metadata.JobSubmissionException;\r
+import compbio.metadata.Limit;\r
+import compbio.metadata.Option;\r
+import compbio.metadata.Preset;\r
+import compbio.metadata.ResultNotAvailableException;\r
+import compbio.metadata.WrongParameterException;\r
+import compbio.runner.msa.ClustalW;\r
+\r
+/**\r
+ * \r
+ * TODO to complete after the approach is tested with SequenceAnnotation!\r
+ * \r
+ * Common methods for all SequenceAnnotation web services\r
+ * \r
+ * @author pvtroshin\r
+ * \r
+ * @param <T>\r
+ * \r
+ * @version 1.0 June 2011\r
+ * @since 2.0\r
+ */\r
+public abstract class _MsaService<T> extends GenericMetadataService {\r
+\r
+ /*\r
+ * FIXME - instances of the Runner (?) and their types should be defined in\r
+ * Executable IF\r
+ */\r
+ _MsaService(SkeletalExecutable<T> exec, Logger log) {\r
+ super(exec, log);\r
+ }\r
+\r
+ public String align(List<FastaSequence> sequences)\r
+ throws JobSubmissionException {\r
+\r
+ WSUtil.validateFastaInput(sequences);\r
+ ConfiguredExecutable<T> confClust = init(sequences);\r
+ return WSUtil.align(sequences, confClust, log, "align", getLimit(""));\r
+ }\r
+\r
+ public String presetAlign(List<FastaSequence> sequences, Preset<T> preset)\r
+ throws JobSubmissionException, WrongParameterException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ if (preset == null) {\r
+ throw new WrongParameterException("Preset must be provided!");\r
+ }\r
+ Limit<T> limit = getLimit(preset.getName());\r
+ ConfiguredExecutable<T> confClust = init(sequences);\r
+ confClust.addParameters(preset.getOptions());\r
+ return WSUtil.align(sequences, confClust, log, "presetAlign", limit);\r
+ }\r
+\r
+ public String customAlign(List<FastaSequence> sequences,\r
+ List<Option<T>> options) throws JobSubmissionException,\r
+ WrongParameterException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ ConfiguredExecutable<T> 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, log, "customAlign",\r
+ getLimit(""));\r
+ }\r
+\r
+ @SuppressWarnings("unchecked")\r
+ public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
+\r
+ WSUtil.validateJobId(jobId);\r
+ AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
+ ConfiguredExecutable<T> clustal = (ConfiguredExecutable<T>) asyncEngine\r
+ .getResults(jobId);\r
+ Alignment al = clustal.getResults();\r
+ return al;\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
+ + ClustalW.getStatFile();\r
+ ChunkHolder cholder = WSUtil.pullFile(file, position);\r
+ return cholder;\r
+ }\r
+\r
+}\r