Switch from SCANS_DIR to PROJECT_SCANS_DIR to avoid collision
This commit is contained in:
@@ -45,15 +45,15 @@ function varargout = EASYconsole(varargin)
|
|||||||
scansDir=getenv('PROJECT');
|
scansDir=getenv('PROJECT');
|
||||||
fprintf('Using project path: %s from environment variable PROJECT\n', scansDir);
|
fprintf('Using project path: %s from environment variable PROJECT\n', scansDir);
|
||||||
disp('This usually indicates that we are in standalone mode');
|
disp('This usually indicates that we are in standalone mode');
|
||||||
elseif exist('SCANS_DIR', 'var') && ~isempty(getenv('SCANS_DIR'))
|
elseif exist('PROJECT_SCANS_DIR', 'var') && ~isempty(getenv('PROJECT_SCANS_DIR'))
|
||||||
scansDir=getenv('SCANS_DIR');
|
scansDir=getenv('PROJECT_SCANS_DIR');
|
||||||
fprintf('Using scans directory: %s from environment variable SCANS_DIR\n', scansDir);
|
fprintf('Using scans directory: %s from environment variable PROJECT_SCANS_DIR\n', scansDir);
|
||||||
disp('This usually indicates that we are in module mode');
|
disp('This usually indicates that we are in module mode');
|
||||||
else
|
else
|
||||||
% TODO Lots of this is hardcoded logic, this TODO is just a reminder to change this block
|
% TODO Lots of this is hardcoded logic, this TODO is just a reminder to change this block
|
||||||
% when changing EASY and other variables in the parent script
|
% when changing EASY and other variables in the parent script
|
||||||
fprintf('Beginning parent scans directory search\n');
|
fprintf('Beginning parent scans directory search\n');
|
||||||
fprintf('This usually indicates that we are in stand-alone mode without PROJECT or SCANS_DIR environment variables\n');
|
fprintf('This usually indicates that we are in stand-alone mode without PROJECT or PROJECT_SCANS_DIR environment variables\n');
|
||||||
dirsToScan={
|
dirsToScan={
|
||||||
fullfile(parentDir,'..', '..', 'scans'),
|
fullfile(parentDir,'..', '..', 'scans'),
|
||||||
fullfile(parentDir, '..', '..', 'ExpJobs'),
|
fullfile(parentDir, '..', '..', 'ExpJobs'),
|
||||||
|
|||||||
@@ -406,10 +406,10 @@ init_project() {
|
|||||||
|
|
||||||
# We handle this in main() and pushd to it
|
# We handle this in main() and pushd to it
|
||||||
# But do it one more time in case this is run as a module
|
# But do it one more time in case this is run as a module
|
||||||
[[ -d $SCANS_DIR ]] ||
|
|
||||||
( mkdir -p "$SCANS_DIR" && pushd "$SCANS_DIR" || return 1 )
|
ask "Initialize a project at $PROJECT_SCANS_DIR?" || return 1
|
||||||
|
|
||||||
ask "Initialize a project at $SCANS_DIR?" || return 1
|
[[ -d $PROJECT_SCANS_DIR ]] || (mkdir -p "$PROJECT_SCANS_DIR" || return 1)
|
||||||
|
|
||||||
# Write skeleton files in csv
|
# Write skeleton files in csv
|
||||||
# If we have to convert to xlsx later, so be it
|
# If we have to convert to xlsx later, so be it
|
||||||
@@ -425,7 +425,7 @@ init_project() {
|
|||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# TODO here we'll copy scan from robot but for now let's pause and wait for transfer
|
# TODO here we'll copy scans from robot but for now let's pause and wait for transfer
|
||||||
read -r -p "Hit <Enter> to continue: "
|
read -r -p "Hit <Enter> to continue: "
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -585,25 +585,25 @@ easy() {
|
|||||||
# TODO will need to play with the -sd startup option to see what works (well)
|
# TODO will need to play with the -sd startup option to see what works (well)
|
||||||
# Skip this step altogether in auto mode since it requires graphical interaction
|
# Skip this step altogether in auto mode since it requires graphical interaction
|
||||||
if ! ((YES)) && ask "Start EASY in MATLAB? This requires a GUI."; then
|
if ! ((YES)) && ask "Start EASY in MATLAB? This requires a GUI."; then
|
||||||
export SCANS_DIR PROJECT_DATE EASY_DIR PROJECT_USER EASY_NAME EASY_SUFFIX EASY_RESULTS_DIR MASTER_PLATE_FILE DRUG_MEDIA_FILE
|
export PROJECT_SCANS_DIR PROJECT_DATE EASY_DIR PROJECT_USER EASY_NAME EASY_SUFFIX EASY_RESULTS_DIR MASTER_PLATE_FILE DRUG_MEDIA_FILE
|
||||||
echo "Hit enter to use the default EASY results directory $SCANS_DIR/Results_${PROJECT_PREFIX}_($PROJECT_SUFFIX)"
|
echo "Hit enter to use the default EASY results directory $PROJECT_SCANS_DIR/Results_${PROJECT_PREFIX}_($PROJECT_SUFFIX)"
|
||||||
(( YES )) || read -r -p "Or enter a custom suffix: " suffix
|
(( YES )) || read -r -p "Or enter a custom suffix: " suffix
|
||||||
EASY_RESULTS_DIR="$SCANS_DIR/Results_${PROJECT_PREFIX}_${suffix:-$PROJECT_SUFFIX}"
|
EASY_RESULTS_DIR="$PROJECT_SCANS_DIR/Results_${PROJECT_PREFIX}_${suffix:-$PROJECT_SUFFIX}"
|
||||||
while [[ -d $EASY_RESULTS_DIR ]]; do
|
while [[ -d $EASY_RESULTS_DIR ]]; do
|
||||||
count=1
|
count=1
|
||||||
if [[ $count -eq 1 ]] && ask "$EASY_RESULTS_DIR already exists, increment dir name (y) or overwrite (N)?"; then
|
if [[ $count -eq 1 ]] && ask "$EASY_RESULTS_DIR already exists, increment dir name (y) or overwrite (N)?"; then
|
||||||
EASY_SUFFIX="${suffix:-$PROJECT_SUFFIX}.$((count++))"
|
EASY_SUFFIX="${suffix:-$PROJECT_SUFFIX}.$((count++))"
|
||||||
EASY_RESULTS_DIR="$SCANS_DIR/Results_${PROJECT_PREFIX}_${EASY_SUFFIX}"
|
EASY_RESULTS_DIR="$PROJECT_SCANS_DIR/Results_${PROJECT_PREFIX}_${EASY_SUFFIX}"
|
||||||
else
|
else
|
||||||
EASY_SUFFIX=${suffix:-$PROJECT_SUFFIX}
|
EASY_SUFFIX=${suffix:-$PROJECT_SUFFIX}
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
EASY_SUFFIX=${EASY_SUFFIX:-$suffix:-$PROJECT_SUFFIX}
|
EASY_SUFFIX=${EASY_SUFFIX:-$suffix:-$PROJECT_SUFFIX}
|
||||||
EASY_NAME="${PROJECT_PREFIX}_${EASY_SUFFIX}"
|
EASY_NAME="${PROJECT_PREFIX}_${EASY_SUFFIX}"
|
||||||
EASY_RESULTS_DIR="$SCANS_DIR/Results_$EASY_NAME"
|
EASY_RESULTS_DIR="$PROJECT_SCANS_DIR/Results_$EASY_NAME"
|
||||||
[[ -d $SCANS_DIR/MasterPlateFiles ]] || mkdir -p "$SCANS_DIR/MasterPlateFiles"
|
[[ -d $PROJECT_SCANS_DIR/MasterPlateFiles ]] || mkdir -p "$PROJECT_SCANS_DIR/MasterPlateFiles"
|
||||||
DRUG_MEDIA_FILE="$SCANS_DIR/MasterPlateFiles/DrugMedia_$PROJECT.xls"
|
DRUG_MEDIA_FILE="$PROJECT_SCANS_DIR/MasterPlateFiles/DrugMedia_$PROJECT.xls"
|
||||||
MASTER_PLATE_FILE="$SCANS_DIR/MasterPlateFiles/MasterPlate_$PROJECT.xls"
|
MASTER_PLATE_FILE="$PROJECT_SCANS_DIR/MasterPlateFiles/MasterPlate_$PROJECT.xls"
|
||||||
|
|
||||||
# Make EASY dirs
|
# Make EASY dirs
|
||||||
debug "mkdir -p $EASY_RESULTS_DIR"
|
debug "mkdir -p $EASY_RESULTS_DIR"
|
||||||
@@ -618,12 +618,12 @@ easy() {
|
|||||||
|
|
||||||
# Launch matlab
|
# Launch matlab
|
||||||
matlab -nosplash -r "run $script"
|
matlab -nosplash -r "run $script"
|
||||||
# matlab -nosplash -sd "$SCANS_DIR" -r "run $script"
|
# matlab -nosplash -sd "$PROJECT_SCANS_DIR" -r "run $script"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Use the function return code see if we succeeded
|
# Use the function return code see if we succeeded
|
||||||
get_easy_results "$SCANS_DIR" || return 1
|
get_easy_results "$PROJECT_SCANS_DIR" || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -775,7 +775,7 @@ qhtcp() {
|
|||||||
unset STUDY_DIR
|
unset STUDY_DIR
|
||||||
|
|
||||||
# Replacing ExpFrontend.m
|
# Replacing ExpFrontend.m
|
||||||
get_easy_results "$SCANS_DIR" || (err "No EASY results found in $SCANS_DIR"; return 1)
|
get_easy_results "$PROJECT_SCANS_DIR" || (err "No EASY results found in $PROJECT_SCANS_DIR"; return 1)
|
||||||
|
|
||||||
# Set the right results directory
|
# Set the right results directory
|
||||||
# TODO eventually we could run this on multiple results dirs simultaneously with some refactoring
|
# TODO eventually we could run this on multiple results dirs simultaneously with some refactoring
|
||||||
@@ -783,7 +783,7 @@ qhtcp() {
|
|||||||
# In automatic mode just choose the first OUT DIR in the list
|
# In automatic mode just choose the first OUT DIR in the list
|
||||||
EASY_RESULT_DIR="${EASY_RESULTS_DIRS[0]}" # TODO right now just choose
|
EASY_RESULT_DIR="${EASY_RESULTS_DIRS[0]}" # TODO right now just choose
|
||||||
else
|
else
|
||||||
echo "Multiple EASY results dirs found in $SCANS_DIR"
|
echo "Multiple EASY results dirs found in $PROJECT_SCANS_DIR"
|
||||||
echo "Here is a list: "
|
echo "Here is a list: "
|
||||||
for (( i=0; i<${#EASY_RESULTS_DIRS[@]}; i++ )); do
|
for (( i=0; i<${#EASY_RESULTS_DIRS[@]}; i++ )); do
|
||||||
printf "%d. %s\n" "$((i+1))" "${EASY_RESULTS_DIRS[i]}"
|
printf "%d. %s\n" "$((i+1))" "${EASY_RESULTS_DIRS[i]}"
|
||||||
@@ -808,7 +808,7 @@ qhtcp() {
|
|||||||
# Trying to match old ExpFrontend formatting
|
# Trying to match old ExpFrontend formatting
|
||||||
printf "%s\t" \
|
printf "%s\t" \
|
||||||
"${DATE//_/}" "$PROJECT" "$QHTCP_PROJECT_DIR" "Exp$s" \
|
"${DATE//_/}" "$PROJECT" "$QHTCP_PROJECT_DIR" "Exp$s" \
|
||||||
"$PROJECT_DATE" "$SCANS_DIR" "$EASY_RESULT_DIR" "${f##*/}" \
|
"$PROJECT_DATE" "$PROJECT_SCANS_DIR" "$EASY_RESULT_DIR" "${f##*/}" \
|
||||||
>> "$STUDIES_ARCHIVE_FILE"
|
>> "$STUDIES_ARCHIVE_FILE"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
@@ -1407,8 +1407,8 @@ submodule get_easy_results # lol
|
|||||||
# TODO: Standardize EASY output, it's hard to understand
|
# TODO: Standardize EASY output, it's hard to understand
|
||||||
# @exitcode 0 if at least one results directory exists
|
# @exitcode 0 if at least one results directory exists
|
||||||
# @exitcode 1 if no results directories exist
|
# @exitcode 1 if no results directories exist
|
||||||
# @set EASY_RESULTS_DIRS array Globbed results files from SCANS_DIR/
|
# @set EASY_RESULTS_DIRS array Globbed results files from PROJECT_SCANS_DIR/
|
||||||
# @set EASY_RESULTS_FILES array Globbed results files from SCANS_DIR/
|
# @set EASY_RESULTS_FILES array Globbed results files from PROJECT_SCANS_DIR/
|
||||||
# @arg $1 string Project scans (ExpJobs)
|
# @arg $1 string Project scans (ExpJobs)
|
||||||
get_easy_results() {
|
get_easy_results() {
|
||||||
debug "Running: ${FUNCNAME[0]}"
|
debug "Running: ${FUNCNAME[0]}"
|
||||||
@@ -1534,7 +1534,7 @@ main() {
|
|||||||
|
|
||||||
# Loop over projects
|
# Loop over projects
|
||||||
for PROJECT in "${PROJECTS[@]}"; do
|
for PROJECT in "${PROJECTS[@]}"; do
|
||||||
SCANS_DIR="$SCANS/$PROJECT"
|
PROJECT_SCANS_DIR="$SCANS/$PROJECT"
|
||||||
PROJECT_DATE="${PROJECT%"${PROJECT#????????}"}" # e.g. 20240723
|
PROJECT_DATE="${PROJECT%"${PROJECT#????????}"}" # e.g. 20240723
|
||||||
PROJECT_SUFFIX="${PROJECT#????????_*_}"
|
PROJECT_SUFFIX="${PROJECT#????????_*_}"
|
||||||
PROJECT_USER="${PROJECT#????????_}"; PROJECT_USER="${PROJECT_USER%%_*}"
|
PROJECT_USER="${PROJECT#????????_}"; PROJECT_USER="${PROJECT_USER%%_*}"
|
||||||
|
|||||||
Reference in New Issue
Block a user