Commit 9e08f7b4 authored by Gael  MILLOT's avatar Gael MILLOT
Browse files

v1.0.0 release test

parent c18e7112
#### DESCRIPTION
Project 12231 submitted by Lars Rogge, Institut Pasteur, Paris, France
Perfom Limma and Random forest analysis using a discovery cohorte of patient (for model building) and using a validation cohorte for validating the model.
Dedicated to SLURM (TARS CLuster) analysis
#### LICENCE
This package of scripts can be redistributed and/or modified under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details at https://www.gnu.org/licenses.
#### CREDITS
Vincent Rouilly, Institut Pasteur, Paris, France
Vincent Guillemot, Hub-C3BI, Institut Pasteur, USR 3756 IP CNRS, Paris, France
Gael A. Millot, Hub-C3BI, Institut Pasteur, USR 3756 IP CNRS, Paris, France
#### HOW TO USE IT
Download the desired Tagged version, never the current master.
Open rogge_12231.conf
Set the parameters
Start the job using a command like:
STARTTIME_SH=$(date) ; JOB_ID_SH=$(date -d "$STARTTIME_SH" +%s) ; sh /pasteur/homes/gmillot/rogge12231/rogge_12231_workflow.sh | tee /pasteur/homes/gmillot/rogge12231/${JOB_ID_SH}_workflow_log
#### FILE DESCRIPTIONS
rogge_12231.conf config file. Parameters need to be set by the user inside this file before running
rogge_12231_workflow.sh file allowing checkings and SLURM job submission
rogge_12231_whole_VGVR.R R script run by SLURM
The three files must be in the same directory before running
#### WEB LOCATION
Check for updated versions (most recent tags) at https://gitlab.pasteur.fr/gmillot/rogge_12231/tags
#### WHAT'S NEW IN
## v1.0.0
Everything
#!/bin/bash # shebang (#! https://en.wikipedia.org/wiki/Shebang_%28Unix%29) indicating to the shell what program to interpret the script with, when executed, probably optional here.
# export allow the variable to be use in subprocesses. Without export, the variable is only available in the current process. Example ANNOVAR_CONF=/bioinfo/local/build/annovar_20130729 instead of export ANNOVAR_CONF=/bioinfo/local/build/annovar_20130729
# _conf: lowercases for alias and scripts, and uppercases for variables
# never use PATH as a variable
#_______________________________________________________________________________________________
# SOFTWARES (LOCALS OR IN MODULES)
shopt -s expand_aliases # to be sure that alias are expended to the different environments
alias R_conf='module load gcc/4.7.4 R/3.5.0 ; Rscript'
# alias R_conf='/pasteur/homes/gmillot/softwares/R/R-3.5.2/lib64/R/bin/Rscript'
#_______________________________________________________________________________________________
# SCRIPTS TO RUN
export r_main_functions_conf=/pasteur/homes/gmillot/Git_versions_to_use/cute_little_R_functions-v4.5.0/cute_little_R_functions.R
export bash_main_functions_conf=/pasteur/homes/gmillot/Git_versions_to_use/little_bash_functions-v1.0.0/little_bash_functions-v1.0.0.sh
# export r_ini_check_conf=/pasteur/homes/gmillot/rogge12231/rogge_12231_ini.R
export r_main_conf=/pasteur/homes/gmillot/rogge12231/rogge_12231_whole_VGVR.R
#_______________________________________________________________________________________________
# GENERAL PARAMETERS
#_______________________________________________________________________________________________
# R PARAMETERS
################ locations
PATH_LIB_CONF="/pasteur/homes/gmillot/R/x86_64-pc-linux-gnu-library/3.5/" # absolute path of the library folder. Write "" if not required
PATH_IN_CONF="/pasteur/homes/gmillot/rogge12231/" # absolute path of the data folder
PATH_OUT_CONF="/pasteur/homes/gmillot/rogge12231/" # absolute path of the output folder
PATH_FUNCTION1_CONF="/pasteur/homes/gmillot/Git_versions_to_use/cute_little_R_functions-v4.5.0/" # Define the absolute pathway of the folder containing functions created by Gael Millot
################ File name
FILE_NAME1_CONF="supplementary_data_file_test.csv" # name of the data file to import
NAME_SOURCE_FILE1_CONF="cute_little_R_functions.R"
################ loop & bootstrap
ML_BOOTSTRAP_NB_CONF=3
LOOP_NB_CONF=3
################ other
PROJECT_NAME_CONF="rogge_12231"
################ graphical parameters
R_PDF_DISPLAY_CONF="TRUE" # will be converted in the R script
R_OPT_TXT_CONF="notxt"
#_______________________________________________________________________________________________
# SLURM PARAMETERS
MAX_RUNNING_TIME_CONF=359 # in minutes. If 0, min no max time. Acceptable time formats include "minutes", "minutes:seconds", "hours:minutes:seconds", "days-hours", "days-hours:minutes" and "days-hours:minutes:seconds"
NB_CPU_PER_TASK_CONF=1 # -c option
MEM_PER_CPU_CONF=5G # --mem-per-cpu option: 1G, 500M, etc.
MAIL_CONF="gael.millot@pasteur.fr"
DEDICATED_CONF="hubbioit" # -p option of sbatch: hubbioit or common
QOS_CONF="hubbioit" # --qos option of sbatch: hubbioit for -p "hubbioit" or fast, normal or long for -p "common"
# DEDICATED_CONF="common" # -p option of sbatch: dedicated or common
# QOS_CONF="fast" # --qos option of sbatch: hubbioit for -p "dedicated" or fast, normal or long for -p "common"
################ INITIALIZATION
#!/bin/bash
# echo -e "\nJOB COMMAND EXECUTED:\n$0\n" # to get the line that executes the job but does not work (gives /bioinfo/guests/gmillot/Gael_code/workflow_fastq_gael.sh)
# BEWARE: double __ is a reserved character string to deal with spaces in paths
module purge
LOCAL_USER_VAR= # empty variable that will be used to recover the name of all the variables created here
LANG=en_us_8859_1 # to use for the correct use of the date function
INI_POSITION=$(pwd)
LOCAL_USER_VAR+=" LANG INI_POSITION" # do not forget the space before the variable name
shopt -s expand_aliases # to be sure that alias are expended to the different environments
# set -e # stop the workflow if a command return something different from 0 in $?. Use set -ex to have the blocking line. It is important to know that each instruction executed send a result in $? Either 0 (true) or something else (different from 0)
################ SCRIPT NAME RECOVERY
SCRIPT_USED=$0 # SCRIPT_USED="" or SCRIPT_USED= (it is the same) produce an empty variable. SCRIPT_USED=`echo "$@"` keep only the options, not the .sh before the options ($0).
for i in $@ ; do
SCRIPT_USED="$SCRIPT_USED $i"
done
SCRIPT_USED=$(echo $SCRIPT_USED | sed 's/\ /__/g') # replace space by 2 underscores in SCRIPT_USED
LOCAL_USER_VAR+=" SCRIPT_USED" # do not forget the space before the variable name
################ FUNCTIONS
function verif_fun {
if [[ $1 = -* ]]; then
((OPTIND--))
fi
}
function single_path_with_regex_fun { # comes from little_bash_functions-v1.0.0/little_bash_functions-v1.0.0.sh
# DESCRIPTION
# check that $1 path exists and is single
# BEWARE
# do not use set -e !
# ARGUMENTS
# $0: name of the function
# $1: first argument, ie path with regex
# RETURN OUTPUT
# 0: single path detected is valid
# 1: error: $1 not provided
# 2: error: $2 provided or more than one path detected
# 3: single path detected does not exist
# EXAMPLES
# single_path_with_regex_fun /cygdrive/c/Users/Gael/Desktop/config_tars_lodscore_gael_2017121[[:digit:]].conf
# single_path_with_regex_fun /pasteur/homes/gmillot/dyslexia/code_gael/config_tars_lodscore_gael_2017121[[:digit:]].conf
# argument checking
if [[ -z $1 ]] ; then
echo -e "\n### ERROR ### ARGUMENT 1 REQUIRED IN single_path_with_regex_fun\n"
return 1
fi
# main code
if [[ ! -z $2 ]] ; then
echo -e "\n### ERROR ###\n1) AT LEAST ARGUMENT 2 PRESENT IN single_path_with_regex_fun WHILE ONLY ONE REQUIRED OR\n2) REGEX PATH RESULT IN SEVERAL RESULTS:\n$@\n"
return 2
fi
local ARG1="$1"
# echo $ARG1 # print ARG1
local ARG1_ARR=("$ARG1") # conversion to array (split acccording to space). If no corresponding regexp, keep $1 with regexp and length = 1
# echo ${ARG1_ARR[@]} # print the array
local ARG1_ARR_LENGTH=$(( ${#ARG1_ARR[@]} - 1 )) # total number of elements in the array
# echo "LENGTH: $ARG1_ARR_LENGTH" # print the length of the array
if [[ $ARG1_ARR_LENGTH != 0 ]] ; then
echo -e "\n### ERROR ### SPECIFIED REGEXP PATH IN single_path_with_regex_fun CORRESPOND TO MORE THAN ONE PATH: ${ARG1_ARR_LENGTH[@]}\n";
return 2
else
shopt -s extglob # -s unable global extention, ie the recognition of special global pattern in path, like [[:digit:]]
if [[ ! ( -d ${ARG1_ARR[0]} || -f ${ARG1_ARR[0]} ) ]] ; then
echo -e "\n### ERROR ### SPECIFIED PATH IN single_path_with_regex_fun DOES NOT EXISTS: ${ARG1_ARR[0]}\n";
shopt -u extglob # -u disable global extention, ie the recognition of special global pattern in path, like [[:digit:]]
return 3
else
shopt -u extglob # -u disable global extention, ie the recognition of special global pattern in path, like [[:digit:]]
return 0
fi
fi
}
function var_existence_check_fun { #comes from little_bash_functions-v1.0.0/little_bash_functions-v1.0.0.sh
# DESCRIPTION
# check that $1 variable exists
# $0: name of the function
# $1: first argument, ie variable name without $
# BEWARE
# do not use set -e !
# RETURN OUTPUT
# 0: variable is detected in the environment
# 1: error: $1 not provided
# 2: error: $2 provided or more than one path detected
# 3: variable does not exist
# EXAMPLES
#
# argument checking
if [[ -z $1 ]] ; then
echo -e "\n### ERROR ### ARGUMENT 1 REQUIRED IN var_existence_check_fun\n"
return 1
fi
# main code
if [[ ! -z $2 ]] ; then
echo -e "\n### ERROR ###\n1) AT LEAST ARGUMENT 2 PRESENT IN var_existence_check_fun WHILE ONLY ONE REQUIRED OR\n2) REGEX PATH RESULT IN SEVERAL RESULTS:\n$@\n"
return 2
fi
ARG1=$(echo $1)
ARG2=$(echo ${!ARG1}) # double because I need to know if the content of $(echo $1) is "" (echo return "" when does not exist)
if [[ -z "$ARG2" ]] ; then # test if $ARG1 is ""
return 3
else
return 0
fi
}
################ STARTING TIME JOB & JOB ID
STARTTIME=$(date)
JOB_ID=$(date -d "$STARTTIME" +%s)
LOCAL_USER_VAR+=" STARTTIME JOB_ID" # do not forget the space before the variable name
echo -e "\n----WORKFLOW JOB ${JOB_ID}----\n"
echo -e "PROCESS IGNITION START TIME:" $STARTTIME "\n"
TEMPO_SCRIPT_USED=$(echo $SCRIPT_USED | sed 's/__/\ /g') # replace 2 underscores by space in SCRIPT_USED
echo -e "SCRIPT USED: $TEMPO_SCRIPT_USED\n"
echo -e "SCRIPT LOCAL LANGUAGE USED: $LANG\n"
echo -e "JOB ID: $JOB_ID\n"
################ COMMAND DEFINITION
# http://stackoverflow.com/questions/255898/how-to-iterate-over-arguments-in-bash-script
usage () {
cat << EOF
USAGE: `basename $0` -c config_file.conf -K ini_check
OPTIONS:
-h help
-c name and path of the config .conf file. Optional if rogge_12231.conf is in /pasteur/homes/gmillot/rogge12231/
-V sbatch --export local variable option. Declare here supplemental variables that will be used in the process.sh file (other than defined in the previous options)
-K --running_operation
'ini_check' - check the initial parameters and files
'running' - run the analysis
Optional (default: perform everything). Separate arguments using comma
-r --remove_tm_files logical option: Remove temporary files ? Only 0 or 1 admitted. Default true (0).
EX1: `basename $0` -p ~/process.sh -K ini_check,running
EOF
}
while getopts ":hc:V:K:r:" OPTION ; do
# add : after the option name to specify that something is required (-h has nothing required after)
# the first : before h is to induce getopts switching to "silent error reporting mode" (disable annoying messages).
case $OPTION in
h) usage; exit 1 ;;
c) verif_fun $OPTARG ; CONFIG_FILE=$OPTARG ;;
V) verif_fun $OPTARG ; SUP_VAR=$OPTARG ;;
K) verif_fun $OPTARG ; RUNNING_OP=$OPTARG ;;
r) verif_fun $OPTARG ; REMOVE_TMP=$OPTARG ;;
\?) echo -e "### ERROR ### INVALID OPTION: - $OPTARG\n" ; usage; exit 1;;
:) echo "### ERROR ### OPTION -$OPTARG REQUIRES AN ARGUMENT\n" >&2 usage; exit 1;;
esac
done
shift $((OPTIND-1))
LOCAL_USER_VAR+=" CONFIG_FILE PROCESS_FILE SUP_VAR RUNNING_OP REMOVE_TMP" # do not forget the space before the variable name
################ CHECK
if [[ -z $RUNNING_OP ]]; then
RUNNING_OP="ini_check,running"
else
if [[ ! $RUNNING_OP =~ ini_check|running ]]; then
echo -e "\n### ERROR ### -K OPTION WITH INVALID ARGUMENT. ONLY ini_check, running AUTHORIZED: $RUNNING_OP\n"
usage
exit 1
else
echo -e "FOLLOWING OPERATIONS WILL BE EXECUTED (-K OPTION): $RUNNING_OP\n"
fi
fi
######## CONF FILE CHECKING
if [[ ! -z $CONFIG_FILE ]] ; then
if [[ ! -f $CONFIG_FILE ]]; then
echo -e "\n### ERROR ### -c OPTION (config file) MISSING AT THE INDICATED PATH: $CONFIG_FILE\n"
usage
exit 1
fi
else
CONFIG_FILE=/pasteur/homes/gmillot/rogge12231/rogge_12231.conf
single_path_with_regex_fun $CONFIG_FILE
TEMPO_RETURN_1=$(echo $?) # test space
if [[ $TEMPO_RETURN_1 == 1 || $TEMPO_RETURN_1 == 2 ]]; then
echo -e "\n### ERROR ### -PROBLEM WITH THE single_path_with_regex_fun FUNCTION\n"
exit 1
elif [[ $TEMPO_RETURN_1 == 3 ]]; then
echo -e "\n### ERROR ### -c OPTION (config file): $CONFIG_FILE NOT PRESENT IN `dirname $CONFIG_FILE`\n"
usage
exit 1
elif [[ $TEMPO_RETURN_1 == 0 ]]; then
CONFIG_FILE=$(echo $CONFIG_FILE) # to remove regex in the path
else
echo -e "\n### ERROR ### PROBLEM WITH THE single_path_with_regex_fun FUNCTION: RETURN IS OTHER THAN 0-3 VALUES\n"
exit 1
fi
fi
source $CONFIG_FILE
#### check the files and variables necessary for the process .sh file
# TOOLS
for i in "R_conf" ; do
if [[ ! $(type -t $i) == "alias" ]] ; then
echo -e "\n### ERROR ### $i ALIAS NOT AVAILABLE IN THE GLOBAL ENVIRONMENT: CHECK IN ${CONFIG_FILE}\n"
usage
exit 1
else
echo -e "$i ALIAS FROM ${CONFIG_FILE} DETECTED IN THE GLOBAL ENVIRONMENT"
fi
done
CONF_SCRIPTS=(
# SCRIPTS
"r_main_functions_conf"
"bash_main_functions_conf"
"r_main_conf"
)
conf_scripts_Num=$(( ${#CONF_SCRIPTS[@]} - 1 )) # total number of elements in the array
LOCAL_USER_VAR+=" CONF_SCRIPTS conf_scripts_Num " # do not forget the space before the variable name
CONF_PATH=(
# R PARAMETERS - locations
"PATH_LIB_CONF"
"PATH_IN_CONF"
"PATH_OUT_CONF"
"PATH_FUNCTION1_CONF"
)
conf_path_Num=$(( ${#CONF_PATH[@]} - 1 )) # total number of elements in the array
LOCAL_USER_VAR+=" CONF_PATH conf_path_Num" # do not forget the space before the variable name
CONF_VAR_CHECK=(
# R PARAMETERS
"FILE_NAME1_CONF"
"NAME_SOURCE_FILE1_CONF"
"ML_BOOTSTRAP_NB_CONF"
"LOOP_NB_CONF"
"PROJECT_NAME_CONF"
"R_OPT_TXT_CONF"
"R_PDF_DISPLAY_CONF"
# SLURM PARAMETERS
"MAX_RUNNING_TIME_CONF"
"NB_CPU_PER_TASK_CONF"
"MEM_PER_CPU_CONF"
"MAIL_CONF"
"DEDICATED_CONF"
"QOS_CONF"
# SCRIPTS
$(echo ${CONF_SCRIPTS[@]})
# R PARAMETERS - locations
$(echo ${CONF_PATH[@]})
)
conf_var_check_Num=$(( ${#CONF_VAR_CHECK[@]} - 1 )) # total number of elements in the array
LOCAL_USER_VAR+=" CONF_VAR_CHECK conf_var_check_Num" # do not forget the space before the variable name
# verif presence of the conf variables
for ((i=0; i<=$conf_var_check_Num; i++)); do
var_existence_check_fun ${CONF_VAR_CHECK[$i]}
TEMPO_RETURN_1=$(echo $?) # test space
if [[ $TEMPO_RETURN_1 == 1 || $TEMPO_RETURN_1 == 2 ]]; then
echo -e "\n### ERROR ### -PROBLEM WITH THE var_existence_check_fun FUNCTION\n"
exit 1
elif [[ $TEMPO_RETURN_1 == 3 ]]; then
echo -e "\n### ERROR ### ${CONF_VAR_CHECK[$i]} VARIABLE IS NECESSARY. CHECK THE config_tars_workflow.conf FILE\n"
exit 1
elif [[ $TEMPO_RETURN_1 == 0 ]]; then
shopt -s extglob # -s unable global extention, ie the recognition of special global pattern in path, like [[:digit:]]
echo -e "${CONF_VAR_CHECK[$i]} CORRECTLY DETECTED IN config_tars_workflow.conf FILE: ${!CONF_VAR_CHECK[$i]}"
shopt -u extglob # -u disable global extention, ie the recognition of special global pattern in path, like [[:digit:]]
else
echo -e "\n### ERROR ### PROBLEM WITH THE var_existence_check_fun FUNCTION: RETURN IS OTHER THAN 0-3 VALUES\n"
exit 1
fi
done
# verif presence of the special conf variables
for ((i=0; i<=$conf_scripts_Num; i++)); do
TEMPO_FILE_NAME=${CONF_SCRIPTS[$i]}
# echo "TEMPO_FILE_NAME IS: $TEMPO_FILE_NAME"
single_path_with_regex_fun $(echo ${!TEMPO_FILE_NAME})
TEMPO_RETURN_2=$(echo $?) # test space
if [[ $TEMPO_RETURN_2 == 1 || $TEMPO_RETURN_2 == 2 ]]; then
echo -e "\n### ERROR ### -PROBLEM WITH THE single_path_with_regex_fun FUNCTION\n"
exit 1
elif [[ $TEMPO_RETURN_2 == 3 ]]; then
shopt -s extglob # -s unable global extention, ie the recognition of special global pattern in path, like [[:digit:]]
echo -e "\n### ERROR ### PROBLEM WITH $TEMPO_FILE_NAME PARAMETER VALUE NOT CORRECT $(echo ${!TEMPO_FILE_NAME})\nCHECK THE $CONFIG_FILE FILE\n"
shopt -u extglob # -u disable global extention
exit 1
elif [[ $TEMPO_RETURN_2 == 0 ]]; then
shopt -s extglob # -s unable global extention, ie the recognition of special global pattern in path, like [[:digit:]]
echo -e "THE $TEMPO_FILE_NAME FUNCTION IMPORTED IS $(echo ${!TEMPO_FILE_NAME})"
export $TEMPO_FILE_NAME=$(echo ${!TEMPO_FILE_NAME}) # to remove regex in the path
shopt -u extglob # -u disable global extention
else
echo -e "\n### ERROR ### PROBLEM WITH THE single_path_with_regex_fun FUNCTION: RETURN IS OTHER THAN 0-3 VALUES\n"
exit 1
fi
done
echo -e "\n"
#### end check the files and variables necessary for the process .sh file
source $bash_main_functions_conf
# files below necessary for the process .sh file
for i in "show_time_fun" ; do
if [[ ! $(type -t $i) == "function" ]] ; then
echo -e "\n### ERROR ### $i FUNCTION NOT AVAILABLE IN THE GLOBAL ENVIRONMENT: CHECK IN ${CONFIG_FILE}\n"
usage
exit 1
else
echo -e "$i FUNCTION FROM ${CONFIG_FILE} DETECTED IN THE GLOBAL ENVIRONMENT"
fi
done
echo -e "\n"
################ END CHECK
################ sbatch PARAMETERS
if [[ ! -z $SUP_VAR ]] ; then
if [[$SUP_VAR =~ CONFIG_FILE|$CONFIG_FILE|PROCESS_FILE|$PROCESS_FILE|SUP_VAR|RUNNING_OP|REMOVE_TMP ]] ; then
echo -e "\n### ERROR ### VARIABLE(S) $SUP_VAR DECLARED IN -V SHOULD BE OR ALREADY DECLARED IN -d, -o, -c, -V -K -r\n"
usage
exit 1
fi
else
SUP_VAR=""
fi
RUNNING_OP_EXPORT=$(echo $RUNNING_OP | sed 's/,/_._/g') # replace comma by _._ , Important because when imported into sbatch variables, commas are not considered and everything behind is skipped
SUP_VAR="SCRIPT_USED=$SCRIPT_USED,CONFIG_FILE=$CONFIG_FILE,RUNNING_OP=$RUNNING_OP_EXPORT,REMOVE_TMP=$REMOVE_TMP"
################ END sbatch PARAMETERS
################ sbatch LOOP
OUTPUT_DIR_PATH_tempo="${PATH_OUT_CONF}${PROJECT_NAME_CONF}_${JOB_ID}"
mkdir ${OUTPUT_DIR_PATH_tempo}
LOCAL_USER_VAR+=" OUTPUT_DIR_PATH_tempo" # do not forget the space before the variable name
for i in `seq 1 $LOOP_NB_CONF` ; do
OUTPUT_DIR_PATH_tempo2="${OUTPUT_DIR_PATH_tempo}/loop$i/"
mkdir ${OUTPUT_DIR_PATH_tempo2}
SUP_VAR_tempo="$SUP_VAR,OUTPUT_DIR_PATH_tempo2=$OUTPUT_DIR_PATH_tempo2,i=$i"
echo -e '#!/bin/sh
# write the previous line exactly like this, with no comments, otherwise do not work
source $CONFIG_FILE # never forget this because another environment
# next line cannot be put outside (which would have been convenient -> put into the SUP_VAR_tempo for display. But SUP_VAR_tempo for sbatch do not like spaces)
R_PROC="R_conf ${r_main_conf} $PATH_LIB_CONF $PATH_IN_CONF ${OUTPUT_DIR_PATH_tempo2} $PATH_FUNCTION1_CONF $FILE_NAME1_CONF $NAME_SOURCE_FILE1_CONF $ML_BOOTSTRAP_NB_CONF $PROJECT_NAME_CONF $R_PDF_DISPLAY_CONF $R_OPT_TXT_CONF $i"
R_PROC2="${R_PROC} &> ${OUTPUT_DIR_PATH_tempo2}r_console_messages.txt" # or "$R_PROC > ${OUTPUT_DIR_PATH_tempo2}r_console_messages.txt 2>&1" # to add the estderror in the stdout
eval "$R_PROC2"
' | sbatch -p $DEDICATED_CONF --qos $QOS_CONF --time $MAX_RUNNING_TIME_CONF -c $NB_CPU_PER_TASK_CONF --mem-per-cpu $MEM_PER_CPU_CONF -J job_$i --mail-type END,FAIL --mail-user $MAIL_CONF --export $SUP_VAR_tempo | tee -a ${OUTPUT_DIR_PATH_tempo2}/loop${i}_${PROJECT_NAME_CONF}_slurm_jobID.txt # write all th echo from the $PROC alaso into a log file
# tricky part of this sbatch because the SUP_VAR_tempo will be used in the script piped to sbatch
done
LOCAL_USER_VAR+=" SUP_VAR_tempo" # do not forget the space before the variable name
################ END MAIN CODE
################ LANDING
echo -e "\nALL CHECKS OK: PROCESS ENGAGED......................\n"
STOPTIME=$(date)
LOCAL_USER_VAR+=" STOPTIME" # do not forget the space before the variable name
echo -e "PROCESS END TIME:" $STOPTIME
echo -e "JOB LAPSE TIME: " $(show_time_fun $(($(date -d"$STOPTIME" +%s) - $(date -d"$STARTTIME" +%s)))) # +%s to print the date in seconds
SCRIPT_USED=$(echo $SCRIPT_USED | sed 's/__/\ /g') # replace 2 underscores by space in SCRIPT_USED
echo -e "\n\nVARIABLES USED:\n"
# echo $LOCAL_USER_VAR
IFS=' ' read -ra LOCAL_USER_VAR2 <<< "$LOCAL_USER_VAR" # system that split a character string into an array according to different delimiters (here space)
unset IFS # set IFS back to ist default value
for j in $(seq 0 $(( ${#LOCAL_USER_VAR2[@]} - 1 )) ) ; do # use echo $LOCAL_USER_VAR[@]} to see all the arry and echo ${#LOCAL_USER_VAR[@]} to have the length of the arry
if [[ ${LOCAL_USER_VAR2[$j]} =~ alias ]] ; then
type ${LOCAL_USER_VAR2[$j]}
else
echo -e "${LOCAL_USER_VAR2[$j]}: $(echo "${!LOCAL_USER_VAR2[$j]}")" # $(eval ${LOCAL_USER_VAR2[$i]})" ;
fi
done
echo -e "\n\n"
cd $INI_POSITION
module purge
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment