From: Daniel Barton Date: Wed, 21 Aug 2013 11:13:40 +0000 (+0100) Subject: Reverted some changes I made for testing back to their original states. X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=778c188406bfee47be3cdc76fb95a36bbb8ea737;p=jabaws.git Reverted some changes I made for testing back to their original states. --- diff --git a/runner/compbio/runner/Util.java b/runner/compbio/runner/Util.java index f9106ca..6f0ec09 100644 --- a/runner/compbio/runner/Util.java +++ b/runner/compbio/runner/Util.java @@ -38,12 +38,13 @@ import java.util.Scanner; + import org.apache.log4j.Logger; import compbio.data.sequence.Alignment; import compbio.data.sequence.ClustalAlignmentUtil; import compbio.data.sequence.FastaSequence; -import compbio.data.sequence.RNAStruct; +import compbio.data.sequence.RNAStructScoreManager; import compbio.data.sequence.Score; import compbio.data.sequence.ScoreManager; import compbio.data.sequence.Range; @@ -167,7 +168,7 @@ public final class Util { } - public static ScoreManager readRNAStruct(String workDirectory, + public static RNAStructScoreManager readRNAStruct(String workDirectory, String structFile) throws IOException, FileNotFoundException { assert !compbio.util.Util.isEmpty(workDirectory); diff --git a/webservices/compbio/ws/client/Jws2Client.java b/webservices/compbio/ws/client/Jws2Client.java index ce4980d..ae38d9f 100644 --- a/webservices/compbio/ws/client/Jws2Client.java +++ b/webservices/compbio/ws/client/Jws2Client.java @@ -50,7 +50,6 @@ import compbio.data.msa.RegistryWS; import compbio.data.msa.SequenceAnnotation; import compbio.data.sequence.Alignment; import compbio.data.sequence.FastaSequence; -import compbio.data.sequence.RNAStruct; import compbio.data.sequence.ScoreManager; import compbio.data.sequence.ClustalAlignmentUtil; import compbio.data.sequence.SequenceUtil; @@ -176,7 +175,9 @@ public class Jws2Client { ScoreManager result = analize(inputFile, ((SequenceAnnotation) msaws), preset, customOptions); - System.out.println(result\.asRNAStruct().toString()); + // A System.out.println just for testing! + System.out.println(result.toString()); + IOHelper.writeOut(writer, result); } else if (service.getServiceType() == MsaWS.class) { alignment = align(inputFile, (MsaWS) msaws, preset, @@ -530,60 +531,60 @@ public class Jws2Client { * @return String */ - static String fold(File file, FoldWS foldws, Preset preset, - List> customOptions) { - FileInputStream instream = null; - Alignment alignment = null; - String rnastruct = null; - try { - instream = new FileInputStream(file); - alignment = ClustalAlignmentUtil.readClustalFile(instream); - instream.close(); - String jobId = null; - if (customOptions != null && preset != null) { - System.out.println("WARN: Parameters (-f) are defined together" - + "with a preset (-r), ignoring preset! "); - } - if (customOptions != null) { - jobId = foldws.customFold(alignment, customOptions); - } else if (preset != null) { - jobId = foldws.presetFold(alignment, preset); - } else { - jobId = foldws.fold(alignment); - } - System.out.println("\n\ncalling fold........."); - Thread.sleep(1000); - rnastruct = foldws.getResult(jobId); - - } catch (IOException e) { - System.err.println("Exception while reading the input file. Exception details: "); - e.printStackTrace(); - } catch (UnknownFileFormatException e) { - System.err.println("Exception while reading input file. Doesnt look like a Clustal format file"); - e.printStackTrace(); - } catch (JobSubmissionException e) { - System.err.println("Exception while submitting job to the web server. "); - e.printStackTrace(); - } catch (ResultNotAvailableException e) { - System.err.println("Exception while waiting for results. Exception details: "); - e.printStackTrace(); - } catch (InterruptedException ignored) { - // ignore and propagate an interruption - Thread.currentThread().interrupt(); - } catch (WrongParameterException e) { - e.printStackTrace(); - } finally { - if (instream != null) { - try { - instream.close(); - } catch (IOException ignored) { - // ignore - } - } - } - return rnastruct; - } - +// static String fold(File file, FoldWS foldws, Preset preset, +// List> customOptions) { +// FileInputStream instream = null; +// Alignment alignment = null; +// String rnastruct = null; +// try { +// instream = new FileInputStream(file); +// alignment = ClustalAlignmentUtil.readClustalFile(instream); +// instream.close(); +// String jobId = null; +// if (customOptions != null && preset != null) { +// System.out.println("WARN: Parameters (-f) are defined together" +// + "with a preset (-r), ignoring preset! "); +// } +// if (customOptions != null) { +// jobId = foldws.customFold(alignment, customOptions); +// } else if (preset != null) { +// jobId = foldws.presetFold(alignment, preset); +// } else { +// jobId = foldws.fold(alignment); +// } +// System.out.println("\n\ncalling fold........."); +// Thread.sleep(1000); +// rnastruct = foldws.getResult(jobId); +// +// } catch (IOException e) { +// System.err.println("Exception while reading the input file. Exception details: "); +// e.printStackTrace(); +// } catch (UnknownFileFormatException e) { +// System.err.println("Exception while reading input file. Doesnt look like a Clustal format file"); +// e.printStackTrace(); +// } catch (JobSubmissionException e) { +// System.err.println("Exception while submitting job to the web server. "); +// e.printStackTrace(); +// } catch (ResultNotAvailableException e) { +// System.err.println("Exception while waiting for results. Exception details: "); +// e.printStackTrace(); +// } catch (InterruptedException ignored) { +// // ignore and propagate an interruption +// Thread.currentThread().interrupt(); +// } catch (WrongParameterException e) { +// e.printStackTrace(); +// } finally { +// if (instream != null) { +// try { +// instream.close(); +// } catch (IOException ignored) { +// // ignore +// } +// } +// } +// return rnastruct; +// } +// /** * Prints Jws2Client usage information to standard out * diff --git a/webservices/compbio/ws/server/RNAalifoldWS.java b/webservices/compbio/ws/server/RNAalifoldWS.java index beca1dc..a6ed826 100644 --- a/webservices/compbio/ws/server/RNAalifoldWS.java +++ b/webservices/compbio/ws/server/RNAalifoldWS.java @@ -9,7 +9,6 @@ import org.apache.log4j.Logger; import compbio.data.msa.JABAService; import compbio.data.msa.SequenceAnnotation; import compbio.data.sequence.FastaSequence; -import compbio.data.sequence.RNAStructScoreManager; import compbio.engine.client.ConfiguredExecutable; import compbio.metadata.JobSubmissionException; import compbio.metadata.LimitExceededException; @@ -32,40 +31,6 @@ public class RNAalifoldWS extends SequenceAnnotationService super (new RNAalifold(), log); } - - // for testing - @Override - public RNAStructScoreManager getAnnotation(String jobId) - throws ResultNotAvailableException { - return WSUtil.getAnnotation(jobId, log); - } - - @Override - public String analize(List sequences) - throws UnsupportedRuntimeException, LimitExceededException, - JobSubmissionException { - WSUtil.validateFastaInput(sequences); - ConfiguredExecutable confRNAalifold = init(sequences); - return WSUtil.fold(sequences, confRNAalifold, log, "analize", - getLimit("")); - } - - @Override - public String customAnalize(List sequences, - List> options) throws UnsupportedRuntimeException, - LimitExceededException, JobSubmissionException, - WrongParameterException { - WSUtil.validateFastaInput(sequences); - ConfiguredExecutable confRNAalifold = init(sequences); - - List params = WSUtil.getCommands(options, - AACon.KEY_VALUE_SEPARATOR); - confRNAalifold.addParameters(params); - return WSUtil.fold(sequences, confRNAalifold, log, "customAnalize", - getLimit("")); - } - - /* * No presets are supported, thus the result of this call will be as simple * call to analize without parameters diff --git a/webservices/compbio/ws/server/WSUtil.java b/webservices/compbio/ws/server/WSUtil.java index a3f96d8..e80b1e5 100644 --- a/webservices/compbio/ws/server/WSUtil.java +++ b/webservices/compbio/ws/server/WSUtil.java @@ -27,7 +27,6 @@ import org.apache.log4j.Logger; import compbio.data.sequence.Alignment; import compbio.data.sequence.FastaSequence; -import compbio.data.sequence.RNAStructScoreManager; import compbio.data.sequence.ScoreManager; import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; @@ -209,9 +208,7 @@ public final class WSUtil { } } - // test - // set return type back to ScoreManager - public static RNAStructScoreManager getAnnotation(String jobId, Logger log) + public static ScoreManager getAnnotation(String jobId, Logger log) throws ResultNotAvailableException { WSUtil.validateJobId(jobId); AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId); @@ -219,10 +216,7 @@ public final class WSUtil { .getResults(jobId); - // test RNAalifold -// ScoreManager mas = aacon.getResults(); - - RNAStructScoreManager mas = aacon.getResults(); + ScoreManager mas = aacon.getResults(); log.trace(jobId + " getConservation : " + mas); return mas;