% This script calculates % 1) The fraction of Ire1 concentrated in foci % 2) The colocalization index (CI), that scores for the fraction of RNA % foci colocalizing with Ire1 % This script takes as inputs a GFP ('1g.tif'), and a RFP ('1r.tif') image. % Derived from the RFP image, a crop containing intracellular, non-ER signal, % is used as a background image ('1b.tif') % To use this script, move images to be compared into the same directory as % this file. Then modify this script to call the image by typing the file % names (including the extension) between the ' ' in the two lines below. RNAim = imread('1g.tif'); IRE1im = imread('1r.tif'); BGRNDim = imread('1b.tif'); % Total Ire1 fluorescence is defined as the RFP signal above 1.1 times the % average intensity of the background image. % Under non-stress conditions, we never observed pixels with an Ire1 signal % to exceed a 1.5-fold background threshold. Thus, this threshold value is used % to score for Ire1 in foci. IRE1_background = 1.1; threshold_IRE1_foci = 1.5; % The smallest Ire1 foci visualized was ~10 square pixels. To prevent % individual bright background pixels from appearing as Ire1 signal in foci, % we applied a smooting filter h = ones(5,5) / 25; IRE1im=imfilter(IRE1im,h,'replicate'); % For HAC1 fluorescence, the thresholds are with respect to the average % intensity of the image RNA_background = 1.5; threshold_RNA_foci = 2.0; % TotIRE1 and TotRNA define the Ire and RNA signal in those pixels above the % background cutoff value. TotIRE1 = IRE1im - IRE1_background*mean(mean(BGRNDim)); TotRNA = RNAim - RNA_background*mean(mean(RNAim)); % IRE1_in_foci and HAC1_in_foci scores the signal of IRE1 and HAC1 in those pixels % above the threshold that defines foci RNA_in_foci = RNAim - threshold_RNA_foci*mean(mean(RNAim)); IRE1_in_foci = IRE1im - threshold_IRE1_foci*mean(mean(BGRNDim)); % To identify the RNA signal colocalizing with Ire1 foci, we first make % a mask which includes all pixels containing IRE1 in foci IRE1_foci_mask = im2bw(single(IRE1_in_foci),1); % Also, we grow this mask by 3 pixels in each direction (to compensate % for the foci having moved in the time between acquisition of the red and green % channels) h2 = ones(7,7); IRE1_foci_mask_grown = imfilter(IRE1_foci_mask,h2,'replicate'); % Finally, we define RNA in IRE1 foci as RNA in foci which overlaps the enlarged IRE1 % foci mask RNA_in_IRE1_foci = IRE1_foci_mask_grown.*single(RNA_in_foci); % To calculate the colocalization index (fraction of RNA colocalizing with Ire1 vs TotRNA), % (CI) num = mean(mean(single(RNA_in_IRE1_foci))); denom = mean(mean(single(TotRNA))); if num == 0 CI = 0; else CI = num/denom; end CI % To calculate the fraction of Ire in foci IRE1_in_fociQ = single(TotIRE1).*IRE1_foci_mask; Fraction_IRE1_in_Foci = mean(mean(IRE1_in_fociQ))/mean(mean(TotIRE1))