Make muscle executable compilation not static to fix problem on Macs
[jabaws.git] / website / manual.html
index 5941807..fe1928e 100644 (file)
@@ -37,13 +37,14 @@ href="manual.html">Manual</a> <a href="howto.html">How To</a>
 \r
 <!-- panel end-->\r
 <div id="content">\r
-<h2 align="center">JABAWS Manual</h2>\r
+<h2 id="headtitle">JABAWS Manual</h2>\r
 \r
 <h3>Table of content</h3>\r
-<p>\r
-<h4>JABAWS Virtual Appliance </h4>\r
+<h4>JABAWS Virtual Appliance \r
+</h4>\r
 <ul>\r
     <li><a href="#whenvm">When to use virtual appliance</a> </li>\r
+    <li><a href="#howtoinstallvm">How to install VMWare Player or VirtualBox</a> </li>\r
        <li><a href="#virtualbox">VirtualBox appliance configuration</a></li>\r
        <li><a href="#vmplayer">VMware Player appliance configuration </a></li>\r
        <li><a href="#jabawsAppliance">JABAWS Appliance details </a></li>\r
@@ -71,10 +72,19 @@ href="manual.html">Manual</a> <a href="howto.html">How To</a>
   <li><a href="#setexecenv">Defining Environment Variables for\r
     Executables</a></li>\r
 </ul>\r
-<h4>For Developers  </h4>\r
+<h4>Using JABAWS in your program </h4>\r
 <ul>\r
-  <li><a href="#wsfunctions">Web service functions </a></li>\r
+  <li><a href="#wsfunctions">Web services functions overview </a></li>\r
   <li><a href="#templatestr">The template client structure</a></li>\r
+  <li><a href="#connectto">Connecting to JABAWS</a></li>\r
+  <li><a href="#validnames">Valid JABAWS service names and WSDL files</a></li>\r
+  <li><a href="#defalign">Aligning sequences</a></li>\r
+  <li><a href="#checkresults">Checking the status of the calculation </a></li>\r
+  <li><a href="#presetalign">Aligning with presets</a></li>\r
+  <li><a href="#customalign">Aligning with custom parameters</a></li>\r
+  <li><a href="#writingaltofile">Writing alignments to a file</a></li>\r
+  <li><a href="#compex">A complete client example </a></li>\r
+  <li><a href="#buildart">Building web services artifacts</a></li>\r
 </ul>\r
 <h4>JABA Web Services Internals </h4>\r
 <ul>\r
@@ -83,28 +93,38 @@ href="manual.html">Manual</a> <a href="howto.html">How To</a>
   <li><a href="#warfile">JABAWS War File Content</a></li>\r
 </ul>\r
 <h3>JABAWS Virtual Appliance </h3>\r
-<h4><a name="whenvm" id="whenvm"/></a>When to use virtual  appliance </h4>\r
-<p>The appliance best suits for individual users who want to  use 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
-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
+<h4><a name="whenvm" id="whenvm"/></a>When to use the virtual  appliance </h4>\r
+<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
+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
+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
+\r
+<h4><a name="howtoinstallvm" id="howtoinstallvm"></a>How to install VMWare Player or VirtualBox</h4>\r
+<p>Please see the <a href="http://downloads.vmware.com/d/info/desktop_downloads/vmware_player/3_0">VMware Player</a>  \r
+and <a href="http://www.virtualbox.org/wiki/Downloads">Oracle VirtualBox</a> websites for up to date instructions and downloads.</p>\r
+\r
 <h4><a name="virtualbox" id="virtualbox"/>VirtualBox appliance configuration</h4>\r
-<p>VirtualBox can be used to run JABAWS services from Windows, Linux, Solaris or Mac host operation systems. Use VitualBox &quot;Import  Appliance&quot; option to import JABAWS. Please bear in mind that to benefit from multiple CPU support under 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
-<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 you 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
+<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
+<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
 <p>VirtualBox JABAWS VM configuration screen shot displaying virtualization settings.</p>\r
 <p><img src="images/vmb_virtual.png" alt="VT-x extension on VirtualBox" width="669" height="535" /></p>\r
