Examplary walkthrough analysis
Set paths
Ensure the current folder is set to QuimP11_MATLAB, or add the QuimP11_MATLAB to to [File->Set Path] so QuimP's functions are useable.
addpath('QuimP11_MATLAB')
Read in the data output by QuimP.
Missing files will be skipped. When prompted, select the folder containing the associated paQP file.
qCells = readQanalysis('example_output_new');
qCells is a structure. Each element is data for one analysis (i.e. one paQP file). If only one paQP file was located then qCells will be of length of 1.
% we will extract the first analysis into 'c'.
c = qCells(1);
c % type c and you will see a list of the data in the analysis
to access data, for example the fluoMap, type c.fluoMap
Load the image used for channel 1
If this fails, the path c.FLUOCH1TIFF is probably wrong due to it being moved
info = imfinfo(c.FLUOCH1TIFF,'TIFF'); % structure array with data about each image in the stack
im = imread(c.FLUOCH1TIFF, 3, 'Info', info); % load frame 3
figure(1);
imagesc(im);
axis equal
axis off
title('3rd frame of QW\_channel\_1\_actin.tif')
Plot the motility and fluo maps
figure(2);
plotMap(c.motilityMap, 'm', c.FI); % 'm' tells plotMap to format as a motility map.
% c.FI is the frame interval for scaling.
figure(3);
plotMap(c.fluoCh1Map, 'f', c.FI); % 'f' for fluorescence map
Calculate a cross correlation
xFM = xcorrQ( c.motilityMap,c.fluoCh1Map );
figure(4);
imagesc(xFM); title('Motility Map Xcorr with Fluo Map');
colorbar
yticks(0:5:40);
yticklabels(yticks*c.FI);
ylabel('Time (seconds)')
xticks(0:100:400);
xticklabels(xticks./400);
xlabel('Cell outline')
Yellow is strong correlation, blue strong negative correlation. We can also do auto-correlation ( correlate maps with themselves) to search for repetitive patterns of motility/fluorescence.
xMM = xcorrQ( c.motilityMap, c.motilityMap); % calc an auto correlation
figure(5);
imagesc(xMM); title('AutoCorr of Motility Map');
colorbar
yticks(0:5:40);
yticklabels(yticks*c.FI);
ylabel('Time (seconds)')
xticks(0:100:400);
xticklabels(xticks./400);
xlabel('Cell outline')
Plot the cell outlines, stored in c.outlines.
This a cell array. Each cell as the outline for one frame. See c.outlineHeaders for the contents of the columns. We want columns 3 and 4.
c.outlineHeaders
c.outlines{7}(:,3:4) % x and y co-ordinates at frame 7
figure(6);
colours = summer(c.nbFrames); % create a colour chart
hold off;
% plot all the cell outline
for i = 1:c.nbFrames
plotOutline(c.outlines{i}, colours(i,:));
hold on;
end
hold off;
axis equal;
axis(c.R); % set the axis bounds
set(gca,'YDir','reverse'); % flip the Y-axis around so matlab plots (0,0) at the top left
Plot and colour and outline according to membrane speed
The maxMigration value is used to scale the colours
figure(7);
% we take the max velocity across all frames and include negative values
scale = max(abs(c.maxSpeed));
% frame 35. red is expansion, blue contraction
plotMotility(c.outlines{35}, scale, 5);
axis(c.R); % set the axis bounds
axis equal;
% flip the Y-axis around so matlab plots (0,0) at the top left
set(gca,'YDir','reverse');
% this function needs a bit of work to improve its visuals
Plot some global statistics
c.stats is a matrix, rows are frames. See c.statHeaders for column contents.
The cell centroid is computed as the weighted centre of the polygon formed by the cell outline. The measures computed by BOA are as follows (http://pilip.lnx.warwick.ac.uk/docs/master/QuimP_Guide.html):
- X-Centroid [pixels] - Horizontal pixel co-ordinate of the cell centroid.
- Y-Centroid [pixels] - Vertical pixel co-ordinate of the cell centroid.
- Displacement [microns] - Distance the cell centroid has moved from its position in the first recorded frame.
- Distance Travelled [microns] - Sum of the centroid displacements between frame, i.e. the total distance over which the centroid has moved.
- Directionality - Persistence in direction, calculated as Displacement∕Dist.Travelled (chemotaxis index). A value of 1 reveals that a cell has moved in a straight line. Decreasing values denote a cell moving increasingly erratically.
- Speed [microns per second] - Speed at which the centroid moved between the current and previous frame.
- Perimeter [microns] - Length of the cell perimeter (segmented outline).
- Elongation - An ellipse is fitted to the cell outline and the major/minor axis used to compute the elongation of the cell’s shape. Elongation = major axis∕minor axis. Note that a value of 1 does not necessarily represent a perfectly circular cell, only a circular fitted ellipse.
- Circularity - A measure of circularity defined by the following equation: . A value of 1 reveals the cell’s outline to be perfectly circular.
- Area [microns2] - Cell area.
% path of the cell centroid
figure(8)
plot(c.stats(:,2), c.stats(:,3));
axis equal
title('Path of the cell centroid')
grid on
xlabel('x coordinate')
ylabel('y coordinate')
% change in cell area
figure(9)
plot(c.stats(:,1), c.stats(:,11));
axis equal
title('Change in cell area');
grid on
xticks(0:5:40);
xticklabels(yticks*c.FI);
xlabel('Time (seconds)')
ylabel('Area (\mum^2)')
Fluorescence stats are slightly more complicated, as there are three channels, but is in the same format as c.stats.
c.fluoStats contains all the data. The dimensions are: (Frame, Channel, measure), where measure one of those listed in c.fluostatsHeaders
% for example
c.fluoStats(:,2,7); % for all frame, channel 2, mean cyto fluorescence
c.fluoStats(1:10,1,11); % for the first 10 frames, channel 1, %age cortex fluo.
The measures computed by ANA are as follows (http://pilip.lnx.warwick.ac.uk/docs/master/QuimP_Guide.html):
- Total fluo. [pixels intensity] - Total fluorescence. Sum of all pixel intensities within the cell outline.
- Mean fluo. [pixels intensity] - Mean fluorescence. Average intensity of pixels within the cell outline.
- Cortex width [microns] - Width of the cortex, as specified by the user.
- Cyto. area [microns2] - Area of the cytoplasm (area of the whole cell minus the cortex area).
- Total cyto. fluo. [pixels intensity] - Sum of all pixel intensities within the cytoplasm.
- Mean cyto. fluo. [pixels intensity] - Average pixel intensity within the cytoplasm.
- Cortex area [microns2] - Area of the cortex.
- Total cortex fluo. [pixels intensity] - Sum of all pixel intensities within the cortex.
- Mean cortex fluo. [pixels intensity] - Average pixel intensity within the cortex.
%plot them against frame number
figure(10);
plot(c.frames, c.fluoStats(:,1,7),c.frames, c.fluoStats(:,1,11));
grid on
legend('Mean cyto fluo','%age Cortex')
title('Cortex fluorescence')
xticks(0:5:40);
xticklabels(yticks*c.FI);
xlabel('Time (seconds)')
ylabel('Pixel intensity')
Tracking through maps
We can track using ECMM data recorded in the co-ordinate and origin maps I have provided all the code to do so
Track forwards.
Typically, the backward tracking gives better results, due to the nature of ECMM mapping.
figure(11);
hold off
plotMap(c.motilityMap, 'm', c.FI); % plot the motility map
trackF = trackForward( c.forwardMap, 1 , 120, 35 );
hold on
plot(trackF(:,2), trackF(:,1), 'r','LineWidth',2);
hold off
Track backwards
trackB = trackBackward( c.backwardMap, 30 , 223, 30 );
hold on
plot(trackB(:,2), trackB(:,1), 'b','LineWidth',2);
hold off
figure(12)
plotMap(c.fluoCh1Map, 'f', c.FI)
trackB2 = trackBackward( c.backwardMap, 40 , 80, 30 );
hold on
plot(trackB2(:,2), trackB2(:,1), 'b','LineWidth',2);
hold off