2d9d729204a80e7a7300a28cd7c665a2b4f8e327
[jabaws.git] / webservices / compbio / data / msa / SequenceAnnotation.java
1 package compbio.data.msa;\r
2 \r
3 import java.security.InvalidParameterException;\r
4 import java.util.List;\r
5 \r
6 import javax.jws.WebMethod;\r
7 import javax.jws.WebParam;\r
8 import javax.jws.WebService;\r
9 \r
10 import compbio.data.sequence.FastaSequence;\r
11 import compbio.data.sequence.ScoreManager;\r
12 import compbio.metadata.JobSubmissionException;\r
13 import compbio.metadata.LimitExceededException;\r
14 import compbio.metadata.Option;\r
15 import compbio.metadata.Preset;\r
16 import compbio.metadata.ResultNotAvailableException;\r
17 import compbio.metadata.UnsupportedRuntimeException;\r
18 import compbio.metadata.WrongParameterException;\r
19 \r
20 /**\r
21  * Interface for tools that results to one or more annotation to sequence(s)\r
22  * \r
23  * Single, multiple sequences their groups or alignments can be annotated\r
24  * \r
25  * @author Peter Troshin\r
26  * \r
27  * @param <T>\r
28  *            executable type / web service type\r
29  * \r
30  * @version 1.0 November 2010\r
31  */\r
32 @WebService(targetNamespace = JABAService.V2_SERVICE_NAMESPACE)\r
33 public interface SequenceAnnotation<T>\r
34                 extends\r
35                         JABAService,\r
36                         JManagement,\r
37                         Metadata<T> {\r
38 \r
39         /**\r
40          * \r
41          * Analyse the sequences. The actual analysis algorithm is defined by the\r
42          * type T.\r
43          * \r
44          * Any dataset containing a greater number of sequences or the average\r
45          * length of the sequences are greater then defined in the default Limit\r
46          * will not be accepted for an alignment operation and\r
47          * JobSubmissionException will be thrown.\r
48          * \r
49          * @param sequences\r
50          *            List of FastaSequence objects. The programme does not perform\r
51          *            any sequence validity checks. Nor does it checks whether the\r
52          *            sequences names are unique. It is responsibility of the caller\r
53          *            to validate this information\r
54          * @return jobId - unique identifier for the job\r
55          * @throws JobSubmissionException\r
56          *             is thrown when the job could not be submitted due to the\r
57          *             following reasons: 1) The number of sequences in the\r
58          *             submission or their average length is greater then defined by\r
59          *             the default Limit. 2) Any problems on the server side e.g. it\r
60          *             is misconfigured or malfunction, is reported via this\r
61          *             exception. In the first case the information on the limit\r
62          *             could be obtained from an exception.\r
63          * @throws InvalidParameterException\r
64          *             thrown if input list of fasta sequence is null or empty\r
65          * @throws UnsupportedRuntimeException\r
66          *             thrown if server OS does not support native executables for a\r
67          *             given web service, e.g. JABAWS is deployed on Windows and\r
68          *             Mafft service is called\r
69          * @throws LimitExceededException\r
70          *             is throw if the input sequences number or average length\r
71          *             exceeds what is defined by the limit\r
72          */\r
73         @WebMethod\r
74         String analize(\r
75                         @WebParam(name = "fastaSequences") List<FastaSequence> sequences)\r
76                         throws UnsupportedRuntimeException, LimitExceededException,\r
77                         JobSubmissionException;\r
78 \r
79         /**\r
80          * Analyse the sequences according to custom settings defined in options\r
81          * list. The actual analysis algorithm is defined by the type T. Default\r
82          * Limit is used to decide whether the calculation will be permitted or\r
83          * denied\r
84          * \r
85          * @param sequences\r
86          *            List of FastaSequence objects. The programme does not perform\r
87          *            any sequence validity checks. Nor does it checks whether the\r
88          *            sequences names are unique. It is responsibility of the caller\r
89          *            to validate this information\r
90          * @param options\r
91          *            A list of Options\r
92          * @return jobId - unique identifier for the job\r
93          * @throws JobSubmissionException\r
94          *             is thrown when the job could not be submitted due to the\r
95          *             following reasons: 1) The number of sequences in the\r
96          *             submission or their average length is greater then defined by\r
97          *             the default Limit. 2) Any problems on the server side e.g. it\r
98          *             is misconfigured or malfunction, is reported via this\r
99          *             exception. In the first case the information on the limit\r
100          *             could be obtained from an exception.\r
101          * @throws WrongParameterException\r
102          *             is throws when 1) One of the Options provided is not\r
103          *             supported, 2) The value of the option is defined outside the\r
104          *             boundaries. In both cases exception object contain the\r
105          *             information on the violating Option.\r
106          * @throws InvalidParameterException\r
107          *             thrown if input list of fasta sequence is null or empty\r
108          * @throws UnsupportedRuntimeException\r
109          *             thrown if server OS does not support native executables for a\r
110          *             given web service, e.g. JABAWS is deployed on Windows and\r
111          *             Mafft service is called\r
112          * @throws LimitExceededException\r
113          *             is throw if the input sequences number or average length\r
114          *             exceeds what is defined by the limit\r
115          * @see Option\r
116          */\r
117         @WebMethod\r
118         String customAnalize(\r
119                         @WebParam(name = "fastaSequences") List<FastaSequence> sequences,\r
120                         @WebParam(name = "options") List<Option<T>> options)\r
121                         throws UnsupportedRuntimeException, LimitExceededException,\r
122                         JobSubmissionException, WrongParameterException;\r
123 \r
124         /**\r
125          * Analyse the sequences according to the preset settings. The actual\r
126          * analysis algorithm is defined by the type T.\r
127          * \r
128          * Limit for a presetName is used whether the calculation will be permitted\r
129          * or denied. If no Limit was defined for a presetName, than default limit\r
130          * is used.\r
131          * \r
132          * @param sequences\r
133          *            List of FastaSequence objects. The programme does not perform\r
134          *            any sequence validity checks. Nor does it checks whether the\r
135          *            sequences names are unique. It is responsibility of the caller\r
136          *            to validate this information\r
137          * @param preset\r
138          *            A list of Options\r
139          * @return String - jobId - unique identifier for the job\r
140          * @throws JobSubmissionException\r
141          *             is thrown when the job could not be submitted due to the\r
142          *             following reasons: 1) The number of sequences in the\r
143          *             submission or their average length is greater then defined by\r
144          *             the default Limit. 2) Any problems on the server side e.g. it\r
145          *             is misconfigured or malfunction, is reported via this\r
146          *             exception. In the first case the information on the limit\r
147          *             could be obtained from an exception.\r
148          * @throws WrongParameterException\r
149          *             is throws when 1) One of the Options provided is not\r
150          *             supported, 2) The value of the option is defined outside the\r
151          *             boundaries. In both cases exception object contain the\r
152          *             information on the violating Option.\r
153          * @throws InvalidParameterException\r
154          *             thrown if input list of fasta sequence is null or empty\r
155          * @throws UnsupportedRuntimeException\r
156          *             thrown if server OS does not support native executables for a\r
157          *             given web service, e.g. JABAWS is deployed on Windows and\r
158          *             Mafft service is called\r
159          * @throws LimitExceededException\r
160          *             is throw if the input sequences number or average length\r
161          *             exceeds what is defined by the limit\r
162          */\r
163         @WebMethod\r
164         String presetAnalize(\r
165                         @WebParam(name = "fastaSequences") List<FastaSequence> sequences,\r
166                         @WebParam(name = "preset") Preset<T> preset)\r
167                         throws UnsupportedRuntimeException, LimitExceededException,\r
168                         JobSubmissionException, WrongParameterException;\r
169 \r
170         /**\r
171          * Return the result of the job.\r
172          * \r
173          * @param jobId\r
174          *            a unique job identifier\r
175          * @return the Map with the sequence names, sequence group names or the word\r
176          *         'Alignment' in case of alignments and values the represented by a\r
177          *         Set of Score objects. The alignment can be represented in as\r
178          *         little as one key->value pair in this map, the list of sequences\r
179          *         will be represented by multiple key->value mappings. If multiple\r
180          *         annotations were calculated, then they are represented as a Set\r
181          *         of Scores.\r
182          * @throws ResultNotAvailableException\r
183          *             this exception is throw if the job execution was not\r
184          *             successful or the result of the execution could not be found.\r
185          *             (e.g. removed). Exception could also be thrown is dues to the\r
186          *             lower level problems on the server i.e. IOException,\r
187          *             FileNotFoundException problems as well as\r
188          *             UnknownFileFormatException.\r
189          * @throws InvalidParameterException\r
190          *             thrown if jobId is empty or cannot be recognised e.g. in\r
191          *             invalid format\r
192          * \r
193          */\r
194         @WebMethod\r
195         ScoreManager getAnnotation(@WebParam(name = "jobId") String jobId)\r
196                         throws ResultNotAvailableException;\r
197         /*\r
198          * The method should really return Map and Set, but unfortunately JAXB\r
199          * cannot serialize interfaces, has a concrete implementation is used Could\r
200          * also specify the generic Set e.g. ? extends Set. But this would require\r
201          * the client cast or operate with generic Set. Keep it simple for now.\r
202          */\r
203 }\r