AAConWS further work
authorpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Mon, 29 Nov 2010 22:05:57 +0000 (22:05 +0000)
committerpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Mon, 29 Nov 2010 22:05:57 +0000 (22:05 +0000)
git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@3406 e3abac25-378b-4346-85de-24260fe3988d

13 files changed:
.classpath
TODO.txt
WEB-INF/sun-jaxws.xml
WEB-INF/web.xml
binaries/aaconservation.jar
datamodel/compbio/data/sequence/MultiAnnotatedSequence.java
runner/compbio/runner/conservation/AACon.java
testsrc/compbio/data/sequence/SequenceUtilTester.java
testsrc/compbio/runner/conservation/AAConTester.java
webservices/compbio/data/msa/Annotation.java
webservices/compbio/data/msa/MsaWS.java
webservices/compbio/ws/server/AAConWS.java
wsbuild.xml

index cff7667..7833d32 100644 (file)
@@ -7,11 +7,11 @@
        <classpathentry kind="src" path="datamodel"/>\r
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
        <classpathentry kind="lib" path="WEB-INF/lib/log4j-1.2.15.jar"/>\r
-       <classpathentry kind="lib" path="WEB-INF/lib/compbio-annotations-1.0.jar"/>\r
        <classpathentry kind="lib" path="testsrc/lib/testng-5.10-jdk15.jar"/>\r
        <classpathentry kind="lib" path="lib/servlet-api.jar"/>\r
        <classpathentry kind="lib" path="WEB-INF/lib/drmaa.jar"/>\r
        <classpathentry kind="lib" path="WEB-INF/lib/compbio-util-1.3.jar"/>\r
+       <classpathentry kind="lib" path="WEB-INF/lib/compbio-annotations-1.0.jar"/>\r
        <classpathentry kind="lib" path="binaries/aaconservation.jar"/>\r
        <classpathentry kind="output" path="WEB-INF/classes"/>\r
 </classpath>\r
index 6e70077..b6d15ed 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,9 +1,19 @@
 TODO: \r
 \r
+Publish jabaws-discuss contact information\r
+\r
+Output file parsing for stat reporting\r
+cluster engine stat of www-jws2 user\r
+\r
+integrate the above to tweak the size of the local job\r
+\r
+Add AACon ws\r
 Add iupred ws http://iupred.enzim.hu/\r
 Add globprot ws \r
 Add ronn ws\r
 \r
+Philogeny Mrbayes + Philip\r
\r
 USE CASE - TURN ALIGNMENT INTO PROFILE AND SEARCH SEQUENCE DATABASE USECASE\r
 - Receive user alignment \r
 - use hmmerbuild to turn it to profile\r
index 13510ed..994abef 100644 (file)
@@ -20,4 +20,8 @@
         name='ProbconsWS'\r
         implementation='compbio.ws.server.ProbconsWS'\r
         url-pattern='/ProbconsWS'/>\r
+    <endpoint\r
+        name='AAConWS'\r
+        implementation='compbio.ws.server.AAConWS'\r
+        url-pattern='/AAConWS'/>\r
 </endpoints>\r
index 090a978..ae99a94 100644 (file)
@@ -3,8 +3,8 @@
     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"\r
     version="2.4">\r
 \r
-    <display-name>Jalview Web Services</display-name>\r
-    <description>Jalview Web Services v2.0</description>\r
+    <display-name>JABAWS</display-name>\r
+    <description>JAva Bioinformatics Analysis Web Services (JABAWS)</description>\r
 \r
        <listener>\r
                <listener-class>compbio.ws.server.ShutdownEngines</listener-class>\r
         <load-on-startup/>\r
     </servlet>\r
     \r
+     <servlet>\r
+        <servlet-name>AAConWS</servlet-name>\r
+        <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>\r
+        <load-on-startup/>\r
+    </servlet>\r
+    \r
     <servlet-mapping>\r
        <servlet-name>ClustalWS</servlet-name>\r
        <url-pattern>/ClustalWS</url-pattern>\r
        <servlet-name>ProbconsWS</servlet-name>\r
        <url-pattern>/ProbconsWS</url-pattern>\r
    </servlet-mapping>\r
