From 1059f954bc521e5ee59ec084ed066268a802ceaf Mon Sep 17 00:00:00 2001 From: Sasha Sherstnev Date: Tue, 17 Sep 2013 15:20:15 +0100 Subject: [PATCH] Fix probem with metadata --- datamodel/compbio/data/sequence/Program.java | 8 +++-- webservices/compbio/ws/server/ClustalOWS.java | 41 +++++++++---------------- webservices/compbio/ws/server/ClustalWS.java | 36 ++++++++-------------- webservices/compbio/ws/server/JpredWS.java | 1 - webservices/compbio/ws/server/MafftWS.java | 16 +++++----- webservices/compbio/ws/server/MuscleWS.java | 4 +-- webservices/compbio/ws/server/ProbconsWS.java | 4 +-- webservices/compbio/ws/server/TcoffeeWS.java | 19 +++++------- 8 files changed, 51 insertions(+), 78 deletions(-) diff --git a/datamodel/compbio/data/sequence/Program.java b/datamodel/compbio/data/sequence/Program.java index e5f4e76..0a234a3 100644 --- a/datamodel/compbio/data/sequence/Program.java +++ b/datamodel/compbio/data/sequence/Program.java @@ -32,14 +32,18 @@ public enum Program { CLUSTAL, /** + * ClustalO + */ + ClustalO, + /** * Mafft */ - MAFFT, + Mafft, /** * Muscle */ - MUSCLE, + Muscle, /** * Tcoffee diff --git a/webservices/compbio/ws/server/ClustalOWS.java b/webservices/compbio/ws/server/ClustalOWS.java index 898b3ad..2681364 100644 --- a/webservices/compbio/ws/server/ClustalOWS.java +++ b/webservices/compbio/ws/server/ClustalOWS.java @@ -29,6 +29,7 @@ import compbio.data.msa.JABAService; import compbio.data.msa.MsaWS; import compbio.data.sequence.Alignment; import compbio.data.sequence.FastaSequence; +import compbio.data.sequence.Program; import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; @@ -53,19 +54,15 @@ public class ClustalOWS implements MsaWS { private static Logger log = Logger.getLogger(ClustalOWS.class); - private static final RunnerConfig clustalOptions = Util - .getSupportedOptions(ClustalO.class); + private static final RunnerConfig clustalOptions = Util.getSupportedOptions(ClustalO.class); - private static final PresetManager clustalPresets = Util - .getPresets(ClustalO.class); + private static final PresetManager clustalPresets = Util.getPresets(ClustalO.class); - private static final LimitsManager limitMan = compbio.engine.client.Util - .getLimits(new ClustalO().getType()); + private static final LimitsManager limitMan = compbio.engine.client.Util.getLimits(new ClustalO().getType()); @Override public String align(List sequences) throws JobSubmissionException { - WSUtil.validateFastaInput(sequences); ConfiguredExecutable confClust = init(sequences); return WSUtil.align(sequences, confClust, log, "align", getLimit("")); @@ -74,20 +71,17 @@ public class ClustalOWS implements MsaWS { ConfiguredExecutable init(List dataSet) throws JobSubmissionException { ClustalO clustal = new ClustalO(); - clustal.setInput(SkeletalExecutable.INPUT) - .setOutput(SkeletalExecutable.OUTPUT) - .setError(SkeletalExecutable.ERROR); - ConfiguredExecutable confClust = Configurator - .configureExecutable(clustal, dataSet); + clustal.setInput(SkeletalExecutable.INPUT); + clustal.setOutput(SkeletalExecutable.OUTPUT); + clustal.setError(SkeletalExecutable.ERROR); + ConfiguredExecutable confClust = Configurator.configureExecutable(clustal, dataSet); // Set the number of threads for the cluster execution from conf file if (confClust.getExecProvider() == Executable.ExecProvider.Cluster) { - int clusterCpuNum = SkeletalExecutable.getClusterCpuNum(clustal - .getType()); + int clusterCpuNum = SkeletalExecutable.getClusterCpuNum(clustal.getType()); if (clusterCpuNum != 0) { clustal.setNCore(clusterCpuNum); } } - return confClust; } @@ -111,12 +105,10 @@ public class ClustalOWS implements MsaWS { WrongParameterException { WSUtil.validateFastaInput(sequences); ConfiguredExecutable confClust = init(sequences); - List params = WSUtil.getCommands(options, - ClustalO.KEY_VALUE_SEPARATOR); + List params = WSUtil.getCommands(options, ClustalO.KEY_VALUE_SEPARATOR); confClust.addParameters(params); log.info("Setting parameters: " + params); - return WSUtil.align(sequences, confClust, log, "customAlign", - getLimit("")); + return WSUtil.align(sequences, confClust, log, "customAlign", getLimit("")); } @Override @@ -127,14 +119,11 @@ public class ClustalOWS implements MsaWS { @SuppressWarnings("unchecked") @Override public Alignment getResult(String jobId) throws ResultNotAvailableException { - WSUtil.validateJobId(jobId); AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId); - ConfiguredExecutable clustal = (ConfiguredExecutable) asyncEngine - .getResults(jobId); + ConfiguredExecutable clustal = (ConfiguredExecutable) asyncEngine.getResults(jobId); Alignment al = clustal.getResults(); - - return al; + return new Alignment (al.getSequences(),Program.ClustalO, '-'); } @Override @@ -173,10 +162,8 @@ public class ClustalOWS implements MsaWS { @Override public ChunkHolder pullExecStatistics(String jobId, long position) { - WSUtil.validateJobId(jobId); - String file = Configurator.getWorkDirectory(jobId) + File.separator - + ClustalO.getStatFile(); + String file = Configurator.getWorkDirectory(jobId) + File.separator + ClustalO.getStatFile(); ChunkHolder cholder = WSUtil.pullFile(file, position); return cholder; } diff --git a/webservices/compbio/ws/server/ClustalWS.java b/webservices/compbio/ws/server/ClustalWS.java index 3ba7d62..ce12c6a 100644 --- a/webservices/compbio/ws/server/ClustalWS.java +++ b/webservices/compbio/ws/server/ClustalWS.java @@ -29,6 +29,7 @@ import compbio.data.msa.JABAService; import compbio.data.msa.MsaWS; import compbio.data.sequence.Alignment; import compbio.data.sequence.FastaSequence; +import compbio.data.sequence.Program; import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; @@ -52,14 +53,11 @@ public class ClustalWS implements MsaWS { private static Logger log = Logger.getLogger(ClustalWS.class); - private static final RunnerConfig clustalOptions = Util - .getSupportedOptions(ClustalW.class); + private static final RunnerConfig clustalOptions = Util.getSupportedOptions(ClustalW.class); - private static final PresetManager clustalPresets = Util - .getPresets(ClustalW.class); + private static final PresetManager clustalPresets = Util.getPresets(ClustalW.class); - private static final LimitsManager limitMan = compbio.engine.client.Util - .getLimits(new ClustalW().getType()); + private static final LimitsManager limitMan = compbio.engine.client.Util.getLimits(new ClustalW().getType()); @Override public String align(List sequences) @@ -73,11 +71,10 @@ public class ClustalWS implements MsaWS { ConfiguredExecutable init(List dataSet) throws JobSubmissionException { ClustalW clustal = new ClustalW(); - clustal.setInput(SkeletalExecutable.INPUT) - .setOutput(SkeletalExecutable.OUTPUT) - .setError(SkeletalExecutable.ERROR); - ConfiguredExecutable confClust = Configurator - .configureExecutable(clustal, dataSet); + clustal.setInput(SkeletalExecutable.INPUT); + clustal.setOutput(SkeletalExecutable.OUTPUT); + clustal.setError(SkeletalExecutable.ERROR); + ConfiguredExecutable confClust = Configurator.configureExecutable(clustal, dataSet); return confClust; } @@ -101,12 +98,10 @@ public class ClustalWS implements MsaWS { WrongParameterException { WSUtil.validateFastaInput(sequences); ConfiguredExecutable confClust = init(sequences); - List params = WSUtil.getCommands(options, - ClustalW.KEY_VALUE_SEPARATOR); + List params = WSUtil.getCommands(options, ClustalW.KEY_VALUE_SEPARATOR); confClust.addParameters(params); log.info("Setting parameters: " + params); - return WSUtil.align(sequences, confClust, log, "customAlign", - getLimit("")); + return WSUtil.align(sequences, confClust, log, "customAlign", getLimit("")); } @Override @@ -117,14 +112,11 @@ public class ClustalWS implements MsaWS { @SuppressWarnings("unchecked") @Override public Alignment getResult(String jobId) throws ResultNotAvailableException { - WSUtil.validateJobId(jobId); AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId); - ConfiguredExecutable clustal = (ConfiguredExecutable) asyncEngine - .getResults(jobId); + ConfiguredExecutable clustal = (ConfiguredExecutable) asyncEngine.getResults(jobId); Alignment al = clustal.getResults(); - - return al; + return new Alignment (al.getSequences(), Program.CLUSTAL, '-'); } @Override @@ -163,10 +155,8 @@ public class ClustalWS implements MsaWS { @Override public ChunkHolder pullExecStatistics(String jobId, long position) { - WSUtil.validateJobId(jobId); - String file = Configurator.getWorkDirectory(jobId) + File.separator - + ClustalW.getStatFile(); + String file = Configurator.getWorkDirectory(jobId) + File.separator + ClustalW.getStatFile(); ChunkHolder cholder = WSUtil.pullFile(file, position); return cholder; } diff --git a/webservices/compbio/ws/server/JpredWS.java b/webservices/compbio/ws/server/JpredWS.java index b23a64b..18be1b8 100644 --- a/webservices/compbio/ws/server/JpredWS.java +++ b/webservices/compbio/ws/server/JpredWS.java @@ -61,7 +61,6 @@ public class JpredWS implements MsaWS { @Override public String align(List sequences) throws JobSubmissionException { - WSUtil.validateFastaInput(sequences); ConfiguredExecutable confClust = init(sequences); return WSUtil.align(sequences, confClust, log, "align", getLimit("")); diff --git a/webservices/compbio/ws/server/MafftWS.java b/webservices/compbio/ws/server/MafftWS.java index f293ae7..5ee6872 100644 --- a/webservices/compbio/ws/server/MafftWS.java +++ b/webservices/compbio/ws/server/MafftWS.java @@ -29,6 +29,7 @@ import compbio.data.msa.JABAService; import compbio.data.msa.MsaWS; import compbio.data.sequence.Alignment; import compbio.data.sequence.FastaSequence; +import compbio.data.sequence.Program; import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; @@ -72,9 +73,9 @@ public class MafftWS implements MsaWS { ConfiguredExecutable init(List dataSet) throws JobSubmissionException { Mafft mafft = new Mafft(); - mafft.setInput(SkeletalExecutable.INPUT) - .setOutput(SkeletalExecutable.OUTPUT) - .setError(SkeletalExecutable.ERROR); + mafft.setInput(SkeletalExecutable.INPUT); + mafft.setOutput(SkeletalExecutable.OUTPUT); + mafft.setError(SkeletalExecutable.ERROR); return Configurator.configureExecutable(mafft, dataSet); } @@ -84,12 +85,10 @@ public class MafftWS implements MsaWS { WrongParameterException { WSUtil.validateFastaInput(sequences); ConfiguredExecutable confMafft = init(sequences); - List params = WSUtil.getCommands(options, - Mafft.KEY_VALUE_SEPARATOR); + List params = WSUtil.getCommands(options, Mafft.KEY_VALUE_SEPARATOR); log.info("Setting parameters: " + params); confMafft.addParameters(params); - return WSUtil.align(sequences, confMafft, log, "customAlign", - getLimit("")); + return WSUtil.align(sequences, confMafft, log, "customAlign", getLimit("")); } @Override @@ -117,8 +116,7 @@ public class MafftWS implements MsaWS { ConfiguredExecutable mafft = (ConfiguredExecutable) asyncEngine .getResults(jobId); Alignment al = mafft.getResults(); - // log(jobId, "getResults"); - return al; + return new Alignment (al.getSequences(), Program.Mafft, '-'); } @Override diff --git a/webservices/compbio/ws/server/MuscleWS.java b/webservices/compbio/ws/server/MuscleWS.java index a9d6c52..1937a68 100644 --- a/webservices/compbio/ws/server/MuscleWS.java +++ b/webservices/compbio/ws/server/MuscleWS.java @@ -29,6 +29,7 @@ import compbio.data.msa.JABAService; import compbio.data.msa.MsaWS; import compbio.data.sequence.Alignment; import compbio.data.sequence.FastaSequence; +import compbio.data.sequence.Program; import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; @@ -116,8 +117,7 @@ public class MuscleWS implements MsaWS { ConfiguredExecutable muscle = (ConfiguredExecutable) asyncEngine .getResults(jobId); Alignment al = muscle.getResults(); - // log(jobId, "getResults"); - return al; + return new Alignment (al.getSequences(),Program.Muscle, '-'); } @Override diff --git a/webservices/compbio/ws/server/ProbconsWS.java b/webservices/compbio/ws/server/ProbconsWS.java index d4fa3df..087afc6 100644 --- a/webservices/compbio/ws/server/ProbconsWS.java +++ b/webservices/compbio/ws/server/ProbconsWS.java @@ -29,6 +29,7 @@ import compbio.data.msa.JABAService; import compbio.data.msa.MsaWS; import compbio.data.sequence.Alignment; import compbio.data.sequence.FastaSequence; +import compbio.data.sequence.Program; import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; @@ -105,8 +106,7 @@ public class ProbconsWS implements MsaWS { AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId); ConfiguredExecutable probcons = (ConfiguredExecutable) asyncEngine.getResults(jobId); Alignment al = probcons.getResults(); - // log(jobId, "getResults"); - return al; + return new Alignment (al.getSequences(), Program.Probcons, '-'); } @Override diff --git a/webservices/compbio/ws/server/TcoffeeWS.java b/webservices/compbio/ws/server/TcoffeeWS.java index 086d870..72291dc 100644 --- a/webservices/compbio/ws/server/TcoffeeWS.java +++ b/webservices/compbio/ws/server/TcoffeeWS.java @@ -29,6 +29,7 @@ import compbio.data.msa.JABAService; import compbio.data.msa.MsaWS; import compbio.data.sequence.Alignment; import compbio.data.sequence.FastaSequence; +import compbio.data.sequence.Program; import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; @@ -53,14 +54,11 @@ public class TcoffeeWS implements MsaWS { private static Logger log = Logger.getLogger(TcoffeeWS.class); - private static final RunnerConfig tcoffeeOptions = Util - .getSupportedOptions(Tcoffee.class); + private static final RunnerConfig tcoffeeOptions = Util.getSupportedOptions(Tcoffee.class); - private static final PresetManager tcoffeePresets = Util - .getPresets(Tcoffee.class); + private static final PresetManager tcoffeePresets = Util.getPresets(Tcoffee.class); - private static final LimitsManager limitMan = compbio.engine.client.Util - .getLimits(new Tcoffee().getType()); + private static final LimitsManager limitMan = compbio.engine.client.Util.getLimits(new Tcoffee().getType()); @Override public String align(List sequences) @@ -96,12 +94,10 @@ public class TcoffeeWS implements MsaWS { WSUtil.validateFastaInput(sequences); ConfiguredExecutable confTcoffee = init(sequences); - List params = WSUtil.getCommands(options, - Tcoffee.KEY_VALUE_SEPARATOR); + List params = WSUtil.getCommands(options, Tcoffee.KEY_VALUE_SEPARATOR); log.info("Setting parameters:" + params); confTcoffee.addParameters(params); - return WSUtil.align(sequences, confTcoffee, log, "customAlign", - getLimit("")); + return WSUtil.align(sequences, confTcoffee, log, "customAlign", getLimit("")); } @Override @@ -126,8 +122,7 @@ public class TcoffeeWS implements MsaWS { ConfiguredExecutable tcoffee = (ConfiguredExecutable) asyncEngine .getResults(jobId); Alignment al = tcoffee.getResults(); - // log(jobId, "getResults"); - return al; + return new Alignment (al.getSequences(), Program.Tcoffee, '-'); } @Override -- 1.7.10.2