JWS-111 & JWS-109 Fixed some typos.
[jabaws.git] / website / man_dev.jsp
1 <%--<?xml version="1.0" encoding="ISO-8859-1" ?>--%>
2 <%--<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>--%>
3
4 <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
5 <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
6 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
7 <%@ taglib uri="http://displaytag.sf.net" prefix="dt" %>
8
9
10 <c:import url="template_header.jsp" >
11         <c:param name="title">Documentation</c:param>
12 </c:import>
13
14 <ol class="breadcrumb">
15         <li><a href="${pageContext.request.contextPath}/index.jsp">Home</a></li>
16         <li><a href="man_docs.jsp">Documentation</a></li>
17         <li class="active"><a href="man_server_dev.jsp">Develop JABAWS</a></li>
18 </ol>
19 <div class="row">
20         <div class="col-md-12">
21                 <div class="panel panel-default">
22                         <div class="panel panel-heading">
23                                 <h1 class="panel-title">Using JABAWS From Your Program</h1>
24                         </div>
25                         <div class="panel-body">
26                                 <!--<h4>JABAWS Server Virtual Appliance</h4>-->
27                                 <ul>
28                                         <li><a href="#wsfunctions">Web services functions overview </a></li>
29                                         <li><a href="#templatestr">The template client structure</a></li>
30                                         <li><a href="#connectto">Connecting to JABAWS</a></li>
31                                         <li><a href="#validnames">Valid JABAWS service names and WSDL files</a></li>
32                                         <li><a href="#defalign">Aligning sequences</a></li>
33                                         <li><a href="#checkresults">Checking the status of the calculation </a></li>
34                                         <li><a href="#presetalign">Aligning with presets</a></li>
35                                         <li><a href="#customalign">Aligning with custom parameters</a></li>
36                                         <li><a href="#writingaltofile">Writing alignments to a file</a></li>
37                                         <li><a href="#compex">A complete client example </a></li>
38                                         <li><a href="#buildart">Building web services artifacts</a></li>
39                                 </ul>
40                                 <!--<p class="justify">-->
41                                 <!--</p>-->
42                         </div>
43                 </div>
44         </div>
45 </div>
46
47 <div class="row" id="wsfunctions">
48         <div class="col-md-12">
49                 <div class="panel panel-default">
50                         <div class="panel panel-heading">
51                                 <h1 class="panel-title">Web services functions overview</h1>
52                         </div>
53                         <div class="panel-body">
54                                 <p class="justify">
55                                         All JABA multiple sequence alignment web services comply to the same
56                                         interface, thus the function described below are available from all the services.
57                                 </p>
58                                 <strong>Functions for initiating the alignment </strong>
59                                 <pre><code class="java">String id = align(List&lt;FastaSequence&gt; list)
60 String id = customAlign(List&lt;FastaSequence&gt; sequenceList, List&lt;Option&gt; optionList)
61 String id = presetAlign(List&lt;FastaSequence&gt; sequenceList, Preset preset)</code></pre>
62
63                                 <strong>Functions pertaining to job monitoring and control</strong><br />
64                                 <pre><code class="java">JobStatus status = getJobStatus(String id)
65 Alignment al = getResult(String id)
66 boolean cancelled = cancelJob(String id)
67 ChunkHolder chunk = pullExecStatistics(String id, long marker)</code></pre>
68                                 <strong>Functions relating to service features discovery</strong><br />
69                                 <pre><code class="java">RunnerConfig rc = getRunnerOptions()
70 Limit limit = getLimit(String name)
71 LimitsManager lm = getLimits()
72 PresetManager pm = getPresets()</code></pre>
73                                 <p class="justify">
74                                         Please refer to a <a href="dm_javadoc/compbio/data/msa/MsaWS.html">data model
75                                         javadoc</a> for a detailed description of each methods.
76                                 </p>
77                                 <p class="text-right">
78                                         <a href="#">Back to top <i class="fa fa-arrow-up" aria-hidden="true"></i></a>
79                                 </p>
80                         </div>
81                 </div>
82         </div>
83 </div>
84 <div class="row" id="templatestr">
85         <div class="col-md-12">
86                 <div class="panel panel-default">
87                         <div class="panel panel-heading">
88                                 <h1 class="panel-title">Structure of the template command line client</h1>
89                         </div>
90                         <div class="panel-body">
91                                 <table class="table">
92                                         <tr>
93                                                 <td style="width:19%"><strong>Packages</strong></td>
94                                                 <td style="width:81%"><strong>Classes and Interfaces </strong></td>
95                                         </tr>
96                                         <tr>
97                                                 <td>compbio.data.msa </td>
98                                                 <td>MsaWS the interface for all multiple sequence alignment web services </td>
99                                         </tr>
100                                         <tr>
101                                                 <td>compbio.data.sequence</td>
102                                                 <td>JABAWS data types </td>
103                                         </tr>
104                                         <tr>
105                                                 <td>compbio.metadata</td>
106                                                 <td>JABAWS meta data types </td>
107                                         </tr>
108                                         <tr>
109                                                 <td>compbio.ws.client</td>
110                                                 <td>JABAWS command line client </td>
111                                         </tr>
112                                 </table>
113                                 <p class="justify">
114                                         Additional utility libraries that this client depend upon is the
115                                         compbio-util-1.3.jar and compbio-annotation-1.0.jar.
116                                 </p>
117                                 <p class="justify">
118                                         Please refer to a <a href="dm_javadoc/index.html">data model javadoc</a>
119                                         for a detailed description of each class and its methods.
120                                 </p>
121                                 <p class="text-right">
122                                         <a href="#">Back to top <i class="fa fa-arrow-up" aria-hidden="true"></i></a>
123                                 </p>
124                         </div>
125                 </div>
126         </div>
127 </div>
128 <div class="row" id="connectto">
129         <div class="col-md-12">
130                 <div class="panel panel-default">
131                         <div class="panel panel-heading">
132                                 <h1 class="panel-title">Connecting to JABAWS</h1>
133                         </div>
134                         <div class="panel-body">
135                                 <p class="justify">
136                                         For a complete working example of JABAWS command line client please see
137                                         compbio.ws.client.Jws2Client class. JABAWS command line client
138                                         source code is available from the
139                                         <a href="http://gjb-www-1.cluster.lifesci.dundee.ac.uk:8086/jabaws-dev">download page</a>.
140                                         Please note that for now all
141                                         the examples are in Java, other languages will follow if there is sufficient demand.
142                                 </p>
143                                 <p class="justify">
144                                         Download a binary JABAWS client. Add the client to the class path. The following
145                                         code excerpt will connect your program to Clustal
146                                         web service deployed in the University of Dundee.
147                                 </p>
148                                 <pre><code class="java">import java.net.URL;
149 import javax.xml.namespace.QName;
150 import javax.xml.ws.Service;
151 // (...)
152 String qualifiedName = &quot;http://msa.data.compbio/01/01/2010/&quot;;
153 URL url = new URL(&quot;http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl&quot;);
154 QName qname = new QName(, &quot;ClustalWS&quot;);
155 Service serv = Service.create(url, qname);
156 MsaWS msaws = serv.getPort(new QName(qualifiedName, &quot;ClustalWSPort&quot;),
157 MsaWS.class);</code></pre>
158                                 <p>Line 1 makes a qualified name for JABA web services.</p>
159                                 <p>Line 2 constructs the URL to the web services WSDL.</p>
160                                 <p>Line 3 makes a qualified name instance for Clustal JABA web service.</p>
161                                 <p>Line 4 creates a service instance.</p>
162                                 <p>Line 5 makes a connection to the server.</p>
163                                 <p>A more generic connection method would look like this</p>
164
165                                 <pre><code class="java">import java.net.URL;
166 import javax.xml.namespace.QName;
167 import javax.xml.ws.Service;
168 import compbio.ws.client.Services
169 // (...)
170 String qualifiedServiceName = &quot;http://msa.data.compbio/01/01/2010/&quot;;
171 String host = &quot;http://www.compbio.dundee.ac.uk/jabaws&quot;;
172 // In real life the service name can come from args
173 Services clustal = Services.ClustalWS;
174 URL url = new URL(host + &quot;/&quot; + clustal.toString() + &quot;?wsdl&quot;);
175 QName qname = new QName(qualifiedServiceName, clustal.toString());
176 Service serv = Service.create(url, qname);
177 MsaWS msaws = serv.getPort(new QName(qualifiedServiceName, clustal + &quot;Port&quot;), MsaWS.class);</code></pre>
178
179                                 <p class="justify">
180                                         Where Services is enumeration of JABAWS web services. All JABAWS multiple
181                                         sequence alignment methods confirm to
182                                         MsaWS specification, thus from the caller point of view all JABAWS web
183                                         services can be represented by MsaWS
184                                         interface. The full documentation of MsaWS functions is available from
185                                         the <a href="dm_javadoc/compbio/data/msa/MsaWS.html">javadoc</a>.
186                                 </p>
187
188                                 <p class="text-right">
189                                         <a href="#">Back to top <i class="fa fa-arrow-up" aria-hidden="true"></i></a>
190                                 </p>
191                         </div>
192                 </div>
193         </div>
194 </div>
195 <div class="row" id="validnames">
196         <div class="col-md-12">
197                 <div class="panel panel-default">
198                         <div class="panel panel-heading">
199                                 <h1 class="panel-title">Valid JABAWS service names and WSDL files</h1>
200                         </div>
201                         <div class="panel-body">
202                                 <p>Multiple sequence alignment services</p>
203                                 <ul><li><a href="http://www.compbio.dundee.ac.uk/jabaws-dev/ClustalOWS?wsdl">ClustalOWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/ClustalOWS?wsdl) </li>
204                                         <li><a href="http://www.compbio.dundee.ac.uk/jabaws-dev/ClustalWS?wsdl">ClustalWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/ClustalWS?wsdl) </li>
205                                         <li><a href="http://www.compbio.dundee.ac.uk/jabaws-dev/MuscleWS?wsdl">MuscleWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/MuscleWS?wsdl) </li>
206                                         <li><a href="http://www.compbio.dundee.ac.uk/jabaws-dev/MafftWS?wsdl">MafftWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/MafftWS?wsdl) </li>
207                                         <li><a href="http://www.compbio.dundee.ac.uk/jabaws-dev/TcoffeeWS?wsdl">TcoffeeWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/TcoffeeWS?wsdl) </li>
208                                         <li><a href="http://www.compbio.dundee.ac.uk/jabaws-dev/ProbconsWS?wsdl">ProbconsWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/ProbconsWS?wsdl) </li>
209                                         <li><a href="http://www.compbio.dundee.ac.uk/jabaws-dev/MSAprobsWS?wsdl">MSAprobsWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/MSAprobsWS?wsdl) </li>
210                                         <li><a href="http://www.compbio.dundee.ac.uk/jabaws-dev/GLprobsWS?wsdl">GLprobsWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/GLprobsWS?wsdl) </li>
211                                 </ul>
212                                 <p>Protein disorder prediction services</p>
213                                 <ul>
214                                         <li><a href="http://www.compbio.dundee.ac.uk/jabaws-dev/IUPredWS?wsdl">IUPredWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/IUPredWS?wsdl) </li>
215                                         <li><a href="http://www.compbio.dundee.ac.uk/jabaws-dev/GlobPlotWS?wsdl">GlobPlotWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/GlobPlotWS?wsdl) </li>
216                                         <li><a href="http://www.compbio.dundee.ac.uk/jabaws-dev/DisemblWS?wsdl">DisemblWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/DisemblWS?wsdl) </li>
217                                         <li><a href="http://www.compbio.dundee.ac.uk/jabaws-dev/JronnWS?wsdl">JronnWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/JronnWS?wsdl) </li>
218                                 </ul>
219                                 <p>Amino acid conservation service</p>
220                                 <ul>
221                                         <li><a href="http://www.compbio.dundee.ac.uk/jabaws-dev/AAConWS?wsdl">AAConWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/AAConWS?wsdl) </li>
222                                 </ul>
223                                 <p>Protein and RNA Secondary Structure Prediction</p>
224                                 <ul>
225                                         <li><a href="http://www.compbio.dundee.ac.uk/jabaws-dev/JpredWS?wsdl">JpredWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/JpredWS?wsdl) </li>
226                                         <li><a href="http://www.compbio.dundee.ac.uk/jabaws-dev/RNAalifoldWS?wsdl">RNAalifoldWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/RNAalifoldWS?wsdl) </li>
227                                 </ul>
228                                 <p class="justify">
229                                         Please replace <em2>http://www.compbio.dundee.ac.uk/</em2> with your JABAWS instance host name, and
230                                         <em2>jabaws</em2> with your JABAWS context name to access your local version of JABAWS web services.
231                                         For example <em2>http://localhost:8080/jabaws</em2> would be a valid URL for the default Apache-Tomcat
232                                         installation and jabaws.war file deployment.
233                                 </p>
234                                 <p class="text-right">
235                                         <a href="#">Back to top <i class="fa fa-arrow-up" aria-hidden="true"></i></a>
236                                 </p>
237                         </div>
238                 </div>
239         </div>
240 </div>
241 <div class="row" id="defalign">
242         <div class="col-md-12">
243                 <div class="panel panel-default">
244                         <div class="panel panel-heading">
245                                 <h1 class="panel-title">Aligning sequences</h1>
246                         </div>
247                         <div class="panel-body">
248                                 <p class="justify">
249                                         Given that <em2>msaws</em2> is web service proxy, created as described in &quot;Connecting to JABAWS&quot;
250                                         section, the actual alignment can be obtained as follows:
251                                 </p>
252                                 <pre><code class="java">List&lt;FastaSequence&gt; fastalist = SequenceUtil.readFasta(new FileInputStream(file));
253 String jobId = msaws.align(fastalist);
254 Alignment alignment = msaws.getResult(jobId);</code></pre>
255
256                                 <p>Line  one loads FASTA sequence from the file.</p>
257                                 <p>Line two submits them to web service represented by msaws proxy.</p>
258                                 <p class="justify">
259                                         Line three retrieves the alignment from a web service. This line will block the execution until the result is available.
260                                         Use this with caution. In general, you should make sure that the calculation has been completed before attempting
261                                         retrieving results. This is to avoid keeping the connection to the server on hold for a prolonged periods of time.
262                                         While this may be ok with your local server, our public server
263                                         (<a href="http://www.compbio.dundee.ac.uk/jabaws">www.compbio.dundee.ac.uk/jabaws</a>) will not let you hold the connection
264                                         for longer than 10 minutes. This is done to prevent excessive load on the server. The next section describes how to check
265                                         the status of the calculation.<br />
266                                         Methods and classes mentioned in the excerpt are available from the JABAWS client library.
267                                 </p>
268                                 <p class="text-right">
269                                         <a href="#">Back to top <i class="fa fa-arrow-up" aria-hidden="true"></i></a>
270                                 </p>
271                         </div>
272                 </div>
273         </div>
274 </div>
275 <div class="row" id="checkresults">
276         <div class="col-md-12">
277                 <div class="panel panel-default">
278                         <div class="panel panel-heading">
279                                 <h1 class="panel-title">Checking the status of the calculation</h1>
280                         </div>
281                         <div class="panel-body">
282                                 <p class="justify">
283                                         You may have noticed that there was no pause between submitting the job and retrieving of the results. This is
284                                         because <em2>getResult(jobId)</em2> method block the processing until the calculation is completed.
285                                         However, taking into account that the connection holds server resources, our public server
286                                         (<a href="http://www.compbio.dundee.ac.uk/jabaws">www.compbio.dundee.ac.uk/jabaws</a>) is configured to reset the
287                                         connection after 10 minutes of waiting. To work around the connection reset you are encouraged to check whether the
288                                         calculation has been completed before accessing the results. You can do it like this:
289                                 </p>
290                                 <pre><code class="java">while (msaws.getJobStatus(jobId) != JobStatus.FINISHED) {
291 &nbsp;&nbsp;&nbsp;&nbsp;Thread.sleep(2000); // wait two  seconds, then recheck the status
292 }</code></pre>
293                                 <p class="text-right">
294                                         <a href="#">Back to top <i class="fa fa-arrow-up" aria-hidden="true"></i></a>
295                                 </p>
296                         </div>
297                 </div>
298         </div>
299 </div>
300 <div class="row" id="presetalign">
301         <div class="col-md-12">
302                 <div class="panel panel-default">
303                         <div class="panel panel-heading">
304                                 <h1 class="panel-title">Aligning with presets</h1>
305                         </div>
306                         <div class="panel-body">
307                                  <pre><code class="java">PresetManager presetman = msaws.getPresets();
308 Preset preset = presetman.getPresetByName(presetName);
309 List&lt;FastaSequence&gt; fastalist = SequenceUtil.readFasta(new FileInputStream(file));
310 String jobId = msaws.presetAlign(fastalist, preset);
311 Alignment alignment = msaws.getResult(jobId);</code></pre>
312                                 <p>Line one obtains the lists of presets supported by a web service.</p>
313                                 <p>Line two return a particular Preset by its name.</p>
314                                 <p>
315                                         Lines three to five  are doing the same job as in the first <a href="#defalign">
316                                         aligning sequences example</a>.
317                                 </p>
318                                 <p class="text-right">
319                                         <a href="#">Back to top <i class="fa fa-arrow-up" aria-hidden="true"></i></a>
320                                 </p>
321                         </div>
322                 </div>
323         </div>
324 </div>
325 <div class="row" id="customalign">
326         <div class="col-md-12">
327                 <div class="panel panel-default">
328                         <div class="panel panel-heading">
329                                 <h1 class="panel-title">Aligning with custom parameters</h1>
330                         </div>
331                         <div class="panel-body">
332                                 <pre><code class="java">RunnerConfig options = msaws.getRunnerOptions();
333 Argument matrix = options.getArgument(&quot;MATRIX&quot;);
334 matrix.setValue(&quot;PAM300&quot;);
335 Argument gapopenpenalty = options.getArgument(&quot;GAPOPEN&quot;);
336 gapopenpenalty.setValue(&quot;20&quot;);
337 List&lt;Argument&gt; arguments = new ArrayList&lt;Argument&gt;();
338 arguments.add(matrix); arguments.add(gapopenpenalty);
339 List&lt;FastaSequence&gt; fastalist = SequenceUtil.readFasta(new FileInputStream(file));
340 String jobId = msaws.customAlign(fastalist, arguments);
341 Alignment alignment = msaws.getResult(jobId);</code></pre>
342
343                                 <p>Line one obtains the <em2>RunnerConfig</em2> object that holds information on
344                                         supported parameters and their values</p>
345                                 <p>Line two retrieve a particular parameter from the holder by its name.</p>
346                                 <p>Lines three sets a value to this parameter which will be used in the calculation. </p>
347                                 <p>Line four and five do the same but for another parameter.</p>
348                                 <p>Line six makes a List to hold the parameters.</p>
349                                 <p>Line seven puts the parameters into that list.</p>
350                                 <p>Line eight and ten is the same as in previous examples.</p>
351                                 <p>Line nine submit an alignment request with the sequences and the parameters.</p>
352                                 <p class="justify">The names of all the parameters supported by a web service e.g. &quot;PAM300&quot; can be obtained
353                                         using <em2>options.getArguments()</em2>method. Further details on the methods
354                                         available from <em2>RunnerConfig</em2> object are available from the
355                                         <a href="dm_javadoc/index.html">javadoc</a>.
356                                 </p>
357                                 <p class="text-right">
358                                         <a href="#">Back to top <i class="fa fa-arrow-up" aria-hidden="true"></i></a>
359                                 </p>
360                         </div>
361                 </div>
362         </div>
363 </div>
364 <div class="row" id="writingaltofile">
365         <div class="col-md-12">
366                 <div class="panel panel-default">
367                         <div class="panel panel-heading">
368                                 <h1 class="panel-title">Writing alignments to a file</h1>
369                         </div>
370                         <div class="panel-body">
371                                 <p class="justify">
372                                         There is a utility method in the client library that does exactly that.
373                                 </p>
374                                 <pre><code class="java">Alignment alignment = align(...)
375 FileOutputStream outStream = new FileOutputStream(file);
376 ClustalAlignmentUtil.writeClustalAlignment(outStream, align);</code></pre>
377                                 <p class="text-right">
378                                         <a href="#">Back to top <i class="fa fa-arrow-up" aria-hidden="true"></i></a>
379                                 </p>
380                         </div>
381                 </div>
382         </div>
383 </div>
384 <div class="row" id="compex">
385         <div class="col-md-12">
386                 <div class="panel panel-default">
387                         <div class="panel panel-heading">
388                                 <h1 class="panel-title">A complete client example</h1>
389                         </div>
390                         <div class="panel-body">
391                                 <p class="justify">
392                                         Finally, a complete example of the program that connects to JABAWS Clustal
393                                         service and aligns sequences using
394                                         one of the  Clustal web service presets. There is also a
395                                         <a href="2.1/Example_template.pdf">PDF version</a> of
396                                         this example with syntax highlighted. The text comments are commented by block
397                                         style comments e.g. /* comment */,
398                                         the alternatives given in the code are line commented // comment. You may want
399                                         to remove line style comments to
400                                         test alternatives of the functions. All you need for this to work is a
401                                         <a href="http://gjb-www-1.cluster.lifesci.dundee.ac.uk:8086/jabaws-dev/get?id=min-jaba-client-2.0.jar">JABAWS binary client</a>.
402                                         Please make sure that the client is in the Java class path before running this example.
403                                 </p>
404                                 <pre><code class="java">
405 import java.io.ByteArrayInputStream;
406 import java.io.FileNotFoundException;
407 import java.io.IOException;
408 import java.net.URL;
409 import java.util.List;
410
411 import javax.xml.namespace.QName;
412 import javax.xml.ws.Service;
413
414 import compbio.data.msa.MsaWS;
415 import compbio.data.sequence.Alignment;
416 import compbio.data.sequence.FastaSequence;
417 import compbio.data.sequence.SequenceUtil;
418 import compbio.metadata.JobSubmissionException;
419 import compbio.metadata.LimitExceededException;
420 import compbio.metadata.Preset;
421 import compbio.metadata.PresetManager;
422 import compbio.metadata.ResultNotAvailableException;
423 import compbio.metadata.UnsupportedRuntimeException;
424 import compbio.metadata.WrongParameterException;
425
426 public class Example {
427
428 /*
429  * Input sequences for alignment
430  */
431 static final String input = &quot;&gt;Foo\r\n&quot;
432                 + &quot;MTADGPRELLQLRAAVRHRPQDFVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAVARLGR&quot;
433                 + &quot;VRWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDAGQAEAAAAAYTRAHQLLPEEPYITAQ&quot;
434                 + &quot;LLNWRRRLCDWRALDVLSAQVRAAVAQGVGAVEPFAFLSEDASAAEQLACARTRAQAIAASVRPL&quot;
435                 + &quot;APTRVRSKGPLRVGFVSNGFGAHPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQA&quot;
436                 + &quot;STLHDVTALGHLATAKHIRHHGIDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMD&quot;
437                 + &quot;YVLGDAFALPPALEPFYSEHVLRLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLN&quot;
438                 + &quot;PQSMARMLAVLREVPDSVLWLLSGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHAD&quot;
439                 + &quot;LFLDTHPYNAHTTASDALWTGCPVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALAS&quot;
440                 + &quot;DPAALTALHARVDVLRRESGVFEMDGFADDFGALLQALARRHGWLGI\r\n&quot;
441                 + &quot;\r\n&quot;
442                 + &quot;&gt;Bar\r\n&quot;
443                 + &quot;MGDTTAGEMAVQRGLALHQQRHAEAAVLLQQASDAAPEHPGIALWLHALEDAGQAEAAAAYTRAH&quot;
444                 + &quot;QLLPEEPYITAQLLNAVAQGVGAVEPFAFLSEDASAAESVRPLAPTRVRSKGPLRVGFVSNGFGA&quot;
445                 + &quot;HPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHG&quot;
446                 + &quot;IDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVL&quot;
447                 + &quot;RLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLL&quot;
448                 + &quot;SGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGC&quot;
449                 + &quot;PVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRESGV&quot;
450                 + &quot;FEMDGFADDFGALLQALARRHGWLGI\r\n&quot;
451                 + &quot;\r\n&quot;
452                 + &quot;&gt;Friends\r\n&quot;
453                 + &quot;MTADGPRELLQLRAAVRHRPQDVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAVARLGRV&quot;
454                 + &quot;RWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDHQLLPEEPYITAQLDVLSAQVRAAVAQG&quot;
455                 + &quot;VGAVEPFAFLSEDASAAEQLACARTRAQAIAASVRPLAPTRVRSKGPLRVGFVSNGFGAHPTGLL&quot;
456                 + &quot;TVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHGIDLLFD&quot;
457                 + &quot;LRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVLRLQGAF&quot;
458                 + &quot;QPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLLSGPGEA&quot;
459                 + &quot;DARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGCPVLTTP&quot;
460                 + &quot;GETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRESI&quot;;
461
462 public static void main(String[] args) throws UnsupportedRuntimeException,
463                 LimitExceededException, JobSubmissionException,
464                 WrongParameterException, FileNotFoundException, IOException,
465                 ResultNotAvailableException, InterruptedException {
466
467         String qualifiedServiceName = &quot;http://msa.data.compbio/01/01/2010/&quot;;
468
469         /* Make a URL pointing to web service WSDL */
470         URL url = new URL(&quot;http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl&quot;);
471
472         /*
473          * If you are making a client that connects to different web services
474          * you can use something like this:
475          */
476         // URL url = new URL(host + &quot;/&quot; + Services.ClustalWS.toString() +
477         // &quot;?wsdl&quot;);
478
479         QName qname = new QName(qualifiedServiceName, &quot;ClustalWS&quot;);
480         Service serv = Service.create(url, qname);
481         /*
482          * Multiple sequence alignment interface for Clustal web service
483          * instance
484          */
485         MsaWS msaws = serv.getPort(new QName(qualifiedServiceName, &quot;ClustalWS&quot;
486                         + &quot;Port&quot;), MsaWS.class);
487
488         /* Get the list of available presets */
489         PresetManager presetman = msaws.getPresets();
490
491         /* Get the Preset object by preset name */
492         Preset preset = presetman
493                         .getPresetByName(&quot;Disable gap weighting (Speed-oriented)&quot;);
494
495         /*
496          * Load sequences in FASTA format from the file You can use something
497          * like new FileInputStream(&lt;filename&gt;) to load sequence from the file
498          */
499         List&lt;FastaSequence&gt; fastalist = SequenceUtil
500                         .readFasta(new ByteArrayInputStream(input.getBytes()));
501
502         /*
503          * Submit loaded sequences for an alignment using preset. The job
504          * identifier is returned by this method, you can retrieve the results
505          * with it sometime later.
506          */
507         String jobId = msaws.presetAlign(fastalist, preset);
508
509         /* This method will block for the duration of the calculation */
510         Alignment alignment = msaws.getResult(jobId);
511
512         /*
513          * This is a better way of obtaining results, it does not involve
514          * holding the connection open for the duration of the calculation,
515          * Besides, as the University of Dundee public server will reset the
516          * connection after 10 minutes of idling, this is the only way to obtain
517          * the results of long running task from our public server.
518          */
519         // while (msaws.getJobStatus(jobId) != JobStatus.FINISHED) {
520         // Thread.sleep(1000); // wait a second, then recheck the status
521         // }
522
523         /* Output the alignment to standard out */
524         System.out.println(alignment);
525
526         // Alternatively, you can record retrieved alignment into the file in
527         // ClustalW format
528
529         // ClustalAlignmentUtil.writeClustalAlignment(new FileOutputStream(
530         // &quot;output.al&quot;), alignment);
531
532 }
533 }
534 </code></pre>
535                                 <p>For a more detailed description of all available types and their functions please
536                                         refer to the <a href="dm_javadoc/index.html">data model javadoc</a>.
537                                 </p>
538                                 <p class="text-right">
539                                         <a href="#">Back to top <i class="fa fa-arrow-up" aria-hidden="true"></i></a>
540                                 </p>
541                         </div>
542                 </div>
543         </div>
544 </div>
545 <div class="row" id="buildart">
546         <div class="col-md-12">
547                 <div class="panel panel-default">
548                         <div class="panel panel-heading">
549                                 <h1 class="panel-title">Building web services artifacts</h1>
550                         </div>
551                         <div class="panel-body">
552                                 <p class="justify">
553                                         JABAWS are the standard <a href="http://jax-ws.java.net/">JAX-WS</a> SOAP web
554                                         services, which are <a href="http://www.ws-i.org/">WS-I</a>
555                                         basic profile compatible. This means that you could use whatever tool your
556                                         language has to work with web services. Below is how you can
557                                         generate portable artifacts to work with JABAWS from Java. However if
558                                         programming in Java, we recommend using our  client library as
559                                         it provides a handful of useful methods in addition to plain data types.
560                                 </p>
561                                 <pre><code class="bash">wsimport -keep http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl</code></pre>
562                         </div>
563                 </div>
564         </div>
565 </div>
566
567 <jsp:include page="template_footer.jsp" />