#! /bin/sh
##
## Usage:
##     run-mysql $1 $2 $3 $4 $5 $6 $7 $8
##
## $1 = host machine for MySQL server
## $2 = MySQL database name
## $3 = MySQL userid
## $4 = password for userid
## $5 = path to directory containing input files
## $6 = version of source database 
## $7 = release date of the source database
## $8 = optional; port to communicate with MySQL server

ENZYME=$5/ligand/enzyme
COMPOUND=$5/ligand/compound
REACTION=$5/ligand/reaction
GENES=$5/genes
GENOME=$5/genome
export ENZYME COMPOUND GENES GENOME

port=3306; export port
if [ "$8" != "" ]
  then port=$7
fi

./mysql-kegg-loader -h $1 -b $2 -u $3 -p $4 -v $6 -r $7 -t $port -o $GENOME -g $GENES -c $COMPOUND -x $REACTION -e $ENZYME
