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.List;
\r
25 import javax.jws.WebService;
\r
27 import org.apache.log4j.Logger;
\r
29 import compbio.data.msa.JABAService;
\r
30 import compbio.data.msa.SequenceAnnotation;
\r
31 import compbio.data.sequence.FastaSequence;
\r
32 import compbio.engine.Configurator;
\r
33 import compbio.engine.client.ConfiguredExecutable;
\r
34 import compbio.metadata.ChunkHolder;
\r
35 import compbio.metadata.JobSubmissionException;
\r
36 import compbio.metadata.LimitExceededException;
\r
37 import compbio.metadata.Option;
\r
38 import compbio.metadata.Preset;
\r
39 import compbio.metadata.UnsupportedRuntimeException;
\r
40 import compbio.metadata.WrongParameterException;
\r
41 import compbio.runner.predictors.Jpred;
\r
43 @WebService(endpointInterface = "compbio.data.msa.SequenceAnnotation", targetNamespace = JABAService.V2_SERVICE_NAMESPACE, serviceName = "JpredWS")
\r
44 public class JpredWS extends SequenceAnnotationService<Jpred>
\r
45 implements SequenceAnnotation<Jpred> {
\r
47 private static Logger log = Logger.getLogger(JpredWS.class);
\r
50 super(new Jpred(), log);
\r
54 public String analize(List<FastaSequence> sequences)
\r
55 throws UnsupportedRuntimeException, LimitExceededException, JobSubmissionException {
\r
56 WSUtil.validateJpredInput(sequences);
\r
57 ConfiguredExecutable<Jpred> confpred = init(sequences);
\r
59 // set default conservation method to fastest - SHENKIN
\r
60 // TODO: This violates encapsulation, should be moved to the runners
\r
62 //confpred.addParameters(Arrays.asList("-m=SHENKIN"));
\r
63 return WSUtil.analize(sequences, confpred, log, "JpredWS analize", getLimit(""));
\r
67 public String customAnalize(List<FastaSequence> sequences, List<Option<Jpred>> options)
\r
68 throws UnsupportedRuntimeException, LimitExceededException, JobSubmissionException, WrongParameterException {
\r
69 WSUtil.validateJpredInput(sequences);
\r
70 return super.customAnalize(sequences, options);
\r
74 public String presetAnalize(List<FastaSequence> sequences, Preset<Jpred> preset)
\r
75 throws UnsupportedRuntimeException, LimitExceededException, JobSubmissionException, WrongParameterException {
\r
76 WSUtil.validateJpredInput(sequences);
\r
77 return super.presetAnalize(sequences, preset);
\r
81 public ChunkHolder pullExecStatistics(String jobId, long position) {
\r
82 WSUtil.validateJobId(jobId);
\r
83 String file = Configurator.getWorkDirectory(jobId) + File.separator + Jpred.getStatFile();
\r
84 return WSUtil.pullFile(file, position);
\r