From d77711acb7b61473e2b0b5931dc7baef14c45827 Mon Sep 17 00:00:00 2001 From: Bryan Roessler Date: Sat, 27 Jul 2024 03:14:39 -0400 Subject: [PATCH] EASY refactor --- workflow/templates/easy/DgenResults.m | 9 ++------- workflow/templates/easy/EASYconsole.m | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/workflow/templates/easy/DgenResults.m b/workflow/templates/easy/DgenResults.m index dfc76fb4..8247fcfc 100755 --- a/workflow/templates/easy/DgenResults.m +++ b/workflow/templates/easy/DgenResults.m @@ -52,13 +52,8 @@ end % localscansDir=scansDir; % end -expNm=scansDir(max(strfind(scansDir,'\'))+1:end); -drivePos=min(strfind(scansDir,'\')); -elseif (isunix || ismac) - expNm=scansDir(max(strfind(scansDir,'/'))+1:end); - drivePos=min(strfind(scansDir,'/')); -end - +expNm=scansDir(max(strfind(scansDir,'/'))+1:end); +drivePos=min(strfind(scansDir,'/')); drive=scansDir(1:(drivePos-1)); DBupload=fullfile(drive,'EZdbFiles','DBupLOADfiles'); diff --git a/workflow/templates/easy/EASYconsole.m b/workflow/templates/easy/EASYconsole.m index 229a01a9..4353468f 100644 --- a/workflow/templates/easy/EASYconsole.m +++ b/workflow/templates/easy/EASYconsole.m @@ -50,7 +50,7 @@ function varargout = EASYconsole(varargin) scansDir=sortedDirs{1}; disp('Beginning in newest project scans directory'); disp(strcat('Using scans directory: ', scansDir, ' from hardcoded default')); - disp('This usually indicates that we are in stand-alone mode'); + disp('This usually indicates that we are in stand-alone mode without PROJECT or SCANS_DIR environment variables'); end % If we don't have the EASY_SUFFIX from the module, generate it from scansDir @@ -93,22 +93,22 @@ function varargout = EASYconsole(varargin) disp(strcat('Using EASY script directory: ', easyDir, ' from hardcoded default')); end - if exist('EASY_RESULTS_DIR', 'env') && ~isempty(getenv('EASY_RESULTS_DIR')) - easyResultsDir=fullfile(get_env('EASY_RESULTS_DIR')); - disp(strcat('Using project prefix: ', easyResultsDir, ' from environment variable EASY_RESULTS_DIR')) - else - easyResultsDirName=strcat('Results_',todayStr,'_',easySuffix); - easyResultsDir=fullfile(scansDir,easyResultsDirName); - scansDir=fullfile(parent_dir,'ExpJobs'); % relative to easy script dir - disp(strcat('Using project prefix: ', PROJECT_PREFIX, ' from environment variable PROJECT_PREFIX')) - end - if exist('PROJECT_USER', 'env') && ~isempty(getenv('PROJECT_USER')) if get_env('PROJECT_USER') ~= userName % sanity check disp("WARNING: PROJECT_USER does not match the current namespace"); end end + if exist('EASY_RESULTS_DIR', 'env') && ~isempty(getenv('EASY_RESULTS_DIR')) + easyResultsDir=fullfile(get_env('EASY_RESULTS_DIR')); + disp(strcat('Using output directory: ', easyResultsDir, ' from environment variable EASY_RESULTS_DIR')) + else + easyResultsDirName=strcat('Results_',todayStr,'_',userName,'_',easySuffix); + easyResultsDir=fullfile(scansDir,easyResultsDirName); + + disp(strcat('Using output directory: ', PROJECT_PREFIX, ' from environment variable PROJECT_PREFIX')) + end + if exist('MASTER_PLATE_FILE', 'env') && ~isempty(getenv('MASTER_PLATE_FILE')) masterPlateFile=fullfile(get_env('MASTER_PLATE_FILE')); disp(strcat('Using drug media file: ', masterPlateFile, ' from environment variable MASTER_PLATE_FILE'))