#!/bin/bash

# Check if java-based TabixReader would have missed any rows from a catalog because of the tabix bug in the old Java-based version 

# exits with a non-zero return code if any part of script fails
set -e
_bior_check_java_version
set +e

#
#  Usage checked in java program: bior_count_catalog_misses -c <CATALOG_TO_CHECK> [ -o <OUTPUT_FILE> --fixed ]
#
# NOTE: Script requires 3 jars. These are picked up by including $BIOR_LITE_HOME/lib in the classpath. They are:
#       bior_pipeline-XXXXXX.jar
#		htsjdk-1.143.jar
#		samtools-1.5.6.jar
# 


# Fix for excessive virtual memory usage
# newer glibc will allocate 64MB per thread
# this will limit 64MB to all threads for a process
export MALLOC_ARENA_MAX=1


class_path="$BIOR_LITE_HOME/lib/*:."
#echo "Executing script with classpath value: $class_path"

java -cp $class_path -Xmx2000m edu.mayo.bior.catalog.misses.TabixReaderTest $*
exitStatus=$?

exit $exitStatus
