Some header work

This commit is contained in:
2024-08-01 16:06:47 -04:00
parent e012065641
commit 2545eff4ab
3 changed files with 99 additions and 69 deletions

View File

@@ -30,7 +30,7 @@ if ~exist(masterPlateFile, 'file') || isempty(masterPlateFile)
% This can be silent, not really an error
end
for i=1:5 % give users 5 chances to get it right
try
% For standalone mode
% GUI input for selecting a MasterPlate Excel file
@@ -53,9 +53,7 @@ if ~exist(masterPlateFile, 'file') || isempty(masterPlateFile)
disp('Rerunning directory selection');
% I don't know what else we'll need to do here
end
end
else
for i=1:5 % give users 5 chances to get it right
try
% For standalone mode
% GUI input for selecting a MasterPlate Excel file
@@ -80,7 +78,6 @@ if ~exist(masterPlateFile, 'file') || isempty(masterPlateFile)
% I don't know what else we'll need to do here
end
end
end
else
fprintf('Using MasterPlate file: %s skipping directory selection\n', masterPlateFile);
end

View File

@@ -448,8 +448,7 @@ end
function runResults_DBcombo_Callback(~, ~, ~)
try
DgenResults %similar but semicolons removed to restore so cmdLine display info.
%Dgen241010qhtcp %par4global -convert 1x1cell of 384cells to be like previous 1x384 cells CFparameter
DgenResults
catch ME
fprintf('Error in DgenResults: %s\n', ME.message);
EASYconsole

View File

@@ -299,11 +299,46 @@ print_header() {
EOF
cat <<-EOF
Available modules: ${ALL_MODULES[*]}
Available submodules: ${ALL_SUBMODULES[*]}
EOF
echo "Using scans directory: $SCANS_DIR"
echo "Change the SCANS_DIR environment variable to override"
echo "Example: SCANS_DIR=/path/to/scans ./qhtcp-workflow"
echo ""
echo "Using output directory: $OUT_DIR"
echo "Change the out_DIR environment variable to override"
echo "Example: SCANS_DIR=/path/to/scans OUT_DIR=/path/to/out ./qhtcp-workflow"
echo ""
shopt -s nullglob
projects=("$SCANS_DIR"/*/)
shopt -u nullglob
echo "Available Projects:"
for i in "${!projects[@]}"; do
printf "%d. %s\n" "$((i+1))" "${projects[i]}"
done
echo "Available Modules:"
for i in "${!ALL_MODULES[@]}"; do
printf "%d. %s\n" "$((i+1))" "${ALL_MODULES[i]}"
done
echo ""
echo "Available Submodules:"
for i in "${!ALL_SUBMODULES[@]}"; do
printf "%d. %s\n" "$((i+1))" "${ALL_SUBMODULES[i]}"
done
last_index=$(( ${#ALL_MODULES} - 1 ))
read -r -p "Enter a comma deliminated list of modules to run: " response1
IFS=',' read -ra MODULES <<< "$response1"
last_index=$(( ${#ALL_SUBMODULES} - 1 ))
read -r -p "Enter the item number to select EASY results directory, default ($last_index): " response2
IFS=',' read -ra SUBMODULES <<< "$response2"
# cat <<-EOF
# Available modules: ${ALL_MODULES[*]}
# Available submodules: ${ALL_SUBMODULES[*]}
# EOF
}
@@ -618,13 +653,13 @@ easy() {
script="$EASY_DIR/EASYconsole.m"
# Prompt user for suffix
echo "Using default EASY results directory: $EASY_RESULTS_DIR"
((YES)) || read -r -p "Enter a custom suffix and/or hit enter to use the default (no suffix): " EASY_SUFFIX
echo "Using EASY results directory: $EASY_RESULTS_DIR"
((YES)) || read -r -p "Enter a custom suffix and/or hit enter to use the default directory (no suffix): " EASY_SUFFIX
[[ -n $EASY_SUFFIX ]] && EASY_RESULTS_DIR+="_$EASY_SUFFIX"
# This dirname is separate from the project's so multiple EASY results can be generated
declare -gx EASY_PROJECT_NAME="${EASY_RESULTS_DIR##*/}"
debug "EASY results output name: $EASY_PROJECT_NAME"
debug "EASY results project name: $EASY_PROJECT_NAME"
# Backup and create EASY results dirs
[[ -d $EASY_RESULTS_DIR ]] && backup "$EASY_RESULTS_DIR"
@@ -1498,19 +1533,19 @@ documentation() {
main() {
debug "Running: ${FUNCNAME[0]}" "$@"
# Where are we
# Some global vars
SCRIPT=$(realpath -s "${BASH_SOURCE[0]}")
SCRIPT_DIR=$(dirname "$SCRIPT")
print_header
# Global directory variables
declare -g TEMPLATES_DIR="$SCRIPT_DIR/templates"
APPS_DIR="$SCRIPT_DIR/apps"
DATE="$(date +%Y%m%d)" # change in EASYconsole.m to match
# scans_heirarchy=("./scans" "/mnt/data/scans" "/mnt/data/ExpJobs" "./scans")
local scans_heirarchy=( "$SCANS_DIR" "./scans" "/mnt/data/scans" "./scans") # TODO change back for production, avoid actual scan dirs during testing
TEMPLATES_DIR="$SCRIPT_DIR/templates"
PROJECT_USER="$(whoami)"
DATE="$(date +%Y%m%d)" # change in EASYconsole.m to match 'hardcode'
# Find a scans directory
# TODO change back for production, avoid actual scan dirs during testing
# local scans_heirarchy=("./scans" "/mnt/data/scans" "/mnt/data/ExpJobs" "./scans")
local scans_heirarchy=( "$SCANS_DIR" "./scans" "/mnt/data/scans" "./scans")
[[ -z $SCANS_DIR ]] && for d in "${scans_heirarchy[@]}"; do
if [[ -d $d ]]; then
declare -g SCANS_DIR="$d"
@@ -1525,10 +1560,8 @@ main() {
exit 1;
fi
fi
echo "Using scans directory: $SCANS_DIR"
echo "Change the SCANS environment variable to override"
echo "Example: SCANS=/path/to/scans ./qhtcp-workflow"
# Find an output directory
local out_heirarchy=("$(dirname "$SCANS_DIR")/out" "$SCRIPT_DIR/out" "/mnt/data/out")
for d in "${out_heirarchy[@]}"; do
if [[ -d $d ]]; then
@@ -1545,17 +1578,18 @@ main() {
debug "mkdir $SCRIPT_DIR/out"
mkdir "$SCRIPT_DIR/out"
else
err "No output directory, but attempting to continue..."
err "No output directory, attempting to continue..."
fi
fi
# Set the automatic project directory prefix
PROJECT_USER="$(whoami)"
PROJECT_PREFIX="${DATE}_${PROJECT_USER}" # reversed these so easier to sort and parse date
sanitize_pn() { [[ $1 =~ [0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]_.+_.+ ]]; } # sanitizer regex for prefix
declare -a PROJECTS=() # this array will hold all of the projects for this run
print_header
parse_input "$@" # parse arguments with getopt
# Prompt user for the PROJECT if we still don't have one