X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=website%2Fmanual.html;h=fe1928efd164ec6a7ff396c815d14f27c7af4e4d;hb=5f582fe1adafda5df440d1d1b3955b2bca7fbc88;hp=59418077b5c439ef697e7642800fa5923bfaeb7b;hpb=cb02e8a08893701386c270a8bf9d0f08b9cbc4db;p=jabaws.git diff --git a/website/manual.html b/website/manual.html index 5941807..fe1928e 100644 --- a/website/manual.html +++ b/website/manual.html @@ -37,13 +37,14 @@ href="manual.html">Manual How To
-

JABAWS Manual

+

JABAWS Manual

Table of content

-

-

JABAWS Virtual Appliance

+

JABAWS Virtual Appliance +

-

For Developers

+

Using JABAWS in your program

JABA Web Services Internals

JABAWS Virtual Appliance

-

When to use virtual appliance

-

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 war distribution instead.
-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.

+

When to use the virtual appliance

+

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 +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 war distribution instead.
+The appliance comes pre configured to use 1 CPU and 512M of memory and the minimum amount of memory required is about 378M.

+ +

How to install VMWare Player or VirtualBox

+

Please see the VMware Player +and Oracle VirtualBox websites for up to date instructions and downloads.

+

VirtualBox appliance configuration

-

VirtualBox can be used to run JABAWS services from Windows, Linux, Solaris or Mac host operation systems. Use VitualBox "Import Appliance" option to import JABAWS. Please bear in mind that to benefit from multiple CPU support under VirtualBox software you need to enable hardware virtualization extensions, 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.

-

We found that, by default, virtualization extensions are enabled in VirtualBox irrespective of whether your computer supports them. You will get the VERR_VMX_MSR_LOCKED_OR_DISABLED 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.

+

VirtualBox can be used to run JABAWS services from Windows, Linux, Solaris or Mac host operating systems. Use the VitualBox "Import Appliance" option to import the JABAWS. Please bear in mind that to benefit from multiple CPU support under the VirtualBox software you need to enable hardware virtualization extensions, 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.

+

We found that, by default, virtualization extensions are enabled in VirtualBox irrespective of whether your computer supports them. You will get the VERR_VMX_MSR_LOCKED_OR_DISABLED 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.

VirtualBox JABAWS VM configuration screen shot displaying virtualization settings.

VT-x extension on VirtualBox

+

VMware Player appliance configuration

-

Free VMware Player 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, VMware Fusion, a commercial VMware product, offer virtual machine support for Mac computers too.

-

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 "Open Virtual Machine" and point the Player to the location of the JABAWS, choose JABAWS.vmx file to open an appliance.

+

The free VMware Player 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). +However, VMware Fusion, a commercial VMware product, offers virtual machine support for Mac computers too.

+

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 "Open Virtual Machine" and point the Player to the location of the JABAWS, then choose the JABAWS.vmx file to open an appliance.

When you play the machine for the first time the Player might ask you whether "This virtual machine may have been moved or copied.", say that you have copied it. That is all.

+

JABAWS Appliance details

-

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.

+

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.

The VMware Player screen shot below displays JABAWS VM CPU settings.

vmware cpu settings

+

JABAWS appliance configuration:

VMware info
- Date of creation: 8 October 2010
- CPUs : 1
- RAM : 512 MB
- - Networking : Host only (the VM has no access to the outside network, nothing from outside network can access the VM)
+ - Networking : Host only (the VM has no access to the outside network, nothing from the outside network can access the VM)
- Hard disk : 20 GB (expanding)
- VMware tools : Installed

OS info
@@ -135,11 +155,13 @@ To run the appliance you would need to have relatively powerful computer. The a

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.

Configuring Jalview to work with your JABAWS VM

-

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->Tools->Preferences->Web Services -> New Service URL, and add JABAWS URL into the box provided. For more information please refer to Jalview help pages.

+

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->Tools->Preferences->Web Services -> New Service URL, and add JABAWS URL into the box provided. For more information please refer to Jalview help pages.

JABAWS welcome screen

If you click on Advanced Menu, you will see the configuration console, similar to the one below.

JABAWS welcome screen

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.

+ +

JABAWS Installation

System Requirements

@@ -199,8 +221,8 @@ libraries or other problems, then you probably need to Restart the Tomcat. -That's it! JABAWS should work at this point. Try it out using theJABAWS test client. If not, +That's it! JABAWS should work at this point. Try it out using the JABAWS test client. If not, read on... or have a look at deploying on Tomcat tips.
Note: You may want to enable logging, see @@ -236,7 +258,7 @@ the JABAWS test client to check that JABAWS can use the new binaries. -

