#!/usr/bin/python


import os
import sys
import shutil
import re
import optparse
import os.path

from bcv import git_version

# =============================================================================
#
#                               PREAMBLE
#
# =============================================================================

def parse_commandline():
        """
        Parse the options given on the command-line.
        """
        parser = optparse.OptionParser(usage = __doc__,version=git_version.verbose_msg)

        parser.add_option("-p", "--path",help="Path to analysis directory.",default = '')
	parser.add_option("-t", "--tolerance",help="Cluster tolerance.",default = 4)

        opts, args = parser.parse_args()
        return opts

# =============================================================================
#
#                                    Main
#
# =============================================================================
def main():
        ## parse the command line
        opts = parse_commandline()
	path = opts.path
	tol = int(opts.tolerance)

	cmd = 'source inputfiles/MatlabSetup_R2008a_glnxa64.sh; list_analyze %s %d'%(path,tol)
	print cmd	

        os.system(cmd)

if __name__ == "__main__":
    main()

