JWS-109 Updated the Documentation pages. Fixed the links and fixed chuncks of text...
[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">Accessing 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 JABAWS 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="${pageContext.request.contextPath}/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="${pageContext.request.contextPath}/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="${pageContext.request.contextPath}/download.jsp">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="${pageContext.request.contextPath}/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="${pageContext.request.contextPath}/ClustalOWS?wsdl">ClustalOWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/ClustalOWS?wsdl) </li>
204                                         <li><a href="${pageContext.request.contextPath}/ClustalWS?wsdl">ClustalWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/ClustalWS?wsdl) </li>
205                                         <li><a href="${pageContext.request.contextPath}/MuscleWS?wsdl">MuscleWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/MuscleWS?wsdl) </li>
206                                         <li><a href="${pageContext.request.contextPath}/MafftWS?wsdl">MafftWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/MafftWS?wsdl) </li>
207                                         <li><a href="${pageContext.request.contextPath}/TcoffeeWS?wsdl">TcoffeeWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/TcoffeeWS?wsdl) </li>
208                                         <li><a href="${pageContext.request.contextPath}/ProbconsWS?wsdl">ProbconsWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/ProbconsWS?wsdl) </li>
209                                         <li><a href="${pageContext.request.contextPath}/MSAprobsWS?wsdl">MSAprobsWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/MSAprobsWS?wsdl) </li>
210                                         <li><a href="${pageContext.request.contextPath}/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="${pageContext.request.contextPath}/IUPredWS?wsdl">IUPredWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/IUPredWS?wsdl) </li>
215                                         <li><a href="${pageContext.request.contextPath}/GlobPlotWS?wsdl">GlobPlotWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/GlobPlotWS?wsdl) </li>
216                                         <li><a href="${pageContext.request.contextPath}/DisemblWS?wsdl">DisemblWS</a> (http://www.compbio.dundee.ac.uk/jabaws-dev/DisemblWS?wsdl) </li>
217                                         <li><a href="${pageContext.request.contextPath}/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>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="${pageContext.request.contextPath}/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="${pageContext.request.contextPath}/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.  All you need for this to work is a
395                                         <a href="${pageContext.request.contextPath}/download.jsp#client">JABAWS binary client</a>.
396                                         Please make sure that the client is in the Java class path before running this example.
397                                 </p>
398                                 <pre><code class="java">
399 import java.io.ByteArrayInputStream;
400 import java.io.FileNotFoundException;
401 import java.io.IOException;
402 import java.net.URL;
403 import java.util.List;
404
405 import javax.xml.namespace.QName;
406 import javax.xml.ws.Service;
407
408 import compbio.data.msa.MsaWS;
409 import compbio.data.sequence.Alignment;
410 import compbio.data.sequence.FastaSequence;
411 import compbio.data.sequence.SequenceUtil;
412 import compbio.metadata.JobSubmissionException;
413 import compbio.metadata.LimitExceededException;
414 import compbio.metadata.Preset;
415 import compbio.metadata.PresetManager;
416 import compbio.metadata.ResultNotAvailableException;
417 import compbio.metadata.UnsupportedRuntimeException;
418 import compbio.metadata.WrongParameterException;
419
420 public class Example {
421
422 /*
423  * Input sequences for alignment
424  */
425 static final String input = &quot;&gt;Foo\r\n&quot;
426                 + &quot;MTADGPRELLQLRAAVRHRPQDFVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAVARLGR&quot;
427                 + &quot;VRWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDAGQAEAAAAAYTRAHQLLPEEPYITAQ&quot;
428                 + &quot;LLNWRRRLCDWRALDVLSAQVRAAVAQGVGAVEPFAFLSEDASAAEQLACARTRAQAIAASVRPL&quot;
429                 + &quot;APTRVRSKGPLRVGFVSNGFGAHPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQA&quot;
430                 + &quot;STLHDVTALGHLATAKHIRHHGIDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMD&quot;
431                 + &quot;YVLGDAFALPPALEPFYSEHVLRLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLN&quot;
432                 + &quot;PQSMARMLAVLREVPDSVLWLLSGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHAD&quot;
433                 + &quot;LFLDTHPYNAHTTASDALWTGCPVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALAS&quot;
434                 + &quot;DPAALTALHARVDVLRRESGVFEMDGFADDFGALLQALARRHGWLGI\r\n&quot;
435                 + &quot;\r\n&quot;
436                 + &quot;&gt;Bar\r\n&quot;
437                 + &quot;MGDTTAGEMAVQRGLALHQQRHAEAAVLLQQASDAAPEHPGIALWLHALEDAGQAEAAAAYTRAH&quot;
438                 + &quot;QLLPEEPYITAQLLNAVAQGVGAVEPFAFLSEDASAAESVRPLAPTRVRSKGPLRVGFVSNGFGA&quot;
439                 + &quot;HPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHG&quot;
440                 + &quot;IDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVL&quot;
441                 + &quot;RLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLL&quot;
442                 + &quot;SGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGC&quot;
443                 + &quot;PVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRESGV&quot;
444                 + &quot;FEMDGFADDFGALLQALARRHGWLGI\r\n&quot;
445                 + &quot;\r\n&quot;
446                 + &quot;&gt;Friends\r\n&quot;
447                 + &quot;MTADGPRELLQLRAAVRHRPQDVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAVARLGRV&quot;
448                 + &quot;RWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDHQLLPEEPYITAQLDVLSAQVRAAVAQG&quot;
449                 + &quot;VGAVEPFAFLSEDASAAEQLACARTRAQAIAASVRPLAPTRVRSKGPLRVGFVSNGFGAHPTGLL&quot;
450                 + &quot;TVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHGIDLLFD&quot;
451                 + &quot;LRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVLRLQGAF&quot;
452                 + &quot;QPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLLSGPGEA&quot;
453                 + &quot;DARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGCPVLTTP&quot;
454                 + &quot;GETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRESI&quot;;
455
456 public static void main(String[] args) throws UnsupportedRuntimeException,
457                 LimitExceededException, JobSubmissionException,
458                 WrongParameterException, FileNotFoundException, IOException,
459                 ResultNotAvailableException, InterruptedException {
460
461         String qualifiedServiceName = &quot;http://msa.data.compbio/01/01/2010/&quot;;
462
463         /* Make a URL pointing to web service WSDL */
464         URL url = new URL(&quot;http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl&quot;);
465
466         /*
467          * If you are making a client that connects to different web services
468          * you can use something like this:
469          */
470         // URL url = new URL(host + &quot;/&quot; + Services.ClustalWS.toString() +
471         // &quot;?wsdl&quot;);
472
473         QName qname = new QName(qualifiedServiceName, &quot;ClustalWS&quot;);
474         Service serv = Service.create(url, qname);
475         /*
476          * Multiple sequence alignment interface for Clustal web service
477          * instance
478          */
479         MsaWS msaws = serv.getPort(new QName(qualifiedServiceName, &quot;ClustalWS&quot;
480                         + &quot;Port&quot;), MsaWS.class);
481
482         /* Get the list of available presets */
483         PresetManager presetman = msaws.getPresets();
484
485         /* Get the Preset object by preset name */
486         Preset preset = presetman
487                         .getPresetByName(&quot;Disable gap weighting (Speed-oriented)&quot;);
488
489         /*
490          * Load sequences in FASTA format from the file You can use something
491          * like new FileInputStream(&lt;filename&gt;) to load sequence from the file
492          */
493         List&lt;FastaSequence&gt; fastalist = SequenceUtil
494                         .readFasta(new ByteArrayInputStream(input.getBytes()));
495
496         /*
497          * Submit loaded sequences for an alignment using preset. The job
498          * identifier is returned by this method, you can retrieve the results
499          * with it sometime later.
500          */
501         String jobId = msaws.presetAlign(fastalist, preset);
502
503         /* This method will block for the duration of the calculation */
504         Alignment alignment = msaws.getResult(jobId);
505
506         /*
507          * This is a better way of obtaining results, it does not involve
508          * holding the connection open for the duration of the calculation,
509          * Besides, as the University of Dundee public server will reset the
510          * connection after 10 minutes of idling, this is the only way to obtain
511          * the results of long running task from our public server.
512          */
513         // while (msaws.getJobStatus(jobId) != JobStatus.FINISHED) {
514         // Thread.sleep(1000); // wait a second, then recheck the status
515         // }
516
517         /* Output the alignment to standard out */
518         System.out.println(alignment);
519
520         // Alternatively, you can record retrieved alignment into the file in
521         // ClustalW format
522
523         // ClustalAlignmentUtil.writeClustalAlignment(new FileOutputStream(
524         // &quot;output.al&quot;), alignment);
525
526 }
527 }
528 </code></pre>
529                                 <p>For a more detailed description of all available types and their functions please
530                                         refer to the <a href="dm_javadoc/index.html">Data Model JavaDoc</a>.
531                                 </p>
532                                 <p class="text-right">
533                                         <a href="#">Back to top <i class="fa fa-arrow-up" aria-hidden="true"></i></a>
534                                 </p>
535                         </div>
536                 </div>
537         </div>
538 </div>
539 <div class="row" id="buildart">
540         <div class="col-md-12">
541                 <div class="panel panel-default">
542                         <div class="panel panel-heading">
543                                 <h1 class="panel-title">Building web services artifacts</h1>
544                         </div>
545                         <div class="panel-body">
546                                 <p class="justify">
547                                         JABAWS are the standard <a href="http://jax-ws.java.net/">JAX-WS</a> SOAP web
548                                         services, which are <a href="http://www.ws-i.org/">WS-I</a>
549                                         basic profile compatible. This means that you could use whatever tool your
550                                         language has to work with web services. Below is how you can
551                                         generate portable artifacts to work with JABAWS from Java. However if
552                                         programming in Java, we recommend using our  client library as
553                                         it provides a handful of useful methods in addition to plain data types.
554                                 </p>
555                                 <pre><code class="bash">wsimport -keep http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl</code></pre>
556                         </div>
557                 </div>
558         </div>
559 </div>
560
561 <jsp:include page="template_footer.jsp" />