If you couldn't compile everthing, then it may be that your system does +

If you couldn't compile everything, then it may be that your system does not have all the tools required for compiling the programs. At the very least check that you have gcc, g++ and make installed in your system. If not install these packages and repeat the compilation @@ -284,7 +306,7 @@ look at the war file content table).

enabled, with job output written to directory called "jobsout" within the web application itself. This means that JABAWS will work out of the box, but may not be suitable for serving a whole lab or -instute.

+a university.

Local Engine Configuration

@@ -376,9 +398,9 @@ optional>

Default JABAWS configuration includes path to local executables to be run by the local engine only, all cluster related settings -are commened out, but they are there for you as example. Cluster +are commented out, but they are there for you as example. Cluster engine is disabled by default. To configure executable for cluster -execution uncomment the X.cluster settings and change them +execution un comment the X.cluster settings and change them appropriately.

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 conf/settings/<X>Limit.xml files.
After you have completed the editing your configuration may look like @@ -464,8 +486,8 @@ by providing an absolute path to them. All these settings are defined in conf/Executable.properties file.

-

For Developers

-

Web service functions description

+

Using JABAWS in your program

+

Web services functions overview

All JABA multiple sequence alignment web services comply to the same interface, thus the function described below are available from all the services.

Functions for initiating the alignment String id = align(List<FastaSequence> list)
String id = customAlign(List<FastaSequence> sequenceList, List<Option> optionList)
@@ -506,6 +528,239 @@ defined in

Additional utility libraries this client depend upon is the compbio-util-1.3.jar and compbio-annotation-1.0.jar.
Please refer to a data model javadoc for a detailed description of each class and its methods.

+

Connecting to JABAWS

+

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 download page. Please note that for now all the examples are in Java other languages will follow given a sufficient demand.

+

Download a binary JABAWS client. 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.

+

import java.net.URL;
+ import javax.xml.namespace.QName;
+ import javax.xml.ws.Service;
+ ...............
+ 1) String qualifiedName = "http://msa.data.compbio/01/01/2010/";
+ 2) URL url = new URL("http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl");
+ 3) QName qname = new QName(, "ClustalWS");
+ 4) Service serv = Service.create(url, qname);
+ 5) MsaWS msaws = serv.getPort(new QName(qualifiedName, "ClustalWSPort"), + MsaWS.class);

+

Line 1 makes a qualified name for JABA web services.
+ Line 2 + constructs the URL to the web services WSDL.
+ Line 3 makes a qualified name instance for Clustal JABA web service.
+ Line 4 creates a service instance.
+ Line 5 makes a connection to the server.

+

A more generic connection method would look like this

+

import java.net.URL;
+ import javax.xml.namespace.QName;
+ import javax.xml.ws.Service;
+ import compbio.ws.client.Services
+ ..............
+ String qualifiedServiceName = "http://msa.data.compbio/01/01/2010/";
+ String host = "http://www.compbio.dundee.ac.uk/jabaws";
+ // In real life the service name can come from args
+ Services clustal = Services.ClustalWS;
+ URL url = new URL(host + "/" + clustal.toString() + "?wsdl");
+ QName qname = new QName(qualifiedServiceName, clustal.toString());
+ Service serv = Service.create(url, qname);
+ MsaWS msaws = serv.getPort(new QName(qualifiedServiceName, clustal
+ + "Port"), MsaWS.class);

+

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 javadoc.

+

Valid JABAWS service names and WSDL files

+ +

Aligning sequences

+

Given that msaws is web service proxy, created as described in "Connecting to JABAWS" section, the actual alignment can be obtained as follows:

+

1) List<FastaSequence> fastalist = SequenceUtil.readFasta(new FileInputStream(file));
+ 2) String jobId = msaws.align(fastalist);
+ 3) Alignment alignment = msaws.getResult(jobId);

+

Line one loads FASTA sequence from the file
+ Line two submits them to web service represented by msaws proxy
+ 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 (www.compbio.dundee.ac.uk/jabaws) 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.
+ Methods and classes mentioned in the excerpt are available from the JABAWS client library.

+

Checking the status of the calculation

+

You may have noticed that there was no pause between submitting the job and retrieving of the results. This is because getResult(jobId) method block the processing until the calculation is completed. However, taking into account that the connection holds server resources, our public server (www.compbio.dundee.ac.uk/jabaws) 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:

+

while (msaws.getJobStatus(jobId) != JobStatus.FINISHED) {
+     Thread.sleep(2000); // wait two seconds, then recheck the status
+ }

+

Aligning with presets

+

