Code covered by the BSD License  

Highlights from
FRETSCAL

image thumbnail

FRETSCAL

by

 

For the FRET analysis of images of yeast cells labeled with YFP and CFP.

fretscal
function fretscal
%Version 1/5/11
%Important section for initial setup are lines 36-66!
%Sets up the Graphical User Interface.
%Has 4 pull down menus for:
%1)choosing the files to process and their description
%2)choosing the limits that will be used for the initial screening and culling
%3)allowing the user to walk through and inspect the images
%4)setting up the output.
%Each menu item calls a function to process the request. The functions are
%other .m files.
%The current settings are displayed in 3 blue text boxes. These are
%constantly updated as changes are made.
%A green text box is presented as a strip along the top that updates the
%screening process.

clear all%clears memory
close all % clears any figures

global dirsep h_fig h_menu_summary
global initialdone culldone inspectdone finaldone
global initials culls inspects finals
global m1f m1b m2f m2b m3f m3b m4f m4b m5f m5b darkgreen lightgreen
global platform fontpics progbarcol
global sourcedirectory startdirectory homedirectory inputdirectory outputdirectory

darkgreen = [ 0 .7 .7 ];
lightgreen = [.9 .95 .9];
m1f = 'black'; m1b = 'black';  % note: backgroundcolor doesn't work on uimenu entries
m2f = 'black'; m2b = 'blue';
m3f = 'white'; m3b = 'blue';
m4f = 'black'; m4b = 'green';  % For the progress bar
m5f = 'black'; m5b = 'white';  % For text responses
platform = computer;
dirsep = filesep;
%CHANGE THE DIRECTORY PATH FOR FRETSCAL.
%Lines 46-66 may need to be customized for your installation.
%The exact lines that need to be changed depend on the host computer.
%Find your computer and replace "eric" with the name of the user account 
%If the fretscal folder is placed inside the Matlab program's root local directory, i.e. within 
%...Matlab>toolbox>local, then this section can be left alone. 
if exist(fullfile(matlabroot,'toolbox','local','fretscal'),'dir')> 0
     cd (fullfile(matlabroot,'toolbox','local'));
     sourcedirectory = fullfile(matlabroot,'toolbox','local','fretscal')
     homedirectory = pwd
% Find your OS and make changes in that section
elseif strcmp( platform(1:2),'PC')
    platform = 'PC';
%For Windows XP
    if exist('C:\Documents and Settings\eric\My Documents\MATLAB\fretscal','dir')>0;
        cd ('C:\Documents and Settings\eric\My Documents\MATLAB')%Windows XP
        sourcedirectory = ('C:\Documents and Settings\Eric Muller\My Documents\MATLAB\fretscal')
        homedirectory = pwd
%For Windows 7 or Windows Vista
    elseif exist('C:\users\eric\Documents\MATLAB\fretscal','dir')> 0;
        cd ('C:\users\eric\Documents\MATLAB')%Vista or Windows 7
        sourcedirectory = ('C:\users\eric\Documents\MATLAB\fretscal')
        homedirectory = pwd
    end
% For Mac's change this section
elseif( strcmp( platform(1:3), 'MAC' ) )
    platform = 'MAC';
    if exist ('users/eric/Documents/MATLAB/fretscal','dir')> 0;
    cd('users/eric/Documents/MATLAB');
    sourcedirectory =('/users/eric/Documents/MATLAB/fretscal');
    homedirectory = pwd
    end
% For Linux change this section
elseif strcmp( platform(1:3),'GLN')
    platform = 'Linux';
    if exist ('/home/eric/MATLAB/fretscal','dir')> 0
    cd ('/home/eric/MATLAB')
    sourcedirectory = ('/home/eric/MATLAB/fretscal')
    homedirectory = pwd
    end
end;
startdirectory = homedirectory;
if(exist(fullfile(homedirectory,'prefs.txt'),'file')) ~= 0
    settings = sprintf('%s%sprefs.txt', homedirectory, dirsep );
    freadlast(settings, 1);
else
    fprintf( 1, 'Reading setup from Fretscal defaults\n');
    frestoredefaults();
end;

inputstring = sprintf( '%-54s', 'Input' );
cullingstring = sprintf( '%-54s', 'Search and Cull' );
inspectionstring = sprintf( '%-54s', 'Inspection' );
summarystring = sprintf( '%-54s', 'General Prefs & Final Results' );
initials = 0; culls = 0; inspects = 0; finals = 0;
initialdone = 0; culldone = 0; inspectdone = 0; finaldone = 0;
x = .05 ; y = .18; w = .90; h = .75;
progbarcol = 'red';
timevector = clock;
day = num2str(timevector(3));
month = num2str(timevector(2));
year = num2str(timevector(1));
truncyear = year(3:4);
newoutputdirectory = strcat(outputdirectory,month,day,truncyear);
count = 64;
while(exist(fullfile(inputdirectory,newoutputdirectory),'file'))== 7
    count = count + 1;
    ctstr = char(count);
    newoutputdirectory = strcat(outputdirectory,month,day,truncyear,ctstr);
end
outputdirectory = newoutputdirectory;  

h_fig = figure('Color', darkgreen, 'units', 'normalized', 'Menubar', 'none', 'Color', darkgreen, 'Name', 'FRETSCAL', 'NumberTitle', 'off', 'pos', [ x y w h ] );

