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