1 /* Copyright (c) 2011 Peter Troshin
\r
2 * Copyright (c) 2013 Alexander Sherstnev
\r
4 * JAva Bioinformatics Analysis Web Services (JABAWS)
\r
7 * This library is free software; you can redistribute it and/or modify it under the terms of the
\r
8 * Apache License version 2 as published by the Apache Software Foundation
\r
10 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
\r
11 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache
\r
12 * License for more details.
\r
14 * A copy of the license is in apache_license.txt. It is also available here:
\r
15 * @see: http://www.apache.org/licenses/LICENSE-2.0.txt
\r
17 * Any republication or derived work distributed in source code form
\r
18 * must include this copyright and license notice.
\r
20 package compbio.ws.server;
\r
22 import java.io.File;
\r
23 import java.util.Arrays;
\r
24 import java.util.List;
\r
26 import javax.jws.WebService;
\r
28 import org.apache.log4j.Logger;
\r
30 import compbio.data.msa.JABAService;
\r
31 import compbio.data.msa.SequenceAnnotation;
\r
32 import compbio.data.sequence.FastaSequence;
\r
33 import compbio.engine.Configurator;
\r
34 import compbio.engine.client.ConfiguredExecutable;
\r
35 import compbio.metadata.ChunkHolder;
\r
36 import compbio.metadata.JobSubmissionException;
\r
37 import compbio.metadata.LimitExceededException;
\r
38 import compbio.metadata.Option;
\r
39 import compbio.metadata.Preset;
\r
40 import compbio.metadata.UnsupportedRuntimeException;
\r
41 import compbio.metadata.WrongParameterException;
\r
42 import compbio.runner.predictors.Jpred;
\r
44 @WebService(endpointInterface = "compbio.data.msa.SequenceAnnotation", targetNamespace = JABAService.V2_SERVICE_NAMESPACE, serviceName = "JpredWS")
\r
45 public class JpredWS extends SequenceAnnotationService<Jpred>
\r
46 implements SequenceAnnotation<Jpred> {
\r
48 private static Logger log = Logger.getLogger(JpredWS.class);
\r
51 super(new Jpred(), log);
\r
55 public String analize(List<FastaSequence> sequences)
\r
56 throws UnsupportedRuntimeException, LimitExceededException, JobSubmissionException {
\r
57 WSUtil.validateJpredInput(sequences);
\r
58 ConfiguredExecutable<Jpred> confpred = init(sequences);
\r
60 // set default conservation method to fastest - SHENKIN
\r
61 // TODO: This violates encapsulation, should be moved to the runners
\r
63 //confpred.addParameters(Arrays.asList("-m=SHENKIN"));
\r
64 return WSUtil.analize(sequences, confpred, log, "JpredWS analize", getLimit(""));
\r
68 public String customAnalize(List<FastaSequence> sequences, List<Option<Jpred>> options)
\r
69 throws UnsupportedRuntimeException, LimitExceededException, JobSubmissionException, WrongParameterException {
\r
70 WSUtil.validateJpredInput(sequences);
\r
71 return super.customAnalize(sequences, options);
\r
75 public String presetAnalize(List<FastaSequence> sequences, Preset<Jpred> preset)
\r
76 throws UnsupportedRuntimeException, LimitExceededException, JobSubmissionException, WrongParameterException {
\r
77 WSUtil.validateJpredInput(sequences);
\r
78 return super.presetAnalize(sequences, preset);
\r
82 public ChunkHolder pullExecStatistics(String jobId, long position) {
\r
83 WSUtil.validateJobId(jobId);
\r
84 String file = Configurator.getWorkDirectory(jobId) + File.separator + Jpred.getStatFile();
\r
85 return WSUtil.pullFile(file, position);
\r