h_menu_input = uimenu( h_fig, 'label', inputstring, 'fore', m1f,'Separator','off'  );
uimenu( h_menu_input, 'label', 'Experiment type', 'callback', 'fgettype', 'fore', m2f );
uimenu( h_menu_input, 'label', 'Strain name', 'callback', 'fgetstrain', 'fore', m2f );
uimenu( h_menu_input, 'label', 'YFP tagged protein', 'callback', 'fgetYFPtag', 'fore', m2f );
uimenu( h_menu_input, 'label', 'CFP tagged protein', 'callback', 'fgetCFPtag', 'fore', m2f );
uimenu( h_menu_input, 'label', 'Input directory', 'callback', 'fgetinput', 'fore', m2f);
uimenu( h_menu_input, 'label', 'Name for output directory', 'callback', 'fgetoutput', 'fore', m2f);
uimenu( h_menu_input, 'label', '......................', 'fore', m2f );
uimenu( h_menu_input, 'label', 'AOI shape', 'callback', 'getAOIshape', 'fore', m2f );
uimenu( h_menu_input, 'label', 'AOI background boundaries', 'callback', 'getboundary', 'fore', m2f );
uimenu( h_menu_input, 'label', 'Context', 'callback', 'fgetcontext', 'fore', m2f );
uimenu( h_menu_input, 'label', '......................', 'fore', m2f );
uimenu( h_menu_input, 'label', 'Max acceptable pixel intensity', 'callback', 'fmaxpix', 'fore', m2f );
uimenu( h_menu_input, 'label', 'Minimum intensity limit', 'callback', 'fgetintensitylimit', 'fore', m2f );
uimenu( h_menu_input, 'label', 'Maximum AOIs per tif', 'callback', 'fgetmaximumpeaks', 'fore', m2f );
uimenu( h_menu_input, 'label', 'Minimum separation between AOIs', 'callback', 'fgetseparation', 'fore', m2f);
uimenu( h_menu_input, 'label', 'Maximum movement', 'callback', 'fgetmaxmove', 'fore', m2f );
uimenu( h_menu_input, 'label', '......................', 'fore', m2f );
uimenu( h_menu_input, 'label', 'Bright patch filter', 'callback', 'brightpatch', 'fore', m2f );
%uimenu( h_menu_input, 'label', '......................', 'fore', m2f );
%uimenu( h_menu_input, 'label', 'Search', 'callback', 'fsearch_callback', 'fore', m2f );

h_menu_culling      = uimenu( h_fig, 'label', cullingstring, 'fore', m1f );
uimenu( h_menu_culling, 'label', 'Search limits', 'callback', 'getsearchlimits', 'fore', m2f );
uimenu( h_menu_culling, 'label', 'SEARCH', 'callback', 'fsearch_callback', 'fore', m2f );
uimenu( h_menu_culling, 'label', '......................', 'fore', m2f );
uimenu( h_menu_culling, 'label', 'Cull limits', 'callback', 'getculllimits', 'fore', m2f );
uimenu( h_menu_culling, 'label', 'CULL', 'callback', 'cull_callback', 'fore', m2f );

h_menu_inspection = uimenu( h_fig, 'label', inspectionstring, 'fore', m1f );
uimenu( h_menu_inspection, 'label', 'Inspect AOIs','callback','walkthru', 'fore', m2f);

h_menu_summary = uimenu( h_fig, 'label', summarystring, 'fore', m1f );
uimenu( h_menu_summary, 'label', 'Font size', 'callback', 'fgetfont', 'fore', m2f );
uimenu( h_menu_summary, 'label', '......................', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Image file characteristics', 'callback', 'fimage', 'fore', m2f );
uimenu( h_menu_summary, 'label', '......................', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Save new default user prefs', 'callback', 'fwritelast(1)', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Restore user prefs', 'callback', 'restoreprefsdefaults;fupdate', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Restore program default settings', 'callback', 'frestoredefaults;fupdate', 'fore', m2f );
uimenu( h_menu_summary, 'label', '......................', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Input YFP Spillover Factor', 'callback', 'fgetYFPspill', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Input CFP Spillover Factor', 'callback', 'fgetCFPspill', 'fore', m2f );
uimenu( h_menu_summary, 'label', '......................', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Histogram of YFP raw intensities /Bkg', 'callback', 'fdistribution2( 1 )', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Histogram of FRET raw intensities /Bkg', 'callback', 'fdistribution2( 3 )', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Histogram of CFP raw intensities /Bkg', 'callback', 'fdistribution2( 5 )', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Histogram of YFP monotonic values', 'callback', 'fdistribution2( 10 )', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Histogram of FRET monotonic values', 'callback', 'fdistribution2( 11 )', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Histogram of CFP monotonic values', 'callback', 'fdistribution2( 12 )', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Histogram of YFP FWHM', 'callback', 'fdistribution2( 2 )', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Histogram of FRET FWHM', 'callback', 'fdistribution2( 4 )', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Histogram of CFP FWHM', 'callback', 'fdistribution2( 6 )', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Histogram of YFP spillover', 'callback', 'fdistribution2( 7 )', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Histogram of CFP spillover', 'callback', 'fdistribution2( 8 )', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Histogram of FRETR', 'callback', 'fdistribution2( 9 )', 'fore', m2f );
uimenu( h_menu_summary, 'label', '......................', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Write final results', 'callback', 'fwritefinal', 'fore', m2f );
uimenu( h_menu_summary, 'label', '......................', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'About Fretscal', 'callback', 'fabout', 'fore', m2f );
uimenu( h_menu_summary, 'label', 'Exit', 'callback', 'close all', 'fore', m2f );

fupdate;

Contact us