-        \r
\r
+   <servlet-mapping>\r
+       <servlet-name>AAConWS</servlet-name>\r
+       <url-pattern>/AAConWS</url-pattern>\r
+   </servlet-mapping>\r
    \r
    <security-constraint>\r
     <web-resource-collection>\r
       <!-- Define the Login Configuration for this Application -->\r
   <login-config>\r
         <auth-method>BASIC</auth-method>\r
-        <realm-name>JWS2 admins</realm-name>\r
+        <realm-name>JABAWS administrators</realm-name>\r
   </login-config>\r
   \r
     <!-- Security roles referenced by this web application -->\r
   <security-role>\r
     <description>\r
-      The role that is required to log in and view JWS2 internals\r
+      The role that is required to log in and view JABAWS internals\r
     </description>\r
     <role-name>admin</role-name>\r
   </security-role>\r
index 375b8e9..db61ab7 100644 (file)
Binary files a/binaries/aaconservation.jar and b/binaries/aaconservation.jar differ
index d5942b3..92d475d 100644 (file)
@@ -5,9 +5,6 @@ import java.util.EnumMap;
 import java.util.List;\r
 import java.util.Map;\r
 \r
-import javax.xml.bind.annotation.XmlAccessType;\r
-import javax.xml.bind.annotation.XmlAccessorType;\r
-\r
 import compbio.util.annotation.NotThreadSafe;\r
 \r
 /**\r
@@ -19,7 +16,7 @@ import compbio.util.annotation.NotThreadSafe;
  *            enum type\r
  */\r
 @NotThreadSafe\r
