#!/bin/bash -

#
# This script will start Bam View on a UNIX system.
#

QUIET=no

APPLICATION_PROPERTIES="-Djdbc.drivers=org.postgresql.Driver -Dartemis.environment=UNIX $SANGER_ARTEMIS_OPTIONS"

#
# "-mx2g" sets the maximum amount of memory to use. 
# This may need to be increased when dealing with large files
#
if [[ "$ARTEMIS_JVM_FLAGS" = "" ]]
then
    FLAGS="-mx2g -ms100m -noverify"
else
    FLAGS="$ARTEMIS_JVM_FLAGS -noverify"
fi

if [[ "$QUIET" = "no" ]]
then
    echo "Starting BamView with arguments: $FLAGS $APPLICATION_PROPERTIES $*"
fi

java $FLAGS $APPLICATION_PROPERTIES -jar /usr/share/java/bamview.jar $*
result=$?

exit $result