+\r
 <h4><a name="vmplayer" id="vmplayer"/>VMware Player appliance configuration </h4>\r
-<p>Free <a href="http://downloads.vmware.com/d/info/desktop_downloads/vmware_player/3_0">VMware Player</a> can be used to run JABAWS services from Windows and Linux host operation system, 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, offer virtual machine support for Mac computers too. </p>\r
-<p>To run JABAWS server on VMware player,  unpack JABAWS VM into one of the folders on your local hard drive. Open VMware Player, and click &quot;Open Virtual Machine&quot; and point the Player to the location of the JABAWS, choose JABAWS.vmx file to open an appliance. </p>\r
+<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
+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
+<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
 <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
+\r
 <h4><a name="jabawsAppliance" id="jabawsAppliance"/>JABAWS Appliance details</h4>\r
-<p>By default, 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 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 let  your VM deal with larger tasks, e.g. work with large alignments.</p>\r
+<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
 <p>The VMware Player screen shot below displays JABAWS VM CPU settings. </p>\r
 <p><img src="images/VMware_cpu.png" alt="vmware cpu settings" width="852" height="267" border="1" /></p>\r
+\r
 <p><strong>JABAWS appliance configuration: </strong></p>\r
 <p><strong>VMware info</strong><br />\r
   - Date of creation: 8 October 2010<br />\r
   - CPUs : 1<br />\r
   - RAM : 512 MB<br />\r
-  - Networking : Host only (the VM has no access to the outside network, nothing from outside network can access the VM)<br />\r
+  - Networking : Host only (the VM has no access to the outside network, nothing from the outside network can access the VM)<br />\r
   - Hard disk : 20 GB  (expanding)<br />\r
   - VMware tools : Installed</p>\r
 <p><strong>OS info</strong><br />\r
@@ -135,11 +155,13 @@ To run the appliance you would need to have relatively  powerful computer. The a
   </ul>\r
 <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
 <h4><a name="jalviewWithJaba" id="jalviewWithJaba"/>Configuring Jalview to work with your JABAWS VM</a> </h4>\r
-<p>After you booted 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
+<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
 <p><img src="images/vm_welcome_screen.png" alt="JABAWS welcome screen" width="734" height="461" /></p>\r
 <p>If you click on Advanced Menu, you will see the configuration console, similar to the one below.   </p>\r
 <p><img src="images/VMware_booted.png" alt="JABAWS welcome screen" width="735" height="461" /></p>\r
 <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
+\r
+\r
 <h3>JABAWS Installation</h3>\r
 <h4><a name="sysreq" id="sysreq"></a>System Requirements</h4>\r
 \r
@@ -199,8 +221,8 @@ libraries or other problems, then you probably need to <a href=
 <li>Restart the Tomcat.</li>\r
 </ol>\r
 \r
-That's it! JABAWS should work at this point. Try it out using the<a\r
-href="howto.html#usingWsTester">JABAWS test client</a>. If not,\r
+That's it! JABAWS should work at this point. Try it out using the JABAWS<a\r
+href="howto.html#usingWsTester"> test client</a>. If not,\r
 read on... or have a look at <a href=\r
 "howto.html#usingtomcat">deploying on Tomcat</a> tips.<br />\r
  <em>Note: You may want to enable logging, <a href="#logfiles">see\r
@@ -236,7 +258,7 @@ the <a href="howto.html#usingWsTester">JABAWS test client</a> to
 check that JABAWS can use the new binaries.</li>\r
 </ol>\r
 \r
-<p>If you couldn't compile everthing, then it may be that your system does\r
+<p>If you couldn't compile everything, then it may be that your system does\r
 not have all the tools required for compiling the programs. At the very\r
 least check that you have gcc, g++ and make installed in your\r
 system. If not install these packages and repeat the compilation\r
@@ -284,7 +306,7 @@ look at the <a href="#warfile">war file content table</a>).</p>
 enabled, with job output written to directory called "jobsout"\r
 within the web application itself. This means that JABAWS will work\r
 out of the box, but may not be suitable for serving a whole lab or\r
