From 9072bd850138bedbd005509e5b14bb5e104574b4 Mon Sep 17 00:00:00 2001 From: Daniel Barton Date: Mon, 12 Aug 2013 15:24:23 +0100 Subject: [PATCH] Webservice which implements FoldWS and returns String. Parameters.xml file updated in line with the RunnerConfig schema. --- conf/Executable.properties | 3 +- conf/settings/RNAalifoldParameters.xml | 121 +++++---- datamodel/compbio/data/sequence/SequenceUtil.java | 2 +- runner/compbio/runner/Util.java | 45 +++- runner/compbio/runner/structure/RNAalifold.java | 10 +- .../structure/RNAalifoldParametersTester.java | 263 +++++++++++++++++--- testsrc/compbio/ws/client/TestRNAalifoldWS.java | 55 ++-- testsrc/testdata/RNAalifoldParameters.xml | 124 +++++---- webservices/compbio/data/msa/FoldWS.java | 2 +- webservices/compbio/ws/client/Jws2Client.java | 14 +- webservices/compbio/ws/client/WSTester.java | 47 ++++ webservices/compbio/ws/server/RNAalifoldWS.java | 2 +- .../compbio/ws/server/resource/RNAalifoldWS.wsdl | 48 ++-- .../ws/server/resource/RNAalifoldWS_schema1.xsd | 64 ++--- 14 files changed, 570 insertions(+), 230 deletions(-) diff --git a/conf/Executable.properties b/conf/Executable.properties index 7944081..9641fb9 100644 --- a/conf/Executable.properties +++ b/conf/Executable.properties @@ -185,6 +185,7 @@ iupred.parameters.file=conf/settings/IUPredParameters.xml #local.aacon.bin=/sw/java/latest/bin/java #cluster.aacon.bin=/sw/java/latest/bin/java # Path to the AACon library + aacon.jar.file=binaries/windows/aaconservation.jar aacon.parameters.file=conf/settings/AAConParameters.xml aacon.presets.file=conf/settings/AAConPresets.xml @@ -198,5 +199,5 @@ aacon.presets.file=conf/settings/AAConPresets.xml ##### RNAALIFOLD CONFIGURATION ###### # just the windows binary at the moment local.rnaalifold.bin.windows=binaries/windows/ViennaRNA/RNAalifold.exe -rnaalifold.parameters.file=conf/settings/RNAalifoldParamteres.xml +rnaalifold.parameters.file=conf/settings/RNAalifoldParameters.xml diff --git a/conf/settings/RNAalifoldParameters.xml b/conf/settings/RNAalifoldParameters.xml index 2561ec4..5ee3fc2 100644 --- a/conf/settings/RNAalifoldParameters.xml +++ b/conf/settings/RNAalifoldParameters.xml @@ -17,6 +17,13 @@ Partition Function Output partition function and probability matrix -p + --partfunc + -p + + + p0 + deactivates the calculation of the pair probabilities + -p0 color @@ -34,11 +41,6 @@ --noPS - Partition Function - Output partition function and probability matrix - -p - - Circular Assume circular RNA molecule -c @@ -54,7 +56,7 @@ -g - Dangling End Preset + d2 dangling energies will be added for the bases adjacent to a helix on both sides -d2 @@ -85,6 +87,18 @@ --ribosum_scoring -r + + d2 + + Dangling energies are added for the bases adjacent to a helix on both sides + + -d2 + + + MEA Structure + Maximum Expected Accuracy Structure + --MEA + + + - MEA structure - Maximum Expected Accuracy Structure - --MEA - 1 + Stochastic Backtrack + Compute a number of random structures + -s + + + + 5 - Float + Integer + 1 + 100000 - - - - - - - - - - - - stochBT_en Print Backtrack structures --stochBT_en 5 - Int + Integer + 1 + 100000 @@ -136,13 +145,20 @@ be of the form -s INT and &dash-stochBT=INT --> 1.07 Float + 0 + 100 bppmThreshold Threshold for base pair probabilities --bppmThreshold - 1e-6 + 0.000001 + + Float + 0.0000000000001 + 1.0 + Temperature @@ -151,7 +167,9 @@ be of the form -s INT and &dash-stochBT=INT --> 37 - Double + Float + -274 + 1000000 @@ -161,7 +179,9 @@ be of the form -s INT and &dash-stochBT=INT --> 2 - Int + Integer + 0 + 100000 @@ -170,7 +190,9 @@ be of the form -s INT and &dash-stochBT=INT --> --cfactor 1.0 - Double + Float + 0 + 100000 @@ -179,7 +201,9 @@ be of the form -s INT and &dash-stochBT=INT --> --nfactor 1.0 - Double + Float + 0 + 100000 @@ -188,35 +212,42 @@ be of the form -s INT and &dash-stochBT=INT --> - + - + + + + Allow Pairs - allow pairs in addition to AU, GC and GU + allow pairs in addition to AU, GC and GU --nsp -GA + -GA + -AG + + + + betaScale + Set scaling of Boltzmann factors + --betaScale + 1.0 - String + Float + 0 + 100000 - - - - - - - - - - \ No newline at end of file diff --git a/datamodel/compbio/data/sequence/SequenceUtil.java b/datamodel/compbio/data/sequence/SequenceUtil.java index 548e57d..884315d 100644 --- a/datamodel/compbio/data/sequence/SequenceUtil.java +++ b/datamodel/compbio/data/sequence/SequenceUtil.java @@ -761,7 +761,7 @@ public final class SequenceUtil { /* * Reads and parses the output of an RNAalifold job * - * Currently only in the defualt no args format + * OUT OF USE */ public static RNAstruct readRNAalifoldResults(InputStream results) { if (results == null) { diff --git a/runner/compbio/runner/Util.java b/runner/compbio/runner/Util.java index f033bf0..c6cb33f 100644 --- a/runner/compbio/runner/Util.java +++ b/runner/compbio/runner/Util.java @@ -20,6 +20,8 @@ package compbio.runner; import java.io.File; import java.io.FileInputStream; +import java.io.FileReader; +import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; @@ -151,20 +153,55 @@ public final class Util { } } - public static final RNAstruct readRNAStructFile(String workDirectory, + // OUT OF USE + +// public static final RNAstruct readRNAStructFile(String workDirectory, +// String structFile) throws IOException, FileNotFoundException { +// assert !compbio.util.Util.isEmpty(workDirectory); +// assert !compbio.util.Util.isEmpty(structFile); +// File sfile = new File(compbio.engine.client.Util.getFullPath( +// workDirectory, structFile)); +// if(!(sfile.exists() && sfile.length() > 0)) { +// throw new FileNotFoundException("Result for the jobId " +// + workDirectory + "with file name " + structFile +// + " is not found!"); +// } +// return compbio.data.sequence.SequenceUtil.readRNAalifoldResults( +// new FileInputStream(sfile)); +// } + + public static String readRNAStruct(String workDirectory, String structFile) throws IOException, FileNotFoundException { assert !compbio.util.Util.isEmpty(workDirectory); assert !compbio.util.Util.isEmpty(structFile); File sfile = new File(compbio.engine.client.Util.getFullPath( workDirectory, structFile)); - log.trace("RNAALIFOLD OUTPUT FILE PATH: " + sfile.getAbsolutePath()); if(!(sfile.exists() && sfile.length() > 0)) { throw new FileNotFoundException("Result for the jobId " + workDirectory + "with file name " + structFile + " is not found!"); } - return compbio.data.sequence.SequenceUtil.readRNAalifoldResults( - new FileInputStream(sfile)); + return readFile(sfile); + } + + public static String readFile(File inputFile) throws + FileNotFoundException, IOException { + + BufferedReader input = new BufferedReader(new FileReader(inputFile)); + + String file = new String(); + String line = new String(); + + while (true) { + line = input.readLine(); + + if (line != null) { + file = file + line + "\r\n"; + } else break; + } + // Close file + input.close(); + return file; } diff --git a/runner/compbio/runner/structure/RNAalifold.java b/runner/compbio/runner/structure/RNAalifold.java index 3871ea9..52a784c 100644 --- a/runner/compbio/runner/structure/RNAalifold.java +++ b/runner/compbio/runner/structure/RNAalifold.java @@ -6,10 +6,7 @@ import java.io.IOException; import java.util.Arrays; import java.util.List; -//imports for filereader method -import java.io.FileReader; -import java.io.BufferedReader; -import java.io.File; + @@ -61,11 +58,10 @@ public class RNAalifold extends SkeletalExecutable @SuppressWarnings("unchecked") @Override // PlaceHolder method - public RNAstruct getResults(String workDirectory) + public String getResults(String workDirectory) throws ResultNotAvailableException { try { - // System.out.println("Specialread " + Util.readRNAStructFile(workDirectory, getOutput()).toString()); - return Util.readRNAStructFile(workDirectory, getOutput()); + return Util.readRNAStruct(workDirectory, getOutput()); } catch (FileNotFoundException e) { log.error(e.getMessage(), e.getCause()); diff --git a/testsrc/compbio/runner/structure/RNAalifoldParametersTester.java b/testsrc/compbio/runner/structure/RNAalifoldParametersTester.java index 21ed5d4..b93cd18 100644 --- a/testsrc/compbio/runner/structure/RNAalifoldParametersTester.java +++ b/testsrc/compbio/runner/structure/RNAalifoldParametersTester.java @@ -70,11 +70,8 @@ public class RNAalifoldParametersTester { rnaalifoldConfigFile)), RunnerConfig.class); // set Name value separator rnaalifoldConfig.setPrmSeparator(" "); - log.info("prmSeparator: " + rnaalifoldConfig.getPrmSeparator()); rnaalifoldOpc = new OptionCombinator(rnaalifoldConfig); - log.info("Num options: " + rnaalifoldOpc.getAllOptions().size()); - log.info("Num params: " + rnaalifoldOpc.getAllParameters().size()); } catch (JAXBException e) { @@ -124,42 +121,146 @@ public class RNAalifoldParametersTester { } } - @Test(groups = { AllTestSuit.test_group_runner }) + + + @Test public void testOptions() { - test(rnaalifoldOpc.getAllOptions()); + // populate list of incompatable pairs by their names. todo + List> failPairs = new ArrayList>(); + + + // test the parameters without -g option + test(removeParam(rnaalifoldOpc.getAllOptions(), "G-Quadruplex")); + // now test without -c option + test(removeParam(rnaalifoldOpc.getAllOptions(), "Circular")); } - @Test(groups = { AllTestSuit.test_group_runner }) + + // Prints all the incompatible option pairs + // (-c, -g) and (-p, -p0) + + @Test public void testOptionPairs() throws ResultNotAvailableException { List> pair = new ArrayList>(); List> options = rnaalifoldOpc.getAllOptions(); - int numpairs = 0; + List> failedOptionPairs = new ArrayList>(); + + boolean failed = true; for (int i = 0; i args = rnaalifoldOpc.argumentsToCommandString(pair); + try { + failed = singleRun(args); + } catch (ResultNotAvailableException e) { + System.out.println("Results not available: " + e.getMessage()); + failed = true; + } catch (JobSubmissionException e) { + e.printStackTrace(); + fail(e.getLocalizedMessage()); + } catch (JobExecutionException e) { + e.printStackTrace(); + fail(e.getLocalizedMessage()); + } catch (IOException e) { + e.printStackTrace(); + fail(e.getLocalizedMessage()); + } + if (failed == true) { + failedOptionPairs.add(args); + } } } } + System.out.println("failedOptionPairs: " + failedOptionPairs); + } - + + // tests for incompatible Pairs of Parameters + // there are none however the --betascale parameter requires -p + + @Test + public void testParameterPairs() throws ResultNotAvailableException { + List> pair = new ArrayList>(); + List> Parameters = rnaalifoldOpc.getAllParameters(); + List> failedParameterPairs = new ArrayList>(); + + + boolean failed = true; + for (int i = 0; i args = rnaalifoldOpc.argumentsToCommandString(pair); + args.add("-p"); // --betascale requires -p + try { + failed = singleRun(args); + } catch (ResultNotAvailableException e) { + System.out.println("Results not available: " + e.getMessage()); + failed = true; + } catch (JobSubmissionException e) { + e.printStackTrace(); + fail(e.getLocalizedMessage()); + } catch (JobExecutionException e) { + e.printStackTrace(); + fail(e.getLocalizedMessage()); + } catch (IOException e) { + e.printStackTrace(); + fail(e.getLocalizedMessage()); + } + if (failed == true) { + failedParameterPairs.add(args); + } + } + } + } + System.out.println("failedParameterPairs: " + failedParameterPairs); + + } + + + // removes an argument from the list by name + public > List removeParam(List optionList, String name) { + List newL = new ArrayList(); + for (int i = 0; i < optionList.size(); i++) { + System.out.println(name.equals(optionList.get(i).getName())); + if (!name.equals(optionList.get(i).getName())) { + + newL.add(optionList.get(i)); + } + + } + return newL; + } + + public > List removeParams(List optionList, List names) { + for (int i = 0; i < names.size(); i++) { + optionList = removeParam(optionList, names.get(i)); + } + return optionList; + } + + @Test(groups = { AllTestSuit.test_group_runner }) public void testParameters() { List> params = rnaalifoldOpc.getAllParameters(); + System.out.println("param list: " + params); Collections.shuffle(params); - test(params); + // test with -p for betascale option + List precursor = new ArrayList(); + precursor.add("-p"); + + test(params, precursor); } + + // incompatible pairs of arguments are + /* + * the -c and -g options + * the -d2 option and the -d option + * the -p and -p0 option + */ @Test(groups = { AllTestSuit.test_group_runner }) public void testArguments() { @@ -169,19 +270,63 @@ public class RNAalifoldParametersTester { test(options); } - /* - void test(Map, String> paramValue) { - List> paramList = new ArrayList>(paramValue - .keySet()); - for (int i = 0; i < paramValue.size(); i++) { - List args = rnaalifoldOpc.parametersToCommandString(paramList, - paramValue); - singleTest(args); - Collections.shuffle(paramList); + // This test supercedes the testParameterPair() and testOptionPair() + // tests by testing all pairs of arguments + + + @Test + public void testAllPairs() throws ResultNotAvailableException { + List> pair = new ArrayList>(); + List> options = rnaalifoldOpc.getAllOptions(); + + // take out -p options so it can be added to all commands later + options = removeParam(options, "Partition Function"); + + options.addAll(rnaalifoldOpc.getAllParameters()); + List> failedOptionPairs = new ArrayList>(); + + boolean failed = true; + for (int i = 0; i args = rnaalifoldOpc.argumentsToCommandString(pair); + // add -p + args.add("-p"); + try { + failed = singleRun(args); + } catch (ResultNotAvailableException e) { + System.out.println("Results not available: " + e.getMessage()); + failed = true; + } catch (JobSubmissionException e) { + e.printStackTrace(); + fail(e.getLocalizedMessage()); + } catch (JobExecutionException e) { + e.printStackTrace(); + fail(e.getLocalizedMessage()); + } catch (IOException e) { + e.printStackTrace(); + fail(e.getLocalizedMessage()); + } + if (failed == true) { + failedOptionPairs.add(args); + } + } + } } - log.info("NUMBER OF COMBINATION TESTED: " + paramValue.size()); + System.out.println("failedOptionPairs: " + failedOptionPairs); } - */ + + /* + * This test method stolen from the other parameter testing classes + * the only purpose of the Collections.shuffle(params) and the for loop + * is to test giving the executable the parameters in different orders + * which leads to a lot of (unnecessary?) tests with an argument list + * as long as this one. + * + */ + void test(List> params) { for (int i = 0; i < params.size(); i++) { @@ -192,6 +337,18 @@ public class RNAalifoldParametersTester { log.info("NUMBER OF COMBINATION TESTED: " + params.size()); } + // because some parameters presuppose the -p option + + void test(List> params, List precursor) { + + for (int i = 0; i < params.size(); i++) { + List args = rnaalifoldOpc.argumentsToCommandString(params); + args.addAll(precursor); + singleTest(args); + Collections.shuffle(params); + } + log.info("NUMBER OF COMBINATION TESTED: " + params.size()); + } @Test void singleParamTest() { //List> params = rnaalifoldOpc.getAllParameters(); @@ -199,7 +356,8 @@ public class RNAalifoldParametersTester { //List args = rnaalifoldOpc.argumentsToCommandString(params); List args = new ArrayList(); - args.add("-T 37"); args.add("-S 1.07"); args.add("--stochBT_en=10"); + args.add("-T 37"); args.add("-S 1.07"); args.add("--stochBT_en 10"); + // replace "=" with " " to fail test args.add("--MEA=1"); System.out.println("special: args: " + args); singleTest(args); @@ -219,7 +377,10 @@ public class RNAalifoldParametersTester { LocalRunner lr = new LocalRunner(confRNAalifold); lr.executeJob(); confRNAalifold = (ConfiguredExecutable) lr.waitForResult(); - assertNotNull(confRNAalifold.getResults()); + assertNotNull(confRNAalifold.getResults(), "results is null"); + + //System.out.println("Results: \n" + confRNAalifold.getResults()); + File errors = new File(confRNAalifold.getWorkDirectory(), ExecutableWrapper.PROC_ERR_FILE); if (errors.length() != 0) { @@ -243,4 +404,42 @@ public class RNAalifoldParametersTester { } } + /* A version of singleTest that continues running instead of calling + * fail() when it encounters a problem + * + * Used to identify incompatible options and parameters + * returns -1 on failure + * + * Bad Progamming practice? + */ + + + boolean singleRun(List params) throws JobSubmissionException, + JobExecutionException, IOException, ResultNotAvailableException { + boolean fail = true; + log.info("Using arguments: " + params); + RNAalifold rnaalifold = new RNAalifold(); + rnaalifold.setInput(AllTestSuit.test_input_aln).setOutput(test_outfile); + + ConfiguredExecutable confRNAalifold = Configurator + .configureExecutable(rnaalifold, ExecProvider.Local); + // Add options to the executable + confRNAalifold.addParameters(params); + LocalRunner lr = new LocalRunner(confRNAalifold); + lr.executeJob(); + confRNAalifold = (ConfiguredExecutable) lr.waitForResult(); + + //System.out.println("Results: \n" + confRNAalifold.getResults()); + + if (confRNAalifold.getResults() != null) fail = false; + File errors = new File(confRNAalifold.getWorkDirectory(), + ExecutableWrapper.PROC_ERR_FILE); + if (errors.length() != 0) { + log.error("PROBLEMS:\n " + FileUtil.readFileToString(errors)); + } + assertTrue(errors.length() == 0, "Run with arguments : " + params + + " FAILED!"); + Collections.shuffle(params); + return fail; + } } diff --git a/testsrc/compbio/ws/client/TestRNAalifoldWS.java b/testsrc/compbio/ws/client/TestRNAalifoldWS.java index 2d392f7..b061fcc 100644 --- a/testsrc/compbio/ws/client/TestRNAalifoldWS.java +++ b/testsrc/compbio/ws/client/TestRNAalifoldWS.java @@ -1,5 +1,6 @@ package compbio.ws.client; +import compbio.metadata.AllTestSuit; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; import static org.testng.Assert.fail; @@ -17,10 +18,10 @@ import javax.xml.ws.WebServiceException; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; +import compbio.data.msa.FoldWS; import compbio.data.msa.JABAService; import compbio.data.msa.SequenceAnnotation; import compbio.data.sequence.Alignment; -import compbio.data.structure.FoldWS; import compbio.data.sequence.RNAstruct; import compbio.data.sequence.ClustalAlignmentUtil; import compbio.data.sequence.ConservationMethod; @@ -37,47 +38,50 @@ import compbio.metadata.ResultNotAvailableException; import compbio.metadata.RunnerConfig; import compbio.metadata.UnsupportedRuntimeException; import compbio.metadata.WrongParameterException; - import compbio.runner.conservation.AACon; import compbio.util.SysPrefs; import compbio.ws.server.RNAalifoldWS; + public class TestRNAalifoldWS { FoldWS foldws; -// @BeforeTest(groups = {AllTestSuit.test_group_webservices}) -// void initConnection() { -// -// try { -// JABAService client = Jws2Client.connect( -// "http://localhost:8080/jabaws", Services.RNAalifoldWS); -// foldws = (FoldWS) client; -// } catch (ConnectException e) { -// e.printStackTrace(); -// fail(e.getMessage()); -// } catch (WebServiceException e) { -// e.printStackTrace(); -// fail(e.getMessage()); -// } -// } + @BeforeTest(groups = {AllTestSuit.test_group_webservices}) + void initConnection() { + + try { + JABAService client = Jws2Client.connect( + "http://localhost:8080/jabaws", Services.RNAalifoldWS); + foldws = (FoldWS) client; + } catch (ConnectException e) { + e.printStackTrace(); + fail(e.getMessage()); + } catch (WebServiceException e) { + e.printStackTrace(); + fail(e.getMessage()); + } + } @Test(groups = {AllTestSuit.test_group_webservices}) public void testFold() throws FileNotFoundException, IOException, UnknownFileFormatException { - String CURRENT_DIRECTORY = SysPrefs.getCurrentDirectory() - + File.separator; +// String CURRENT_DIRECTORY = SysPrefs.getCurrentDirectory() +// + File.separator; Alignment aln = ClustalAlignmentUtil.readClustalFile(new FileInputStream( - CURRENT_DIRECTORY + "testsrc" + File.separator + "testdata" - + File.separator + "unfolded_RF00031.aln")); + AllTestSuit.test_input_aln)); try { - String jobId = foldws.fold(aln); + List> options = new ArrayList>(); + options.add(foldws.getRunnerOptions().getArgumentByOptionName("--mis")); + System.out.println("TestRNAalifoldWS: print options: " + options.toString()); + String jobId = foldws.customFold(aln, options); System.out.println("J: " + jobId); - RNAstruct result = foldws.getResult(jobId); + String result = foldws.getResult(jobId); + System.out.println("fold results: \n" + result); assertNotNull(result); } catch (UnsupportedRuntimeException e) { @@ -92,7 +96,10 @@ public class TestRNAalifoldWS { } catch (ResultNotAvailableException e) { e.printStackTrace(); fail(e.getMessage()); - } + } catch (WrongParameterException e) { + e.printStackTrace(); + fail(e.getMessage()); + } } } diff --git a/testsrc/testdata/RNAalifoldParameters.xml b/testsrc/testdata/RNAalifoldParameters.xml index 2561ec4..845f480 100644 --- a/testsrc/testdata/RNAalifoldParameters.xml +++ b/testsrc/testdata/RNAalifoldParameters.xml @@ -1,5 +1,6 @@ - + compbio.runner.structure.RNAalifold Endgaps @@ -17,6 +18,13 @@ Partition Function Output partition function and probability matrix -p + --partfunc + -p + + + p0 + deactivates the calculation of the pair probabilities + -p0 color @@ -34,11 +42,6 @@ --noPS - Partition Function - Output partition function and probability matrix - -p - - Circular Assume circular RNA molecule -c @@ -54,7 +57,7 @@ -g - Dangling End Preset + d2 dangling energies will be added for the bases adjacent to a helix on both sides -d2 @@ -85,6 +88,18 @@ --ribosum_scoring -r + + d2 + + Dangling energies are added for the bases adjacent to a helix on both sides + + -d2 + + + MEA Structure + Maximum Expected Accuracy Structure + --MEA + + + - MEA structure - Maximum Expected Accuracy Structure - --MEA - 1 + Stochastic Backtrack + Compute a number of random structures + -s + + + + 5 - Float + Integer + 1 + 100000 - - - - - - - - - - - - stochBT_en Print Backtrack structures --stochBT_en 5 - Int + Integer + 1 + 100000 @@ -136,13 +146,20 @@ be of the form -s INT and &dash-stochBT=INT --> 1.07 Float + 0 + 100 bppmThreshold Threshold for base pair probabilities --bppmThreshold - 1e-6 + 0.000001 + + Float + 0.0000000000001 + 1.0 + Temperature @@ -151,7 +168,9 @@ be of the form -s INT and &dash-stochBT=INT --> 37 - Double + Float + -274 + 1000000 @@ -161,7 +180,9 @@ be of the form -s INT and &dash-stochBT=INT --> 2 - Int + Integer + 0 + 100000 @@ -170,7 +191,9 @@ be of the form -s INT and &dash-stochBT=INT --> --cfactor 1.0 - Double + Float + 0 + 100000 @@ -179,7 +202,9 @@ be of the form -s INT and &dash-stochBT=INT --> --nfactor 1.0 - Double + Float + 0 + 100000 @@ -188,35 +213,42 @@ be of the form -s INT and &dash-stochBT=INT --> - + - + + + + Allow Pairs - allow pairs in addition to AU, GC and GU + allow pairs in addition to AU, GC and GU --nsp -GA + -GA + -AG + + + + betaScale + Set scaling of Boltzmann factors + --betaScale + 1.0 - String + Float + 0 + 100000 - - - - - - - - - - \ No newline at end of file diff --git a/webservices/compbio/data/msa/FoldWS.java b/webservices/compbio/data/msa/FoldWS.java index 9f0d4d8..4a99b9f 100644 --- a/webservices/compbio/data/msa/FoldWS.java +++ b/webservices/compbio/data/msa/FoldWS.java @@ -53,7 +53,7 @@ public interface FoldWS throws UnsupportedRuntimeException, LimitExceededException, JobSubmissionException, WrongParameterException; - RNAstruct getResult(@WebParam(name = "jobId") String jobId) + String getResult(@WebParam(name = "jobId") String jobId) throws ResultNotAvailableException; } diff --git a/webservices/compbio/ws/client/Jws2Client.java b/webservices/compbio/ws/client/Jws2Client.java index 888ec5f..a06a6fa 100644 --- a/webservices/compbio/ws/client/Jws2Client.java +++ b/webservices/compbio/ws/client/Jws2Client.java @@ -161,8 +161,10 @@ public class Jws2Client { customOptions = MetadataHelper.processParameters(prms, msaws.getRunnerOptions()); } +// System.out.println("The Options read from the command line: " + customOptions); + Alignment alignment = null; - RNAstruct rnastruct = null; + String rnastruct = null; if (inputFile != null) { Writer writer = null; if (outFile != null) { @@ -185,7 +187,7 @@ public class Jws2Client { rnastruct = fold(inputFile, (FoldWS) foldws, preset, customOptions); // No IOHelper method for rnastruct/String yet if (writer != null) { - writer.write(rnastruct.toString()); + writer.write(rnastruct); } } writer.close(); @@ -532,14 +534,14 @@ public class Jws2Client { * Preset to use optional * @param customOptions * file which contains new line separated list of options - * @return RNAstruct + * @return String */ - static RNAstruct fold(File file, FoldWS foldws, Preset preset, + static String fold(File file, FoldWS foldws, Preset preset, List> customOptions) { FileInputStream instream = null; Alignment alignment = null; - RNAstruct rnastruct = null; + String rnastruct = null; try { instream = new FileInputStream(file); alignment = ClustalAlignmentUtil.readClustalFile(instream); @@ -559,8 +561,6 @@ public class Jws2Client { System.out.println("\n\ncalling fold........."); Thread.sleep(1000); rnastruct = foldws.getResult(jobId); - log.info("log test print results:\n" + rnastruct.toString()); - System.out.println("print test results:\n " + rnastruct.toString()); } catch (IOException e) { System.err.println("Exception while reading the input file. Exception details: "); diff --git a/webservices/compbio/ws/client/WSTester.java b/webservices/compbio/ws/client/WSTester.java index c6eaf76..5b0d760 100644 --- a/webservices/compbio/ws/client/WSTester.java +++ b/webservices/compbio/ws/client/WSTester.java @@ -35,9 +35,11 @@ import javax.xml.ws.WebServiceException; import compbio.data.msa.JABAService; import compbio.data.msa.Metadata; import compbio.data.msa.MsaWS; +import compbio.data.msa.FoldWS; import compbio.data.msa.SequenceAnnotation; import compbio.data.sequence.Alignment; import compbio.data.sequence.FastaSequence; +import compbio.data.sequence.Program; import compbio.data.sequence.ScoreManager; import compbio.data.sequence.SequenceUtil; import compbio.metadata.JobStatus; @@ -74,6 +76,8 @@ public class WSTester { + "ASDAAPEH------------PGIALWLHALE-DAGQAEAAA---AYTRAHQLLPEEPYITAQLLNAVA\n" + ""; + + static final List seqs = loadSeqs(); private static final String FAILED = "FAILED"; @@ -206,6 +210,15 @@ public class WSTester { testMetadata(msaws); return succeed; } + + private boolean testFoldWS(FoldWS foldws) throws Exception { + assert foldws != null; + + boolean succeed = testDefaultFold(foldws); + + // testMetadata(foldws); + return succeed; + } /** * Call most of web services functions and check the output * @@ -230,6 +243,8 @@ public class WSTester { } else if (wservice instanceof SequenceAnnotation) { return testSequenceAnnotationWS( (SequenceAnnotation) wservice, service); + } else if (wservice instanceof FoldWS) { + return testFoldWS( (FoldWS) wservice); } else { throw new UnsupportedOperationException("The service: " + wservice.getClass() + " is not supported! "); @@ -360,6 +375,38 @@ public class WSTester { } return succeed; } + + /** + * Fold using default settings + * + * @param + * @param foldws + * @throws UnsupportedRuntimeException + */ + + private boolean testDefaultFold(FoldWS foldws) throws Exception { + writer.print("Testing fold with default parameters:"); + // load the input from the aligned fasta string at the top of the file + Alignment al = new Alignment(loadAlignment(), Program.CLUSTAL, '-'); + String rs = null; + boolean succeed = false; + + String taskId = foldws.fold(al); + writer.print("\nQuerying job status..."); + JobStatus status = foldws.getJobStatus(taskId); + while (status != JobStatus.FINISHED) { + Thread.sleep(1000); + status = foldws.getJobStatus(taskId); + } + writer.println(OK); + writer.print("Retrieving results..."); + rs = foldws.getResult(taskId); + succeed = true; + if (rs != null) { + writer.println(OK); + } + return succeed; + } /** * Test JWS2 web services * diff --git a/webservices/compbio/ws/server/RNAalifoldWS.java b/webservices/compbio/ws/server/RNAalifoldWS.java index f838b16..cafb173 100644 --- a/webservices/compbio/ws/server/RNAalifoldWS.java +++ b/webservices/compbio/ws/server/RNAalifoldWS.java @@ -102,7 +102,7 @@ public class RNAalifoldWS implements FoldWS { } @SuppressWarnings("unchecked") - public RNAstruct getResult(String jobId) throws ResultNotAvailableException { + public String getResult(String jobId) throws ResultNotAvailableException { WSUtil.validateJobId(jobId); AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId); diff --git a/webservices/compbio/ws/server/resource/RNAalifoldWS.wsdl b/webservices/compbio/ws/server/resource/RNAalifoldWS.wsdl index 5c07638..fea5adb 100644 --- a/webservices/compbio/ws/server/resource/RNAalifoldWS.wsdl +++ b/webservices/compbio/ws/server/resource/RNAalifoldWS.wsdl @@ -51,18 +51,18 @@ - - - - - - + + + + + + @@ -75,18 +75,18 @@ - - - - - - + + + + + + @@ -120,14 +120,14 @@ - - - - + + + + @@ -136,14 +136,14 @@ - - - - + + + + @@ -228,7 +228,7 @@ - + @@ -237,7 +237,7 @@ - + @@ -264,7 +264,7 @@ - + @@ -273,7 +273,7 @@ - + diff --git a/webservices/compbio/ws/server/resource/RNAalifoldWS_schema1.xsd b/webservices/compbio/ws/server/resource/RNAalifoldWS_schema1.xsd index 5c6f88d..43f9e11 100644 --- a/webservices/compbio/ws/server/resource/RNAalifoldWS_schema1.xsd +++ b/webservices/compbio/ws/server/resource/RNAalifoldWS_schema1.xsd @@ -185,17 +185,7 @@ - - - - - - - - - - - + @@ -224,32 +214,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -281,6 +245,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + -- 1.7.10.2