#!/bin/sh
  

## simple script to execute java with the appropriate options to run snpEff
## Change JAVA_CMD to the location of your java binary if necessary
##
## edeveaud, copied from mauve.sh  (c) 2003 Aaron Darling


JAVA_CMD="java"
DIR="/opt/gensoft/exe/beast-mcmc/10.5.0-beta4/libexec"
JAVA_ARGS="-Djava.library.path=/opt/gensoft/exe/beast-mcmc/10.5.0-beta4/lib:${BEAGLELIB_ROOT}/lib"
JAVA_OPTS=${BEAST_MCMC_JAVA_OPTS:--Xms64m -Xmx2048m}

JAR=beast
RUNNER=-cp
EXTRA=''

PROG=$(basename $0)
if [[ ${PROG} = beast ]]
then 
    EXTRA="dr.app.beast.BeastMain"; 
fi

if [[ ${PROG} = beauti ]]
then 
    RUNNER=-jar
    JAR=beauti
fi

if [[ ${PROG} = loganalyser ]]
then
    EXTRA="dr.app.tools.LogAnalyser"
fi

if [[ ${PROG} = logcombiner ]] 
then
    EXTRA="dr.app.tools.logcombiner.LogCombiner"
fi

if [[ ${PROG} = treeannotator ]] 
then
    EXTRA="dr.app.tools.treeannotator.TreeAnnotator"
fi

if [[ ${PROG} = treestat ]] 
then
    JAR=beast; 
    EXTRA="dr.app.treestat.TreeStatApp"
fi

#echo $JAVA_CMD $JAVA_OPTS $JAVA_ARGS ${RUNNER} ${DIR}/${JAR}.jar ${EXTRA} ${1+"$@"}
$JAVA_CMD $JAVA_OPTS $JAVA_ARGS ${RUNNER} ${DIR}/${JAR}.jar ${EXTRA} ${1+"$@"}

