Installation of TOUCAN web services
-----------------------------------

Note on platform dependencies: the web server can be on any platform, but the RMI services run only on a linux machine.
The RMI services have, so far, only been tested on Mandrake 10.0 official and Fedora.


Background

The TOUCAN framework consists of multiple layers:
* Layer 4 : TOUCAN GUI, run by Java Web Start. This is the client tool a users runs on his desktop computer.
* Layer 3 : Business logic on the client side
* Layer 2 : Data access layer (e.g., to Ensembl) via specific APIs or via MySQL access
* Layer 2bis : Algorithmic access layer, via SOAP (Simple Object Access Protocol). The SOAP client is part of the TOUCAN GUI, and the SOAP server runs within Tomcat (using Axis) 
               on a web server (e.g., the ESAT web server).
* Layer 1 : RMI services (Remote Method Invocation) on a server (e.g., the ESAT numbercruncher). These are Java wrappers around the standalone programs. The only function of this 
            wrapper is to communicate over the network with the SOAP server. The RMI client is part of the SOAP server class, and the RMI server is started on the numbercruncher.
* Layer 0: Standalone programs that are invoked from within a RMI service.

The mirroring of the TOUCAN services involves two main parts: (1) install the SOAP service in Tomcat and (2) start the RMI services on a numbercruncher machine that runs linux.

------------------------------------------------------------------------------------------------------------------------

Detailed installation steps:

1. Install Java somewhere on the network, for example on the webserver and on the numbercruncher. Typing "java" on the command line should give you the java options. If java is not recognized, add it to your classpath or make a symbolic link to the jre/bin/java in the /usr/bin directory.

2. Install Tomcat on your (departmental) webserver, or contact your system administrator to have Tomcat installed. You should have write permission on the webapps directory of Tomcat.
Instructions on the download and the installation of Tomcat can be found here: http://jakarta.apache.org/tomcat/
A correct (default) installation will result in the visualization of the Tomcat documentation at port 8080, e.g. http://www.esat.kuleuven.ac.be:8080

Example: 
-I've downloaded the file 5.0.28.tar.gz from http://jakarta.apache.org/site/binindex.cgi
-tar -xzvf jakarta-tomcat-5.0.28.tar.gz
-mv jakarta-tomcat-5.0.28 /var/www/ (as root)
-export JAVA_HOME=/usr/local/jdk1.5.0/
-/var/www/jakarta-tomcat-5.0.28/bin/startup.sh
-Now http://localhost:8080/ in a browser looks fine. It begins with: "If you're seeing this page via a web browser, it means you've setup Tomcat successfully. Congratulations!"

3. Make your webserver aware of Tomcat.
Unless you want to keep the :8080 in the URLs of the web services (nothing wrong with that), you can make sure that your web server automatically recognizes which requests are for Tomcat. See the Tomcat documentation on how to do this.

4. Install the Axis web application. Here is the information: http://ws.apache.org/axis/java/install.html
A correct installation will result in an axis directory in Tomcat's webapps directory, and a display of Apache-Axis at http://localhost:8080/axis/

Example:
- Downloaded Version 1.1 Binary - tar.gz from http://ws.apache.org/axis/download.cgi
- tar -xzvf axis-1_1.tar.gz
- cp -r axis-1_1/webapps/axis /var/www/jakarta-tomcat-5.0.28/webapps/
- now the URL http://localhost:8080/axis/ displays Apache-Axis

5. Install the TOUCAN SOAP Service. 
Extract the toucan_services package. Make sure the directory (chmod 755) and the files.tab and matrixnames.tab files (chmod 644) have the right access privileges. 
Edit the SOAP/ToucanSOAPService.jws file and change the adress of the RMI server and the local file path (point to the toucan/services/ directory. See below for information on the RMI services. The RMI server can be any machine in your network, including the web server itself.
Now simply put the ToucanSOAPService.jws file under the axis dir in Tomcat. 

Example: 
- public final String RMI_SERVER = "//localhost:8081/"; (Note that in this example I will run the RMI services on the same machine, namely the localhost, as the webserver). AND make sure that there is no package definition in this Java file. Otherwise it won't work. 
- cp ToucanSOAPService.jws /var/www/jakarta-tomcat-5.0.28/webapps/axis
- The SOAP server needs a number of Java libraries. Copy all the jars in the distribution into the axis/WEB-INF/lib directory.
- cp --reply=no jars/*.jar /var/www/jakarta-tomcat-5.0.28/webapps/axis/WEB-INF/lib/ (remove file
- now in a browser: http://localhost:8080/axis/ToucanSOAPService.jws displays "There is a Web Service. Click here to see the WSDL". Now you should see an XML file.

6. Start the RMI services.
Login to the (numbercruncher) server where you want to perform all the calculations. To minimize the loading of the web server, this should ideally be a separate machine. 
Edit the shell script RMI/startrmi_toucan:
- Set the TOUCAN_SRV_HOME environment variable to the directory where you unpacked the distribution

Now run the script, providing the server name (or IP) as only parameter. This will start the rmiregistry and all the individual services.

Example: ./startrmi_toucan //10.33.123.161:8081


7. The programs are in the bin directory. 
The perl scripts require the following perl libraries to be installed:
- bioperl
- ensembl (ensembl modules, ensembl-external modules, and ensembl-compara modules)
- math CDF (http://search.cpan.org/~callahan/Math-CDF-0.1/)
- DBI and DBD

Set the perl libraries paths: (add your local perl5 libs [with bioperl, ensembl, etc.] and the toucan services perl/lib)
export PERL5LIB=${PERL5LIB}:/usr/lib/perl5/vendor_perl/5.8.2/:${TOUCAN_SRV_HOME}/perl/lib:

Edit the perl scripts and change the use lib lines to the proper paths.
The executable programs should run on linux.

8. The ModuleScanner uses MySQL databases, created by scoring "the genome" with the MotifScanner, for example all human-mouse conserved non-coding sequences scored with the Jaspar or 
Transfac library. The data (to be loaded into your local MySQL database) can be downloaded here: , and the database specifications (name, user, password, etc.) have to be specified in the ToucanSOAPService.jws in Tomcat.
The MySQL server, together with login/passwd information is encoded within the file ToucanSOAPService.jws. MySQL 
can be obtained from http://www.mysql.com. 


9. Testing.
Start TOUCAN and run some services with the new service URL (e.g., localhost:8080/axis/ToucanSOAPService.jws)

10. Make sure you send an email to stein.aerts@med.kuleuven.ac.be with the exact service URLs, so that they can be included in the TOUCAN properties.

Thank you!
The TOUCAN team.