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