#!/usr/bin/perl
use strict;
use Env;

##########################################################################################
#                                                                                        #
#  Project     :  SCRATCH-1D                                                             #
#  Release     :  1.1                                                                    #
#                                                                                        #
#  File        :  check_project_profile.pl                                               #
#  Description :  Checks the environment variables needed to run SCRATCH-1D              #
#                                                                                        #
#  Author(s)   :  Christophe Magnan (cmagnan@ics.uci.edu)                                #
#  Copyright   :  Institute for Genomics and Bioinformatics                              #
#                 University of California, Irvine                                       #
#                                                                                        #
#  Modified    :  2015/07/02                                                             #
#                                                                                        #
##########################################################################################

# Log Messages
my $script_name="check_project_profile.pl"; my $m="[$script_name]";

# Checking Installation Folder
my $root_dir=$ENV{"SCRATCH1D_ROOT_DIR"};
my $lib_dir=$ENV{"SCRATCH1D_LIB_DIR"};
my $tmp_dir=$ENV{"SCRATCH1D_TMP_DIR"};
if(! -d "$root_dir"){ print "$m installation folder not found.\n"; exit 1; }
if(! -d "$lib_dir"){ print "$m lib folder not found.\n"; exit 1; }
if(! -d "$tmp_dir"){ print "$m tmp folder not found.\n"; exit 1; }

# Checking Project Dependencies - PROFILpro
my $profilpro_dir=$ENV{"PROFILpro_INSTALL_DIR"};
my $profilpro_exe=$ENV{"PROFILpro_GET_PROFILES"};
if(! -d "$profilpro_dir"){ print "$m PROFILpro installation folder not found.\n"; exit 1; }
if(! -f "$profilpro_exe"){ print "$m PROFILpro bin scripts not found.\n"; exit 1; }

# Checking Project Dependencies - SSpro
my $sspro_dir=$ENV{"SSpro_INSTALL_DIR"};
my $sspro_exe=$ENV{"SSpro_RUN_PREDICTOR"};
if(! -d "$sspro_dir"){ print "$m SSpro installation folder not found.\n"; exit 1; }
if(! -f "$sspro_exe"){ print "$m SSpro bin scripts not found.\n"; exit 1; }

# Checking Project Dependencies - SSpro8
my $sspro8_dir=$ENV{"SSpro8_INSTALL_DIR"};
my $sspro8_exe=$ENV{"SSpro8_RUN_PREDICTOR"};
if(! -d "$sspro8_dir"){ print "$m SSpro8 installation folder not found.\n"; exit 1; }
if(! -f "$sspro8_exe"){ print "$m SSpro8 bin scripts not found.\n"; exit 1; }

# Checking Project Dependencies - ACCpro
my $accpro_dir=$ENV{"ACCpro_INSTALL_DIR"};
my $accpro_exe=$ENV{"ACCpro_RUN_PREDICTOR"};
if(! -d "$accpro_dir"){ print "$m ACCpro installation folder not found.\n"; exit 1; }
if(! -f "$accpro_exe"){ print "$m ACCpro bin scripts not found.\n"; exit 1; }

# Checking Project Dependencies - ACCpro20
my $accpro20_dir=$ENV{"ACCpro20_INSTALL_DIR"};
my $accpro20_exe=$ENV{"ACCpro20_RUN_PREDICTOR"};
if(! -d "$accpro20_dir"){ print "$m ACCpro20 installation folder not found.\n"; exit 1; }
if(! -f "$accpro20_exe"){ print "$m ACCpro20 bin scripts not found.\n"; exit 1; }

# Checking Project Dependencies - HOMOLpro
my $homolpro_dir=$ENV{"HOMOLpro_INSTALL_DIR"};
my $homolpro_exe=$ENV{"HOMOLpro_ADD_HOMOLOGY"};
if(! -d "$homolpro_dir"){ print "$m HOMOLpro installation folder not found.\n"; exit 1; }
if(! -f "$homolpro_exe"){ print "$m HOMOLpro bin scripts not found.\n"; exit 1; }

