###############
# Prerequisite
###############

A) Biomaj Workflow
   ---------------
   External tools used by Biomaj configured in /etc/biomaj/general.conf :

   GNU Tar 1.13 or higher ( http://www.gnu.org/software/tar/tar.html) 
   Gzip 1.3.3 or higher (http://www.gzip.org/) 
   Bzip2 0.9.0 or higher (http://sources.redhat.com/bzip2/) 
   Tar, Gzip, and Bzip2 are only needed if you need to extract files that use those compression formats. 


   The following list needs more attention :

   Java 1.6.x or higher ( http://java.sun.com/j2se/) 
   Ant 1.7.0 or higher ( http://ant.apache.org/) 

B) Post-processes
   --------------
            
   The post-processes are available in the conf/process directory
   of this package. Please note, that some packages may require some third-parity tools :

	- perl 5.8.x
	- ncbi blast  ftp.ncbi.nih.gov:/blast/executables/LATEST ==> formatdb & fastcmd programs
	- srs ==> 
	- readseq ==> http://iubio.bio.indiana.edu/soft/molbio/readseq/

###############
# BioMAJ Configuration
###############

If you already have BioMAJ installed, skip to MIGRATION section.
Otherwise, see INSTALL file.

##############
# BmajWatcher Configuration
##############

BmajWatcher is a web interface for banks administration.

With a tomcat server (shipped tomcat is in $BIOMAJ_ROOT/apache-tomcat-6.0.24):
	* Copy BmajWatcher.war in <TOMCAT>/webapps/ (Already done with shipped tomcat)
	* Make a symbolic link in <TOMCAT>/lib named biomaj.jar to $BIOMAJ_ROOT/lib/biomaj.jar
	* Start the server (<TOMCAT>/bin/startup.sh)
	* Edit BmajWatcher.xml in <TOMCAT>/conf/Catalina/localhost/
		
		Set the right values for the following mandatory parameters :
		
		<Parameter name="BIOMAJ_ROOT" value="" override="false"/>
		=> $BIOMAJ_ROOT
		
		<Parameter name="JOBS_LOCATION" value="" override="false"/>
		=> Absolute path to directory that contains jobs.xml and jobs.xsd. By default they are located in BmajWatcher root directory.
		   You can change it so that they remain unchanged if you update the .war. 
		
		<Parameter name="ADMIN_LOGIN" value="admin" override="false"/>
		=> The admin login
		
		
	* Create a file named BmajWatcher#logs.xml in <TOMCAT>conf/Catalina/localhost/ with the following content :
	
		<Context docBase="<log.dir>" debug="0" privileged="true">
		</Context>
		=> log.dir : Absolute path to the directory that contains the banks logs. Defined in $BIOMAJ_ROOT/general.conf
	

################
# MIGRATION
################

*** Biomaj Watcher ***


1. Update <TOMCAT>/webapps/BmajWatcher.war : replace it with new BmajWatcher.war
2. Move configuration files:
	2.1. Move <TOMCAT>/webapps/BmajWatcher/jobs.xml and jobs.xsd in $BIOMAJ_ROOT or any other directory outside of BmajWatcher/
	2.2. Move <TOMCAT>/webapps/BmajWatcher/processDescription.properties outside of BmajWatcher/ if you modified it.
3. Remove <TOMCAT>/webapps/BmajWatcher/ directory
4. Update <TOMCAT>/conf/Catalina/localhost/BmajWatcher.xml : Add following parameters:
	<Parameter name=\"ADMIN_LOGIN\" value=\"admin\" override=\"false\"/>
	<Parameter name=\"JOBS_LOCATION\" value=\"<absolute path to jobs.xml/jobs.xsd directory>\" override=\"false\"/>"
5. Start server
6. Move back processDescription.properties if needed


*** Biomaj ***

- From biomaj <= 1.0

1. Import data from the xml statefiles into the database.
A script is provided to do so:
$BIOMAJ_ROOT/bin/import_statefiles.sh --dir someDir
$BIOMAJ_ROOT/bin/import_statefiles.sh --files bank1.xml bank2.xml ...

2. Run $BIOMAJ_ROOT/bin/migration.sh


- From biomaj 1.1.0
Run $BIOMAJ_ROOT/bin/migration.sh


###################
# USEFUL COMMANDS
###################

a) HELP :

    biomaj --help

b) Start update for alu bank :

    biomaj --update alu

c) Rebuild a bank (rerun the post-processes) :

    biomaj --rebuild alu

c) Status of the data repository

    biomaj --status

d) Status of a bank :

    biomaj --status <bank>

########################
# COMPLETE DOCUMENTATION 
#######################

BiomajWatcher specific doc : $BIOMAJ_ROOT/doc/BW_userguide.pdf
Biomaj general doc : $BIOMAJ_ROOT/doc/UsersGuide_BioMAJ_EN.pdf

