final static String parameterkey = "-p";\r
final static String presetkey = "-r";\r
\r
- final static String help_text = "\r\n"\r
- + "JABAWS client v2.0 June 2011 http://www.compbio.dundee.ac.uk/jabaws \r\n"\r
- + " \r\n"\r
- + "Usage: <Class or Jar file name> -h=host_and_context <-s=serviceName> ACTION [OPTIONS] \r\n"\r
- + "\r\n"\r
- + "-h=<host_context> - a full URL to the JABAWS web server including context \r\n"\r
- + " path e.g. http://10.31.1.159:8080/ws\r\n"\r
- + "-s=<ServiceName> - one of [MafftWS, MuscleWS, ClustalWS, TcoffeeWS, ProbconsWS, \r\n"\r
- + " AAConWS, JronnWS, DisemblWS, GlobPlotWS, IUPredWS]\r\n"\r
- + " <serviceName> is required for all ACTIONS but -list_services\r\n"\r
- + "\r\n"\r
- + "ACTIONS: \r\n"\r
- + "-list_services - list available services\r\n"\r
- + "-test - test service \r\n"\r
- + "-i=<inputFile> - full path to fasta formatted sequence file, from which to align \r\n"\r
- + " sequences\r\n"\r
- + "-parameters - lists parameters supported by web service\r\n"\r
- + "-presets - lists presets supported by web service\r\n"\r
- + "-limits - lists web services limits\r\n"\r
- + "\r\n"\r
- + "Please note that if input file is specified other actions are ignored\r\n"\r
- + "\r\n"\r
- + "OPTIONS (only for use with -i action):\r\n"\r
- + "-r=<presetName> - name of the preset to use\r\n"\r
- + "-o=<outputFile> - full path to the file where to write an alignment\r\n"\r
- + "-f=<PrmInputFile> - the name of the file with the list of parameters to use.\r\n"\r
- + "\r\n"\r
- + "Please note that -r and -f options cannot be used together. Alignment is done with \r\n"\r
- + "either preset or a parameters from the file, but not both!\r\n"\r
- + "\r\n"\r
- + "EXAMPLES: \r\n"\r
- + "\r\n"\r
- + "1) List all available services on the host \r\n"\r
- + "\r\n"\r
- + "Jws2Client -h=http://www.compbio.dundee.ac.uk/jabaws -list_services\r\n"\r
- + "\r\n"\r
- + "2) Test Clustal web service \r\n"\r
- + "\r\n"\r
- + "Jws2Client -h=http://www.compbio.dundee.ac.uk/jabaws -s=ClustalWS -test \r\n"\r
- + "\r\n"\r
- + "3) Align sequence from file input.txt with Probcons. Record resulting alignment \r\n"\r
- + "into the output.txt \r\n"\r
- + "\r\n"\r
- + "Jws2Client -h=http://www.compbio.dundee.ac.uk/jabaws -s=ProbconsWS -i=input.txt -o=output.txt\r\n"\r
- + "\r\n"\r
- + "4) Calculate disorder with Disembl take input from input.txt, output results to \r\n"\r
- + "the console \r\n"\r
- + "\r\n"\r
- + "Jws2Client -h=http://www.compbio.dundee.ac.uk/jabaws -s=DisemblWS -i=input.txt \r\n"\r
- + "\r\n"\r
- + "5) List all parameters available for AAconWS service \r\n"\r
- + "\r\n"\r
- + "Jws2Client -h=http://www.compbio.dundee.ac.uk/jabaws -s=AAconWS -parameters\r\n"\r
- + "\r\n"\r
- + "6) Calculate conservation with AAConWS using LANDGRAF method, for Clustal alignment \r\n"\r
- + "from input.txt and report the scores to the console \r\n"\r
- + "\r\n"\r
- + "Jws2Client -h=http://www.compbio.dundee.ac.uk/jabaws -s=AAconWS -i=input.txt -f=prm.txt \r\n"\r
- + "\r\n"\r
- + "Where the content of prm.txt file is -m=LANDGRAF\r\n"\r
- + "The list of the supported parameters can be obtained as shown in the example 5. \r\n"\r
- + "\r\n"\r
- + "Citation: Peter V. Troshin, James B. Procter and Geoffrey J. Barton - \"Java \r\n"\r
- + "Bioinformatics Analysis Web Services for Multiple Sequence Alignment - \r\n"\r
- + "JABAWS:MSA\" Bioinformatics 2011; doi: 10.1093/bioinformatics/btr304.\r\n"\r
- + "";\r
+ final static String help_text = "\r\n" + \r
+ "JABAWS2 client August 2011 http://www.compbio.dundee.ac.uk/jabaws \r\n" + \r
+ " \r\n" + \r
+ "Usage: <Class or Jar file name> -h=host_and_context <-s=serviceName> ACTION [OPTIONS] \r\n" + \r
+ "\r\n" + \r
+ "-h=<host_context> - a full URL to the JABAWS web server including context \r\n" + \r
+ " path e.g. http://10.31.1.159:8080/ws\r\n" + \r
+ "-s=<ServiceName> - one of [MafftWS, MuscleWS, ClustalWS, ClustalOWS, TcoffeeWS, \r\n" + \r
+ " ProbconsWS, AAConWS, JronnWS, DisemblWS, GlobPlotWS, IUPredWS]\r\n" + \r
+ " <serviceName> is required for all ACTIONS but -list_services\r\n" + \r
+ "\r\n" + \r
+ "ACTIONS: \r\n" + \r
+ "-list_services - list available services\r\n" + \r
+ "-test - test service \r\n" + \r
+ "-i=<inputFile> - full path to fasta formatted sequence file, from which to align \r\n" + \r
+ " sequences\r\n" + \r
+ "-parameters - lists parameters supported by web service\r\n" + \r
+ "-presets - lists presets supported by web service\r\n" + \r
+ "-limits - lists web services limits\r\n" + \r
+ "\r\n" + \r
+ "Please note that if input file is specified other actions are ignored\r\n" + \r
+ "\r\n" + \r
+ "OPTIONS (only for use with -i action):\r\n" + \r
+ "-r=<presetName> - name of the preset to use\r\n" + \r
+ "-o=<outputFile> - full path to the file where to write an alignment\r\n" + \r
+ "-f=<PrmInputFile> - the name of the file with the list of parameters to use.\r\n" + \r
+ "\r\n" + \r
+ "Please note that -r and -f options cannot be used together. Alignment is done with \r\n" + \r
+ "either preset or a parameters from the file, but not both!\r\n" + \r
+ "\r\n" + \r
+ "EXAMPLES: \r\n" + \r
+ "\r\n" + \r
+ "1) List all available services on the host \r\n" + \r
+ "\r\n" + \r
+ "Jws2Client -h=http://www.compbio.dundee.ac.uk/jabaws -list_services\r\n" + \r
+ "\r\n" + \r
+ "2) Test Clustal web service \r\n" + \r
+ "\r\n" + \r
+ "Jws2Client -h=http://www.compbio.dundee.ac.uk/jabaws -s=ClustalWS -test \r\n" + \r
+ "\r\n" + \r
+ "3) Align sequence from file input.txt with Probcons. Record resulting alignment \r\n" + \r
+ "into the output.txt \r\n" + \r
+ "\r\n" + \r
+ "Jws2Client -h=http://www.compbio.dundee.ac.uk/jabaws -s=ProbconsWS -i=input.txt -o=output.txt\r\n" + \r
+ "\r\n" + \r
+ "4) Calculate disorder with Disembl take input from input.txt, output results to \r\n" + \r
+ "the console \r\n" + \r
+ "\r\n" + \r
+ "Jws2Client -h=http://www.compbio.dundee.ac.uk/jabaws -s=DisemblWS -i=input.txt \r\n" + \r
+ "\r\n" + \r
+ "5) List all parameters available for AAconWS service \r\n" + \r
+ "\r\n" + \r
+ "Jws2Client -h=http://www.compbio.dundee.ac.uk/jabaws -s=AAconWS -parameters\r\n" + \r
+ "\r\n" + \r
+ "6) Calculate conservation with AAConWS using LANDGRAF method, for Clustal alignment \r\n" + \r
+ "from input.txt and report the scores to the console \r\n" + \r
+ "\r\n" + \r
+ "Jws2Client -h=http://www.compbio.dundee.ac.uk/jabaws -s=AAconWS -i=input.txt -f=prm.txt \r\n" + \r
+ "\r\n" + \r
+ "Where the content of prm.txt file is -m=LANDGRAF\r\n" + \r
+ "The list of the supported parameters can be obtained as shown in the example 5. \r\n" + \r
+ "\r\n" + \r
+ "Citation: Peter V. Troshin, James B. Procter and Geoffrey J. Barton - \"Java \r\n" + \r
+ "Bioinformatics Analysis Web Services for Multiple Sequence Alignment - \r\n" + \r
+ "JABAWS:MSA\" Bioinformatics 2011; doi: 10.1093/bioinformatics/btr304.\r\n" + \r
+ "";\r
\r
}\r
import compbio.runner.disorder.GlobPlot;\r
import compbio.runner.disorder.IUPred;\r
import compbio.runner.disorder.Jronn;\r
+import compbio.runner.msa.ClustalO;\r
import compbio.runner.msa.ClustalW;\r
import compbio.runner.msa.Mafft;\r
import compbio.runner.msa.Muscle;\r
* \r
*/\r
public enum Services {\r
- MafftWS, MuscleWS, ClustalWS, TcoffeeWS, ProbconsWS, AAConWS, JronnWS, DisemblWS, GlobPlotWS, IUPredWS;\r
+ MafftWS, MuscleWS, ClustalWS, ClustalOWS, TcoffeeWS, ProbconsWS, AAConWS, JronnWS, DisemblWS, GlobPlotWS, IUPredWS;\r
\r
public static Services getService(String servName) {\r
servName = servName.trim().toLowerCase();\r
switch (this) {\r
case AAConWS :\r
return AACon.class;\r
+ case ClustalOWS :\r
+ return ClustalO.class;\r
case ClustalWS :\r
return ClustalW.class;\r
case MafftWS :\r
\r
// deliberate leaking\r
case ClustalWS :\r
+ case ClustalOWS :\r
case MafftWS :\r
case MuscleWS :\r
case ProbconsWS :\r
\r
-JABAWS client v2.0 June 2011 http://www.compbio.dundee.ac.uk/jabaws \r
+JABAWS2 client August 2011 http://www.compbio.dundee.ac.uk/jabaws \r
\r
Usage: <Class or Jar file name> -h=host_and_context <-s=serviceName> ACTION [OPTIONS] \r
\r
-h=<host_context> - a full URL to the JABAWS web server including context \r
path e.g. http://10.31.1.159:8080/ws\r
--s=<ServiceName> - one of [MafftWS, MuscleWS, ClustalWS, TcoffeeWS, ProbconsWS, \r
- AAConWS, JronnWS, DisemblWS, GlobPlotWS, IUPredWS]\r
+-s=<ServiceName> - one of [MafftWS, MuscleWS, ClustalWS, ClustalOWS, TcoffeeWS, \r
+ ProbconsWS, AAConWS, JronnWS, DisemblWS, GlobPlotWS, IUPredWS]\r
<serviceName> is required for all ACTIONS but -list_services\r
\r
ACTIONS: \r
--- /dev/null
+/* Copyright (c) 2009 Peter Troshin\r
+ * \r
+ * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0 \r
+ * \r
+ * This library is free software; you can redistribute it and/or modify it under the terms of the\r
+ * Apache License version 2 as published by the Apache Software Foundation\r
+ * \r
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
+ * License for more details.\r
+ * \r
+ * A copy of the license is in apache_license.txt. It is also available here:\r
+ * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
+ * \r
+ * Any republication or derived work distributed in source code form\r
+ * must include this copyright and license notice.\r
+ */\r
+\r
+package compbio.ws.server;\r
+\r
+import java.io.File;\r
+import java.util.List;\r
+\r
+import javax.jws.WebService;\r
+\r
+import org.apache.log4j.Logger;\r
+\r
+import compbio.data.msa.JABAService;\r
+import compbio.data.msa.MsaWS;\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.Executable;\r
+import compbio.engine.client.SkeletalExecutable;\r
+import compbio.metadata.ChunkHolder;\r
+import compbio.metadata.JobStatus;\r
+import compbio.metadata.JobSubmissionException;\r
+import compbio.metadata.Limit;\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.WrongParameterException;\r
+import compbio.runner.Util;\r
+import compbio.runner.msa.ClustalO;\r
+import compbio.runner.msa.ClustalW;\r
+import compbio.runner.msa.Tcoffee;\r
+\r
+@WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = JABAService.SERVICE_NAMESPACE, serviceName = "ClustalOWS")\r
+public class ClustalOWS implements MsaWS<ClustalO> {\r
+\r
+ private static Logger log = Logger.getLogger(ClustalOWS.class);\r
+\r
+ private static final RunnerConfig<ClustalO> clustalOptions = Util\r
+ .getSupportedOptions(ClustalO.class);\r
+\r
+ private static final PresetManager<ClustalO> clustalPresets = Util\r
+ .getPresets(ClustalO.class);\r
+\r
+ private static final LimitsManager<ClustalO> limitMan = compbio.engine.client.Util\r
+ .getLimits(new ClustalO().getType());\r
+\r
+ @Override\r
+ public String align(List<FastaSequence> sequences)\r
+ throws JobSubmissionException {\r
+\r
+ WSUtil.validateFastaInput(sequences);\r
+ ConfiguredExecutable<ClustalO> confClust = init(sequences);\r
+ return WSUtil.align(sequences, confClust, log, "align", getLimit(""));\r
+ }\r
+\r
+ ConfiguredExecutable<ClustalO> init(List<FastaSequence> dataSet)\r
+ throws JobSubmissionException {\r
+ ClustalO clustal = new ClustalO();\r
+ clustal.setInput(SkeletalExecutable.INPUT)\r
+ .setOutput(SkeletalExecutable.OUTPUT)\r
+ .setError(SkeletalExecutable.ERROR);\r
+ ConfiguredExecutable<ClustalO> confClust = Configurator\r
+ .configureExecutable(clustal, dataSet);\r
+ // Set the number of threads for the cluster execution from conf file\r
+ if (confClust.getExecProvider() == Executable.ExecProvider.Cluster) {\r
+ int clusterCpuNum = SkeletalExecutable.getClusterCpuNum(clustal.getType());\r
+ if (clusterCpuNum != 0) {\r
+ clustal.setNCore(clusterCpuNum);\r
+ }\r
+ }\r
+\r
+ return confClust;\r
+ }\r
+\r
+ @Override\r
+ public String presetAlign(List<FastaSequence> sequences,\r
+ Preset<ClustalO> preset) throws JobSubmissionException,\r
+ WrongParameterException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ if (preset == null) {\r
+ throw new WrongParameterException("Preset must be provided!");\r
+ }\r
+ Limit<ClustalO> limit = getLimit(preset.getName());\r
+ ConfiguredExecutable<ClustalO> confClust = init(sequences);\r
+ confClust.addParameters(preset.getOptions());\r
+ return WSUtil.align(sequences, confClust, log, "presetAlign", limit);\r
+ }\r
+\r
+ @Override\r
+ public String customAlign(List<FastaSequence> sequences,\r
+ List<Option<ClustalO>> options) throws JobSubmissionException,\r
+ WrongParameterException {\r
+ WSUtil.validateFastaInput(sequences);\r
+ ConfiguredExecutable<ClustalO> confClust = init(sequences);\r
+ List<String> params = WSUtil.getCommands(options,\r
+ ClustalO.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
+ @Override\r
+ public RunnerConfig<ClustalO> getRunnerOptions() {\r
+ return clustalOptions;\r
+ }\r
+\r
+ @SuppressWarnings("unchecked")\r
+ @Override\r
+ public Alignment getResult(String jobId) throws ResultNotAvailableException {\r
+\r
+ WSUtil.validateJobId(jobId);\r
+ AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
+ ConfiguredExecutable<ClustalO> clustal = (ConfiguredExecutable<ClustalO>) asyncEngine\r
+ .getResults(jobId);\r
+ Alignment al = clustal.getResults();\r
+\r
+ return al;\r
+ }\r
+\r
+ @Override\r
+ public Limit<ClustalO> getLimit(String presetName) {\r
+ if (limitMan == null) {\r
+ // No limit is configured\r
+ return null;\r
+ }\r
+ Limit<ClustalO> limit = limitMan.getLimitByName(presetName);\r
+ return limit;\r
+ }\r
+\r
+ @Override\r
+ public LimitsManager<ClustalO> getLimits() {\r
+ return limitMan;\r
+ }\r
+\r
+ @Override\r
+ public boolean cancelJob(String jobId) {\r
+ WSUtil.validateJobId(jobId);\r
+ boolean result = WSUtil.cancelJob(jobId);\r
+ return result;\r
+ }\r
+\r
+ @Override\r
+ public JobStatus getJobStatus(String jobId) {\r
+ WSUtil.validateJobId(jobId);\r
+ JobStatus status = WSUtil.getJobStatus(jobId);\r
+ return status;\r
+ }\r
+\r
+ @Override\r
+ public PresetManager<ClustalO> getPresets() {\r
+ return clustalPresets;\r
+ }\r
+\r
+ @Override\r
+ public ChunkHolder pullExecStatistics(String jobId, long position) {\r
+\r
+ WSUtil.validateJobId(jobId);\r
+ String file = Configurator.getWorkDirectory(jobId) + File.separator\r
+ + ClustalO.getStatFile();\r
+ ChunkHolder cholder = WSUtil.pullFile(file, position);\r
+ return cholder;\r
+ }\r
+\r
+}\r