-instute.</p>\r
+a university.</p>\r
 \r
 <h4><a name="locEngConf" id="locEngConf"></a>Local Engine Configuration</h4>\r
 \r
@@ -376,9 +398,9 @@ optional&gt;</span></p>
 \r
 <p>Default JABAWS configuration includes path to local executables\r
 to be run by the local engine only, all cluster related settings\r
-are commened out, but they are there for you as example. Cluster\r
+are commented out, but they are there for you as example. Cluster\r
 engine is disabled by default. To configure executable for cluster\r
-execution uncomment the X.cluster settings and change them\r
+execution un comment the X.cluster settings and change them\r
 appropriately. </p>\r
 <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
   After you have completed the editing your configuration may look like\r
@@ -464,8 +486,8 @@ by providing an absolute path to them. All these settings are
 defined in <span class=\r
 "hightlight">conf/Executable.properties</span> file.</p>\r
 \r
-<h3>For Developers</h3>\r
-<h4><a name="wsfunctions" id="wsfunctions"></a>Web service functions description </h4>\r
+<h3>Using JABAWS in your program </h3>\r
+<h4><a name="wsfunctions" id="wsfunctions"></a>Web services functions overview </h4>\r
 <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
 <p><strong>Functions for initiating the alignment </strong><span class="code">  String id = align(List&lt;FastaSequence&gt; list)<br />\r
   String id = customAlign(List&lt;FastaSequence&gt; sequenceList, List&lt;Option&gt; optionList)<br />\r
@@ -506,6 +528,239 @@ defined in <span class=
 </table>\r
 <p>Additional utility libraries this client depend upon is the compbio-util-1.3.jar and compbio-annotation-1.0.jar. <br />\r
   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
