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