-@XmlAccessorType(XmlAccessType.FIELD)\r
+// @XmlAccessorType(XmlAccessType.FIELD)\r
 public class MultiAnnotatedSequence<T extends Enum<T>> {\r
 \r
        private EnumMap<T, ArrayList<Float>> annotations;\r
index f514e24..5a1d752 100644 (file)
@@ -20,11 +20,12 @@ import java.io.FileNotFoundException;
 import java.io.IOException;\r
 import java.io.InputStream;\r
 import java.util.Arrays;\r
+import java.util.HashMap;\r
 import java.util.List;\r
-import java.util.Map;\r
 \r
 import org.apache.log4j.Logger;\r
 \r
+import compbio.conservation.Method;\r
 import compbio.engine.client.CommandBuilder;\r
 import compbio.engine.client.Executable;\r
 import compbio.engine.client.SkeletalExecutable;\r
@@ -63,10 +64,9 @@ public class AACon extends SkeletalExecutable<AACon> {
                addParameters(Arrays.asList("-jar", getLibPath(), "-d=" + STAT_FILE,\r
                                "-f=RESULT_NO_ALIGNMENT"));\r
        }\r
-\r
-       @SuppressWarnings("unchecked")\r
+       // HashMap<Method, float[]>\r
        @Override\r
-       public Map getResults(String workDirectory)\r
+       public HashMap<Method, float[]> getResults(String workDirectory)\r
                        throws ResultNotAvailableException {\r
                // MultiAnnotatedSequence<Method> annotations = null;\r
                try {\r
index b726d88..742fa24 100644 (file)
@@ -184,6 +184,6 @@ public class SequenceUtilTester {
        public void testReadResults() throws FileNotFoundException {\r
                InputStream inStream = new FileInputStream(AllTestSuit.TEST_DATA_PATH\r
                                + "aacon_results.txt");\r
-               System.out.println(SequenceUtil.readResults(inStream));\r
+//             /System.out.println(SequenceUtil.readResults(inStream));\r
        }\r
 }\r
index fbb9720..da924f0 100644 (file)
@@ -256,6 +256,7 @@ public class AAConTester {
                        assertNotNull(annotations);\r
                        assertEquals(annotations.getAnnotations().size(), 3);\r
                        assertEquals(al1.getResults(), annotations);\r
+\r
                } catch (JobSubmissionException e) {\r
                        e.printStackTrace();\r
                        fail(e.getLocalizedMessage());\r
index c73c0bc..45c1a68 100644 (file)
@@ -7,7 +7,6 @@ import javax.jws.WebParam;
 import javax.jws.WebService;\r
 \r
 import compbio.data.sequence.FastaSequence;\r
-import compbio.data.sequence.MultiAnnotatedSequence;\r
 import compbio.metadata.JobSubmissionException;\r
 import compbio.metadata.LimitExceededException;\r
 import compbio.metadata.Option;\r
@@ -26,7 +25,7 @@ import compbio.metadata.WrongParameterException;
  * @param <T>\r
  *            executable type / web service type\r
  */\r
-@WebService(targetNamespace = "http://a.data.compbio/01/12/2010/")\r
+@WebService(targetNamespace = "http://msa.data.compbio/01/12/2010/")\r
 public interface Annotation<T> extends JManagement, Metadata<T> {\r
 \r
        /**\r
@@ -170,6 +169,6 @@ public interface Annotation<T> extends JManagement, Metadata<T> {
         *             thrown if jobId is empty or cannot be recognised e.g. in\r
         *             invalid format\r
         */\r
-       MultiAnnotatedSequence<?> getResult(@WebParam(name = "jobId") String jobId)\r
+       String getResult(@WebParam(name = "jobId") String jobId)\r
                        throws ResultNotAvailableException;\r
 }\r
index d5b64f8..cea5cdf 100644 (file)
@@ -44,7 +44,7 @@ import compbio.metadata.WrongParameterException;
  * @param <T>\r
  *            executable type / web service type\r
  */\r
-@WebService(targetNamespace = "http://msa.data.compbio/01/12/2010/")\r
+@WebService(targetNamespace = "http://msa.data.compbio/01/01/2010/")\r
 public interface MsaWS<T> extends JManagement, Metadata<T> {\r
 \r
        /**\r
index cf382df..d65827e 100644 (file)
@@ -1,6 +1,7 @@
 package compbio.ws.server;\r
 \r
 import java.io.File;\r
+import java.util.Arrays;\r
 import java.util.List;\r
 \r
 import javax.annotation.Resource;\r
@@ -9,11 +10,8 @@ import javax.xml.ws.WebServiceContext;
 \r
 import org.apache.log4j.Logger;\r
 \r
-import compbio.conservation.Method;\r
 import compbio.data.msa.Annotation;\r
 import compbio.data.sequence.FastaSequence;\r
-import compbio.data.sequence.JalviewAnnotation;\r
-import compbio.data.sequence.MultiAnnotatedSequence;\r
 import compbio.engine.AsyncExecutor;\r
 import compbio.engine.Configurator;\r
 import compbio.engine.client.ConfiguredExecutable;\r
@@ -33,7 +31,7 @@ import compbio.metadata.WrongParameterException;
 import compbio.runner.Util;\r
 import compbio.runner.conservation.AACon;\r
 \r
-@WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = "http://msa.data.compbio/01/01/2010/", serviceName = "MuscleWS")\r
+@WebService(endpointInterface = "compbio.data.msa.Annotation", targetNamespace = "http://msa.data.compbio/01/12/2010/", serviceName = "AAConWS")\r
 public class AAConWS implements Annotation<AACon> {\r
 \r
        // Ask for resource injection\r
@@ -53,39 +51,40 @@ public class AAConWS implements Annotation<AACon> {
        ConfiguredExecutable<AACon> init(List<FastaSequence> sequences)\r
                        throws JobSubmissionException {\r
                AACon aacon = new AACon();\r
-               aacon.setInput("fasta.in").setOutput("fasta.out");\r
+               aacon.setInput("fasta.in").setOutput("aacon.out");\r
                return Configurator.configureExecutable(aacon, sequences);\r
        }\r
 \r
+       // HashMap<Method, float[]>\r
        @SuppressWarnings("unchecked")\r
-       public MultiAnnotatedSequence<Method> getResult(String jobId)\r
-                       throws ResultNotAvailableException {\r
+       public String getResult(String jobId) throws ResultNotAvailableException {\r
                WSUtil.validateJobId(jobId);\r
                AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId);\r
                ConfiguredExecutable<AACon> aacon = (ConfiguredExecutable<AACon>) asyncEngine\r
                                .getResults(jobId);\r
-               MultiAnnotatedSequence<Method> mas = aacon.getResults();\r
+               // MultiAnnotatedSequence<Method> mas = aacon.getResults();\r
                // log(jobId, "getResults");\r
-               return mas;\r
+               return "";// new HashMap<Method, float[]>();\r
        }\r
 \r
-       @SuppressWarnings("unchecked")\r
-       public JalviewAnnotation getJalviewAnnotation(String jobId)\r
-                       throws ResultNotAvailableException {\r
-               MultiAnnotatedSequence<Method> result = getResult(jobId);\r
-\r
-               // log(jobId, "getResults");\r
-               return result.toJalviewAnnotation();\r
-       }\r
+       /*\r
+        * @SuppressWarnings("unchecked") public JalviewAnnotation\r
+        * getJalviewAnnotation(String jobId) throws ResultNotAvailableException {\r
+        * MultiAnnotatedSequence<Method> result = getResult(jobId); // TODO //\r
+        * log(jobId, "getResults"); return result.toJalviewAnnotation(); }\r
+        */\r
 \r
+       @Override\r
        public Limit<AACon> getLimit(String presetName) {\r
                return new AACon().getLimit(presetName);\r
        }\r
 \r
+       @Override\r
        public LimitsManager<AACon> getLimits() {\r
                return new AACon().getLimits();\r
        }\r
 \r
+       @Override\r
        public ChunkHolder pullExecStatistics(String jobId, long position) {\r
                WSUtil.validateJobId(jobId);\r
                String file = Configurator.getWorkDirectory(jobId) + File.separator\r
@@ -93,30 +92,53 @@ public class AAConWS implements Annotation<AACon> {
                return WSUtil.pullFile(file, position);\r
        }\r
 \r
+       @Override\r
        public boolean cancelJob(String jobId) {\r
                WSUtil.validateJobId(jobId);\r
                return WSUtil.cancelJob(jobId);\r
        }\r
 \r
+       @Override\r
        public JobStatus getJobStatus(String jobId) {\r
                WSUtil.validateJobId(jobId);\r
                return WSUtil.getJobStatus(jobId);\r
        }\r
 \r
+       @Override\r
        public PresetManager<AACon> getPresets() {\r
                return aaconPresets;\r
        }\r
 \r
+       @Override\r
        public RunnerConfig<AACon> getRunnerOptions() {\r
                return aaconOptions;\r
        }\r
 \r
+       String analize(List<FastaSequence> sequences,\r
+                       ConfiguredExecutable<AACon> confExec, Logger log, String method,\r
+                       Limit<AACon> limit) throws JobSubmissionException {\r
+               if (limit != null && limit.isExceeded(sequences)) {\r
+                       throw LimitExceededException.newLimitExceeded(limit, sequences);\r
+               }\r
+\r
+               compbio.runner.Util.writeInput(sequences, confExec);\r
+               AsyncExecutor engine = Configurator.getAsyncEngine(confExec);\r
+               String jobId = engine.submitJob(confExec);\r
+               return jobId;\r
+       }\r
+\r
        @Override\r
        public String analize(List<FastaSequence> sequences)\r
                        throws UnsupportedRuntimeException, LimitExceededException,\r
                        JobSubmissionException {\r
-               // TODO Auto-generated method stub\r
-               return null;\r
+               WSUtil.validateFastaInput(sequences);\r
+               ConfiguredExecutable<AACon> confAAcon = init(sequences);\r
+\r
+               // set default conservation method to fastest - SHENKIN\r
+               // TODO: This violates encapsulation, should be moved to the runners\r
+               // level.\r
+               confAAcon.addParameters(Arrays.asList("-m=SHENKIN"));\r
+               return analize(sequences, confAAcon, null, "analize", getLimit(""));\r
        }\r
 \r
        @Override\r
@@ -124,8 +146,16 @@ public class AAConWS implements Annotation<AACon> {
                        List<Option<AACon>> options) throws UnsupportedRuntimeException,\r
                        LimitExceededException, JobSubmissionException,\r
                        WrongParameterException {\r
-               // TODO Auto-generated method stub\r
-               return null;\r
+               WSUtil.validateFastaInput(sequences);\r
+               ConfiguredExecutable<AACon> confAACon = init(sequences);\r
+               // Could not do that! Space separated values\r
+               // will all be treated as keys! thus duplicates removed\r
+               // String params = cbuilder.getCommand();\r
+               List<String> params = WSUtil.getCommands(options,\r
+                               AACon.KEY_VALUE_SEPARATOR);\r
+               confAACon.addParameters(params);\r
+               return analize(sequences, confAACon, null, "customAnalize",\r
+                               getLimit(""));\r
        }\r
 \r
        @Override\r
@@ -133,8 +163,14 @@ public class AAConWS implements Annotation<AACon> {
                        Preset<AACon> preset) throws UnsupportedRuntimeException,\r
                        LimitExceededException, JobSubmissionException,\r
                        WrongParameterException {\r
-               // TODO Auto-generated method stub\r
-               return null;\r
+               WSUtil.validateFastaInput(sequences);\r
+               if (preset == null) {\r
+                       throw new WrongParameterException("Preset must be provided!");\r
+               }\r
+               ConfiguredExecutable<AACon> confAAcon = init(sequences);\r
+               confAAcon.addParameters(preset.getOptions());\r
+               Limit<AACon> limit = getLimit(preset.getName());\r
+               return WSUtil.align(sequences, confAAcon, null, "presetAnalize", limit);\r
        }\r
 \r
 }\r
index ea64d08..8e7cc8b 100644 (file)
@@ -22,6 +22,7 @@
        <property name="muscle.wsdl" location="${wsdl.dir}/MuscleWS.wsdl" />\r
        <property name="tcoffee.wsdl" location="${wsdl.dir}/TcoffeeWS.wsdl" />\r
        <property name="mafft.wsdl" location="${wsdl.dir}/MafftWS.wsdl" />\r
+       <property name="aacon.wsdl" location="${wsdl.dir}/AAConWS.wsdl" />\r
 \r
        <taskdef name="wsgen" classname="com.sun.tools.ws.ant.WsGen">\r
                <classpath refid="project.classpath" />\r
                        <!-- destdir - Where to put generated classes -->\r
                        <!-- sourcedestdir -  Where to put generated source files -->\r
                        <!-- resourcedestdir - Where to put generated source files -->\r
+               <wsgen sei="compbio.ws.server.AAConWS" \r
+                                       sourcedestdir="${basedir}/webservices" \r
+                                       destdir="${classes}" \r
+                                       resourcedestdir="${wsdl.dir}" \r
+                                       keep="true" genwsdl="true" \r
+                                       extension="false" \r
+                                       xendorsed="true"                        \r
+                                       verbose="true">\r
+                                       <classpath refid="classes.path" />\r
+                                       <classpath refid="project.classpath" />\r
+               </wsgen>\r
                <wsgen sei="compbio.ws.server.ClustalWS" \r
                                        sourcedestdir="${basedir}/webservices" \r
                                        destdir="${classes}" \r
@@ -75,7 +87,7 @@
                                                verbose="true">\r
                                                <classpath refid="classes.path" />\r
                                                <classpath refid="project.classpath" />\r
-                                       </wsgen>\r
+                       </wsgen>\r
                <wsgen sei="compbio.ws.server.TcoffeeWS" \r
                                                sourcedestdir="${basedir}/webservices" \r
                                                destdir="${classes}" \r
@@ -86,7 +98,8 @@
                                                verbose="true">\r
                                                <classpath refid="classes.path" />\r
                                                <classpath refid="project.classpath" />\r
-                                       </wsgen>\r
+                       </wsgen>\r
+               \r
                </target>\r
 \r
 \r