From: Daniel Barton Date: Thu, 8 Aug 2013 09:34:34 +0000 (+0100) Subject: Webservice works! but only supports some parameters. Replacing RNAstuct X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=fa61eaad52ffe5ee0db449c3dd9ec5fa67aec43f;p=jabaws.git Webservice works! but only supports some parameters. Replacing RNAstuct with String. --- diff --git a/conf/settings/RNAalifoldParameters.xml b/conf/settings/RNAalifoldParameters.xml index b0e8df0..2561ec4 100644 --- a/conf/settings/RNAalifoldParameters.xml +++ b/conf/settings/RNAalifoldParameters.xml @@ -107,18 +107,18 @@ - - Stochastic Backtrack - Compute a number of random structures - -s + + + + - 5 - - Int - - + + + + + stochBT_en Print Backtrack structures @@ -209,13 +209,14 @@ be of the form -s INT and &dash-stochBT=INT --> String - - betaScale - Set scaling of Boltzmann factors - --betaScale - 1.0 - - Double - - + + + + + + + + + + \ No newline at end of file diff --git a/runner/compbio/runner/structure/RNAalifold.java b/runner/compbio/runner/structure/RNAalifold.java index acb4a9e..3871ea9 100644 --- a/runner/compbio/runner/structure/RNAalifold.java +++ b/runner/compbio/runner/structure/RNAalifold.java @@ -31,17 +31,22 @@ public class RNAalifold extends SkeletalExecutable private static Logger log = Logger.getLogger(RNAalifold.class); + // May not be necessary as defult is "" but still dont know + // How to deal with different key value separators for different params + public static final String KEY_VALUE_SEPARATOR = " "; + + public RNAalifold() { + super(KEY_VALUE_SEPARATOR); + } @Override public RNAalifold setOutput(String outFile) { - log.info("Set ouput file: " + outFile.toString()); super.setOutput(outFile); return this; } @Override public RNAalifold setInput(String inFile) { - log.info("Set input file: " + inFile.toString()); cbuilder.setLast(inFile); super.setInput(inFile); return this; @@ -72,12 +77,11 @@ public class RNAalifold extends SkeletalExecutable } - // OLD :- the new methods for reading are found in + // the new currently used methods for reading are found in // - compbio.data.sequence.SequenceUtil and // - compbio.runner.Util // Simple and generic methods for reading a whole file - // Should surfice until a more detailed datamodel and parser are developed // private static String readRNAStruct(String workDirectory, // String structFile) throws IOException, FileNotFoundException { // assert !compbio.util.Util.isEmpty(workDirectory); diff --git a/testsrc/compbio/ws/client/TestRNAalifoldWS.java b/testsrc/compbio/ws/client/TestRNAalifoldWS.java new file mode 100644 index 0000000..2d392f7 --- /dev/null +++ b/testsrc/compbio/ws/client/TestRNAalifoldWS.java @@ -0,0 +1,100 @@ +package compbio.ws.client; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.fail; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.ConnectException; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.ws.WebServiceException; + +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + +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.data.sequence.FastaSequence; +import compbio.data.sequence.ScoreManager; +import compbio.data.sequence.SequenceUtil; +import compbio.data.sequence.UnknownFileFormatException; +import compbio.metadata.AllTestSuit; +import compbio.metadata.JobSubmissionException; +import compbio.metadata.LimitExceededException; +import compbio.metadata.Option; +import compbio.metadata.PresetManager; +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()); +// } +// } + + + @Test(groups = {AllTestSuit.test_group_webservices}) + public void testFold() throws FileNotFoundException, IOException, + UnknownFileFormatException { + + String CURRENT_DIRECTORY = SysPrefs.getCurrentDirectory() + + File.separator; + + Alignment aln = ClustalAlignmentUtil.readClustalFile(new FileInputStream( + CURRENT_DIRECTORY + "testsrc" + File.separator + "testdata" + + File.separator + "unfolded_RF00031.aln")); + + try { + String jobId = foldws.fold(aln); + System.out.println("J: " + jobId); + RNAstruct result = foldws.getResult(jobId); + assertNotNull(result); + + } catch (UnsupportedRuntimeException e) { + e.printStackTrace(); + fail(e.getMessage()); + } catch (LimitExceededException e) { + e.printStackTrace(); + fail(e.getMessage()); + } catch (JobSubmissionException e) { + e.printStackTrace(); + fail(e.getMessage()); + } catch (ResultNotAvailableException e) { + e.printStackTrace(); + fail(e.getMessage()); + } + } +} + + + diff --git a/webservices/compbio/data/msa/FoldWS.java b/webservices/compbio/data/msa/FoldWS.java new file mode 100644 index 0000000..9f0d4d8 --- /dev/null +++ b/webservices/compbio/data/msa/FoldWS.java @@ -0,0 +1,59 @@ +package compbio.data.msa; + +import java.security.InvalidParameterException; +import java.util.List; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; +import javax.naming.ldap.UnsolicitedNotificationEvent; + +import compbio.data.sequence.Alignment; +import compbio.data.sequence.RNAstruct; +import compbio.metadata.JobSubmissionException; +import compbio.metadata.LimitExceededException; +import compbio.metadata.Option; +import compbio.metadata.Preset; +import compbio.metadata.ResultNotAvailableException; +import compbio.metadata.UnsupportedRuntimeException; +import compbio.metadata.WrongParameterException; + +/* + * Interface for tools that results RNA secondary structure information + * + * Still Unsure whether It would be better to use just the aligned fastaList + * or the Alignment object + */ + +// effect of a different targetNamespace? +@WebService(targetNamespace = "http://msa.data.compbio/01/01/2010/") +public interface FoldWS + extends + JABAService, + JManagement, + Metadata { + + + // Is Alignment object JaxB compatible? + + String fold( + @WebParam(name = "alignment") Alignment alignment) + throws UnsupportedRuntimeException, LimitExceededException, + JobSubmissionException; + + String customFold( + @WebParam(name = "alignment") Alignment alignment, + @WebParam(name = "options") List> options) + throws UnsupportedRuntimeException, LimitExceededException, + JobSubmissionException, WrongParameterException; + + String presetFold( + @WebParam(name = "alignment") Alignment alignment, + @WebParam(name = "preset") Preset preset) + throws UnsupportedRuntimeException, LimitExceededException, + JobSubmissionException, WrongParameterException; + + RNAstruct getResult(@WebParam(name = "jobId") String jobId) + throws ResultNotAvailableException; + +} diff --git a/webservices/compbio/data/msa/jaxws/CancelJob.java b/webservices/compbio/data/msa/jaxws/CancelJob.java index 9b1f062..32660d9 100644 --- a/webservices/compbio/data/msa/jaxws/CancelJob.java +++ b/webservices/compbio/data/msa/jaxws/CancelJob.java @@ -7,9 +7,9 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; -@XmlRootElement(name = "cancelJob", namespace = "http://msa.data.compbio/01/12/2010/") +@XmlRootElement(name = "cancelJob", namespace = "http://msa.data.compbio/01/01/2010/") @XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "cancelJob", namespace = "http://msa.data.compbio/01/12/2010/") +@XmlType(name = "cancelJob", namespace = "http://msa.data.compbio/01/01/2010/") public class CancelJob { @XmlElement(name = "jobId", namespace = "") diff --git a/webservices/compbio/data/msa/jaxws/CancelJobResponse.java b/webservices/compbio/data/msa/jaxws/CancelJobResponse.java index 00a92e2..7ccc190 100644 --- a/webservices/compbio/data/msa/jaxws/CancelJobResponse.java +++ b/webservices/compbio/data/msa/jaxws/CancelJobResponse.java @@ -7,9 +7,9 @@ import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; -@XmlRootElement(name = "cancelJobResponse", namespace = "http://msa.data.compbio/01/12/2010/") +@XmlRootElement(name = "cancelJobResponse", namespace = "http://msa.data.compbio/01/01/2010/") @XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "cancelJobResponse", namespace = "http://msa.data.compbio/01/12/2010/") +@XmlType(name = "cancelJobResponse", namespace = "http://msa.data.compbio/01/01/2010/") public class CancelJobResponse { @XmlElement(name = "return", namespace = "") diff --git a/webservices/compbio/data/msa/jaxws/CustomFold.java b/webservices/compbio/data/msa/jaxws/CustomFold.java new file mode 100644 index 0000000..acdd828 --- /dev/null +++ b/webservices/compbio/data/msa/jaxws/CustomFold.java @@ -0,0 +1,60 @@ + +package compbio.data.msa.jaxws; + +import java.util.List; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + +@XmlRootElement(name = "customFold", namespace = "http://msa.data.compbio/01/01/2010/") +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "customFold", namespace = "http://msa.data.compbio/01/01/2010/", propOrder = { + "alignment", + "options" +}) +public class CustomFold { + + @XmlElement(name = "alignment", namespace = "") + private compbio.data.sequence.Alignment alignment; + @XmlElement(name = "options", namespace = "") + private List options; + + /** + * + * @return + * returns Alignment + */ + public compbio.data.sequence.Alignment getAlignment() { + return this.alignment; + } + + /** + * + * @param alignment + * the value for the alignment property + */ + public void setAlignment(compbio.data.sequence.Alignment alignment) { + this.alignment = alignment; + } + + /** + * + * @return + * returns List