1) PresetManager presetman = msaws.getPresets();
+ 2) Preset preset = presetman.getPresetByName(presetName);
+ 3) List<FastaSequence> fastalist = SequenceUtil.readFasta(new FileInputStream(file));
+ 4) String jobId = msaws.presetAlign(fastalist, preset);
+ 5) Alignment alignment = msaws.getResult(jobId);

+

Line one obtains the lists of presets supported by a web service.
+ Line two return a particular Preset + by its name
+ Lines three to five are doing the same job as in the first aligning sequences example.

+

Aligning with custom parameters

+

1) RunnerConfig options = msaws.getRunnerOptions();
+ 2) Argument matrix = options.getArgument("MATRIX");
+ 3) matrix.setValue("PAM300");
+ 4) Argument gapopenpenalty = options.getArgument("GAPOPEN");
+ 5) gapopenpenalty.setValue("20");
+ 6) List<Argument> arguments = new ArrayList<Argument>();
+ 7) arguments.add(matrix); + arguments.add(gapopenpenalty);
+ 8) List<FastaSequence> fastalist = SequenceUtil.readFasta(new FileInputStream(file));
+ 9) String jobId = msaws.customAlign(fastalist, arguments);
+ 10) Alignment alignment = msaws.getResult(jobId);

+

Line one obtains the RunnerConfig object that holds information on supported parameters and their values
+ Line two retrieve a particular parameter from the holder by its name
+ Lines three sets a value to this parameter which will be used in the calculation.
+ Line four and five do the same but for another parameter
+ Line 6 makes a List to hold the parameters
+ Line seven puts the parameters into that list
+ Line eight + and ten is the same as in previous examples
+ Line nine submit an alignment request with the sequences and the parameters
+ The names of all the parameters supported by a web service e.g. "PAM300" can be obtained using options.getArguments() method. Further details on the methods available from RunnerConfig object are available from the javadoc.

+

Writing alignments to a file

+

There is a utility method in the client library that does exactly that.

+

Alignment alignment = align(...)
+ FileOutputStream outStream = new FileOutputStream(file);
+ ClustalAlignmentUtil.writeClustalAlignment(outStream, align);

+

A complete client example

+

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 PDF version 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 JABAWS binary client. Please make sure that the client is in the Java class path before running this example.

