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.

freadlast( settings, flag )
function freadlast( settings, flag )
%Version 4/3/09 Reads in the settings from the prefs.txt file in
%the user's Matlab directory
global CFPspill YFPspill fontpics context toobright
global bitdepth Ysuffix Fsuffix Csuffix Dsuffix
global frettype cfptype yfptype primary limit1 limit2
global initialfile culledfile inspectedfile finalfile
global intensitylimit maximumpeaks bringthick bringincr AOIshape maxmovement
global separation inputdirectory outputdirectory
global strainname CFPtagname YFPtagname
global YFPFWHM FRETFWHM CFPFWHM YFPmono FRETmono CFPmono YFPs2b FRETs2b CFPs2b bpfilter patchpixel
global YFPFWHMcull FRETFWHMcull CFPFWHMcull YFPmonocull FRETmonocull CFPmonocull YFPs2bcull FRETs2bcull CFPs2bcull

%initialize with program defaults. then read in the settings from the
%prefs.txt file. Prefs.txt file saved when one saves user defaults.
frettype  = 1;   cfptype   = 0;   yfptype   = 0; primary = 1;
strainname = 'unassigned';
CFPtagname = 'CFP_Tagged_Protein';
YFPtagname = 'YFP_Tagged_Protein';
intensitylimit = .50;
inputdirectory = pwd;
outputdirectory = 'out1';
initialfile = 'initial.txt';
culledfile = 'culled.txt';
inspectedfile = 'inspected.txt';
finalfile = 'final.txt';
YFPFWHM  = 17;         FRETFWHM = 24;         CFPFWHM  = 24;
YFPmono   = .05;       FRETmono  = .5;       CFPmono   = .5;
YFPs2b    = 1.3;       FRETs2b   = 1.0;      CFPs2b    = 1;
YFPFWHMcull  = 17;     FRETFWHMcull = 24;     CFPFWHMcull  = 15;
YFPmonocull   = .05;   FRETmonocull  = .5;   CFPmonocull   = .5;
YFPs2bcull    = 4.0;   FRETs2bcull   = 1.0;  CFPs2bcull    = 1;

CFPspill = 0.56;
YFPspill = 0.09;
AOIshape = 19;
bringincr = 5;
bringthick = 3;
separation = 15;
maximumpeaks = 30;
fontpics = 10;
context = 40;
toobright = 0.90;
bitdepth = 16;
Ysuffix = '500_545';
Fsuffix = '440_545';
Csuffix = '440_480';
Dsuffix = '0_500';
bpfilter = 0;
patchpixel = 14000;
maxmovement = 3;
limit1 = 1;
limit2 = 0;


