Style issues are resolved - the copy from JABA production release
[jabaws.git] / website / manual.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\r
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
3 <html xmlns="http://www.w3.org/1999/xhtml">\r
4 <head>\r
5 <meta name="generator" content="HTML Tidy, see www.w3.org" />\r
6 <meta http-equiv="Content-Type" content=\r
7 "text/html; charset=iso-8859-1" />\r
8 <meta name="Last-modified" content="Mon, 11 Oct 2010 01:03:33 GMT"/>\r
9 <title>Java Bioinformatics Analyses Web Services (JABAWS)\r
10 manual</title>\r
11 <link href="ws.css" rel="stylesheet" type="text/css" media=\r
12 "screen, projection, handheld, tv" />\r
13 <link rel="stylesheet" type="text/css" media="print" href=\r
14 "print.css" />\r
15 <script type="text/javascript" src="prototype-1.6.0.3.js">\r
16         \r
17 </script>\r
18 </head>\r
19 <body>\r
20 <div id="page">\r
21 <div id="banner">\r
22 <table> \r
23 <tr><td style="width:130px;"><a href="http://www.dundee.ac.uk"><img class="logo" src="images/uod_lt.gif"  alt="University of Dundee"  title="University of Dundee" longdesc="http://www.dundee.ac.uk"/></a></td>\r
24 <td class="bg"><h2><span class="headeru">JA</span>va <span class=\r
25 "headeru">B</span>ioinformatics <span class="headeru">A</span>nalysis <span class="headeru">W</span>eb <span\r
26 class="headeru">S</span>ervices</h2></td>\r
27 </tr>\r
28 </table></div><!-- banner end-->\r
29 \r
30 <div id="wrapper">\r
31 <div id="panel"><a href="index.html">Home</a> <a class="selected"\r
32 href="manual.html">Manual</a> <a href="howto.html">How To</a> \r
33 <a href="dm_javadoc/index.html" title="Data model javadoc">Javadoc</a>\r
34 <a href="download.html">Download</a> \r
35 <a href="http://www.compbio.dundee.ac.uk">Barton Group</a> \r
36 </div>\r
37 \r
38 <!-- panel end-->\r
39 <div id="content">\r
40 <h2 id="headtitle">JABAWS Manual</h2>\r
41 \r
42 <h3>Table of content</h3>\r
43 <h4>JABAWS Virtual Appliance \r
44 </h4>\r
45 <ul>\r
46     <li><a href="#whenvm">When to use virtual appliance</a> </li>\r
47     <li><a href="#howtoinstallvm">How to install VMWare Player or VirtualBox</a> </li>\r
48         <li><a href="#virtualbox">VirtualBox appliance configuration</a></li>\r
49         <li><a href="#vmplayer">VMware Player appliance configuration </a></li>\r
50         <li><a href="#jabawsAppliance">JABAWS Appliance details </a></li>\r
51     <li><a href="#jalviewWithJaba">Configuring Jalview to work with your JABAWS VM</a> </li>\r
52 </ul>\r
53 \r
54 <h4>JABAWS Installation</h4>\r
55 <ul>\r
56   <li><a href="#sysreq">System Requirements</a></li>\r
57   <li><a href="#instwar">Installing the JABAWS WAR file</a></li>\r
58   <li><a href="#prepexec">Preparing executables for use with JABAWS</a></li>\r
59   <li><a href="#useprebin">Using the pre-compiled i386 binaries on Linux</a></li>\r
60   <li><a href="#recompbinaries">Recompiling the bundled\r
61     programs for your system</a></li>\r
62   <li><a href="#haveexec">Reuse the binaries that are\r
63     already in your system</a></li>\r
64   <li><a href="#obtainexec">Obtaining alignment\r
65     programs for your operation system from elsewhere</a></li>\r
66 </ul>\r
67 <h4>Configuring JABAWS</h4>\r
68 <ul>\r
69   <li><a href="#defjabaconf">Default JABA Web Services Configuration</a></li>\r
70   <li><a href="#locEngConf">Local Engine Configuration</a></li>\r
71   <li><a href="#clustEngConf">Cluster Engine Configuration</a></li>\r
72   <li><a href="#setexecenv">Defining Environment Variables for\r
73     Executables</a></li>\r
74 </ul>\r
75 <h4>Using JABAWS in your program </h4>\r
76 <ul>\r
77   <li><a href="#wsfunctions">Web services functions overview </a></li>\r
78   <li><a href="#templatestr">The template client structure</a></li>\r
79   <li><a href="#connectto">Connecting to JABAWS</a></li>\r
80   <li><a href="#validnames">Valid JABAWS service names and WSDL files</a></li>\r
81   <li><a href="#defalign">Aligning sequences</a></li>\r
82   <li><a href="#checkresults">Checking the status of the calculation </a></li>\r
83   <li><a href="#presetalign">Aligning with presets</a></li>\r
84   <li><a href="#customalign">Aligning with custom parameters</a></li>\r
85   <li><a href="#writingaltofile">Writing alignments to a file</a></li>\r
86   <li><a href="#compex">A complete client example </a></li>\r
87   <li><a href="#buildart">Building web services artifacts</a></li>\r
88 </ul>\r
89 <h4>JABA Web Services Internals </h4>\r
90 <ul>\r
91   <li><a href="#testingJaba">Testing JABA Web Services</a></li>\r
92   <li><a href="#logfiles">JABAWS Log Files</a></li>\r
93   <li><a href="#warfile">JABAWS War File Content</a></li>\r
94 </ul>\r
95 <h3>JABAWS Virtual Appliance </h3>\r
96 <h4><a name="whenvm" id="whenvm"/></a>When to use the virtual  appliance </h4>\r
97 <p>The appliance best suits users who would like to use the JABA web services locally, without an Internet connection, or want to keep their data private \r
98 and uses Windows as their main OS. The appliance is a self contained unit of software and as such may be an attractive option for Linux, UNIX or Mac users but they can always deploy a <a href="#instwar">war distribution</a> instead.  <br />\r
99 The appliance comes pre configured to use 1 CPU and 512M of  memory and the minimum amount of memory required is about 378M.    </p>\r
100 \r
101 <h4><a name="howtoinstallvm" id="howtoinstallvm"></a>How to install VMWare Player or VirtualBox</h4>\r
102 <p>Please see the <a href="http://downloads.vmware.com/d/info/desktop_downloads/vmware_player/3_0">VMware Player</a>  \r
103 and <a href="http://www.virtualbox.org/wiki/Downloads">Oracle VirtualBox</a> websites for up to date instructions and downloads.</p>\r
104 \r
105 <h4><a name="virtualbox" id="virtualbox"/>VirtualBox appliance configuration</h4>\r
106 <p>VirtualBox can be used to run JABAWS services from Windows, Linux, Solaris or Mac host operating systems. Use the VitualBox &quot;Import  Appliance&quot; option to import the JABAWS. Please bear in mind that to benefit from multiple CPU support under the VirtualBox software you need to enable<a href="http://en.wikipedia.org/wiki/X86_virtualization"> hardware virtualization extensions</a>, such as  Intel Virtualization VT-x or AMD-V support in the BIOS of your computer. Unfortunately, we were unable to find a reliable way to do it on Mac, so some Macs running VirtualBox will be limited to one CPU only, irrespective of the number of CPUs of the host machine. </p>\r
107 <p>We found that, by default, virtualization extensions are enabled in VirtualBox irrespective of whether your computer supports them. You will get the <a href="howto.html#vmbexc"></a><a href="howto.html#vmbexc">VERR_VMX_MSR_LOCKED_OR_DISABLED</a> exception if your computer does not support the extensions or their support is disabled. Just deselect the checkboxes shown on the screen shot below to solve the problem. </p>\r
108 <p>VirtualBox JABAWS VM configuration screen shot displaying virtualization settings.</p>\r
109 <p><img src="images/vmb_virtual.png" alt="VT-x extension on VirtualBox" width="669" height="535" /></p>\r
110 \r
111 <h4><a name="vmplayer" id="vmplayer"/>VMware Player appliance configuration </h4>\r
112 <p>The free <a href="http://downloads.vmware.com/d/info/desktop_downloads/vmware_player/3_0">VMware Player</a> can be used to run the JABAWS services from the Windows and Linux host operating systems, there is no support for Mac at the time of writing (December 2010). \r
113 However, <a href="https://www.vmware.com/vmwarestore/buyfusion.html">VMware Fusion</a>, a commercial VMware product, offers virtual machine support for Mac computers too. </p>\r
114 <p>To run the JABAWS server on VMware player,  unpack the JABAWS VM into one of the folders on your local hard drive. Open VMware Player, click &quot;Open Virtual Machine&quot; and point the Player to the location of the JABAWS, then choose the JABAWS.vmx file to open an appliance. </p>\r
115 <p>When you play the machine for the first time the Player might ask you whether &quot;This virtual machine may have been moved or copied.&quot;,  say that you have copied it. That is all. </p>\r
116 \r
117 <h4><a name="jabawsAppliance" id="jabawsAppliance"/>JABAWS Appliance details</h4>\r
118 <p>By default, the JABAWS virtual appliance is configured with 512M of memory and 1 CPU, but you are free to change these settings. If you have more than one CPU or CPU core on your computer you can make them available for the JABAWS virtual machine by editing virtual machine settings. Please bear in mind that more CPU power will not make a single calculation go faster, but it will enable the VM to do calculations in parallel. Similarly, you can add more memory to the virtual machine. More memory lets your VM deal with larger tasks, e.g. work with large alignments.</p>\r
119 <p>The VMware Player screen shot below displays JABAWS VM CPU settings. </p>\r
120 <p><img src="images/VMware_cpu.png" alt="vmware cpu settings" width="852" height="267" border="1" /></p>\r
121 \r
122 <p><strong>JABAWS appliance configuration: </strong></p>\r
123 <p><strong>VMware info</strong><br />\r
124   - Date of creation: 8 October 2010<br />\r
125   - CPUs : 1<br />\r
126   - RAM : 512 MB<br />\r
127   - Networking : Host only (the VM has no access to the outside network, nothing from the outside network can access the VM)<br />\r
128   - Hard disk : 20 GB  (expanding)<br />\r
129   - VMware tools : Installed</p>\r
130 <p><strong>OS info</strong><br />\r
131   - OS : TurnKey Linux, based on Ubuntu 8.0.4 JEOS (Just-Enough-Operation-System)<br />\r
132   - Installation : Oracle Java 6, Tomcat 6, JABAWS v. 1.0 <br />\r
133   - Hostname : tomcat <br />\r
134   - Patches : till date of creation<br />\r
135   - IPv4 address : dhcp<br />\r
136   - IPv6 address : auto<br />\r
137   - DNS name : none<br />\r
138   - Name server : dhcp<br />\r
139   - Route : dhcp<br />\r
140   - Keyboard : US_intl</p>\r
141 <p><strong>Login credentials</strong><br />\r
142   - Root password: jabaws</p>\r
143 <p>  <strong>Services</strong></p>\r
144 <ul>\r
145   <li>Default virtual console Alt+F7 </li>\r
146   <li>Tomcat web server. <br />\r
147     <em>Access:</em> http://VM_IP</li>\r
148   <li>JABAWS URL: http://VM_IP/jabaws</li>\r
149   <li>Web Shell<br />\r
150     <em>Access:</em> https://VM_IP:12320/</li>\r
151   <li>Webmean<br />\r
152     <em>Access:</em> https://VM_IP:12321/</li>\r
153   <li>SSH/SFTP<br />\r
154     <em>Access:</em> root@VM_IP</li>\r
155   </ul>\r
156 <p>Where VM_IP is the VM IP address. Under VMware Player host only networking, the first VM may have 192.168.227.128 IP address. Under VirtualBox host only networking, first VM may have 192.168.56.101 IP address.</p>\r
157 <h4><a name="jalviewWithJaba" id="jalviewWithJaba"/>Configuring Jalview to work with your JABAWS VM</a> </h4>\r
158 <p>After booting the JABAWS VM, you should see similar screen, however, the IP address of your VM may be different. To enable Jalview to work with your JABAWS appliance you need to go to Jalview-&gt;Tools-&gt;Preferences-&gt;Web Services -&gt; New Service URL, and add JABAWS URL into the box provided. For more information please refer to Jalview <a href="http://www.jalview.org/help/html/webServices/JABAWS.html">help pages</a>. </p>\r
159 <p><img src="images/vm_welcome_screen.png" alt="JABAWS welcome screen" width="734" height="461" /></p>\r
160 <p>If you click on Advanced Menu, you will see the configuration console, similar to the one below.   </p>\r
161 <p><img src="images/VMware_booted.png" alt="JABAWS welcome screen" width="735" height="461" /></p>\r
162 <p>If you need to configure a static IP address the configuration console will help you with this. Shutting down the VM is best from the configuration console as well.</p>\r
163 \r
164 \r
165 <h3>JABAWS Installation</h3>\r
166 <h4><a name="sysreq" id="sysreq"></a>System Requirements</h4>\r
167 \r
168 <p>JABAWS requires a Java web application server compliant with\r
169 version 2.4 of the Java Servlet specification, and a Java 6 runtime\r
170 environment. We recommend using an official Oracle Java 6 runtime\r
171 environment, and <a\r
172 href="http://tomcat.apache.org/download-60.cgi">Apache-Tomcat</a> web application server version 6, but other versions may work as well.</p>\r
173 \r
174 <!-- todo: link to help about obtaining and installing tomcat -->\r
175 <h4><a name="instwar" id="instwar"></a>Installing the JABAWS WAR file</h4>\r
176 \r
177 <p>JABAWS is distributed as a web application archive (WAR). To\r
178 deploy JABAWS in Apache-Tomcat - simply drop the war file into the\r
179 <span class="highlight">webapps</span> directory of a running\r
180 Tomcat, and it will do the rest. For any other web application\r
181 server, please follow your server's specific deployment procedure\r
182 for 'WAR' files. If you are installing on a windows machine, then\r
183 at this point your JABAWS installation will already be up and\r
184 running, and you can try its services out using the <a href=\r
185 "howto.html#usingWsTester">JABAWS test client</a>, but\r
186 installations on other operating systems will require a final step\r
187 to ensure JABAWS can locate and execute the binary programs it\r
188 needs.</p>\r
189 \r
190 <h4><a name="prepexec" id="prepexec"></a>Preparing executables for use with JABAWS</h4>\r
191 \r
192 <p>JABAWS's web services use command line programs to do\r
193 the actual analysis, so it must have access to programs\r
194 which can be executed on your platform. The native executables\r
195 bundled with JABAWS for Windows (32-bit) and Linux (i386) should be\r
196 OK for those systems. However, the source code for these \r
197 programs is also provided so you can recompile for your own\r
198 architecture and exploit any optimizations that your system can\r
199 provide. Alternately, if you have already got binaries on your\r
200 system, then you can simply change the paths in JABAWS's\r
201 configuration files so these are used instead.</p>\r
202 \r
203 <h4><a name="useprebin" id="useprebin"></a>Using the pre-compiled i386 binaries on Linux</h4>\r
204 \r
205 <p>Before the binaries that are bundled with JABAWS can be used,\r
206 they must first be made executable using the provided <a name=\r
207 "setexecflag" id="setexecflag">'setexecflag.sh'</a> script:</p>\r
208 \r
209 <ol>\r
210 <li>cd to <span class=\r
211 "hightlight">&lt;webapplicationpath&gt;/binaries/src</span></li>\r
212 \r
213 <li>run <span class="hightlight">sh setexecflag.sh</span></li>\r
214 \r
215 <li>Make sure binaries supplied work under your OS.<br />\r
216  For this run each binary, without any command line options or\r
217 input files. If you see an error message complaining about missing\r
218 libraries or other problems, then you probably need to <a href=\r
219 "#recompbinaries">recompile the binaries</a>. with</li>\r
220 \r
221 <li>Restart the Tomcat.</li>\r
222 </ol>\r
223 \r
224 That's it! JABAWS should work at this point. Try it out using the JABAWS<a\r
225 href="howto.html#usingWsTester"> test client</a>. If not,\r
226 read on... or have a look at <a href=\r
227 "howto.html#usingtomcat">deploying on Tomcat</a> tips.<br />\r
228  <em>Note: You may want to enable logging, <a href="#logfiles">see\r
229 below for instructions on how to do that</a>.</em><br />\r
230  \r
231 \r
232 <h4><a name="recompbinaries">Recompiling the bundled\r
233 programs for your system</a></h4>\r
234 \r
235 <p>If you have a fully equipped build environment on your\r
236 (POSIX-like) system, then you should be able to recompile the\r
237 programs from the source distributions which are included\r
238 in the JABAWS war file. A script called 'compilebin.sh' is provided\r
239 to automate this task.</p>\r
240 \r
241 <ol>\r
242 <li>In a terminal window, change the working directory to <span\r
243 class="hightlight">binaries/src</span></li>\r
244 \r
245 <li>execute the <span class="highlight">compilebin.sh</span>\r
246 script,<br />\r
247  either use: <span class="hightlight">chmod +x compilebin.sh;\r
248 compilebin.sh &gt; compilebin.out;</span><br />\r
249  or: <span class="hightlight">sh compilebin.sh &gt;\r
250 compilebin.out</span></li>\r
251 \r
252 <li>Now run <span class="hightlight">sh setexecflag.sh</span><br />\r
253  If any of the binaries was not recompiled, then a 'file not found'\r
254 error will be raised.</li>\r
255 \r
256 <li>Finally, restart your tomcat (or servlet container), and use\r
257 the <a href="howto.html#usingWsTester">JABAWS test client</a> to\r
258 check that JABAWS can use the new binaries.</li>\r
259 </ol>\r
260 \r
261 <p>If you couldn't compile everything, then it may be that your system does\r
262 not have all the tools required for compiling the programs. At the very\r
263 least check that you have gcc, g++ and make installed in your\r
264 system. If not install these packages and repeat the compilation\r
265 steps again. You should also review the compilebin.sh output -\r
266 which was redirected to compilebin.out, and any errors output to\r
267 the terminal. Finally, try obtaining the <a href="#obtainexec">pre\r
268 compiled binaries</a> for your OS.</p>\r
269 \r
270 <h4><a name="haveexec" id="haveexec">Reuse the binaries that are\r
271 already in your system</a></h4>\r
272 \r
273 <p>If you would like to use the binaries you already have then you\r
274 just need to let JABAWS know there they are. To do this, edit:\r
275 <span class="code">conf/Executable.properties</span>\r
276 <p>When specifying paths to executables that already exist on your system, make sure you provide an absolute path, or one relative to the JABAWS directory inside <span class="highlight">webapps</span>. For example, the default path for clustalw is defined\r
277 as<span class=\r
278 "code">local.clustalw.bin=binaries/src/clustalw/src/clustalw2</span>\r
279 Alternatively, instead of changing <span class=\r
280 "hightlight">Executable.properties</span> you could also replace\r
281 the executables bundled with JABAWS with the ones that you have, or make symlinks to them.\r
282 Then the default configuration will work for you. More information\r
283 about <a href="#exec"><span class="hightlight">the\r
284 Executable.properties</span> file is given below</a>.</p>\r
285 \r
286 <h4><a name="obtainexec" id="obtainexec">Obtaining alignment\r
287 programs for your operation system from elsewhere</a></h4>\r
288 \r
289 <p>You could search for pre-packaged compiled executable in your\r
290 system package repository or alternately, download pre-compiled\r
291 binaries from each alignment program's home page. Then, either\r
292 replace the executables supplied with the downloaded ones, or\r
293 modify the paths in <span class=\r
294 "hightlight">executable.properties</span> as described above.</p>\r
295 \r
296 <h3>Configuring JABAWS</h3>\r
297 <p>There are three parts of the system you can configure. The local\r
298 and cluster engines, and the paths to individual executables for\r
299 each engine. These settings are stored in configuration files\r
300 within the web application directory (for an overview, then take a\r
301 look at the <a href="#warfile">war file content table</a>).</p>\r
302 \r
303 <h4><a name="defjabaconf" id="defjabaconf"></a>Default JABA Web Services Configuration</h4>\r
304 \r
305 <p>Initially, JABAWS is configured with only the local engine\r
306 enabled, with job output written to directory called "jobsout"\r
307 within the web application itself. This means that JABAWS will work\r
308 out of the box, but may not be suitable for serving a whole lab or\r
309 a university.</p>\r
310 \r
311 <h4><a name="locEngConf" id="locEngConf"></a>Local Engine Configuration</h4>\r
312 \r
313 <p>The Local execution engine configuration is defined in the\r
314 properties file conf/Engine.local.properties. The supported\r
315 configuration settings are:<br />\r
316  <span class="hightlight">engine.local.enable=true</span> - #\r
317 enable or disable local engine, valid values true | false<br />\r
318  <span class=\r
319 "hightlight">local.tmp.directory=D:\\clusterengine\\testoutput</span>\r
320 - a directory to use for temporary files storage, optional,\r
321 defaults to java temporary directory<br />\r
322  <span class="hightlight">engine.local.thread.number=4</span> -\r
323 Number of threads for tasks execution (valid values between 1 and\r
324 2x cpu. Where x is a number of cores available in the system).\r
325 Optional defaults to the number of cores for core number &lt;=4 and\r
326 number of cores-1 for greater core numbers.</p>\r
327 \r
328 <p>If you are planning to heavily use the local engine (which you\r
329 have to if you do not have a cluster) it is a good idea to increase\r
330 the amount of memory available for the web application server. If\r
331 you are using Apache-Tomcat, then you can define its memory\r
332 settings in the JAVA_OPTS environment variable. To specify which\r
333 JVM to use for Apache-Tomcat, put the full path to the JRE\r
334 installation in the JAVA_HOME environment variable (We would\r
335 recommend using Sun Java Virtual Machine (JVM) in preference to\r
336 Open JDK). Below is an example of code which can be added to <span\r
337 class="hightlight">&lt;tomcat_dir&gt;/bin/setenv.sh</span> script\r
338 to define which JVM to use and a memory settings for Tomcat server.\r
339 Tomcat server startup script (<span class=\r
340 "hightlight">catalina.sh</span>) will execute <span class=\r
341 "hightlight">setenv.sh</span> on each server start\r
342 automatically.<br />\r
343  <span class="code">export\r
344 JAVA_HOME=/homes/ws-dev2/jdk1.6.0_17/<br />\r
345  export JAVA_OPTS="-server -Xincgc -Xms512m -Xmx1024m"</span></p>\r
346 \r
347 <h4><a name="clustEngConf" id="clustEngConf"></a>Cluster Engine Configuration</h4>\r
348 \r
349 <p>Supported configuration settings:<br />\r
350  <span class="hightlight">engine.cluster.enable=true</span> - #\r
351 enable or disable local engine true | false, defaults to\r
352 false<br />\r
353  <span class=\r
354 "hightlight">cluster.tmp.directory=/homes/clustengine/testoutput-</span>\r
355 a directory to use for temporary files storage. The value must be\r
356 an absolute path to the temporary directory. Required. The value\r
357 must be different from what is defined for local engine. This\r
358 directory must be accessible from all cluster nodes.<br />\r
359  For the cluster engine to work, the SGE_ROOT and LD_LIBRARY_PATH\r
360 environment variables have to be defined. They tell the cluster\r
361 engine where to find DRMAA libraries. These variables\r
362 should be defined when the web application server starts up, e.g.</p>\r
363 \r
364 <p><span class="code">SGE_ROOT=/gridware/sge<br />\r
365  LD_LIBRARY_PATH=/gridware/sge/lib/lx24-amd64</span></p>\r
366 \r
367 <p>Finally, do not forget to configure executables for the cluster\r
368 execution, they may be the same as for the local execution but may\r
369 be different. Please refer to the executable configuration section\r
370 for further details.</p>\r
371 \r
372 <h4><a name="exec" id="exec"></a>Executable Configuration</h4>\r
373 \r
374 <p>All the executable programs\r
375 are configured in conf/Executable.properties file. Each executable\r
376 is configured with a number of options. They are: <span class=\r
377 "code">local.X.bin.windows=&lt;path to executable under windows\r
378 system, optional&gt;<br />\r
379  local.X.bin=&lt;path to the executable under non-windows system,\r
380 optional&gt;<br />\r
381  cluster.X.bin=&lt;path to the executable on the cluster, all\r
382 cluster nodes must see it, optional&gt;<br />\r
383  X.bin.env=&lt;semicolon separated list of environment variables\r
384 for executable, use hash symbol as name value separator,\r
385 optional&gt;<br />\r
386  X.--aamatrix.path=&lt;path to the directory containing\r
387 substitution matrices, optional&gt;<br />\r
388  X.presets.file=&lt;path to the preset configuration file, optional\r
389 &gt;<br />\r
390  X.parameters.file=&lt;path to the parameters configuration file,\r
391 optional&gt;<br />\r
392  X.limits.file=&lt;path to the limits configuration file,\r
393 optional&gt;<br />\r
394  X.cluster.settings=&lt;list of the cluster specific options,\r
395 optional&gt;</span></p>\r
396 \r
397 <p>Where X is a short executable wrapper class name.</p>\r
398 \r
399 <p>Default JABAWS configuration includes path to local executables\r
400 to be run by the local engine only, all cluster related settings\r
401 are commented out, but they are there for you as example. Cluster\r
402 engine is disabled by default. To configure executable for cluster\r
403 execution un comment the X.cluster settings and change them\r
404 appropriately. </p>\r
405 <p>By default limits are set well in excess of what you may want to offer to the users outside your lab, to make sure that the tasks are never rejected. The default limit is 100000 sequences of 100000 letters on average for all of the JABA web services.  You can adjust the limits according to your needs by editing <span class="hightlight">conf/settings/&lt;X&gt;Limit.xml</span> files.<br />\r
406   After you have completed the editing your configuration may look like\r
407   this:<span class="code">local.mafft.bin.windows=<br />\r
408     local.mafft.bin=binaries/mafft<br />\r
409     cluster.mafft.bin=/homes/cengine/mafft<br />\r
410     mafft.bin.env=MAFFT_BINARIES#/homes/cengine/mafft;FASTA_4_MAFFT#/bin/fasta34;<br />\r
411     mafft.--aamatrix.path=binaries/matrices<br />\r
412     mafft.presets.file=conf/settings/MafftPresets.xml<br />\r
413     mafft.parameters.file=conf/settings/MafftParameters.xml<br />\r
414     mafft.limits.file=conf/settings/MafftLimits.xml<br />\r
415     mafft.cluster.settings=-q bigmem.q -l h_cpu=24:00:00 -l\r
416     h_vmem=6000M -l ram=6000M</span></p>\r
417 <p>Please not that relative paths must only be specified for the\r
418 files that reside inside web application directory, all other paths\r
419 must be supplied as absolute!</p>\r
420 \r
421 <p>Furthermore, you should avoid using environment variables within the paths or options - since these will not be evaluated correctly.  Instead, please explicitly\r
422 specify the absolute path to anything\r
423 normally evaluated from an environment variable at execution time.</p>\r
424 \r
425 <p>If you are using JABAWS to submit jobs to the cluster (with\r
426 cluster engine enabled), executables must be available from all\r
427 cluster nodes the task can be sent to, also paths to the\r
428 executables on the cluster e.g. <span class=\r
429 "hightlight">cluster.&lt;exec_name&gt;.bin</span> must be\r
430 absolute.</p>\r
431 \r
432 <p>Executables can be located anywhere in your system, they do not\r
433 have to reside on the server as long as the web application server\r
434 can access and execute them.</p>\r
435 \r
436 <p>Cluster settings are treated as a black box, the system will\r
437 just pass whatever is specified in this line directly to the\r
438 cluster submission library. This is how DRMAA itself treats this\r
439 settings. More exactly DRMAA JobTemplate.setNativeSpecification()\r
440 function will be called.</p>\r
441 \r
442 <h4><a name="setexecenv" />Defining Environment Variables for\r
443 Executables</h4>\r
444 \r
445 <p>Environment variables can be defined in property <span class=\r
446 "code">x.bin.env</span> Where <span class="hightlight">x</span> is\r
447 one of five executables supported by JABAWS. Several environment\r
448 variables can be specified in the same line. For example.<br />\r
449  <span class=\r
450 "code">mafft.bin.env=MAFFT_BINARIES#/homes/cengine/mafft;FASTA_4_MAFFT#/bin/fasta34;</span></p>\r
451 \r
452 <p>The example above defines two environment variables with names\r
453 MAFFT-BINARIES and FASTA_4_MAFFT and values /homes/cengine/mafft\r
454 and /bin/fasta34 respectively. Semicolon is used as a separator\r
455 between different environment variables whereas hash is used as a\r
456 separator for name and value of the variable.</p>\r
457 \r
458 <h4><a name="mafftconf" id="mafftconf"></a>Configure JABAWS to Work\r
459 with Mafft</h4>\r
460 \r
461 <p>If you use default configuration you do not need to read any\r
462 further. The default configuration will work for you without any\r
463 changes, however, if you want to install Mafft yourself then there\r
464 is a couple of more steps to do.</p>\r
465 \r
466 <p>Mafft executable needs to know the location of other files\r
467 supplied with Mafft. In addition some Mafft functions depends on\r
468 the fasta executable, which is not supplied with Mafft, but is a\r
469 separate package. Mafft needs to know the location of fasta34\r
470 executable.</p>\r
471 \r
472 <p>To let Mafft know where the other files from its package are\r
473 change the value of MAFFT-BINARIES environment variables. To let\r
474 Mafft know where is the fasta34 executable set the value of\r
475 FASTA_4_MAFFT environment variable to point to a location of\r
476 fasta34 program. The latter can be added to the PATH variable\r
477 instead. If you are using executables supplied with JABAWS, the\r
478 path to Mafft binaries would be like <span class=\r
479 "hightlight">&lt;relative path to web application\r
480 directory&gt;/binaries/src/mafft/binaries</span> and the path to\r
481 fasta34 binary would be <span class="hightlight">&lt;relative path\r
482 to web application\r
483 directory&gt;/binaries/src/fasta34/fasta34</span>. You can specify\r
484 the location of Mafft binaries as well as fasta34 program elsewhere\r
485 by providing an absolute path to them. All these settings are\r
486 defined in <span class=\r
487 "hightlight">conf/Executable.properties</span> file.</p>\r
488 \r
489 <h3>Using JABAWS in your program </h3>\r
490 <h4><a name="wsfunctions" id="wsfunctions"></a>Web services functions overview </h4>\r
491 <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
492 <p><strong>Functions for initiating the alignment </strong><span class="code">  String id = align(List&lt;FastaSequence&gt; list)<br />\r
493   String id = customAlign(List&lt;FastaSequence&gt; sequenceList, List&lt;Option&gt; optionList)<br />\r
494   String id = presetAlign(List&lt;FastaSequence&gt; sequenceList, Preset preset)</span></p>\r
495 <p><strong>Functions pertaining to job monitoring and control</strong><br />\r
496   <span class="code">JobStatus status = getJobStatus(String id)<br />\r
497   Alignment al = getResult(String id)<br />\r
498   boolean cancelled = cancelJob(String id)<br />\r
499   ChunkHolder chunk = pullExecStatistics(String id, long marker)</span></p>\r
500 <p><strong>Functions relating to service features discovery</strong><br />\r
501   <span class="code">RunnerConfig rc = getRunnerOptions()<br />\r
502   Limit limit = getLimit(String name)<br />\r
503   LimitsManager lm = getLimits()<br />\r
504   PresetManager pm = getPresets()</span></p>\r
505 <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
506 <h4><a name="templatestr" id="templatestr"></a>Structure of the template command line client</h4>\r
507 <table width="100%" border="1">\r
508   <tr>\r
509     <td width="18%"><strong>Packages</strong></td>\r
510     <td width="82%"><strong>Classes and Interfaces </strong></td>\r
511   </tr>\r
512   <tr>\r
513     <td>compbio.data.msa </td>\r
514     <td>MsaWS the interface for all multiple sequence alignment web services </td>\r
515   </tr>\r
516   <tr>\r
517     <td>compbio.data.sequence</td>\r
518     <td>JABAWS data types </td>\r
519   </tr>\r
520   <tr>\r
521     <td>compbio.metadata</td>\r
522     <td>JABAWS meta data types </td>\r
523   </tr>\r
524   <tr>\r
525     <td>compbio.ws.client</td>\r
526     <td>JABAWS command line client </td>\r
527   </tr>\r
528 </table>\r
529 <p>Additional utility libraries this client depend upon is the compbio-util-1.3.jar and compbio-annotation-1.0.jar. <br />\r
530   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
531 <h4><a name="connectto" id="connectto"></a>Connecting to JABAWS</h4>\r
532 <p class="attention">For a complete working example of JABAWS command line client please see compbio.ws.client.Jws2Client class. JABAWS command line client source code is available from the <a href="download.html">download page</a>. Please note that for now all the examples are in Java other languages will follow given a sufficient demand. </p>\r
533 <p>Download a binary JABAWS <a href="download.html">client</a>. Add the client to the class path. The following code excerpt will connect your program to Clustal web service deployed in the University of Dundee. </p>\r
534 <p class="code"> import java.net.URL;<br />\r
535   import javax.xml.namespace.QName;<br />\r
536   import javax.xml.ws.Service;<br />\r
537   ...............<br />\r
538   1) String qualifiedName = &quot;http://msa.data.compbio/01/01/2010/&quot;;<br />\r
539   2) URL url = new URL(&quot;http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl&quot;);<br />\r
540   3) QName qname = new QName(, &quot;ClustalWS&quot;);<br />\r
541   4) Service serv = Service.create(url, qname);<br />\r
542   5) MsaWS msaws = serv.getPort(new QName(qualifiedName, &quot;ClustalWSPort&quot;),\r
543   MsaWS.class);</p>\r
544 <p>Line 1 makes a qualified name for JABA web services.<br />\r
545   Line 2 \r
546   constructs the URL to the web services WSDL. <br />\r
547   Line 3 makes a qualified name instance for Clustal JABA web service. <br />\r
548   Line 4 creates a service instance.<br />\r
549   Line 5 makes a connection to the server. </p>\r
550 <p>A more generic connection method would look like this </p>\r
551 <p class="code"> import java.net.URL;<br />\r
552   import javax.xml.namespace.QName;<br />\r
553   import javax.xml.ws.Service;<br />\r
554   import compbio.ws.client.Services<br />\r
555   .............. <br />\r
556   String qualifiedServiceName = &quot;http://msa.data.compbio/01/01/2010/&quot;;<br />\r
557   String host = &quot;http://www.compbio.dundee.ac.uk/jabaws&quot;;<br />\r
558   // In real life the service name can come from args<br />\r
559   Services clustal = Services.ClustalWS;<br />\r
560   URL url = new URL(host + &quot;/&quot; + clustal.toString() + &quot;?wsdl&quot;);<br />\r
561   QName qname = new QName(qualifiedServiceName, clustal.toString());<br />\r
562   Service serv = Service.create(url, qname);<br />\r
563   MsaWS msaws = serv.getPort(new QName(qualifiedServiceName, clustal<br />\r
564   + &quot;Port&quot;), MsaWS.class);</p>\r
565 <p>Where Services is enumeration of JABAWS web services. All JABAWS multiple sequence alignment methods confirm to MsaWS specification, thus from the caller point of view all JABAWS web services can be represented by MsaWS interface. The full documentation of MsaWS functions is available from the <a href="file:///D:/workspace/JWS2/website/dm_javadoc/compbio/data/msa/MsaWS.html">javadoc</a>. </p>\r
566 <h4><a name="validnames" id="validnames"></a>Valid JABAWS service names and WSDL files </h4>\r
567 <ul>\r
568   <li><a href="http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl">ClustalWS</a> (http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl) </li>\r
569   <li><a href="http://www.compbio.dundee.ac.uk/jabaws/MuscleWS?wsdl">MuscleWS</a> (http://www.compbio.dundee.ac.uk/jabaws/MuscleWS?wsdl) </li>\r
570   <li><a href="http://www.compbio.dundee.ac.uk/jabaws/MafftWS?wsdl">MafftWS</a> (http://www.compbio.dundee.ac.uk/jabaws/MafftWS?wsdl) </li>\r
571   <li><a href="http://www.compbio.dundee.ac.uk/jabaws/TcoffeeWS?wsdl">TcoffeeWS</a> (http://www.compbio.dundee.ac.uk/jabaws/TcoffeeWS?wsdl) </li>\r
572   <li><a href="http://www.compbio.dundee.ac.uk/jabaws/ProbconsWS?wsdl">ProbconsWS</a> (http://www.compbio.dundee.ac.uk/jabaws/ProbconsWS?wsdl) </li>\r
573 </ul>\r
574 <h4><a name="defalign" id="defalign"></a>Aligning sequences </h4>\r
575 <p>Given that <span class="hightlight">msaws</span> is web service proxy, created as described in &quot;Connecting to JABAWS&quot; section, the actual alignment can be obtained as follows: </p>\r
576 <p class="code">1) List&lt;FastaSequence&gt; fastalist = SequenceUtil.readFasta(new FileInputStream(file));<br />\r
577   2) String jobId = msaws.align(fastalist); <br />\r
578   3) Alignment alignment = msaws.getResult(jobId);</p>\r
579 <p>Line  one loads FASTA sequence from the file<br />\r
580   Line two submits them to web service represented by msaws proxy <br />\r
581   Line three retrieves the alignment from a web service. This line will block the execution until the result is available. Use this with caution. In general, you should make sure that the calculation has been completed before attempting retrieving results. This is to avoid keeping the connection to the server on hold for a prolonged periods of time. While this may be ok with your local server, our public server (<a href="http://www.compbio.dundee.ac.uk/jabaws">www.compbio.dundee.ac.uk/jabaws</a>) will not let you hold the connection for longer than 10 minutes. This is done to prevent excessive load on the server. The next section describes how to check the status of the calculation.<br />\r
582   Methods and classes mentioned in the excerpt are available from the JABAWS client library. </p>\r
583 <h4><a name="checkresults" id="checkresults"></a>Checking the status of the calculation </h4>\r
584 <p> You may have noticed that there was no pause between submitting the job and retrieving of the results. This is because <span class="hightlight">getResult(jobId)</span> method block the processing until the calculation is completed. However, taking into account that the connection holds server resources, our public server (<a href="http://www.compbio.dundee.ac.uk/jabaws">www.compbio.dundee.ac.uk/jabaws</a>) is configured to reset the connection after 10 minutes of waiting. To work around the connection reset you are encouraged to check whether the calculation has been completed before accessing the results.       You can do it like this: </p>\r
585 <p> <span class="code">while (msaws.getJobStatus(jobId) != JobStatus.FINISHED) {<br />\r
586   &nbsp;&nbsp;&nbsp;&nbsp;Thread.sleep(2000); // wait two  seconds, then recheck the status <br />\r
587   }</span></p>\r
588 <h4><a name="presetalign" id="presetalign"></a>Aligning with presets</h4>\r
589 <p class="code">1) PresetManager presetman = msaws.getPresets();<br />\r
590   2) Preset preset = presetman.getPresetByName(presetName);<br />\r
591   3) List&lt;FastaSequence&gt; fastalist = SequenceUtil.readFasta(new FileInputStream(file));<br />\r
592   4) String jobId = msaws.presetAlign(fastalist, preset);<br />\r
593   5) Alignment alignment = msaws.getResult(jobId);</p>\r
594 <p>Line one obtains the lists of presets supported by a web service.<br />\r
595   Line two return a particular Preset \r
596   by its name<br />\r
597   Lines three to five  are doing the same job as in the first <a href="#defalign"> aligning sequences example</a>.</p>\r
598 <h4><a name="customalign" id="customalign"></a>Aligning with  custom parameters</h4>\r
599 <p class="code"> 1) RunnerConfig options = msaws.getRunnerOptions();<br />\r
600   2) Argument matrix = options.getArgument(&quot;MATRIX&quot;);<br />\r
601   3) matrix.setValue(&quot;PAM300&quot;);<br />\r
602   4) Argument gapopenpenalty = options.getArgument(&quot;GAPOPEN&quot;);<br />\r
603   5) gapopenpenalty.setValue(&quot;20&quot;);<br />\r
604   6) List&lt;Argument&gt; arguments = new ArrayList&lt;Argument&gt;(); <br />\r
605   7) arguments.add(matrix);\r
606   arguments.add(gapopenpenalty);<br />\r
607   8) List&lt;FastaSequence&gt; fastalist = SequenceUtil.readFasta(new FileInputStream(file));<br />\r
608   9) String jobId = msaws.customAlign(fastalist, arguments);<br />\r
609   10) Alignment alignment = msaws.getResult(jobId);</p>\r
610 <p>Line one obtains the RunnerConfig object that holds information on supported parameters and their values<br />\r
611   Line two retrieve a particular parameter from the holder by its name<br />\r
612   Lines three sets a value to this parameter which will be used in the calculation. <br />\r
613   Line four and five do the same but for another parameter<br />\r
614   Line 6 makes a List to hold the parameters <br />\r
615   Line seven puts the parameters into that list<br />\r
616   Line eight \r
617   and ten is the same as in previous examples<br />\r
618   Line nine submit an alignment request with the sequences and the parameters <br />\r
619   The names of all the parameters supported by a web service e.g. &quot;PAM300&quot; can be obtained using options.getArguments() method. Further details on the methods available from RunnerConfig object are available from the <a href="dm_javadoc/index.html">javadoc</a>. </p>\r
620 <h4><a name="writingaltofile" id="writingaltofile"></a>Writing alignments to a file</h4>\r
621 <p>There is a utility method in the client library that does exactly that. </p>\r
622 <p> <span class="code">Alignment alignment = align(...) <br />\r
623   FileOutputStream outStream = new FileOutputStream(file);<br />\r
624   ClustalAlignmentUtil.writeClustalAlignment(outStream, align);</span></p>\r
625 <h4><a name="compex" id="compex"></a>A complete client example </h4>\r
626 <p>Finally, a complete example of the program that connects to JABAWS Clustal service and aligns sequences using one of the  Clustal web service preset. Three is also a <a href="Example_template.pdf">PDF version</a> of this example with syntax highlighted. The text comments are commented by block style comments e.g. /* comment */, the alternatives given in the code are line commented // comment. You may want to remove line style comments to test alternatives of the functions. All you need for this to work is a <a href="download.html">JABAWS binary client</a>. Please make sure that the client is in the Java class path before running this example.</p>\r
627 <pre class="code" style="line-height:1em;">\r
628 import java.io.ByteArrayInputStream;\r
629 import java.io.FileNotFoundException;\r
630 import java.io.IOException;\r
631 import java.net.URL;\r
632 import java.util.List;\r
633 \r
634 import javax.xml.namespace.QName;\r
635 import javax.xml.ws.Service;\r
636 \r
637 import compbio.data.msa.MsaWS;\r
638 import compbio.data.sequence.Alignment;\r
639 import compbio.data.sequence.FastaSequence;\r
640 import compbio.data.sequence.SequenceUtil;\r
641 import compbio.metadata.JobSubmissionException;\r
642 import compbio.metadata.LimitExceededException;\r
643 import compbio.metadata.Preset;\r
644 import compbio.metadata.PresetManager;\r
645 import compbio.metadata.ResultNotAvailableException;\r
646 import compbio.metadata.UnsupportedRuntimeException;\r
647 import compbio.metadata.WrongParameterException;\r
648 \r
649 public class Example {\r
650 \r
651         /*\r
652          * Input sequences for alignment\r
653          */\r
654         static final String input = &quot;&gt;Foo\r\n&quot;\r
655                         + &quot;MTADGPRELLQLRAAVRHRPQDFVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAVARLGR&quot;\r
656                         + &quot;VRWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDAGQAEAAAAAYTRAHQLLPEEPYITAQ&quot;\r
657                         + &quot;LLNWRRRLCDWRALDVLSAQVRAAVAQGVGAVEPFAFLSEDASAAEQLACARTRAQAIAASVRPL&quot;\r
658                         + &quot;APTRVRSKGPLRVGFVSNGFGAHPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQA&quot;\r
659                         + &quot;STLHDVTALGHLATAKHIRHHGIDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMD&quot;\r
660                         + &quot;YVLGDAFALPPALEPFYSEHVLRLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLN&quot;\r
661                         + &quot;PQSMARMLAVLREVPDSVLWLLSGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHAD&quot;\r
662                         + &quot;LFLDTHPYNAHTTASDALWTGCPVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALAS&quot;\r
663                         + &quot;DPAALTALHARVDVLRRESGVFEMDGFADDFGALLQALARRHGWLGI\r\n&quot;\r
664                         + &quot;\r\n&quot;\r
665                         + &quot;&gt;Bar\r\n&quot;\r
666                         + &quot;MGDTTAGEMAVQRGLALHQQRHAEAAVLLQQASDAAPEHPGIALWLHALEDAGQAEAAAAYTRAH&quot;\r
667                         + &quot;QLLPEEPYITAQLLNAVAQGVGAVEPFAFLSEDASAAESVRPLAPTRVRSKGPLRVGFVSNGFGA&quot;\r
668                         + &quot;HPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHG&quot;\r
669                         + &quot;IDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVL&quot;\r
670                         + &quot;RLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLL&quot;\r
671                         + &quot;SGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGC&quot;\r
672                         + &quot;PVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRESGV&quot;\r
673                         + &quot;FEMDGFADDFGALLQALARRHGWLGI\r\n&quot;\r
674                         + &quot;\r\n&quot;\r
675                         + &quot;&gt;Friends\r\n&quot;\r
676                         + &quot;MTADGPRELLQLRAAVRHRPQDVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAVARLGRV&quot;\r
677                         + &quot;RWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDHQLLPEEPYITAQLDVLSAQVRAAVAQG&quot;\r
678                         + &quot;VGAVEPFAFLSEDASAAEQLACARTRAQAIAASVRPLAPTRVRSKGPLRVGFVSNGFGAHPTGLL&quot;\r
679                         + &quot;TVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHGIDLLFD&quot;\r
680                         + &quot;LRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVLRLQGAF&quot;\r
681                         + &quot;QPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLLSGPGEA&quot;\r
682                         + &quot;DARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGCPVLTTP&quot;\r
683                         + &quot;GETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRESI&quot;;\r
684 \r
685         public static void main(String[] args) throws UnsupportedRuntimeException,\r
686                         LimitExceededException, JobSubmissionException,\r
687                         WrongParameterException, FileNotFoundException, IOException,\r
688                         ResultNotAvailableException, InterruptedException {\r
689 \r
690                 String qualifiedServiceName = &quot;http://msa.data.compbio/01/01/2010/&quot;;\r
691 \r
692                 /* Make a URL pointing to web service WSDL */\r
693                 URL url = new URL(\r
694                                 &quot;http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl&quot;);\r
695 \r
696                 /*\r
697                  * If you are making a client that connects to different web services\r
698                  * you can use something like this:\r
699                  */\r
700                 // URL url = new URL(host + &quot;/&quot; + Services.ClustalWS.toString() +\r
701                 // &quot;?wsdl&quot;);\r
702 \r
703                 QName qname = new QName(qualifiedServiceName, &quot;ClustalWS&quot;);\r
704                 Service serv = Service.create(url, qname);\r
705                 /*\r
706                  * Multiple sequence alignment interface for Clustal web service\r
707                  * instance\r
708                  */\r
709                 MsaWS msaws = serv.getPort(new QName(qualifiedServiceName, &quot;ClustalWS&quot;\r
710                                 + &quot;Port&quot;), MsaWS.class);\r
711 \r
712                 /* Get the list of available presets */\r
713                 PresetManager presetman = msaws.getPresets();\r
714 \r
715                 /* Get the Preset object by preset name */\r
716                 Preset preset = presetman\r
717                                 .getPresetByName(&quot;Disable gap weighting (Speed-oriented)&quot;);\r
718 \r
719                 /*\r
720                  * Load sequences in FASTA format from the file You can use something\r
721                  * like new FileInputStream(<filename>) to load sequence from the file\r
722                  */\r
723                 List<FastaSequence> fastalist = SequenceUtil\r
724                                 .readFasta(new ByteArrayInputStream(input.getBytes()));\r
725 \r
726                 /*\r
727                  * Submit loaded sequences for an alignment using preset. The job\r
728                  * identifier is returned by this method, you can retrieve the results\r
729                  * with it sometime later.\r
730                  */\r
731                 String jobId = msaws.presetAlign(fastalist, preset);\r
732 \r
733                 /* This method will block for the duration of the calculation */\r
734                 Alignment alignment = msaws.getResult(jobId);\r
735 \r
736                 /*\r
737                  * This is a better way of obtaining results, it does not involve\r
738                  * holding the connection open for the duration of the calculation,\r
739                  * Besides, as the University of Dundee public server will reset the\r
740                  * connection after 10 minutes of idling, this is the only way to obtain\r
741                  * the results of long running task from our public server.\r
742                  */\r
743                 // while (msaws.getJobStatus(jobId) != JobStatus.FINISHED) {\r
744                 // Thread.sleep(1000); // wait a second, then recheck the status\r
745                 // }\r
746 \r
747                 /* Output the alignment to standard out */\r
748                 System.out.println(alignment);\r
749 \r
750                 // Alternatively, you can record retrieved alignment into the file in\r
751                 // ClustalW format\r
752 \r
753                 // ClustalAlignmentUtil.writeClustalAlignment(new FileOutputStream(\r
754                 // &quot;output.al&quot;), alignment);\r
755 \r
756         }\r
757 }\r
758 </pre>\r
759 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
760 <h4><a name="buildart" id="buildart"></a>Building web services artifacts</h4>\r
761 <p>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> basic   profile compatible. This means that you could use whatever tool your language has to work with web services. Below is how you can generate portable artifacts to work with JABAWS from Java. However,  if programming in Java we recommend using our <a href="#connectto"> client library</a> as it provides a handful of useful methods in addition to plain data types. </p>\r
762 <p class="code">wsimport -keep http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl</p>\r
763 <p>&nbsp;</p>\r
764 <h3>JABA Web Services Internals </h3>\r
765 <h4><a name="testingJaba" id="testingJaba"></a>Testing JABA Web Services</h4>\r
766 <p>You can use a command line client (part of the client only\r
767 package) to test you JABAWS installation as described <a href=\r
768 "howto.html#usingcclient">here</a>. If you downloaded a JABAWS\r
769 server package, you can use <span class=\r
770 "hightlight">&lt;your_jaba_context_name&gt;/WEB-INF/lib/jaba-client.jar</span>\r
771 to test JABAWS installation as described in <a href=\r
772 "howto.html#usingWsTester">how-to</a>. If you downloaded the source\r
773 code, then you could run a number of test suits defined in the\r
774 build.xml ant build file.</p>\r
775 \r
776 <h4><a name="logfiles" id="logfiles"></a>JABAWS Log Files</h4>\r
777 \r
778 <p>JABAWS can be configured to log what it is doing. This comes\r
779 handy if you would like to see who is using your web services or\r
780 need to chase some problems. JABAWS uses <a href=\r
781 "http://logging.apache.org/log4j/1.2/">log4j</a> to do the logging,\r
782 the example of log4j configuration is bundled with JABAWS war file.\r
783 You will find it in the <span class=\r
784 "hightlight">/WEB-INF/classes/log4j.properties</span> file. All the\r
785 lines in this file are commented out. The reason why the logging is\r
786 disabled by default it simple, log4j have to know the exact\r
787 location where the log files should be stored. This is not known up\r
788 until the deployment time. To enable the logging you need to\r
789 define<span class="hightlight"> logDir</span> property in the <span\r
790 class="hightlight">log4j.properties</span> and uncomment section of\r
791 the file which corresponds to your need. More information is given\r
792 in the <span class="hightlight">log4j.properties</span> file\r
793 itself. Restart the tomcat or the JABAWS web application to apply\r
794 the settings.</p>\r
795 \r
796 <p>After you have done this, assuming that you did not change the\r
797 log4j.properties file yourself, you should see the application log\r
798 file called <span class="hightlight">activity.log</span>. The\r
799 amount of information logged can be adjusted using different\r
800 logging levels, it is reduced in the following order of log levels\r
801 TRACE, DEBUG, INFO, WARN, ERROR, FATAL.</p>\r
802 \r
803 <p>If you would like to know who is using your services, you might\r
804 want to <a href="howto.html#logs">enable tomcat access\r
805 logging</a>.</p>\r
806 \r
807 <h4><a name="warfile" id="warfile"></a>JABAWS War File Content</h4>\r
808 \r
809 <table width="100%">\r
810 <tr>\r
811 <th width="19%">Directory</th>\r
812 <th width="81%">Content description</th>\r
813 </tr>\r
814 \r
815 <tr>\r
816 <td>conf/</td>\r
817 <td>contains configuration files such as Executable.properties,\r
818 Engine.local.properties, Engine.cluster.properties</td>\r
819 </tr>\r
820 \r
821 <tr>\r
822 <td>conf/settings</td>\r
823 <td>Contains individual executable description files. In particular\r
824 XXXParameters.xml, XXXPresets.xml, XXXLimits.xml where XXX is the\r
825 name of the executable</td>\r
826 </tr>\r
827 \r
828 <tr>\r
829 <td>jobsout/</td>\r
830 <td>Contains directories generated when running an individual executable. E.g. input and output files and some other task\r
831 related data. (optional)</td>\r
832 </tr>\r
833 \r
834 <tr>\r
835 <td>binaries/</td>\r
836 <td>Directory contains native executables - programs,\r
837 windows binaries (optional)</td>\r
838 </tr>\r
839 \r
840 <tr>\r
841 <td>binaries/src</td>\r
842 <td>Contains source of native executables and Linux i386\r
843 binaries.</td>\r
844 </tr>\r
845 \r
846 <tr>\r
847 <td>binaries/matrices</td>\r
848 <td>Substitution matrices <!-- what format ? --></td>\r
849 </tr>\r
850 \r
851 <tr>\r
852 <td>WEB-INF</td>\r
853 <td>Web application descriptor</td>\r
854 </tr>\r
855 \r
856 <tr>\r
857 <td>WEB-INF/lib</td>\r
858 <td>Web application libraries</td>\r
859 </tr>\r
860 \r
861 <tr>\r
862 <td>WEB-INF/classes</td>\r
863 <td>log4j.properties - log configuration file (optional)</td>\r
864 </tr>\r
865 \r
866 <tr>\r
867 <td colspan="2"><strong>Help Pages</strong> </td>\r
868 </tr>\r
869 \r
870 <tr>\r
871 <td>/</td>\r
872 <td>help pages, index.html is the starting page</td>\r
873 </tr>\r
874 \r
875 <tr>\r
876 <td>dm_javadoc</td>\r
877 <td>javadoc for JABAWS client (the link is available from How To\r
878 pages)</td>\r
879 </tr>\r
880 \r
881 <tr>\r
882 <td>prog_docs</td>\r
883 <td>documentation for programs that JABAWS uses</td>\r
884 </tr>\r
885 \r
886 <tr>\r
887 <td>images</td>\r
888 <td>images referenced by html pages</td>\r
889 </tr>\r
890 </table>\r
891 \r
892 <p>&nbsp;</p>\r
893 </div>\r
894 \r
895 <!-- content end-->\r
896 <div id="copyright">Last update: 17 November 2010<br />\r
897  Peter Troshin, Jim Procter and Geoff Barton, The Barton Group, University of\r
898 Dundee, UK</div>\r
899 </div>\r
900 \r
901 <!-- wrapper end-->\r
902 </div>\r
903 <!-- page end-->\r
904 \r
905 <!-- Google analitics -->\r
906 <script type="text/javascript">\r
907 var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");\r
908 document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));\r
909 </script>\r
910 <script type="text/javascript">\r
911 try{\r
912 var pageTracker = _gat._getTracker("UA-5356328-1");\r
913 pageTracker._trackPageview();\r
914 } catch(err) {}\r
915 </script>\r
916 </body>\r
917 </html>\r
918 \r