From: pvtroshin Date: Mon, 29 Nov 2010 22:05:57 +0000 (+0000) Subject: AAConWS further work X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a66674ad9520261789bbfe8401f88b37ae2a71a2;p=jabaws.git AAConWS further work git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@3406 e3abac25-378b-4346-85de-24260fe3988d --- diff --git a/.classpath b/.classpath index cff7667..7833d32 100644 --- a/.classpath +++ b/.classpath @@ -7,11 +7,11 @@ - + diff --git a/TODO.txt b/TODO.txt index 6e70077..b6d15ed 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,9 +1,19 @@ TODO: +Publish jabaws-discuss contact information + +Output file parsing for stat reporting +cluster engine stat of www-jws2 user + +integrate the above to tweak the size of the local job + +Add AACon ws Add iupred ws http://iupred.enzim.hu/ Add globprot ws Add ronn ws +Philogeny Mrbayes + Philip + USE CASE - TURN ALIGNMENT INTO PROFILE AND SEARCH SEQUENCE DATABASE USECASE - Receive user alignment - use hmmerbuild to turn it to profile diff --git a/WEB-INF/sun-jaxws.xml b/WEB-INF/sun-jaxws.xml index 13510ed..994abef 100644 --- a/WEB-INF/sun-jaxws.xml +++ b/WEB-INF/sun-jaxws.xml @@ -20,4 +20,8 @@ name='ProbconsWS' implementation='compbio.ws.server.ProbconsWS' url-pattern='/ProbconsWS'/> + diff --git a/WEB-INF/web.xml b/WEB-INF/web.xml index 090a978..ae99a94 100644 --- a/WEB-INF/web.xml +++ b/WEB-INF/web.xml @@ -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" version="2.4"> - Jalview Web Services - Jalview Web Services v2.0 + JABAWS + JAva Bioinformatics Analysis Web Services (JABAWS) compbio.ws.server.ShutdownEngines @@ -48,6 +48,12 @@ + + AAConWS + com.sun.xml.ws.transport.http.servlet.WSServlet + + + ClustalWS /ClustalWS @@ -72,7 +78,11 @@ ProbconsWS /ProbconsWS - + + + AAConWS + /AAConWS + @@ -107,13 +117,13 @@ BASIC - JWS2 admins + JABAWS administrators - The role that is required to log in and view JWS2 internals + The role that is required to log in and view JABAWS internals admin diff --git a/binaries/aaconservation.jar b/binaries/aaconservation.jar index 375b8e9..db61ab7 100644 Binary files a/binaries/aaconservation.jar and b/binaries/aaconservation.jar differ diff --git a/datamodel/compbio/data/sequence/MultiAnnotatedSequence.java b/datamodel/compbio/data/sequence/MultiAnnotatedSequence.java index d5942b3..92d475d 100644 --- a/datamodel/compbio/data/sequence/MultiAnnotatedSequence.java +++ b/datamodel/compbio/data/sequence/MultiAnnotatedSequence.java @@ -5,9 +5,6 @@ import java.util.EnumMap; import java.util.List; import java.util.Map; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; - import compbio.util.annotation.NotThreadSafe; /** @@ -19,7 +16,7 @@ import compbio.util.annotation.NotThreadSafe; * enum type */ @NotThreadSafe -@XmlAccessorType(XmlAccessType.FIELD) +// @XmlAccessorType(XmlAccessType.FIELD) public class MultiAnnotatedSequence> { private EnumMap> annotations; diff --git a/runner/compbio/runner/conservation/AACon.java b/runner/compbio/runner/conservation/AACon.java index f514e24..5a1d752 100644 --- a/runner/compbio/runner/conservation/AACon.java +++ b/runner/compbio/runner/conservation/AACon.java @@ -20,11 +20,12 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.Arrays; +import java.util.HashMap; import java.util.List; -import java.util.Map; import org.apache.log4j.Logger; +import compbio.conservation.Method; import compbio.engine.client.CommandBuilder; import compbio.engine.client.Executable; import compbio.engine.client.SkeletalExecutable; @@ -63,10 +64,9 @@ public class AACon extends SkeletalExecutable { addParameters(Arrays.asList("-jar", getLibPath(), "-d=" + STAT_FILE, "-f=RESULT_NO_ALIGNMENT")); } - - @SuppressWarnings("unchecked") + // HashMap @Override - public Map getResults(String workDirectory) + public HashMap getResults(String workDirectory) throws ResultNotAvailableException { // MultiAnnotatedSequence annotations = null; try { diff --git a/testsrc/compbio/data/sequence/SequenceUtilTester.java b/testsrc/compbio/data/sequence/SequenceUtilTester.java index b726d88..742fa24 100644 --- a/testsrc/compbio/data/sequence/SequenceUtilTester.java +++ b/testsrc/compbio/data/sequence/SequenceUtilTester.java @@ -184,6 +184,6 @@ public class SequenceUtilTester { public void testReadResults() throws FileNotFoundException { InputStream inStream = new FileInputStream(AllTestSuit.TEST_DATA_PATH + "aacon_results.txt"); - System.out.println(SequenceUtil.readResults(inStream)); +// /System.out.println(SequenceUtil.readResults(inStream)); } } diff --git a/testsrc/compbio/runner/conservation/AAConTester.java b/testsrc/compbio/runner/conservation/AAConTester.java index fbb9720..da924f0 100644 --- a/testsrc/compbio/runner/conservation/AAConTester.java +++ b/testsrc/compbio/runner/conservation/AAConTester.java @@ -256,6 +256,7 @@ public class AAConTester { assertNotNull(annotations); assertEquals(annotations.getAnnotations().size(), 3); assertEquals(al1.getResults(), annotations); + } catch (JobSubmissionException e) { e.printStackTrace(); fail(e.getLocalizedMessage()); diff --git a/webservices/compbio/data/msa/Annotation.java b/webservices/compbio/data/msa/Annotation.java index c73c0bc..45c1a68 100644 --- a/webservices/compbio/data/msa/Annotation.java +++ b/webservices/compbio/data/msa/Annotation.java @@ -7,7 +7,6 @@ import javax.jws.WebParam; import javax.jws.WebService; import compbio.data.sequence.FastaSequence; -import compbio.data.sequence.MultiAnnotatedSequence; import compbio.metadata.JobSubmissionException; import compbio.metadata.LimitExceededException; import compbio.metadata.Option; @@ -26,7 +25,7 @@ import compbio.metadata.WrongParameterException; * @param * executable type / web service type */ -@WebService(targetNamespace = "http://a.data.compbio/01/12/2010/") +@WebService(targetNamespace = "http://msa.data.compbio/01/12/2010/") public interface Annotation extends JManagement, Metadata { /** @@ -170,6 +169,6 @@ public interface Annotation extends JManagement, Metadata { * thrown if jobId is empty or cannot be recognised e.g. in * invalid format */ - MultiAnnotatedSequence getResult(@WebParam(name = "jobId") String jobId) + String getResult(@WebParam(name = "jobId") String jobId) throws ResultNotAvailableException; } diff --git a/webservices/compbio/data/msa/MsaWS.java b/webservices/compbio/data/msa/MsaWS.java index d5b64f8..cea5cdf 100644 --- a/webservices/compbio/data/msa/MsaWS.java +++ b/webservices/compbio/data/msa/MsaWS.java @@ -44,7 +44,7 @@ import compbio.metadata.WrongParameterException; * @param * executable type / web service type */ -@WebService(targetNamespace = "http://msa.data.compbio/01/12/2010/") +@WebService(targetNamespace = "http://msa.data.compbio/01/01/2010/") public interface MsaWS extends JManagement, Metadata { /** diff --git a/webservices/compbio/ws/server/AAConWS.java b/webservices/compbio/ws/server/AAConWS.java index cf382df..d65827e 100644 --- a/webservices/compbio/ws/server/AAConWS.java +++ b/webservices/compbio/ws/server/AAConWS.java @@ -1,6 +1,7 @@ package compbio.ws.server; import java.io.File; +import java.util.Arrays; import java.util.List; import javax.annotation.Resource; @@ -9,11 +10,8 @@ import javax.xml.ws.WebServiceContext; import org.apache.log4j.Logger; -import compbio.conservation.Method; import compbio.data.msa.Annotation; import compbio.data.sequence.FastaSequence; -import compbio.data.sequence.JalviewAnnotation; -import compbio.data.sequence.MultiAnnotatedSequence; import compbio.engine.AsyncExecutor; import compbio.engine.Configurator; import compbio.engine.client.ConfiguredExecutable; @@ -33,7 +31,7 @@ import compbio.metadata.WrongParameterException; import compbio.runner.Util; import compbio.runner.conservation.AACon; -@WebService(endpointInterface = "compbio.data.msa.MsaWS", targetNamespace = "http://msa.data.compbio/01/01/2010/", serviceName = "MuscleWS") +@WebService(endpointInterface = "compbio.data.msa.Annotation", targetNamespace = "http://msa.data.compbio/01/12/2010/", serviceName = "AAConWS") public class AAConWS implements Annotation { // Ask for resource injection @@ -53,39 +51,40 @@ public class AAConWS implements Annotation { ConfiguredExecutable init(List sequences) throws JobSubmissionException { AACon aacon = new AACon(); - aacon.setInput("fasta.in").setOutput("fasta.out"); + aacon.setInput("fasta.in").setOutput("aacon.out"); return Configurator.configureExecutable(aacon, sequences); } + // HashMap @SuppressWarnings("unchecked") - public MultiAnnotatedSequence getResult(String jobId) - throws ResultNotAvailableException { + public String getResult(String jobId) throws ResultNotAvailableException { WSUtil.validateJobId(jobId); AsyncExecutor asyncEngine = Configurator.getAsyncEngine(jobId); ConfiguredExecutable aacon = (ConfiguredExecutable) asyncEngine .getResults(jobId); - MultiAnnotatedSequence mas = aacon.getResults(); + // MultiAnnotatedSequence mas = aacon.getResults(); // log(jobId, "getResults"); - return mas; + return "";// new HashMap(); } - @SuppressWarnings("unchecked") - public JalviewAnnotation getJalviewAnnotation(String jobId) - throws ResultNotAvailableException { - MultiAnnotatedSequence result = getResult(jobId); - - // log(jobId, "getResults"); - return result.toJalviewAnnotation(); - } + /* + * @SuppressWarnings("unchecked") public JalviewAnnotation + * getJalviewAnnotation(String jobId) throws ResultNotAvailableException { + * MultiAnnotatedSequence result = getResult(jobId); // TODO // + * log(jobId, "getResults"); return result.toJalviewAnnotation(); } + */ + @Override public Limit getLimit(String presetName) { return new AACon().getLimit(presetName); } + @Override public LimitsManager getLimits() { return new AACon().getLimits(); } + @Override public ChunkHolder pullExecStatistics(String jobId, long position) { WSUtil.validateJobId(jobId); String file = Configurator.getWorkDirectory(jobId) + File.separator @@ -93,30 +92,53 @@ public class AAConWS implements Annotation { return WSUtil.pullFile(file, position); } + @Override public boolean cancelJob(String jobId) { WSUtil.validateJobId(jobId); return WSUtil.cancelJob(jobId); } + @Override public JobStatus getJobStatus(String jobId) { WSUtil.validateJobId(jobId); return WSUtil.getJobStatus(jobId); } + @Override public PresetManager getPresets() { return aaconPresets; } + @Override public RunnerConfig getRunnerOptions() { return aaconOptions; } + String analize(List sequences, + ConfiguredExecutable confExec, Logger log, String method, + Limit limit) throws JobSubmissionException { + if (limit != null && limit.isExceeded(sequences)) { + throw LimitExceededException.newLimitExceeded(limit, sequences); + } + + compbio.runner.Util.writeInput(sequences, confExec); + AsyncExecutor engine = Configurator.getAsyncEngine(confExec); + String jobId = engine.submitJob(confExec); + return jobId; + } + @Override public String analize(List sequences) throws UnsupportedRuntimeException, LimitExceededException, JobSubmissionException { - // TODO Auto-generated method stub - return null; + WSUtil.validateFastaInput(sequences); + ConfiguredExecutable confAAcon = init(sequences); + + // set default conservation method to fastest - SHENKIN + // TODO: This violates encapsulation, should be moved to the runners + // level. + confAAcon.addParameters(Arrays.asList("-m=SHENKIN")); + return analize(sequences, confAAcon, null, "analize", getLimit("")); } @Override @@ -124,8 +146,16 @@ public class AAConWS implements Annotation { List> options) throws UnsupportedRuntimeException, LimitExceededException, JobSubmissionException, WrongParameterException { - // TODO Auto-generated method stub - return null; + WSUtil.validateFastaInput(sequences); + ConfiguredExecutable confAACon = init(sequences); + // Could not do that! Space separated values + // will all be treated as keys! thus duplicates removed + // String params = cbuilder.getCommand(); + List params = WSUtil.getCommands(options, + AACon.KEY_VALUE_SEPARATOR); + confAACon.addParameters(params); + return analize(sequences, confAACon, null, "customAnalize", + getLimit("")); } @Override @@ -133,8 +163,14 @@ public class AAConWS implements Annotation { Preset preset) throws UnsupportedRuntimeException, LimitExceededException, JobSubmissionException, WrongParameterException { - // TODO Auto-generated method stub - return null; + WSUtil.validateFastaInput(sequences); + if (preset == null) { + throw new WrongParameterException("Preset must be provided!"); + } + ConfiguredExecutable confAAcon = init(sequences); + confAAcon.addParameters(preset.getOptions()); + Limit limit = getLimit(preset.getName()); + return WSUtil.align(sequences, confAAcon, null, "presetAnalize", limit); } } diff --git a/wsbuild.xml b/wsbuild.xml index ea64d08..8e7cc8b 100644 --- a/wsbuild.xml +++ b/wsbuild.xml @@ -22,6 +22,7 @@ + @@ -43,6 +44,17 @@ + + + + - + - + +