fset = fopen( settings, 'r' );
if( fset ~= -1 ) % successful opening of settings
    fprintf( 1, 'Reading setup from %s\n', settings );
    [ scrap, count ] = fscanf( fset, '%s', 1 );
    while( count > 0 )
        if( strcmp( scrap, 'intensitylimit' ) )
            intensitylimit = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'CFPspill' ) )
            CFPspill   = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'YFPspill' ) )
            YFPspill   = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'strainname' ) )
            strainname   = fscanf( fset, '%s', 1 );
        end;
        if( strcmp( scrap, 'CFPtagname' ) )
            CFPtagname   = fscanf( fset, '%s', 1 );
        end;
        if( strcmp( scrap, 'YFPtagname' ) )
            YFPtagname   = fscanf( fset, '%s', 1 );
        end;
        if( strcmp( scrap, 'inputdirectory' ) )
            tmp   = fgetl( fset );                % get the whole string from line
            if( flag == 1 )
                inputdirectory   = tmp(2:length(tmp));% remove separator space
            else
                scrap             = tmp(2:length(tmp));% remove separator space
            end;
        end;
        if( strcmp( scrap, 'outputdirectory' ) )
            if( flag == 1 || flag == 2 )
                outputdirectory   = fscanf( fset, '%s', 1 );
            else
                scrap             = fscanf( fset, '%s', 1 );
            end;
        end;
        if( strcmp( scrap, 'startdirectory' ) )
            scrap                = fscanf( fset, '%s', 1 );    % you can never change where you've come from
        end;
        if( strcmp( scrap, 'frettype' ) )
            frettype   = fscanf( fset, '%d', 1 );
        end;
        if( strcmp( scrap, 'cfptype' ) )
            cfptype   = fscanf( fset, '%d', 1 );
        end;
        if( strcmp( scrap, 'yfptype' ) )
            yfptype   = fscanf( fset, '%d', 1 );
        end;
        if( strcmp( scrap, 'PrimaryChannel' ) )
            primary   = fscanf( fset, '%d', 1 );
        end;
        if( strcmp( scrap, 'YFPFWHM' ) )
            YFPFWHM   =  fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'FRETFWHM' ) )
            FRETFWHM   = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'CFPFWHM' ) )
            CFPFWHM   = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'YFPmono' ) )
            YFPmono   = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'FRETmono' ) )
            FRETmono   = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'CFPmono' ) )
            CFPmono   = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'YFPs2b' ) )
            YFPs2b   = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'FRETs2b' ) )
            FRETs2b   = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'CFPs2b' ) )
            CFPs2b   = fscanf( fset, '%f', 1 );
        end;       
        if( strcmp( scrap, 'YFPFWHMcull' ) )
            YFPFWHMcull   =  fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'FRETFWHMcull' ) )
            FRETFWHMcull   = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'CFPFWHMcull' ) )
            CFPFWHMcull   = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'YFPmonocull' ) )
            YFPmonocull   = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'FRETmonocull' ) )
            FRETmonocull   = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'CFPmonocull' ) )
            CFPmonocull   = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'YFPs2bcull' ) )
            YFPs2bcull   = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'FRETs2bcull' ) )
            FRETs2bcull   = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'CFPs2bcull' ) )
            CFPs2bcull   = fscanf( fset, '%f', 1 );
        end;        
        if( strcmp( scrap, 'initialfile' ) )
            initialfile   = fscanf( fset, '%s', 1 );
        end;
        if( strcmp( scrap, 'culledfile' ) )
            culledfile   = fscanf( fset, '%s', 1 );
        end;
        if( strcmp( scrap, 'inspectedfile' ) )
            inspectedfile   = fscanf( fset, '%s', 1 );
        end;
        if( strcmp( scrap, 'finalfile' ) )
            finalfile   = fscanf( fset, '%s', 1 );
        end;
        if( strcmp( scrap, 'AOIshape' ) )
            AOIshape   = fscanf( fset, '%d', 1 );
        end;
        if( strcmp( scrap, 'bringincr' ) )
            bringincr   = fscanf( fset, '%d', 1 );
        end;
        if( strcmp( scrap, 'bringthick' ) )
            bringthick   = fscanf( fset, '%d', 1 );
        end;
        if( strcmp( scrap, 'separation' ) )
            separation   = fscanf( fset, '%d', 1 );
        end;
        if( strcmp( scrap, 'maximumpeaks' ) )
            maximumpeaks   = fscanf( fset, '%d', 1 );
        end;
        if( strcmp( scrap, 'fontpics' ) )
            fontpics   = fscanf( fset, '%d', 1 );
        end;
        if( strcmp( scrap, 'context' ) )
            context   = fscanf( fset, '%d', 1 );
        end;
        if( strcmp( scrap, 'toobright' ) )
            toobright = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'bitdepth' ) )
            bitdepth = fscanf( fset, '%f', 1 );
        end;
        if( strcmp( scrap, 'Ysuffix' ) )
            tmp   = fgetl( fset );                % get the whole string from line
            Ysuffix = tmp(2:length(tmp));% remove separator space in prefs file
        end;
        if( strcmp( scrap, 'Fsuffix' ) )
            tmp   = fgetl( fset );                % get the whole string from line
            Fsuffix = tmp(2:length(tmp));% remove separator space in prefs file
        end;
        if( strcmp( scrap, 'Csuffix' ) )
            tmp   = fgetl( fset );                % get the whole string from line
            Csuffix = tmp(2:length(tmp));% remove separator space in prefs file
        end;
        if( strcmp( scrap, 'Dsuffix' ) )
            tmp   = fgetl( fset );                % get the whole string from line
            Dsuffix = tmp(2:length(tmp));% remove separator space in prefs file
        end;
        if( strcmp( scrap, 'bpfilter' ) )
            bpfilter = fscanf( fset, '%d', 1 );
        end;
        if( strcmp( scrap, 'patchpixel' ) )
            patchpixel = fscanf( fset, '%d', 1 );
        end;
        if( strcmp( scrap, 'maxmovement' ) )
            maxmovement = fscanf( fset, '%d', 1 );
        end;
        if( strcmp( scrap, 'searchlimited' ) )
            limit1 = fscanf( fset, '%d', 1 );
        end;
        if( strcmp( scrap, 'culllimited' ) )
            limit2 = fscanf( fset, '%d', 1 );
        end;
        [ scrap, count ] = fscanf( fset, '%s', 1 );
    end;
    fclose( fset );
    YFPFWHM = abs(YFPFWHM);
    CFPFWHM = abs(CFPFWHM);
    FRETFWHM = abs(FRETFWHM);
else
    fprintf( 1, 'couldn''t read %s for settings\n', settings );
end;

Contact us