+
+import java.io.ByteArrayInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URL;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import compbio.data.msa.MsaWS;
+import compbio.data.sequence.Alignment;
+import compbio.data.sequence.FastaSequence;
+import compbio.data.sequence.SequenceUtil;
+import compbio.metadata.JobSubmissionException;
+import compbio.metadata.LimitExceededException;
+import compbio.metadata.Preset;
+import compbio.metadata.PresetManager;
+import compbio.metadata.ResultNotAvailableException;
+import compbio.metadata.UnsupportedRuntimeException;
+import compbio.metadata.WrongParameterException;
+
+public class Example {
+
+	/*
+	 * Input sequences for alignment
+	 */
+	static final String input = ">Foo\r\n"
+			+ "MTADGPRELLQLRAAVRHRPQDFVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAVARLGR"
+			+ "VRWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDAGQAEAAAAAYTRAHQLLPEEPYITAQ"
+			+ "LLNWRRRLCDWRALDVLSAQVRAAVAQGVGAVEPFAFLSEDASAAEQLACARTRAQAIAASVRPL"
+			+ "APTRVRSKGPLRVGFVSNGFGAHPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQA"
+			+ "STLHDVTALGHLATAKHIRHHGIDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMD"
+			+ "YVLGDAFALPPALEPFYSEHVLRLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLN"
+			+ "PQSMARMLAVLREVPDSVLWLLSGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHAD"
+			+ "LFLDTHPYNAHTTASDALWTGCPVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALAS"
+			+ "DPAALTALHARVDVLRRESGVFEMDGFADDFGALLQALARRHGWLGI\r\n"
+			+ "\r\n"
+			+ ">Bar\r\n"
+			+ "MGDTTAGEMAVQRGLALHQQRHAEAAVLLQQASDAAPEHPGIALWLHALEDAGQAEAAAAYTRAH"
+			+ "QLLPEEPYITAQLLNAVAQGVGAVEPFAFLSEDASAAESVRPLAPTRVRSKGPLRVGFVSNGFGA"
+			+ "HPTGLLTVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHG"
+			+ "IDLLFDLRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVL"
+			+ "RLQGAFQPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLL"
+			+ "SGPGEADARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGC"
+			+ "PVLTTPGETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRESGV"
+			+ "FEMDGFADDFGALLQALARRHGWLGI\r\n"
+			+ "\r\n"
+			+ ">Friends\r\n"
+			+ "MTADGPRELLQLRAAVRHRPQDVAWLMLADAELGMGDTTAGEMAVQRGLALHPGHPEAVARLGRV"
+			+ "RWTQQRHAEAAVLLQQASDAAPEHPGIALWLGHALEDHQLLPEEPYITAQLDVLSAQVRAAVAQG"
+			+ "VGAVEPFAFLSEDASAAEQLACARTRAQAIAASVRPLAPTRVRSKGPLRVGFVSNGFGAHPTGLL"
+			+ "TVALFEALQRRQPDLQMHLFATSGDDGSTLRTRLAQASTLHDVTALGHLATAKHIRHHGIDLLFD"
+			+ "LRGWGGGGRPEVFALRPAPVQVNWLAYPGTSGAPWMDYVLGDAFALPPALEPFYSEHVLRLQGAF"
+			+ "QPSDTSRVVAEPPSRTQCGLPEQGVVLCCFNNSYKLNPQSMARMLAVLREVPDSVLWLLSGPGEA"
+			+ "DARLRAFAHAQGVDAQRLVFMPKLPHPQYLARYRHADLFLDTHPYNAHTTASDALWTGCPVLTTP"
+			+ "GETFAARVAGSLNHHLGLDEMNVADDAAFVAKAVALASDPAALTALHARVDVLRRESI";
+
+	public static void main(String[] args) throws UnsupportedRuntimeException,
+			LimitExceededException, JobSubmissionException,
+			WrongParameterException, FileNotFoundException, IOException,
+			ResultNotAvailableException, InterruptedException {
+
+		String qualifiedServiceName = "http://msa.data.compbio/01/01/2010/";
+
+		/* Make a URL pointing to web service WSDL */
+		URL url = new URL(
+				"http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl");
+
+		/*
+		 * If you are making a client that connects to different web services
+		 * you can use something like this:
+		 */
+		// URL url = new URL(host + "/" + Services.ClustalWS.toString() +
+		// "?wsdl");
+
+		QName qname = new QName(qualifiedServiceName, "ClustalWS");
+		Service serv = Service.create(url, qname);
+		/*
+		 * Multiple sequence alignment interface for Clustal web service
+		 * instance
+		 */
+		MsaWS msaws = serv.getPort(new QName(qualifiedServiceName, "ClustalWS"
+				+ "Port"), MsaWS.class);
+
+		/* Get the list of available presets */
+		PresetManager presetman = msaws.getPresets();
+
+		/* Get the Preset object by preset name */
+		Preset preset = presetman
+				.getPresetByName("Disable gap weighting (Speed-oriented)");
+
+		/*
+		 * Load sequences in FASTA format from the file You can use something
+		 * like new FileInputStream() to load sequence from the file
+		 */
+		List fastalist = SequenceUtil
+				.readFasta(new ByteArrayInputStream(input.getBytes()));
+
+		/*
+		 * Submit loaded sequences for an alignment using preset. The job
+		 * identifier is returned by this method, you can retrieve the results
+		 * with it sometime later.
+		 */
+		String jobId = msaws.presetAlign(fastalist, preset);
+
+		/* This method will block for the duration of the calculation */
+		Alignment alignment = msaws.getResult(jobId);
+
+		/*
+		 * This is a better way of obtaining results, it does not involve
+		 * holding the connection open for the duration of the calculation,
+		 * Besides, as the University of Dundee public server will reset the
+		 * connection after 10 minutes of idling, this is the only way to obtain
+		 * the results of long running task from our public server.
+		 */
+		// while (msaws.getJobStatus(jobId) != JobStatus.FINISHED) {
+		// Thread.sleep(1000); // wait a second, then recheck the status
+		// }
+
+		/* Output the alignment to standard out */
+		System.out.println(alignment);
+
+		// Alternatively, you can record retrieved alignment into the file in
+		// ClustalW format
+
+		// ClustalAlignmentUtil.writeClustalAlignment(new FileOutputStream(
+		// "output.al"), alignment);
+
+	}
+}
+
+For a more detailed description of all available types and their functions please refer to the data model javadoc. +

Building web services artifacts

+

JABAWS are the standard JAX-WS SOAP web services, which are WS-I 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 client library as it provides a handful of useful methods in addition to plain data types.

+

wsimport -keep http://www.compbio.dundee.ac.uk/jabaws/ClustalWS?wsdl

+

 

JABA Web Services Internals

Testing JABA Web Services

You can use a command line client (part of the client only @@ -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 location where the log files should be stored. This is not known up until the deployment time. To enable the logging you need to -definelogDir property in the logDir property in the log4j.properties and uncomment section of the file which corresponds to your need. More information is given in the log4j.properties file @@ -625,7 +880,7 @@ pages) prog_docs -documentation for programmes that JABAWS uses +documentation for programs that JABAWS uses