JWS-114 Commented out ‘cluster’ entries for consistency with other methods.
[jabaws.git] / website / v_2_1_0 / man_dev.html
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4
5 <head>
6 <meta name="Last-modified" content="Fri, 28 Jun 2013 12:00:00 GMT"/>
7 <title>Java Bioinformatics Analyses Web Services (JABAWS): Manual</title>
8 <link href="ws.css" rel="stylesheet" type="text/css" media="screen, projection, handheld, tv" />
9 <link href="print.css" rel="stylesheet" type="text/css" media="print" />
10 <link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz:700' rel='stylesheet' type='text/css' />
11 <script type="text/javascript" src="prototype-1.6.0.3.js"></script>
12 </head>
13
14 <body>
15 <div id="page">
16
17 <div id="banner">
18 <table>
19   <tr>
20     <td style="width:158px;"><a href="http://www.dundee.ac.uk"><img src="images/uod_lt_long.gif" width="158" height="90" alt="University of Dundee" class="logo" title="University of Dundee" longdesc="http://www.dundee.ac.uk"/></a></td>
21     <td class="bg"><img src="images/jabaws21.png" width="256" height="67" alt="JABAWS-2.1" title="Java Bioinformatics Analysis Web Services version 2.1"/></td>
22     <td class="bg"><img src="images/banner_right.png" alt="Disorder" width="200" height="80"/></td>
23   </tr>
24 </table>
25 </div>
26 <!-- banner end-->
27
28
29 <div id="wrapper">
30 <div id="panel">
31         <div id="supermenu">
32         <a class="newa" href="index.html">Home</a> 
33         <a class="newa" href="quick_start.html">Getting Started</a> 
34         <a class="newpressed" href="man_about.html">Manual</a> 
35         </div>
36         <div id="submenu">
37                 <a class="newa" href="man_about.html">About</a>
38                 <a class="newa" href="man_servervm.html" title="JABAWS Server as Virtual Appliance">Server VA</a>
39                 <a class="newa" href="man_awscloud.html" title="JABAWS Server in the Amazon EC2 Cloud">Server in the Cloud</a>
40                 <a class="newa" href="man_serverwar.html" title="JABAWS Server as Web Application aRchive">Server WAR</a>
41                 <a class="newa" href="man_configuration.html" >Configure JABAWS</a>
42                 <a class="newa" href="man_client.html" title="JABAWS Command Line Client">Command Client</a>
43                 <a class="newa" href="man_stats.html" title="JABAWS Usage Statistics">Usage Statistics</a>
44                 <a class="newpressed" href="man_dev.html" title="Accessing JABAWS from your program">Accessing JABAWS</a>
45                 <a class="newa" href="man_server_dev.html" >Develop JABAWS</a>
46         </div>
47 </div>
48 <!-- panel end-->
49
50
51 <div id="content">
52 <h2 id="headtitle">JABAWS MANUAL</h2>
53
54 <h2>Using JABAWS From Your Program </h2>
55 <ul>
56   <li><a href="#wsfunctions">Web services functions overview </a></li>
57   <li><a href="#templatestr">The template client structure</a></li>
58   <li><a href="#connectto">Connecting to JABAWS</a></li>
59   <li><a href="#validnames">Valid JABAWS service names and WSDL files</a></li>
60   <li><a href="#defalign">Aligning sequences</a></li>
61   <li><a href="#checkresults">Checking the status of the calculation </a></li>
62   <li><a href="#presetalign">Aligning with presets</a></li>
63   <li><a href="#customalign">Aligning with custom parameters</a></li>
64   <li><a href="#writingaltofile">Writing alignments to a file</a></li>
65   <li><a href="#compex">A complete client example </a></li>
66   <li><a href="#buildart">Building web services artifacts</a></li>
67 </ul>
68 <h3><a name="wsfunctions" id="wsfunctions"></a>Web services functions overview </h3>
69 <p>All JABA multiple sequence alignment web services comply to the same interface, thus the function described below are available from all the services. </p>
70 <p><strong>Functions for initiating the alignment </strong><span class="code">  String id = align(List&lt;FastaSequence&gt; list)<br />
71   String id = customAlign(List&lt;FastaSequence&gt; sequenceList, List&lt;Option&gt; optionList)<br />
72   String id = presetAlign(List&lt;FastaSequence&gt; sequenceList, Preset preset)</span></p>
73 <p><strong>Functions pertaining to job monitoring and control</strong><br />
74   <span class="code">JobStatus status = getJobStatus(String id)<br />
75   Alignment al = getResult(String id)<br />
76   boolean cancelled = cancelJob(String id)<br />
77   ChunkHolder chunk = pullExecStatistics(String id, long marker)</span></p>
78 <p><strong>Functions relating to service features discovery</strong><br />
79   <span class="code">RunnerConfig rc = getRunnerOptions()<br />
80   Limit limit = getLimit(String name)<br />
81   LimitsManager lm = getLimits()<br />
82   PresetManager pm = getPresets()</span></p>
83 <p>Please refer to a <a href="dm_javadoc/compbio/data/msa/MsaWS.html">data model  javadoc</a> for a detailed description of each methods. </p>
84 <h3><a name="templatestr" id="templatestr"></a>Structure of the template command line client</h3>
85 <table width="100%" border="1">
86   <tr>
87     <td style="width:19%"><strong>Packages</strong></td>
88     <td style="width:81%"><strong>Classes and Interfaces </strong></td>
89   </tr>
90   <tr>
91     <td>compbio.data.msa </td>
92     <td>MsaWS the interface for all multiple sequence alignment web services </td>
93   </tr>
94   <tr>
95     <td>compbio.data.sequence</td>
96     <td>JABAWS data types </td>
97   </tr>
98   <tr>
99     <td>compbio.metadata</td>
100     <td>JABAWS meta data types </td>
101   </tr>
102   <tr>
103     <td>compbio.ws.client</td>
104     <td>JABAWS command line client </td>
105   </tr>
106 </table>
107 <p>Additional utility libraries that this client depend upon is the compbio-util-1.3.jar and compbio-annotation-1.0.jar. <br />
108   Please refer to a <a href="dm_javadoc/index.html">data model javadoc</a> for a detailed description of each class and its methods. </p>
109
110
111 <h3><a name="connectto" id="connectto"></a>Connecting to JABAWS</h3>
112 <p class="attention">
113 For a complete working example of JABAWS command line client please see compbio.ws.client.Jws2Client class. JABAWS command line client 
114 source code is available from the <a href="http://www.compbio.dundee.ac.uk/download">download page</a>. Please note that for now all 
115 the examples are in Java other languages will follow given a sufficient demand. </p>
116
117 <p>
118 Download a binary JABAWS client. Add the client to the class path. The following code excerpt will connect your program to Clustal 
119 web service deployed in the University of Dundee. </p>
120 <p class="code"> import java.net.URL;<br />
121   import javax.xml.namespace.QName;<br />
122   import javax.xml.ws.Service;<br />
123   ...............<br />
124   1) String qualifiedName = &quot;http://msa.data.compbio/01/01/2010/&quot;;<br />
125   2) URL url = new URL(&quot;http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl&quot;);<br />
126   3) QName qname = new QName(, &quot;ClustalWS&quot;);<br />
127   4) Service serv = Service.create(url, qname);<br />
128   5) MsaWS msaws = serv.getPort(new QName(qualifiedName, &quot;ClustalWSPort&quot;),
129   MsaWS.class);
130 </p>
131 <p>
132         Line 1 makes a qualified name for JABA web services.<br />
133         Line 2 constructs the URL to the web services WSDL. <br />
134         Line 3 makes a qualified name instance for Clustal JABA web service. <br />
135         Line 4 creates a service instance.<br />
136         Line 5 makes a connection to the server.
137 </p>
138 <p>
139         A more generic connection method would look like this
140 </p>
141 <p class="code"> import java.net.URL;<br />
142   import javax.xml.namespace.QName;<br />
143   import javax.xml.ws.Service;<br />
144   import compbio.ws.client.Services<br />
145   .............. <br />
146   String qualifiedServiceName = &quot;http://msa.data.compbio/01/01/2010/&quot;;<br />
147   String host = &quot;http://www.compbio.dundee.ac.uk/jabaws&quot;;<br />
148   // In real life the service name can come from args<br />
149   Services clustal = Services.ClustalWS;<br />
150   URL url = new URL(host + &quot;/&quot; + clustal.toString() + &quot;?wsdl&quot;);<br />
151   QName qname = new QName(qualifiedServiceName, clustal.toString());<br />
152   Service serv = Service.create(url, qname);<br />
153   MsaWS msaws = serv.getPort(new QName(qualifiedServiceName, clustal<br />
154   + &quot;Port&quot;), MsaWS.class);
155 </p>
156 <p>
157         Where Services is enumeration of JABAWS web services. All JABAWS multiple sequence alignment methods confirm to 
158         MsaWS specification, thus from the caller point of view all JABAWS web services can be represented by MsaWS 
159         interface. The full documentation of MsaWS functions is available from the <a href="dm_javadoc/compbio/data/msa/MsaWS.html">javadoc</a>.
160 </p>
161
162
163 <h3><a name="validnames" id="validnames"></a>Valid JABAWS service names and WSDL files </h3>
164 <p>Multiple sequence alignment services </p>
165 <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>
166         <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>
167         <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>
168         <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>
169         <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>
170         <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>
171         <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>
172         <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>
173 </ul>
174 <p>Protein disorder prediction services </p>
175 <ul>
176         <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>
177         <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>
178         <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>
179         <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>
180 </ul>
181 <p>Amino acid conservation service</p>
182 <ul>
183         <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>
184 </ul>
185 <p>Protein and RNA Secondary Structure Prediction</p>
186 <ul>
187         <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>
188         <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>
189 </ul>
190 <p>
191 Please replace <span class="hightlight">http://www.compbio.dundee.ac.uk/</span> with your JABAWS instance host name, and 
192 <span class="hightlight">jabaws</span> with your JABAWS context name to access your local version of JABAWS web services. 
193 For example <span class="hightlight">http://localhost:8080/jabaws</span> would be a valid URL for the default Apache-Tomcat 
194 installation and jabaws.war file deployment. </p>
195
196
197 <h3><a name="defalign" id="defalign"></a>Aligning sequences </h3>
198 <p>
199 Given that <span class="hightlight">msaws</span> is web service proxy, created as described in &quot;Connecting to JABAWS&quot; 
200 section, the actual alignment can be obtained as follows: </p>
201 <p class="code">1) List&lt;FastaSequence&gt; fastalist = SequenceUtil.readFasta(new FileInputStream(file));<br />
202   2) String jobId = msaws.align(fastalist); <br />
203   3) Alignment alignment = msaws.getResult(jobId);</p>
204 <p>Line  one loads FASTA sequence from the file.<br />
205   Line two submits them to web service represented by msaws proxy. <br />
206   Line three retrieves the alignment from a web service. This line will block the execution until the result is available. 
207   Use this with caution. In general, you should make sure that the calculation has been completed before attempting 
208   retrieving results. This is to avoid keeping the connection to the server on hold for a prolonged periods of time. 
209   While this may be ok with your local server, our public server 
210   (<a href="http://www.compbio.dundee.ac.uk/jabaws">www.compbio.dundee.ac.uk/jabaws</a>) will not let you hold the connection 
211   for longer than 10 minutes. This is done to prevent excessive load on the server. The next section describes how to check 
212   the status of the calculation.<br />
213   Methods and classes mentioned in the excerpt are available from the JABAWS client library. </p>
214 <h3><a name="checkresults" id="checkresults"></a>Checking the status of the calculation </h3>
215 <p> You may have noticed that there was no pause between submitting the job and retrieving of the results. This is 
216 because <span class="hightlight">getResult(jobId)</span> method block the processing until the calculation is completed. 
217 However, taking into account that the connection holds server resources, our public server 
218 (<a href="http://www.compbio.dundee.ac.uk/jabaws">www.compbio.dundee.ac.uk/jabaws</a>) is configured to reset the 
219 connection after 10 minutes of waiting. To work around the connection reset you are encouraged to check whether the 
220 calculation has been completed before accessing the results.    You can do it like this: </p>
221 <p> <span class="code">while (msaws.getJobStatus(jobId) != JobStatus.FINISHED) {<br />
222   &nbsp;&nbsp;&nbsp;&nbsp;Thread.sleep(2000); // wait two  seconds, then recheck the status <br />
223   }</span></p>
224 <h3><a name="presetalign" id="presetalign"></a>Aligning with presets</h3>
225 <p class="code">1) PresetManager presetman = msaws.getPresets();<br />
226   2) Preset preset = presetman.getPresetByName(presetName);<br />
227   3) List&lt;FastaSequence&gt; fastalist = SequenceUtil.readFasta(new FileInputStream(file));<br />
228   4) String jobId = msaws.presetAlign(fastalist, preset);<br />
229   5) Alignment alignment = msaws.getResult(jobId);</p>
230 <p>Line one obtains the lists of presets supported by a web service.<br />
231   Line two return a particular Preset 
232   by its name.<br />
233   Lines three to five  are doing the same job as in the first <a href="#defalign"> aligning sequences example</a>.</p>
234 <h3><a name="customalign" id="customalign"></a>Aligning with  custom parameters</h3>
235 <p class="code"> 1) RunnerConfig options = msaws.getRunnerOptions();<br />
236   2) Argument matrix = options.getArgument(&quot;MATRIX&quot;);<br />
237   3) matrix.setValue(&quot;PAM300&quot;);<br />
238   4) Argument gapopenpenalty = options.getArgument(&quot;GAPOPEN&quot;);<br />
239   5) gapopenpenalty.setValue(&quot;20&quot;);<br />
240   6) List&lt;Argument&gt; arguments = new ArrayList&lt;Argument&gt;(); <br />
241   7) arguments.add(matrix);
242   arguments.add(gapopenpenalty);<br />
243   8) List&lt;FastaSequence&gt; fastalist = SequenceUtil.readFasta(new FileInputStream(file));<br />
244   9) String jobId = msaws.customAlign(fastalist, arguments);<br />
245   10) Alignment alignment = msaws.getResult(jobId);</p>
246 <p>Line one obtains the <span class="hightlight">RunnerConfig</span> object that holds information on supported parameters and their values<br />
247   Line two retrieve a particular parameter from the holder by its name.<br />
248   Lines three sets a value to this parameter which will be used in the calculation. <br />
249   Line four and five do the same but for another parameter.<br />
250   Line 6 makes a List to hold the parameters. <br />
251   Line seven puts the parameters into that list.<br />
252   Line eight 
253   and ten is the same as in previous examples.<br />
254   Line nine submit an alignment request with the sequences and the parameters. <br />
255   The names of all the parameters supported by a web service e.g. &quot;PAM300&quot; can be obtained 
256   using <span class="hightlight">options.getArguments() </span>method. Further details on the methods 
257   available from <span class="hightlight">RunnerConfig</span> object are available from the 
258   <a href="dm_javadoc/index.html">javadoc</a>. </p>
259 <h3><a name="writingaltofile" id="writingaltofile"></a>Writing alignments to a file</h3>
260 <p>There is a utility method in the client library that does exactly that. </p>
261 <p> <span class="code">Alignment alignment = align(...) <br />
262   FileOutputStream outStream = new FileOutputStream(file);<br />
263   ClustalAlignmentUtil.writeClustalAlignment(outStream, align);</span></p>
264 <h3><a name="compex" id="compex"></a>A complete client example </h3>
265 <p>
266 Finally, a complete example of the program that connects to JABAWS Clustal service and aligns sequences using 
267 one of the  Clustal web service presets. There is also a <a href="Example_template.pdf">PDF version</a> of 
268 this example with syntax highlighted. The text comments are commented by block style comments e.g. /* comment */, 
269 the alternatives given in the code are line commented // comment. You may want to remove line style comments to 
270 test alternatives of the functions. All you need for this to work is a 
271 <a href="http://www.compbio.dundee.ac.uk/download/get?id=min-jaba-client-2.0.jar">JABAWS binary client</a>. 
272 Please make sure that the client is in the Java class path before running this example.</p>
273 <pre class="code" style="line-height:1em;">
274 import java.io.ByteArrayInputStream;
275 import java.io.FileNotFoundException;
276 import java.io.IOException;
277 import java.net.URL;
278 import java.util.List;
279
280 import javax.xml.namespace.QName;
281 import javax.xml.ws.Service;
282
283 import compbio.data.msa.MsaWS;
284 import compbio.data.sequence.Alignment;
285 import compbio.data.sequence.FastaSequence;
286 import compbio.data.sequence.SequenceUtil;
287 import compbio.metadata.JobSubmissionException;
288 import compbio.metadata.LimitExceededException;
289 import compbio.metadata.Preset;
290 import compbio.metadata.PresetManager;
291 import compbio.metadata.ResultNotAvailableException;
292 import compbio.metadata.UnsupportedRuntimeException;
293 import compbio.metadata.WrongParameterException;
294
295 public class Example {
296
297         /*
298          * Input sequences for alignment
299          */
300         static final String input = &quot;&gt;Foo\r\n&quot;
301                         + &quot;MTADGPRELLQLRAAVRHRPQDFVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAVARLGR&quot;
302                         + &quot;VRWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDAGQAEAAAAAYTRAHQLLPEEPYITAQ&quot;
303                         + &quot;LLNWRRRLCDWRALDVLSAQVRAAVAQGVGAVEPFAFLSEDASAAEQLACARTRAQAIAASVRPL&quot;
304                         + &quot;APTRVRSKGPLRVGFVSNGFGAHPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQA&quot;
305                         + &quot;STLHDVTALGHLATAKHIRHHGIDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMD&quot;
306                         + &quot;YVLGDAFALPPALEPFYSEHVLRLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLN&quot;
307                         + &quot;PQSMARMLAVLREVPDSVLWLLSGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHAD&quot;
308                         + &quot;LFLDTHPYNAHTTASDALWTGCPVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALAS&quot;
309                         + &quot;DPAALTALHARVDVLRRESGVFEMDGFADDFGALLQALARRHGWLGI\r\n&quot;
310                         + &quot;\r\n&quot;
311                         + &quot;&gt;Bar\r\n&quot;
312                         + &quot;MGDTTAGEMAVQRGLALHQQRHAEAAVLLQQASDAAPEHPGIALWLHALEDAGQAEAAAAYTRAH&quot;
313                         + &quot;QLLPEEPYITAQLLNAVAQGVGAVEPFAFLSEDASAAESVRPLAPTRVRSKGPLRVGFVSNGFGA&quot;
314                         + &quot;HPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHG&quot;
315                         + &quot;IDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVL&quot;
316                         + &quot;RLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLL&quot;
317                         + &quot;SGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGC&quot;
318                         + &quot;PVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRESGV&quot;
319                         + &quot;FEMDGFADDFGALLQALARRHGWLGI\r\n&quot;
320                         + &quot;\r\n&quot;
321                         + &quot;&gt;Friends\r\n&quot;
322                         + &quot;MTADGPRELLQLRAAVRHRPQDVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAVARLGRV&quot;
323                         + &quot;RWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDHQLLPEEPYITAQLDVLSAQVRAAVAQG&quot;
324                         + &quot;VGAVEPFAFLSEDASAAEQLACARTRAQAIAASVRPLAPTRVRSKGPLRVGFVSNGFGAHPTGLL&quot;
325                         + &quot;TVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHGIDLLFD&quot;
326                         + &quot;LRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVLRLQGAF&quot;
327                         + &quot;QPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLLSGPGEA&quot;
328                         + &quot;DARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGCPVLTTP&quot;
329                         + &quot;GETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRESI&quot;;
330
331         public static void main(String[] args) throws UnsupportedRuntimeException,
332                         LimitExceededException, JobSubmissionException,
333                         WrongParameterException, FileNotFoundException, IOException,
334                         ResultNotAvailableException, InterruptedException {
335
336                 String qualifiedServiceName = &quot;http://msa.data.compbio/01/01/2010/&quot;;
337
338                 /* Make a URL pointing to web service WSDL */
339                 URL url = new URL(&quot;http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl&quot;);
340
341                 /*
342                  * If you are making a client that connects to different web services
343                  * you can use something like this:
344                  */
345                 // URL url = new URL(host + &quot;/&quot; + Services.ClustalWS.toString() +
346                 // &quot;?wsdl&quot;);
347
348                 QName qname = new QName(qualifiedServiceName, &quot;ClustalWS&quot;);
349                 Service serv = Service.create(url, qname);
350                 /*
351                  * Multiple sequence alignment interface for Clustal web service
352                  * instance
353                  */
354                 MsaWS msaws = serv.getPort(new QName(qualifiedServiceName, &quot;ClustalWS&quot;
355                                 + &quot;Port&quot;), MsaWS.class);
356
357                 /* Get the list of available presets */
358                 PresetManager presetman = msaws.getPresets();
359
360                 /* Get the Preset object by preset name */
361                 Preset preset = presetman
362                                 .getPresetByName(&quot;Disable gap weighting (Speed-oriented)&quot;);
363
364                 /*
365                  * Load sequences in FASTA format from the file You can use something
366                  * like new FileInputStream(&lt;filename&gt;) to load sequence from the file
367                  */
368                 List&lt;FastaSequence&gt; fastalist = SequenceUtil
369                                 .readFasta(new ByteArrayInputStream(input.getBytes()));
370
371                 /*
372                  * Submit loaded sequences for an alignment using preset. The job
373                  * identifier is returned by this method, you can retrieve the results
374                  * with it sometime later.
375                  */
376                 String jobId = msaws.presetAlign(fastalist, preset);
377
378                 /* This method will block for the duration of the calculation */
379                 Alignment alignment = msaws.getResult(jobId);
380
381                 /*
382                  * This is a better way of obtaining results, it does not involve
383                  * holding the connection open for the duration of the calculation,
384                  * Besides, as the University of Dundee public server will reset the
385                  * connection after 10 minutes of idling, this is the only way to obtain
386                  * the results of long running task from our public server.
387                  */
388                 // while (msaws.getJobStatus(jobId) != JobStatus.FINISHED) {
389                 // Thread.sleep(1000); // wait a second, then recheck the status
390                 // }
391
392                 /* Output the alignment to standard out */
393                 System.out.println(alignment);
394
395                 // Alternatively, you can record retrieved alignment into the file in
396                 // ClustalW format
397
398                 // ClustalAlignmentUtil.writeClustalAlignment(new FileOutputStream(
399                 // &quot;output.al&quot;), alignment);
400
401         }
402 }
403 </pre>
404 For a more detailed description of all available types and their functions please refer to the <a href="dm_javadoc/index.html">data model javadoc</a>.
405 <h3><a name="buildart" id="buildart"></a>Building web services artifacts</h3>
406 <p>
407 JABAWS are the standard <a href="http://jax-ws.java.net/">JAX-WS</a> SOAP web services, which are <a href="http://www.ws-i.org/">WS-I</a> 
408 basic profile compatible. This means that you could use whatever tool your language has to work with web services. Below is how you can 
409 generate portable artifacts to work with JABAWS from Java. However if programming in Java, we recommend using our  client library as 
410 it provides a handful of useful methods in addition to plain data types. </p>
411 <p class="code">wsimport -keep http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl</p>
412 </div><!-- content end-->
413 <div id="copyright">Last update: 30 April 2014<br/>Sasha Sherstnev, Peter Troshin, Jim Procter and Geoff Barton, The Barton Group, University of Dundee, UK</div>
414 </div><!-- wrapper end-->
415 </div><!-- page end-->
416
417
418 <!-- Google analitics -->
419 <script type="text/javascript">
420 var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
421 document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
422 </script>
423 <script type="text/javascript">
424 try{
425 var pageTracker = _gat._getTracker("UA-5356328-1");
426 pageTracker._trackPageview();
427 } catch(err) {}
428 </script>
429 </body>
430 </html>