updated in line with the RunnerConfig schema.
#local.aacon.bin=/sw/java/latest/bin/java\r
#cluster.aacon.bin=/sw/java/latest/bin/java\r
# Path to the AACon library\r
+\r
aacon.jar.file=binaries/windows/aaconservation.jar\r
aacon.parameters.file=conf/settings/AAConParameters.xml\r
aacon.presets.file=conf/settings/AAConPresets.xml\r
##### RNAALIFOLD CONFIGURATION ######\r
# just the windows binary at the moment\r
local.rnaalifold.bin.windows=binaries/windows/ViennaRNA/RNAalifold.exe\r
-rnaalifold.parameters.file=conf/settings/RNAalifoldParamteres.xml\r
+rnaalifold.parameters.file=conf/settings/RNAalifoldParameters.xml\r
\r
<name>Partition Function</name>
<description>Output partition function and probability matrix</description>
<optionNames>-p</optionNames>
+ <optionNames>--partfunc</optionNames>
+ <defaultValue>-p</defaultValue>
+ </options>
+ <options isRequired='false'>
+ <name>p0</name>
+ <description>deactivates the calculation of the pair probabilities</description>
+ <optionNames>-p0</optionNames>
</options>
<options isRequired='false'>
<name>color</name>
<optionNames>--noPS</optionNames>
</options>
<options isRequired='false'>
- <name>Partition Function</name>
- <description>Output partition function and probability matrix</description>
- <optionNames>-p</optionNames>
- </options>
- <options isRequired='false'>
<name>Circular</name>
<description>Assume circular RNA molecule</description>
<optionNames>-c</optionNames>
<defaultValue>-g</defaultValue>
</options>
<options isRequired='false'>
- <name>Dangling End Preset</name>
+ <name>d2</name>
<description>dangling energies will be added for the bases adjacent to a helix on both sides</description>
<optionNames>-d2</optionNames>
</options>
<optionNames>--ribosum_scoring</optionNames>
<defaultValue>-r</defaultValue>
</options>
+ <options isRequired='false'>
+ <name>d2</name>
+ <description>
+ Dangling energies are added for the bases adjacent to a helix on both sides
+ </description>
+ <optionNames>-d2</optionNames>
+ </options>
+ <options isRequired='false'>
+ <name>MEA Structure</name>
+ <description>Maximum Expected Accuracy Structure</description>
+ <optionNames>--MEA</optionNames>
+ </options>
<!-- Constraints are entered on the command line followed by the input .aln file
Causing problems for a batch RNAalifold execution system -->
<!--
<type>String</type>
</validValue>
</option> -->
+
+ <prmSeparator> </prmSeparator>
<parameters isRequired='false'>
- <name>MEA structure</name>
- <description>Maximum Expected Accuracy Structure</description>
- <optionNames>--MEA</optionNames>
- <defaultValue>1</defaultValue>
+ <name>Stochastic Backtrack</name>
+ <description>Compute a number of random structures</description>
+ <optionNames>-s</optionNames>
+<!-- Having multiple optionNames requires a default value but -->
+<!-- in a parameter defaultValue refers to the argument -->
+<!-- <optionNames>-stochBT</optionNames> -->
+ <defaultValue>5</defaultValue>
<validValue>
- <type>Float</type>
+ <type>Integer</type>
+ <min>1</min>
+ <max>100000</max>
</validValue>
</parameters>
-<!-- ?Will Jabaws recognize that arguments for the following params must
-be of the form -s INT and &dash-stochBT=INT -->
-<!-- <parameters isRequired='false'> -->
-<!-- <name>Stochastic Backtrack</name> -->
-<!-- <description>Compute a number of random structures</description> -->
-<!-- <optionNames>-s</optionNames> -->
- <!-- Having multiple optionNames requires a default value but
- in a parameter defaultValue refers to the argument -->
-<!-- <optionNames>-stochBT</optionNames> -->
-<!-- <defaultValue>5</defaultValue> arbitrary -->
-<!-- <validValue> -->
-<!-- <type>Int</type> -->
-<!-- </validValue> -->
-<!-- </parameters> -->
<parameters isRequired='false'>
<name>stochBT_en</name>
<description>Print Backtrack structures</description>
<optionNames>--stochBT_en</optionNames>
<defaultValue>5</defaultValue> <!-- arbitrary -->
<validValue>
- <type>Int</type>
+ <type>Integer</type>
+ <min>1</min>
+ <max>100000</max>
</validValue>
</parameters>
<parameters isRequired='false'>
<defaultValue>1.07</defaultValue>
<validValue>
<type>Float</type>
+ <min>0</min>
+ <max>100</max>
</validValue>
</parameters>
<parameters isRequired='false'>
<name>bppmThreshold</name>
<description>Threshold for base pair probabilities</description>
<optionNames>--bppmThreshold</optionNames>
- <defaultValue>1e-6</defaultValue>
+ <defaultValue>0.000001</defaultValue>
+ <validValue>
+ <type>Float</type>
+ <min>0.0000000000001</min>
+ <max>1.0</max>
+ </validValue>
</parameters>
<parameters isRequired='false'>
<name>Temperature</name>
<!-- <optionNames>-temp</optionNames> -->
<defaultValue>37</defaultValue>
<validValue>
- <type>Double</type>
+ <type>Float</type>
+ <min>-274</min>
+ <max>1000000</max>
</validValue>
</parameters>
<parameters isRequired='false'>
<!-- <optionNames>-dangles</optionNames> -->
<defaultValue>2</defaultValue>
<validValue>
- <type>Int</type>
+ <type>Integer</type>
+ <min>0</min>
+ <max>100000</max>
</validValue>
</parameters>
<parameters isRequired='false'>
<optionNames>--cfactor</optionNames>
<defaultValue>1.0</defaultValue>
<validValue>
- <type>Double</type>
+ <type>Float</type>
+ <min>0</min>
+ <max>100000</max>
</validValue>
</parameters>
<parameters isRequired='false'>
<optionNames>--nfactor</optionNames>
<defaultValue>1.0</defaultValue>
<validValue>
- <type>Double</type>
+ <type>Float</type>
+ <min>0</min>
+ <max>100000</max>
</validValue>
</parameters>
<!-- <name>Ribosum File</name> -->
<!-- <description>Use Specified Ribosum Matrix</description> -->
<!-- <optionNames>-R</optionNames> -->
-<!-- <optionNames>-ribosum_file</optionNames> --> <!-- commentx2 -->
+<!-- <optionNames>-ribosum_file</optionNames> -->
<!-- </parameters> -->
<!-- <parameters isRequired='false'> -->
<!-- <name>Paramfile</name> -->
<!-- <description>Use Energy parameters from a file</description> -->
<!-- <optionNames>-P</optionNames> -->
-<!-- <optionNames>-paramFile</optionNames> --> <!-- commentx2 -->
+<!-- <optionNames>-paramFile</optionNames> -->
<!-- <validValue> -->
<!-- <type>String</type> -->
<!-- </validValue> -->
<!-- </parameters> -->
+ <!-- The values of this parameter are in the form of a comma separated
+ list of allowed pairs. This makes a complete parameter list
+ too large to be represented as a list of possible values
+ How to deal with this? -->
+ <!-- just support the most biologically viable pairs? -->
+
<parameters isRequired='false'>
<name>Allow Pairs</name>
- <descrition>allow pairs in addition to AU, GC and GU</descrition>
+ <description>allow pairs in addition to AU, GC and GU</description>
<optionNames>--nsp</optionNames>
<defaultValue>-GA</defaultValue>
+ <possibleValues>-GA</possibleValues>
+ <possibleValues>-AG</possibleValues>
+ </parameters>
+ <!-- Is dependant on -p (partfunc) -->
+ <parameters isRequired='false'>
+ <name>betaScale</name>
+ <description>Set scaling of Boltzmann factors</description>
+ <optionNames>--betaScale</optionNames>
+ <defaultValue>1.0</defaultValue>
<validValue>
- <type>String</type>
+ <type>Float</type>
+ <min>0</min>
+ <max>100000</max>
</validValue>
</parameters>
- <!-- Is dependant on -p (partfunc) -->
-<!-- <parameters isRequired='false'> -->
-<!-- <name>betaScale</name> -->
-<!-- <description>Set scaling of Boltzmann factors</description> -->
-<!-- <optionNames>-betaScale</optionNames> -->
-<!-- <defaultValue>1.0</defaultValue> -->
-<!-- <validValue> -->
-<!-- <type>Double</type> -->
-<!-- </validValue> -->
-<!-- </parameters> -->
</runnerConfig>
\ No newline at end of file
/*\r
* Reads and parses the output of an RNAalifold job \r
* \r
- * Currently only in the defualt no args format\r
+ * OUT OF USE\r
*/\r
public static RNAstruct readRNAalifoldResults(InputStream results) {\r
if (results == null) {\r
\r
import java.io.File;\r
import java.io.FileInputStream;\r
+import java.io.FileReader;\r
+import java.io.BufferedReader;\r
import java.io.FileNotFoundException;\r
import java.io.FileOutputStream;\r
import java.io.IOException;\r
}\r
}\r
\r
- public static final RNAstruct readRNAStructFile(String workDirectory,\r
+ // OUT OF USE\r
+ \r
+// public static final RNAstruct readRNAStructFile(String workDirectory,\r
+// String structFile) throws IOException, FileNotFoundException {\r
+// assert !compbio.util.Util.isEmpty(workDirectory);\r
+// assert !compbio.util.Util.isEmpty(structFile);\r
+// File sfile = new File(compbio.engine.client.Util.getFullPath(\r
+// workDirectory, structFile));\r
+// if(!(sfile.exists() && sfile.length() > 0)) {\r
+// throw new FileNotFoundException("Result for the jobId "\r
+// + workDirectory + "with file name " + structFile\r
+// + " is not found!");\r
+// }\r
+// return compbio.data.sequence.SequenceUtil.readRNAalifoldResults(\r
+// new FileInputStream(sfile));\r
+// }\r
+ \r
+ public static String readRNAStruct(String workDirectory,\r
String structFile) throws IOException, FileNotFoundException {\r
assert !compbio.util.Util.isEmpty(workDirectory);\r
assert !compbio.util.Util.isEmpty(structFile);\r
File sfile = new File(compbio.engine.client.Util.getFullPath(\r
workDirectory, structFile));\r
- log.trace("RNAALIFOLD OUTPUT FILE PATH: " + sfile.getAbsolutePath());\r
if(!(sfile.exists() && sfile.length() > 0)) {\r
throw new FileNotFoundException("Result for the jobId "\r
+ workDirectory + "with file name " + structFile\r
+ " is not found!");\r
}\r
- return compbio.data.sequence.SequenceUtil.readRNAalifoldResults(\r
- new FileInputStream(sfile));\r
+ return readFile(sfile);\r
+ }\r
+ \r
+ public static String readFile(File inputFile) throws \r
+ FileNotFoundException, IOException {\r
+\r
+ BufferedReader input = new BufferedReader(new FileReader(inputFile));\r
+\r
+ String file = new String();\r
+ String line = new String();\r
+\r
+ while (true) {\r
+ line = input.readLine();\r
+\r
+ if (line != null) {\r
+ file = file + line + "\r\n";\r
+ } else break;\r
+ }\r
+ // Close file\r
+ input.close();\r
+ return file;\r
}\r
\r
\r
import java.util.Arrays;
import java.util.List;
-//imports for filereader method
-import java.io.FileReader;
-import java.io.BufferedReader;
-import java.io.File;
+
@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());
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) {
}
}
- @Test(groups = { AllTestSuit.test_group_runner })
+
+
+ @Test
public void testOptions() {
- test(rnaalifoldOpc.getAllOptions());
+ // populate list of incompatable pairs by their names. todo
+ List<List<String>> failPairs = new ArrayList<List<String>>();
+
+
+ // 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<Option<?>> pair = new ArrayList<Option<?>>();
List<Option<?>> options = rnaalifoldOpc.getAllOptions();
- int numpairs = 0;
+ List<List<String>> failedOptionPairs = new ArrayList<List<String>>();
+
+ boolean failed = true;
for (int i = 0; i<options.size(); i++) {
for (int j = i; j<options.size(); j++) {
if (i != j) {
- //System.out.println("special numOptions: " + options.size());
- //System.out.println("special loop varaibles:- (i,j): (" + i + "," + j +")");
pair.clear();
pair.add(options.get(i)); pair.add(options.get(j));
- log.info("option pair to test: " + pair);
- // I want to catch ResultNotAvailableException here so
- // I can return a list of imcompatable options but
- // singleTest calls a fail() method...
- // can i fail the test and continue running?
- test(pair);
-
- //System.out.println("special numpairstested: " + ++numpairs);
+ List<String> 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<Parameter<?>> pair = new ArrayList<Parameter<?>>();
+ List<Parameter<?>> Parameters = rnaalifoldOpc.getAllParameters();
+ List<List<String>> failedParameterPairs = new ArrayList<List<String>>();
+
+
+ boolean failed = true;
+ for (int i = 0; i<Parameters.size(); i++) {
+ for (int j = i; j<Parameters.size(); j++) {
+ if (i != j) {
+ pair.clear();
+ pair.add(Parameters.get(i)); pair.add(Parameters.get(j));
+ List<String> 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 <U extends Option<?>> List<U> removeParam(List<U> optionList, String name) {
+ List<U> newL = new ArrayList<U>();
+ 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 <U extends Option<?>> List<U> removeParams(List<U> optionList, List<String> 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<Parameter<?>> params = rnaalifoldOpc.getAllParameters();
+ System.out.println("param list: " + params);
Collections.shuffle(params);
- test(params);
+ // test with -p for betascale option
+ List<String> precursor = new ArrayList<String>();
+ 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() {
test(options);
}
- /*
- void test(Map<Parameter<?>, String> paramValue) {
- List<Parameter<?>> paramList = new ArrayList<Parameter<?>>(paramValue
- .keySet());
- for (int i = 0; i < paramValue.size(); i++) {
- List<String> 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<Option<?>> pair = new ArrayList<Option<?>>();
+ List<Option<?>> 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<List<String>> failedOptionPairs = new ArrayList<List<String>>();
+
+ boolean failed = true;
+ for (int i = 0; i<options.size(); i++) {
+ for (int j = i; j<options.size(); j++) {
+ if (i != j) {
+ pair.clear();
+ pair.add(options.get(i)); pair.add(options.get(j));
+ List<String> 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<? extends Option<?>> params) {
for (int i = 0; i < params.size(); i++) {
log.info("NUMBER OF COMBINATION TESTED: " + params.size());
}
+ // because some parameters presuppose the -p option
+
+ void test(List<? extends Option<?>> params, List<String> precursor) {
+
+ for (int i = 0; i < params.size(); i++) {
+ List<String> args = rnaalifoldOpc.argumentsToCommandString(params);
+ args.addAll(precursor);
+ singleTest(args);
+ Collections.shuffle(params);
+ }
+ log.info("NUMBER OF COMBINATION TESTED: " + params.size());
+ }
@Test
void singleParamTest() {
//List<Parameter<?>> params = rnaalifoldOpc.getAllParameters();
//List<String> args = rnaalifoldOpc.argumentsToCommandString(params);
List<String> args = new ArrayList<String>();
- 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);
LocalRunner lr = new LocalRunner(confRNAalifold);
lr.executeJob();
confRNAalifold = (ConfiguredExecutable<RNAalifold>) 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) {
}
}
+ /* 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<String> 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<RNAalifold> confRNAalifold = Configurator
+ .configureExecutable(rnaalifold, ExecProvider.Local);
+ // Add options to the executable
+ confRNAalifold.addParameters(params);
+ LocalRunner lr = new LocalRunner(confRNAalifold);
+ lr.executeJob();
+ confRNAalifold = (ConfiguredExecutable<RNAalifold>) 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;
+ }
}
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;
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;
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<RNAalifoldWS> foldws;
-// @BeforeTest(groups = {AllTestSuit.test_group_webservices})
-// void initConnection() {
-//
-// try {
-// JABAService client = Jws2Client.connect(
-// "http://localhost:8080/jabaws", Services.RNAalifoldWS);
-// foldws = (FoldWS<RNAalifoldWS>) 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<RNAalifoldWS>) 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<Option<RNAalifoldWS>> options = new ArrayList<Option<RNAalifoldWS>>();
+ 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) {
} catch (ResultNotAvailableException e) {
e.printStackTrace();
fail(e.getMessage());
- }
+ } catch (WrongParameterException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
}
}
<?xml version="1.0" encoding="US-ASCII" standalone="yes"?>
-<runnerConfig>
+<runnerConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="RunnerConfigSchema.xsd">
<runnerClassName>compbio.runner.structure.RNAalifold</runnerClassName>
<options isRequired='false'>
<name>Endgaps</name>
<name>Partition Function</name>
<description>Output partition function and probability matrix</description>
<optionNames>-p</optionNames>
+ <optionNames>--partfunc</optionNames>
+ <defaultValue>-p</defaultValue>
+ </options>
+ <options isRequired='false'>
+ <name>p0</name>
+ <description>deactivates the calculation of the pair probabilities</description>
+ <optionNames>-p0</optionNames>
</options>
<options isRequired='false'>
<name>color</name>
<optionNames>--noPS</optionNames>
</options>
<options isRequired='false'>
- <name>Partition Function</name>
- <description>Output partition function and probability matrix</description>
- <optionNames>-p</optionNames>
- </options>
- <options isRequired='false'>
<name>Circular</name>
<description>Assume circular RNA molecule</description>
<optionNames>-c</optionNames>
<defaultValue>-g</defaultValue>
</options>
<options isRequired='false'>
- <name>Dangling End Preset</name>
+ <name>d2</name>
<description>dangling energies will be added for the bases adjacent to a helix on both sides</description>
<optionNames>-d2</optionNames>
</options>
<optionNames>--ribosum_scoring</optionNames>
<defaultValue>-r</defaultValue>
</options>
+ <options isRequired='false'>
+ <name>d2</name>
+ <description>
+ Dangling energies are added for the bases adjacent to a helix on both sides
+ </description>
+ <optionNames>-d2</optionNames>
+ </options>
+ <options isRequired='false'>
+ <name>MEA Structure</name>
+ <description>Maximum Expected Accuracy Structure</description>
+ <optionNames>--MEA</optionNames>
+ </options>
<!-- Constraints are entered on the command line followed by the input .aln file
Causing problems for a batch RNAalifold execution system -->
<!--
<type>String</type>
</validValue>
</option> -->
+
+ <prmSeparator> </prmSeparator>
<parameters isRequired='false'>
- <name>MEA structure</name>
- <description>Maximum Expected Accuracy Structure</description>
- <optionNames>--MEA</optionNames>
- <defaultValue>1</defaultValue>
+ <name>Stochastic Backtrack</name>
+ <description>Compute a number of random structures</description>
+ <optionNames>-s</optionNames>
+<!-- Having multiple optionNames requires a default value but -->
+<!-- in a parameter defaultValue refers to the argument -->
+<!-- <optionNames>-stochBT</optionNames> -->
+ <defaultValue>5</defaultValue>
<validValue>
- <type>Float</type>
+ <type>Integer</type>
+ <min>1</min>
+ <max>100000</max>
</validValue>
</parameters>
-<!-- ?Will Jabaws recognize that arguments for the following params must
-be of the form -s INT and &dash-stochBT=INT -->
-<!-- <parameters isRequired='false'> -->
-<!-- <name>Stochastic Backtrack</name> -->
-<!-- <description>Compute a number of random structures</description> -->
-<!-- <optionNames>-s</optionNames> -->
- <!-- Having multiple optionNames requires a default value but
- in a parameter defaultValue refers to the argument -->
-<!-- <optionNames>-stochBT</optionNames> -->
-<!-- <defaultValue>5</defaultValue> arbitrary -->
-<!-- <validValue> -->
-<!-- <type>Int</type> -->
-<!-- </validValue> -->
-<!-- </parameters> -->
<parameters isRequired='false'>
<name>stochBT_en</name>
<description>Print Backtrack structures</description>
<optionNames>--stochBT_en</optionNames>
<defaultValue>5</defaultValue> <!-- arbitrary -->
<validValue>
- <type>Int</type>
+ <type>Integer</type>
+ <min>1</min>
+ <max>100000</max>
</validValue>
</parameters>
<parameters isRequired='false'>
<defaultValue>1.07</defaultValue>
<validValue>
<type>Float</type>
+ <min>0</min>
+ <max>100</max>
</validValue>
</parameters>
<parameters isRequired='false'>
<name>bppmThreshold</name>
<description>Threshold for base pair probabilities</description>
<optionNames>--bppmThreshold</optionNames>
- <defaultValue>1e-6</defaultValue>
+ <defaultValue>0.000001</defaultValue>
+ <validValue>
+ <type>Float</type>
+ <min>0.0000000000001</min>
+ <max>1.0</max>
+ </validValue>
</parameters>
<parameters isRequired='false'>
<name>Temperature</name>
<!-- <optionNames>-temp</optionNames> -->
<defaultValue>37</defaultValue>
<validValue>
- <type>Double</type>
+ <type>Float</type>
+ <min>-274</min>
+ <max>1000000</max>
</validValue>
</parameters>
<parameters isRequired='false'>
<!-- <optionNames>-dangles</optionNames> -->
<defaultValue>2</defaultValue>
<validValue>
- <type>Int</type>
+ <type>Integer</type>
+ <min>0</min>
+ <max>100000</max>
</validValue>
</parameters>
<parameters isRequired='false'>
<optionNames>--cfactor</optionNames>
<defaultValue>1.0</defaultValue>
<validValue>
- <type>Double</type>
+ <type>Float</type>
+ <min>0</min>
+ <max>100000</max>
</validValue>
</parameters>
<parameters isRequired='false'>
<optionNames>--nfactor</optionNames>
<defaultValue>1.0</defaultValue>
<validValue>
- <type>Double</type>
+ <type>Float</type>
+ <min>0</min>
+ <max>100000</max>
</validValue>
</parameters>
<!-- <name>Ribosum File</name> -->
<!-- <description>Use Specified Ribosum Matrix</description> -->
<!-- <optionNames>-R</optionNames> -->
-<!-- <optionNames>-ribosum_file</optionNames> --> <!-- commentx2 -->
+<!-- <optionNames>-ribosum_file</optionNames> -->
<!-- </parameters> -->
<!-- <parameters isRequired='false'> -->
<!-- <name>Paramfile</name> -->
<!-- <description>Use Energy parameters from a file</description> -->
<!-- <optionNames>-P</optionNames> -->
-<!-- <optionNames>-paramFile</optionNames> --> <!-- commentx2 -->
+<!-- <optionNames>-paramFile</optionNames> -->
<!-- <validValue> -->
<!-- <type>String</type> -->
<!-- </validValue> -->
<!-- </parameters> -->
+ <!-- The values of this parameter are in the form of a comma separated
+ list of allowed pairs. This makes a complete parameter list
+ too large to be represented as a list of possible values
+ How to deal with this? -->
+ <!-- just support the most biologically viable pairs? -->
+
<parameters isRequired='false'>
<name>Allow Pairs</name>
- <descrition>allow pairs in addition to AU, GC and GU</descrition>
+ <description>allow pairs in addition to AU, GC and GU</description>
<optionNames>--nsp</optionNames>
<defaultValue>-GA</defaultValue>
+ <possibleValues>-GA</possibleValues>
+ <possibleValues>-AG</possibleValues>
+ </parameters>
+ <!-- Is dependant on -p (partfunc) -->
+ <parameters isRequired='false'>
+ <name>betaScale</name>
+ <description>Set scaling of Boltzmann factors</description>
+ <optionNames>--betaScale</optionNames>
+ <defaultValue>1.0</defaultValue>
<validValue>
- <type>String</type>
+ <type>Float</type>
+ <min>0</min>
+ <max>100000</max>
</validValue>
</parameters>
- <!-- Is dependant on -p (partfunc) -->
-<!-- <parameters isRequired='false'> -->
-<!-- <name>betaScale</name> -->
-<!-- <description>Set scaling of Boltzmann factors</description> -->
-<!-- <optionNames>-betaScale</optionNames> -->
-<!-- <defaultValue>1.0</defaultValue> -->
-<!-- <validValue> -->
-<!-- <type>Double</type> -->
-<!-- </validValue> -->
-<!-- </parameters> -->
</runnerConfig>
\ No newline at end of file
throws UnsupportedRuntimeException, LimitExceededException,
JobSubmissionException, WrongParameterException;
- RNAstruct getResult(@WebParam(name = "jobId") String jobId)
+ String getResult(@WebParam(name = "jobId") String jobId)
throws ResultNotAvailableException;
}
customOptions = MetadataHelper.processParameters(prms,\r
msaws.getRunnerOptions());\r
}\r
+// System.out.println("The Options read from the command line: " + customOptions);\r
+ \r
Alignment alignment = null;\r
- RNAstruct rnastruct = null;\r
+ String rnastruct = null;\r
if (inputFile != null) {\r
Writer writer = null;\r
if (outFile != null) {\r
rnastruct = fold(inputFile, (FoldWS<T>) foldws, preset, customOptions);\r
// No IOHelper method for rnastruct/String yet\r
if (writer != null) {\r
- writer.write(rnastruct.toString());\r
+ writer.write(rnastruct);\r
}\r
}\r
writer.close();\r
* Preset to use optional\r
* @param customOptions\r
* file which contains new line separated list of options\r
- * @return RNAstruct\r
+ * @return String\r
*/\r
\r
- static <T> RNAstruct fold(File file, FoldWS<T> foldws, Preset<T> preset,\r
+ static <T> String fold(File file, FoldWS<T> foldws, Preset<T> preset,\r
List<Option<T>> customOptions) {\r
FileInputStream instream = null;\r
Alignment alignment = null;\r
- RNAstruct rnastruct = null;\r
+ String rnastruct = null;\r
try {\r
instream = new FileInputStream(file);\r
alignment = ClustalAlignmentUtil.readClustalFile(instream);\r
System.out.println("\n\ncalling fold.........");\r
Thread.sleep(1000);\r
rnastruct = foldws.getResult(jobId);\r
- log.info("log test print results:\n" + rnastruct.toString());\r
- System.out.println("print test results:\n " + rnastruct.toString());\r
\r
} catch (IOException e) {\r
System.err.println("Exception while reading the input file. Exception details: ");\r
import compbio.data.msa.JABAService;\r
import compbio.data.msa.Metadata;\r
import compbio.data.msa.MsaWS;\r
+import compbio.data.msa.FoldWS;\r
import compbio.data.msa.SequenceAnnotation;\r
import compbio.data.sequence.Alignment;\r
import compbio.data.sequence.FastaSequence;\r
+import compbio.data.sequence.Program;\r
import compbio.data.sequence.ScoreManager;\r
import compbio.data.sequence.SequenceUtil;\r
import compbio.metadata.JobStatus;\r
+ "ASDAAPEH------------PGIALWLHALE-DAGQAEAAA---AYTRAHQLLPEEPYITAQLLNAVA\n"\r
+ "";\r
\r
+ \r
+ \r
static final List<FastaSequence> seqs = loadSeqs();\r
\r
private static final String FAILED = "FAILED";\r
testMetadata(msaws);\r
return succeed;\r
}\r
+ \r
+ private <T> boolean testFoldWS(FoldWS<T> foldws) throws Exception {\r
+ assert foldws != null;\r
+ \r
+ boolean succeed = testDefaultFold(foldws);\r
+ \r
+ // testMetadata(foldws);\r
+ return succeed;\r
+ }\r
/**\r
* Call most of web services functions and check the output\r
* \r
} else if (wservice instanceof SequenceAnnotation) {\r
return testSequenceAnnotationWS(\r
(SequenceAnnotation<T>) wservice, service);\r
+ } else if (wservice instanceof FoldWS) {\r
+ return testFoldWS( (FoldWS<T>) wservice);\r
} else {\r
throw new UnsupportedOperationException("The service: "\r
+ wservice.getClass() + " is not supported! ");\r
}\r
return succeed;\r
}\r
+ \r
+ /**\r
+ * Fold using default settings\r
+ * \r
+ * @param <T>\r
+ * @param foldws\r
+ * @throws UnsupportedRuntimeException\r
+ */\r
+ \r
+ private <T> boolean testDefaultFold(FoldWS<T> foldws) throws Exception {\r
+ writer.print("Testing fold with default parameters:");\r
+ // load the input from the aligned fasta string at the top of the file\r
+ Alignment al = new Alignment(loadAlignment(), Program.CLUSTAL, '-');\r
+ String rs = null;\r
+ boolean succeed = false;\r
+ \r
+ String taskId = foldws.fold(al);\r
+ writer.print("\nQuerying job status...");\r
+ JobStatus status = foldws.getJobStatus(taskId);\r
+ while (status != JobStatus.FINISHED) {\r
+ Thread.sleep(1000);\r
+ status = foldws.getJobStatus(taskId);\r
+ }\r
+ writer.println(OK);\r
+ writer.print("Retrieving results...");\r
+ rs = foldws.getResult(taskId);\r
+ succeed = true;\r
+ if (rs != null) {\r
+ writer.println(OK);\r
+ }\r
+ return succeed;\r
+ }\r
/**\r
* Test JWS2 web services\r
* \r
}
@SuppressWarnings("unchecked")
- public RNAstruct getResult(String jobId) throws ResultNotAvailableException {
+ public String getResult(String jobId) throws ResultNotAvailableException {
WSUtil.validateJobId(jobId);
AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);
<message name="pullExecStatisticsResponse">
<part name="parameters" element="tns:pullExecStatisticsResponse"/>
</message>
- <message name="getJobStatus">
- <part name="parameters" element="tns:getJobStatus"/>
- </message>
- <message name="getJobStatusResponse">
- <part name="parameters" element="tns:getJobStatusResponse"/>
- </message>
<message name="cancelJob">
<part name="parameters" element="tns:cancelJob"/>
</message>
<message name="cancelJobResponse">
<part name="parameters" element="tns:cancelJobResponse"/>
</message>
+ <message name="getJobStatus">
+ <part name="parameters" element="tns:getJobStatus"/>
+ </message>
+ <message name="getJobStatusResponse">
+ <part name="parameters" element="tns:getJobStatusResponse"/>
+ </message>
<message name="getRunnerOptions">
<part name="parameters" element="tns:getRunnerOptions"/>
</message>
<message name="getLimitResponse">
<part name="parameters" element="tns:getLimitResponse"/>
</message>
- <message name="getPresets">
- <part name="parameters" element="tns:getPresets"/>
- </message>
- <message name="getPresetsResponse">
- <part name="parameters" element="tns:getPresetsResponse"/>
- </message>
<message name="getLimits">
<part name="parameters" element="tns:getLimits"/>
</message>
<message name="getLimitsResponse">
<part name="parameters" element="tns:getLimitsResponse"/>
</message>
+ <message name="getPresets">
+ <part name="parameters" element="tns:getPresets"/>
+ </message>
+ <message name="getPresetsResponse">
+ <part name="parameters" element="tns:getPresetsResponse"/>
+ </message>
<portType name="FoldWS">
<operation name="getResult">
<input wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/getResultRequest" message="tns:getResult"/>
<input wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/pullExecStatisticsRequest" message="tns:pullExecStatistics"/>
<output wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/pullExecStatisticsResponse" message="tns:pullExecStatisticsResponse"/>
</operation>
- <operation name="getJobStatus">
- <input wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/getJobStatusRequest" message="tns:getJobStatus"/>
- <output wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/getJobStatusResponse" message="tns:getJobStatusResponse"/>
- </operation>
<operation name="cancelJob">
<input wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/cancelJobRequest" message="tns:cancelJob"/>
<output wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/cancelJobResponse" message="tns:cancelJobResponse"/>
</operation>
+ <operation name="getJobStatus">
+ <input wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/getJobStatusRequest" message="tns:getJobStatus"/>
+ <output wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/getJobStatusResponse" message="tns:getJobStatusResponse"/>
+ </operation>
<operation name="getRunnerOptions">
<input wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/getRunnerOptionsRequest" message="tns:getRunnerOptions"/>
<output wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/getRunnerOptionsResponse" message="tns:getRunnerOptionsResponse"/>
<input wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/getLimitRequest" message="tns:getLimit"/>
<output wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/getLimitResponse" message="tns:getLimitResponse"/>
</operation>
- <operation name="getPresets">
- <input wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/getPresetsRequest" message="tns:getPresets"/>
- <output wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/getPresetsResponse" message="tns:getPresetsResponse"/>
- </operation>
<operation name="getLimits">
<input wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/getLimitsRequest" message="tns:getLimits"/>
<output wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/getLimitsResponse" message="tns:getLimitsResponse"/>
</operation>
+ <operation name="getPresets">
+ <input wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/getPresetsRequest" message="tns:getPresets"/>
+ <output wsam:Action="http://msa.data.compbio/01/01/2010/FoldWS/getPresetsResponse" message="tns:getPresetsResponse"/>
+ </operation>
</portType>
<binding name="RNAalifoldWSPortBinding" type="tns:FoldWS">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<soap:body use="literal"/>
</output>
</operation>
- <operation name="getJobStatus">
+ <operation name="cancelJob">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
<soap:body use="literal"/>
</output>
</operation>
- <operation name="cancelJob">
+ <operation name="getJobStatus">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
<soap:body use="literal"/>
</output>
</operation>
- <operation name="getPresets">
+ <operation name="getLimits">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
<soap:body use="literal"/>
</output>
</operation>
- <operation name="getLimits">
+ <operation name="getPresets">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
<xs:complexType name="getResultResponse">
<xs:sequence>
- <xs:element name="return" type="tns:rnAstruct" minOccurs="0"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="rnAstruct" final="extension restriction">
- <xs:sequence>
- <xs:element name="sequence" type="xs:string" minOccurs="0"/>
- <xs:element name="structure" type="xs:string" minOccurs="0"/>
- <xs:element name="minEnergy" type="xs:float" minOccurs="0"/>
- <xs:element name="energySum1" type="xs:float" minOccurs="0"/>
- <xs:element name="energySum2" type="xs:float" minOccurs="0"/>
+ <xs:element name="return" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="getLimits">
- <xs:sequence/>
- </xs:complexType>
-
- <xs:complexType name="getLimitsResponse">
- <xs:sequence>
- <xs:element name="return" type="tns:limitsManager" minOccurs="0"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="limitsManager">
- <xs:sequence>
- <xs:element name="runnerClassName" type="xs:string" minOccurs="0"/>
- <xs:element name="limit" type="tns:limit" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
- </xs:sequence>
- </xs:complexType>
-
- <xs:complexType name="limit">
- <xs:sequence>
- <xs:element name="preset" type="xs:string" minOccurs="0"/>
- <xs:element name="seqNumber" type="xs:int"/>
- <xs:element name="seqLength" type="xs:int"/>
- </xs:sequence>
- <xs:attribute name="isDefault" type="xs:boolean" use="required"/>
- </xs:complexType>
-
<xs:complexType name="getPresets">
<xs:sequence/>
</xs:complexType>
</xs:sequence>
</xs:complexType>
+ <xs:complexType name="getLimits">
+ <xs:sequence/>
+ </xs:complexType>
+
+ <xs:complexType name="getLimitsResponse">
+ <xs:sequence>
+ <xs:element name="return" type="tns:limitsManager" minOccurs="0"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="limitsManager">
+ <xs:sequence>
+ <xs:element name="runnerClassName" type="xs:string" minOccurs="0"/>
+ <xs:element name="limit" type="tns:limit" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="limit">
+ <xs:sequence>
+ <xs:element name="preset" type="xs:string" minOccurs="0"/>
+ <xs:element name="seqNumber" type="xs:int"/>
+ <xs:element name="seqLength" type="xs:int"/>
+ </xs:sequence>
+ <xs:attribute name="isDefault" type="xs:boolean" use="required"/>
+ </xs:complexType>
+
<xs:complexType name="getLimit">
<xs:sequence>
<xs:element name="presetName" type="xs:string" minOccurs="0"/>