+<h4><a name="connectto" id="connectto"></a>Connecting to JABAWS</h4>\r
+<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
+<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
+<p class="code"> import java.net.URL;<br />\r
+  import javax.xml.namespace.QName;<br />\r
+  import javax.xml.ws.Service;<br />\r
+  ...............<br />\r
+  1) String qualifiedName = &quot;http://msa.data.compbio/01/01/2010/&quot;;<br />\r
+  2) URL url = new URL(&quot;http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl&quot;);<br />\r
+  3) QName qname = new QName(, &quot;ClustalWS&quot;);<br />\r
+  4) Service serv = Service.create(url, qname);<br />\r
+  5) MsaWS msaws = serv.getPort(new QName(qualifiedName, &quot;ClustalWSPort&quot;),\r
+  MsaWS.class);</p>\r
+<p>Line 1 makes a qualified name for JABA web services.<br />\r
+  Line 2 \r
+  constructs the URL to the web services WSDL. <br />\r
+  Line 3 makes a qualified name instance for Clustal JABA web service. <br />\r
+  Line 4 creates a service instance.<br />\r
+  Line 5 makes a connection to the server. </p>\r
+<p>A more generic connection method would look like this </p>\r
+<p class="code"> import java.net.URL;<br />\r
+  import javax.xml.namespace.QName;<br />\r
+  import javax.xml.ws.Service;<br />\r
+  import compbio.ws.client.Services<br />\r
+  .............. <br />\r
+  String qualifiedServiceName = &quot;http://msa.data.compbio/01/01/2010/&quot;;<br />\r
+  String host = &quot;http://www.compbio.dundee.ac.uk/jabaws&quot;;<br />\r
+  // In real life the service name can come from args<br />\r
+  Services clustal = Services.ClustalWS;<br />\r
+  URL url = new URL(host + &quot;/&quot; + clustal.toString() + &quot;?wsdl&quot;);<br />\r
+  QName qname = new QName(qualifiedServiceName, clustal.toString());<br />\r
+  Service serv = Service.create(url, qname);<br />\r
+  MsaWS msaws = serv.getPort(new QName(qualifiedServiceName, clustal<br />\r
+  + &quot;Port&quot;), MsaWS.class);</p>\r
+<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
+<h4><a name="validnames" id="validnames"></a>Valid JABAWS service names and WSDL files </h4>\r
+<ul>\r
+  <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
+  <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
+  <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
+  <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
+  <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
+</ul>\r
+<h4><a name="defalign" id="defalign"></a>Aligning sequences </h4>\r
+<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
+<p class="code">1) List&lt;FastaSequence&gt; fastalist = SequenceUtil.readFasta(new FileInputStream(file));<br />\r
+  2) String jobId = msaws.align(fastalist); <br />\r
+  3) Alignment alignment = msaws.getResult(jobId);</p>\r
+<p>Line  one loads FASTA sequence from the file<br />\r
+  Line two submits them to web service represented by msaws proxy <br />\r
+  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
+  Methods and classes mentioned in the excerpt are available from the JABAWS client library. </p>\r
+<h4><a name="checkresults" id="checkresults"></a>Checking the status of the calculation </h4>\r
+<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
+<p> <span class="code">while (msaws.getJobStatus(jobId) != JobStatus.FINISHED) {<br />\r
+  &nbsp;&nbsp;&nbsp;&nbsp;Thread.sleep(2000); // wait two  seconds, then recheck the status <br />\r
+  }</span></p>\r
+<h4><a name="presetalign" id="presetalign"></a>Aligning with presets</h4>\r
+<p class="code">1) PresetManager presetman = msaws.getPresets();<br />\r
+  2) Preset preset = presetman.getPresetByName(presetName);<br />\r
+  3) List&lt;FastaSequence&gt; fastalist = SequenceUtil.readFasta(new FileInputStream(file));<br />\r
+  4) String jobId = msaws.presetAlign(fastalist, preset);<br />\r
+  5) Alignment alignment = msaws.getResult(jobId);</p>\r
+<p>Line one obtains the lists of presets supported by a web service.<br />\r
+  Line two return a particular Preset \r
+  by its name<br />\r
+  Lines three to five  are doing the same job as in the first <a href="#defalign"> aligning sequences example</a>.</p>\r
+<h4><a name="customalign" id="customalign"></a>Aligning with  custom parameters</h4>\r
+<p class="code"> 1) RunnerConfig options = msaws.getRunnerOptions();<br />\r
+  2) Argument matrix = options.getArgument(&quot;MATRIX&quot;);<br />\r
+  3) matrix.setValue(&quot;PAM300&quot;);<br />\r
+  4) Argument gapopenpenalty = options.getArgument(&quot;GAPOPEN&quot;);<br />\r
+  5) gapopenpenalty.setValue(&quot;20&quot;);<br />\r
+  6) List&lt;Argument&gt; arguments = new ArrayList&lt;Argument&gt;(); <br />\r
+  7) arguments.add(matrix);\r
+  arguments.add(gapopenpenalty);<br />\r
+  8) List&lt;FastaSequence&gt; fastalist = SequenceUtil.readFasta(new FileInputStream(file));<br />\r
+  9) String jobId = msaws.customAlign(fastalist, arguments);<br />\r
+  10) Alignment alignment = msaws.getResult(jobId);</p>\r
+<p>Line one obtains the RunnerConfig object that holds information on supported parameters and their values<br />\r
+  Line two retrieve a particular parameter from the holder by its name<br />\r
+  Lines three sets a value to this parameter which will be used in the calculation. <br />\r
+  Line four and five do the same but for another parameter<br />\r
+  Line 6 makes a List to hold the parameters <br />\r
+  Line seven puts the parameters into that list<br />\r
+  Line eight \r
+  and ten is the same as in previous examples<br />\r
+  Line nine submit an alignment request with the sequences and the parameters <br />\r
+  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
+<h4><a name="writingaltofile" id="writingaltofile"></a>Writing alignments to a file</h4>\r
+<p>There is a utility method in the client library that does exactly that. </p>\r
+<p> <span class="code">Alignment alignment = align(...) <br />\r
+  FileOutputStream outStream = new FileOutputStream(file);<br />\r
+  ClustalAlignmentUtil.writeClustalAlignment(outStream, align);</span></p>\r
+<h4><a name="compex" id="compex"></a>A complete client example </h4>\r
+<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
+<pre class="code" style="line-height:1em;">\r
+import java.io.ByteArrayInputStream;\r
+import java.io.FileNotFoundException;\r
+import java.io.IOException;\r
+import java.net.URL;\r
+import java.util.List;\r
+\r
+import javax.xml.namespace.QName;\r
+import javax.xml.ws.Service;\r
+\r
+import compbio.data.msa.MsaWS;\r
+import compbio.data.sequence.Alignment;\r
+import compbio.data.sequence.FastaSequence;\r
+import compbio.data.sequence.SequenceUtil;\r
+import compbio.metadata.JobSubmissionException;\r
+import compbio.metadata.LimitExceededException;\r
+import compbio.metadata.Preset;\r
+import compbio.metadata.PresetManager;\r
+import compbio.metadata.ResultNotAvailableException;\r
+import compbio.metadata.UnsupportedRuntimeException;\r
+import compbio.metadata.WrongParameterException;\r
+\r
+public class Example {\r
+\r
+       /*\r
+        * Input sequences for alignment\r
+        */\r
+       static final String input = &quot;&gt;Foo\r\n&quot;\r
+                       + &quot;MTADGPRELLQLRAAVRHRPQDFVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAVARLGR&quot;\r
+                       + &quot;VRWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDAGQAEAAAAAYTRAHQLLPEEPYITAQ&quot;\r
+                       + &quot;LLNWRRRLCDWRALDVLSAQVRAAVAQGVGAVEPFAFLSEDASAAEQLACARTRAQAIAASVRPL&quot;\r
+                       + &quot;APTRVRSKGPLRVGFVSNGFGAHPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQA&quot;\r
+                       + &quot;STLHDVTALGHLATAKHIRHHGIDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMD&quot;\r
+                       + &quot;YVLGDAFALPPALEPFYSEHVLRLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLN&quot;\r
+                       + &quot;PQSMARMLAVLREVPDSVLWLLSGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHAD&quot;\r
+                       + &quot;LFLDTHPYNAHTTASDALWTGCPVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALAS&quot;\r
+                       + &quot;DPAALTALHARVDVLRRESGVFEMDGFADDFGALLQALARRHGWLGI\r\n&quot;\r
+                       + &quot;\r\n&quot;\r
+                       + &quot;&gt;Bar\r\n&quot;\r
+                       + &quot;MGDTTAGEMAVQRGLALHQQRHAEAAVLLQQASDAAPEHPGIALWLHALEDAGQAEAAAAYTRAH&quot;\r
+                       + &quot;QLLPEEPYITAQLLNAVAQGVGAVEPFAFLSEDASAAESVRPLAPTRVRSKGPLRVGFVSNGFGA&quot;\r
+                       + &quot;HPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHG&quot;\r
+                       + &quot;IDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVL&quot;\r
+                       + &quot;RLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLL&quot;\r
+                       + &quot;SGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGC&quot;\r
+                       + &quot;PVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRESGV&quot;\r
+                       + &quot;FEMDGFADDFGALLQALARRHGWLGI\r\n&quot;\r
+                       + &quot;\r\n&quot;\r
+                       + &quot;&gt;Friends\r\n&quot;\r
+                       + &quot;MTADGPRELLQLRAAVRHRPQDVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAVARLGRV&quot;\r
+                       + &quot;RWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDHQLLPEEPYITAQLDVLSAQVRAAVAQG&quot;\r
+                       + &quot;VGAVEPFAFLSEDASAAEQLACARTRAQAIAASVRPLAPTRVRSKGPLRVGFVSNGFGAHPTGLL&quot;\r
+                       + &quot;TVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHGIDLLFD&quot;\r
+                       + &quot;LRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVLRLQGAF&quot;\r
+                       + &quot;QPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLLSGPGEA&quot;\r
+                       + &quot;DARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGCPVLTTP&quot;\r
+                       + &quot;GETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRESI&quot;;\r
+\r
+       public static void main(String[] args) throws UnsupportedRuntimeException,\r
+                       LimitExceededException, JobSubmissionException,\r
+                       WrongParameterException, FileNotFoundException, IOException,\r
+                       ResultNotAvailableException, InterruptedException {\r
+\r
+               String qualifiedServiceName = &quot;http://msa.data.compbio/01/01/2010/&quot;;\r
+\r
+               /* Make a URL pointing to web service WSDL */\r
+               URL url = new URL(\r
+                               &quot;http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl&quot;);\r
+\r
+               /*\r
+                * If you are making a client that connects to different web services\r
+                * you can use something like this:\r
+                */\r
+               // URL url = new URL(host + &quot;/&quot; + Services.ClustalWS.toString() +\r
+               // &quot;?wsdl&quot;);\r
+\r
+               QName qname = new QName(qualifiedServiceName, &quot;ClustalWS&quot;);\r
+               Service serv = Service.create(url, qname);\r
+               /*\r
+                * Multiple sequence alignment interface for Clustal web service\r
+                * instance\r
+                */\r
+               MsaWS msaws = serv.getPort(new QName(qualifiedServiceName, &quot;ClustalWS&quot;\r
+                               + &quot;Port&quot;), MsaWS.class);\r
+\r
+               /* Get the list of available presets */\r
+               PresetManager presetman = msaws.getPresets();\r
+\r
+               /* Get the Preset object by preset name */\r
+               Preset preset = presetman\r
+                               .getPresetByName(&quot;Disable gap weighting (Speed-oriented)&quot;);\r
+\r
+               /*\r
+                * Load sequences in FASTA format from the file You can use something\r
+                * like new FileInputStream(<filename>) to load sequence from the file\r
+                */\r
+               List<FastaSequence> fastalist = SequenceUtil\r
+                               .readFasta(new ByteArrayInputStream(input.getBytes()));\r
+\r
+               /*\r
+                * Submit loaded sequences for an alignment using preset. The job\r
+                * identifier is returned by this method, you can retrieve the results\r
+                * with it sometime later.\r
+                */\r
+               String jobId = msaws.presetAlign(fastalist, preset);\r
+\r
+               /* This method will block for the duration of the calculation */\r
+               Alignment alignment = msaws.getResult(jobId);\r
+\r
+               /*\r
+                * This is a better way of obtaining results, it does not involve\r
+                * holding the connection open for the duration of the calculation,\r
+                * Besides, as the University of Dundee public server will reset the\r
+                * connection after 10 minutes of idling, this is the only way to obtain\r
+                * the results of long running task from our public server.\r
+                */\r
+               // while (msaws.getJobStatus(jobId) != JobStatus.FINISHED) {\r
+               // Thread.sleep(1000); // wait a second, then recheck the status\r
+               // }\r
+\r
+               /* Output the alignment to standard out */\r
+               System.out.println(alignment);\r
+\r
+               // Alternatively, you can record retrieved alignment into the file in\r
+               // ClustalW format\r
+\r
+               // ClustalAlignmentUtil.writeClustalAlignment(new FileOutputStream(\r
+               // &quot;output.al&quot;), alignment);\r
+\r
+       }\r
+}\r
+</pre>\r
+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
+<h4><a name="buildart" id="buildart"></a>Building web services artifacts</h4>\r
+<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
+<p class="code">wsimport -keep http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl</p>\r
+<p>&nbsp;</p>\r
 <h3>JABA Web Services Internals </h3>\r
 <h4><a name="testingJaba" id="testingJaba"></a>Testing JABA Web Services</h4>\r
 <p>You can use a command line client (part of the client only\r
@@ -531,7 +786,7 @@ lines in this file are commented out. The reason why the logging is
 disabled by default it simple, log4j have to know the exact\r
 location where the log files should be stored. This is not known up\r
 until the deployment time. To enable the logging you need to\r
-define<span class="hightlight">logDir</span> property in the <span\r
+define<span class="hightlight"> logDir</span> property in the <span\r
 class="hightlight">log4j.properties</span> and uncomment section of\r
 the file which corresponds to your need. More information is given\r
 in the <span class="hightlight">log4j.properties</span> file\r
@@ -625,7 +880,7 @@ pages)</td>
 \r
 <tr>\r
 <td>prog_docs</td>\r
-<td>documentation for programmes that JABAWS uses</td>\r
+<td>documentation for programs that JABAWS uses</td>\r
 </tr>\r
 \r
 <tr>\r