EASYconsole2.m reformat

This commit is contained in:
2024-07-23 13:03:35 -04:00
parent 8a171a348c
commit cbc40c3cac

View File

@@ -1,24 +1,4 @@
%% MAIN WORKING FUNCTION: EASYconsole.m %%
%This is a 2023a Expoorted App so that it can be edited in the unfortunate
%new Matlab versions. Created by using the Matlab porting utility in 2023.
% EASYconsole is a function designed to have a variable number of inputs and
% outputs
% These were defined globally in the parent script
% global ExpOutmat
% global ExpPath
% global fhconsole
% global resDir
% global wCodeDir
% global ImParMat
% global openExpfile
% global openExppath
% global newExpfile
% global newExppath
% global SWnewExp
% global matDir
% global scan
% Launch the MATLAB EASY console
function varargout = EASYconsole(varargin)
% initialize global variables for function EASYconsole
global ExpOutmat
@@ -103,28 +83,29 @@ function EASYconsole_OpeningFcn(hObject, ~, handles, varargin)
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
end
end
%% EASYconsole OUTPUT FUNCTION %%
% Outputs from this function are returned to the command line.
function varargout = EASYconsole_OutputFcn(~, ~, handles)
% varargout--cell array for returning output args (see VARARGOUT);
% hObject--handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles--structure with handles and user data (see GUIDATA)
function varargout = EASYconsole_OutputFcn(~, ~, handles)
% Get default command line output from handles structure
varargout{1} = handles.output;
end
%% CONSOLE BUTTON INTERFACES %%
% File Button Interface
function FileMenu_Callback(~, ~, ~)
global wCodeDir
cd(wCodeDir)
returnHome
end
% Load Experiment Button Interface
function LoadExp_Callback(~, ~, ~)
global wCodeDir
cd(wCodeDir)
returnHome
end
% New Experiment Button Interface
function NewExpDat_Callback(~, ~, ~)
global newExpfile
@@ -138,45 +119,11 @@ function NewExpDat_Callback(~, ~, ~)
global fhconsole
global scan
%% RESULTS DIRECTORY CREATION %%
try
% put all users on same working directory
cd(wCodeDir)
wcode=pwd;
if ispc
returnHome
% Create a new experiment
try
% first attempt to begin search at current working directory
cd(fullfile('C:\'));
catch
% if first attempt fails, throw message box and begin the search at the PC's C drive
msgbox('Failure to find selected default Directory so starting Load search at the C Drive .');
%cd(fullfile('C:\'));
wcode
end
end
if isunix
try
name = getenv('USER');
if isequal(name,'jwrodger')
cd('/mnt/data/ExpJobs')
else
%could provide other contingency options here if desireable for other users
%if fails, just go to EASY code folder per JH
cd(wcode) %JH has argued strongly to send user to code directory
end
catch
msgbox('Failure to find selected default Directory so start Load search at root.');
cd(fullfile('/'));
end
end
if ismac
cd(wcode) %JH has argued strongly to send user to code directory
end
% CREATE NEW EXPERIMENT %
questdlg('\fontsize{20} NAME the file and NAVIGATE to the directory with the image folders.','File Creation','OK', struct('Default','OK','Interpreter','tex'));
[newExpfile,newExppath] = uiputfile(' .mat');
SWnewExp=1;
@@ -209,8 +156,6 @@ questdlg('\fontsize{20} NAME the file and NAVIGATE to the directory with the ima
scanMax= max(str2double(sl));
clear scan;
scan(scanMax)= struct(); %[]; %changed for parfor global 20_0118
%*************************************************************************
save(ExpOutmat,'scan')
% create 'PrintResults' file
@@ -242,8 +187,8 @@ if ~exist(fullfile(ExpPath,resDirName,'Fotos','BkUp'))
end
catch ME
cd(wCodeDir)
disp('Error Creating a New Experiment. Loc: EASYconsole.m Lines 106-197')
returnHome
disp('Error Creating a New Experiment')
end
% set the title for fhconsole depending on existence
@@ -253,8 +198,9 @@ else
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
end
end
%% LOAD A PREVIOUS EXPERIMENT %%
%*******LOAD Experiment Analysis directory/file structure
% Load a previous experiment
function LoadDatFile_Callback(~, ~, ~)
global openExpfile
global openExppath
@@ -267,58 +213,16 @@ global wCodeDir
global fhconsole
global ImParMat
returnHome
% TODO this entire try block needs work
try
%cd(wCodeDir)
%wcode=pwd;
%cd ..
%cd(wcode)
% put all users on same working directory
cd(wCodeDir)
wcode=pwd;
if ispc
try
% first attempt to begin search at current working directory
cd(fullfile('C:\'));
catch
% if first attempt fails, throw message box and begin the search at the PC's C drive
msgbox('Failure to find selected default Directory so starting Load search at the C Drive .');
%cd(fullfile('C:\'));
wcode
end
end
if isunix
try
name = getenv('USER');
if isequal(name,'jwrodger')
cd('/mnt/data/ExpJobs')
else
%could provide other contingency options here if desireable for other users
%if fails, just go to EASY code folder per JH
cd(wcode) %JH has argued strongly to send user to code directory
end
catch
msgbox('Failure to find selected default Directory so start Load search at root.');
cd(fullfile('/'));
end
end
if ismac
cd(wcode) %JH has argued strongly to send user to code directory
end
%****************End
%Navigation******************************************
% TODO this section is highly questionable
questdlg('\fontsize{20} Load file from ExpJobs/YourJob/YourResults/matResults','File Creation','OK', struct('Default','OK','Interpreter','tex'));
[openExpfile,openExppath] = uigetfile('.mat','Open Experiment folder and data storage .mat file name','MultiSelect','off');
SWnewExp=0;
ExpOutmat= fullfile(openExppath,openExpfile);
load(ExpOutmat);
cd(openExppath)
cd ..;
resDir=pwd;
@@ -327,14 +231,12 @@ ExpPath=pwd;
cd (wcode)
ExpPath= fullfile(ExpPath);
if isfolder(fullfile(openExppath, '..','..','1')) %If Inovation Vrobot Then
if exist(fullfile(resDir,'PTmats','NImParameters.mat'))
load(fullfile(resDir,'PTmats','NImParameters.mat'));
else
curDir=pwd;
cd(wCodeDir)
returnHome
load NImParameters.mat
cd(curDir)
end
@@ -343,7 +245,7 @@ else %If Epson 10Plate Scans Then>
load(fullfile(resDir,'PTmats','ImParameters.mat'));
else
curDir=pwd;
cd(wCodeDir)
returnHome
load ImParameters.mat
cd(curDir)
end
@@ -368,10 +270,10 @@ end
if ~exist(fullfile(resDir,'Fotos'))
mkdir(fullfile(resDir,'Fotos'));
end
catch
cd(wCodeDir)
returnHome
end
clear scan
if exist('resDir','var')&&~isempty(resDir)
@@ -381,310 +283,168 @@ else
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
end
end
%% CALLBACKS %%
% function Parameters_Callback(~, ~, ~)
% global wCodeDir
% cd(wCodeDir)
% function CFparameters_Callback(~, ~, ~)
% global wCodeDir
% cd(wCodeDir)
% function RunCF_Callback(~, ~, ~)
% global wCodeDir
% cd(wCodeDir)
% try
% CcurveFitStartup
% catch ME
% cd(wCodeDir)
% end
%
% callback for the 'Run' in the dropdown menu
function run_Callback(~, ~, ~)
global wCodeDir
try
catch ME
cd(wCodeDir)
returnHome
end
end
% function Dbase_Callback(~, ~, ~)
% global wCodeDir
% try
% catch ME
% cd(wCodeDir)
% end
% function runImAnal_Callback(~, ~, ~)
% global wCodeDir
% cd(wCodeDir)
% try
% ImStartup
% catch ME
% cd(wCodeDir)
% EASYconsole
% end
function runPlateMapPintool_Callback(~, ~, ~)
global wCodeDir
cd(wCodeDir)
returnHome
try
NImapPT
catch ME
cd(wCodeDir)
returnHome
EASYconsole
end
end
function NImCFcombo_Callback(~, ~, ~)
global wCodeDir
cd(wCodeDir)
returnHome
try
par4Gbl_Main8c
catch
cd(wCodeDir)
returnHome
EASYconsole
end
end
function runPlateImAnal_Callback(~, ~, ~)
global wCodeDir
cd(wCodeDir)
returnHome
try
NImStartupOnly
catch ME
cd(wCodeDir)
returnHome
EASYconsole
end
end
% function runCF_Callback(~, ~, ~)
% global wCodeDir
% try
% cd(wCodeDir)
% CcurveFitStartup
% catch ME
% cd(wCodeDir)
% end
function PlateCFit_Callback(~, ~, ~)
global wCodeDir
global ExpOutmat
returnHome
try
cd(wCodeDir)
NCstart
catch ME
cd(wCodeDir)
returnHome
end
end
% function Gen_CF_GenORF_Callback(~, ~, ~)
% global wCodeDir
% try
% DgenCFoutWnum
% catch ME
% cd(wCodeDir)
% EASYconsole
% end
% function ImParams_Callback(~, ~, ~)
% global wCodeDir
% try
% catch ME
% cd(wCodeDir)
% EASYconsole
% end
%*************************
% function createPTmap_Callback(~, ~, ~)
% global wCodeDir
% try
% cd(wCodeDir)
% ImapPT()
% catch ME
% cd(wCodeDir)
% end
%*************************
function GenPrintouts_Callback(~, ~, ~)
end
%
% function Gen_YXmaster_Callback(~, ~, ~)
% global wCodeDir
% try
% Dgen_YXmasterFile
% catch ME
% cd(wCodeDir)
% EASYconsole
% end
% function Gen_CurveFitOut_Callback(~, ~, ~)
% global wCodeDir
% try
% DgenLegCFout
% catch ME
% cd(wCodeDir)
% EASYconsole
% end
% function Gen_CF_withNums_Callback(~, ~, ~)
% global wCodeDir
% try
% DgenCFoutWnum
% catch ME
% cd(wCodeDir)
% EASYconsole
% end
% function Gen_CF_withNumsOrfsGenes_Callback(~, ~, ~)
% global wCodeDir
% try
% DgenCFoutWnumOrfgene
% catch ME
% cd(wCodeDir)
% EASYconsole
% end
% function Gen_CF_withNumsOrfsGenesPerts_Callback(~, ~, ~)
% global wCodeDir
% try
% DgenCFoutWnumOrfgenePertsDev
% catch ME
% cd(wCodeDir)
% EASYconsole
% end
% function zx_Callback(~, ~, ~)
function uploadExcelMP2DB_Callback(~, ~, ~)
end
% function uploadYXmaster2DB_Callback(~, ~, ~)
%
% function Gen_CF4DB_Callback(~, ~, ~)
%
%
% function Gen_CF4DB_Extras4Review_Callback(~, ~, ~)
%
%
% function uploadCF2DB_Callback(~, ~, ~)
% --------------------------------------------------------------------
function runDMPexcel_Callback(~, ~, ~)
global wCodeDir
global ExpPath
try
DMPexcel2mat_2024winLinix %DMPexcel2mat_2023winLinix
catch ME
cd(wCodeDir)
returnHome
EASYconsole
end
end
% --------------------------------------------------------------------
function runResults_DBcombo_Callback(~, ~, ~)
global wCodeDir
try
DgenResults240430 %similar but semicolons removed to restore so cmdLine display info.
%Dgen241010qhtcp %par4global -convert 1x1cell of 384cells to be like previous 1x384 cells CFparameter
catch ME
disp('Error in DgenResults240430')
cd(wCodeDir)
returnHome
EASYconsole
end
end
% --------------------------------------------------------------------
function Tools_Callback(~, ~, ~)
end
% --------------------------------------------------------------------
function runOverlayPlots_Callback(~, ~, ~)
global wCodeDir
cd(wCodeDir)
returnHome
try
DoverlayPlots2
cd(wCodeDir)
returnHome
EASYconsole
catch ME
cd(wCodeDir)
returnHome
EASYconsole
end
end
% --------------------------------------------------------------------
function runFotoStrip_Callback(~, ~, ~)
global wCodeDir
cd(wCodeDir)
returnHome
try
F_NImStartup_CentCir
cd(wCodeDir)
returnHome
EASYconsole
catch ME
cd(wCodeDir)
returnHome
EASYconsole
end
end
% --------------------------------------------------------------------
function runDisplayFig_Callback(~, ~, ~)
global wCodeDir
cd(wCodeDir)
returnHome
try
UfigDisplay
catch ME
cd(wCodeDir)
returnHome
EASYconsole
end
end
% --------------------------------------------------------------------
function runViewParameters_Callback(~, ~, ~)
global wCodeDir
cd(wCodeDir)
returnHome
try
catch ME
cd(wCodeDir)
returnHome
EASYconsole
end
end
% --------------------------------------------------------------------
function QkviewN_Callback(~, ~, ~)
global wCodeDir
cd(wCodeDir)
returnHome
try
try
cd fullfile(ExpPath)
cd(fullfile(ExpPath))
catch
if ispc cd c:\
if ispc
cd('C:\')
else
cd(fullfile('~'));
end
end
QkviewImages
catch ME
cd(wCodeDir)
returnHome
EASYconsole
end
end
% --------------------------------------------------------------------
function CFdisplay_Callback(~, ~, ~)
global wCodeDir
cd(wCodeDir)
returnHome
try
NCsingleDisplay
cd(wCodeDir)
returnHome
EASYconsole
catch ME
cd(wCodeDir)
returnHome
EASYconsole
end
end