X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=webservices%2Fcompbio%2Fws%2Fserver%2FWSUtil.java;h=07d005d3452c581a2174036095615a24e0d2b5d2;hb=bd6c0919476cff487ea479588d5ad9f3bdd5af1e;hp=7646747429b528cc177964a5800d02293e221845;hpb=42d82f347c559914cc57499c43daa49aed0573b8;p=jabaws.git diff --git a/webservices/compbio/ws/server/WSUtil.java b/webservices/compbio/ws/server/WSUtil.java index 7646747..07d005d 100644 --- a/webservices/compbio/ws/server/WSUtil.java +++ b/webservices/compbio/ws/server/WSUtil.java @@ -25,7 +25,6 @@ import java.util.Set; import org.apache.log4j.Logger; -import compbio.data.sequence.Alignment; import compbio.data.sequence.FastaSequence; import compbio.data.sequence.ScoreManager; import compbio.engine.AsyncExecutor; @@ -113,29 +112,6 @@ public final class WSUtil { return jobId; } - // Hardcoded gapchar '-' in this method - - public static String fold(Alignment alignment, - ConfiguredExecutable confExec, Logger logger, - String callingMethod, Limit limit) - throws LimitExceededException, JobSubmissionException { - - List sequences = alignment.getSequences(); - if (limit != null && limit.isExceeded(sequences)) { - throw LimitExceededException.newLimitExceeded(limit, sequences); - } - compbio.runner.Util.writeClustalInput(sequences, confExec, '-'); - System.out.println("WSUtil-fold: Writing the clustal input file on the server: to file: " - + confExec.getInput()); - System.out.println("WSUtil-fold: The executable is configured with parameters: " - + confExec.getParameters()); -// System.out.println("WSUTil-fold: Dump the configured executable:\n" -// + confExec.toString()); - AsyncExecutor engine = Configurator.getAsyncEngine(confExec); - String jobId = engine.submitJob(confExec); - reportUsage(confExec, logger); - return jobId; - } static void reportUsage(ConfiguredExecutable confExec, Logger logger) { if (GAUtils.IS_GA_ENABLED) { @@ -153,8 +129,25 @@ public final class WSUtil { throw LimitExceededException.newLimitExceeded(limit, sequences); } log.debug("Method: " + method + " with task: " + confExec.getTaskId()); - // Change this line for RNAalifold testing - // compbio.runner.Util.writeInput(sequences, confExec); + compbio.runner.Util.writeInput(sequences, confExec); + AsyncExecutor engine = Configurator.getAsyncEngine(confExec); + String jobId = engine.submitJob(confExec); + reportUsage(confExec, log); + return jobId; + } + + // Same as analize but Alifold takes clustal input not fasta + // An if condition in the above method might be a better solution but + // you need a way of finding out the type of confExec at runtime + + public static String fold(List sequences, + ConfiguredExecutable confExec, Logger log, String method, + Limit limit) throws JobSubmissionException { + if (limit != null && limit.isExceeded(sequences)) { + throw LimitExceededException.newLimitExceeded(limit, sequences); + } + log.debug("Method: " + method + " with task: " + confExec.getTaskId()); + // This line is different from the above method compbio.runner.Util.writeClustalInput(sequences, confExec, '-'); AsyncExecutor engine = Configurator.getAsyncEngine(confExec); String jobId = engine.submitJob(confExec); @@ -185,10 +178,28 @@ public final class WSUtil { } if (fs.getLength() != len) { throw new JobSubmissionException( - "All sequences must be of the same length. Please align " - + "the sequences prior to submission! The first sequence length is : " - + len + " but the sequence '" + fs.getId() - + "' length is " + fs.getLength()); + "All sequences must be of the same length. Please align the sequences " + + " prior to submission! The first sequence length is : " + len + + " but the sequence '" + fs.getId() + "' length is " + fs.getLength()); + } + } + } + + public static void validateJpredInput(List sequences) + throws JobSubmissionException { + validateFastaInput(sequences); + int len = 0; + for (FastaSequence fs : sequences) { + if (len == 0) { + len = fs.getLength(); + continue; + } + if (fs.getLength() != len) { + System.out.println("FASTA rec: id = " + fs.getId() + ": seq = " + fs.getSequence()); + throw new JobSubmissionException( + "All sequences must be of the same length. Please align the sequences " + + " prior to submission! The first sequence length is : " + len + + " but the sequence '" + fs.getId() + "' length is " + fs.getLength()); } } } @@ -197,12 +208,13 @@ public final class WSUtil { throws ResultNotAvailableException { WSUtil.validateJobId(jobId); AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId); - ConfiguredExecutable aacon = (ConfiguredExecutable) asyncEngine - .getResults(jobId); + ConfiguredExecutable aacon = (ConfiguredExecutable) asyncEngine.getResults(jobId); ScoreManager mas = aacon.getResults(); + log.trace(jobId + " getConservation : " + mas); return mas; } + /* * UNUSED