diff --git a/01_flow_cytometry/exercises.m b/01_flow_cytometry/exercises.m index 7bb380b..656ba26 100644 --- a/01_flow_cytometry/exercises.m +++ b/01_flow_cytometry/exercises.m @@ -2,23 +2,23 @@ % Preliminaries: set up TASBE analytics package: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% addpath('~/cur_proj/SynBioIRAD/TASBE_Analytics/'); +% example: addpath('~/Downloads/TASBEFlowAnalytics/'); addpath('your-path-to-analytics'); % turn off sanitized filename warnings: warning('off','TASBE:SanitizeName'); -colordata = '../../colortest/'; -dosedata = '../../plasmidtest/'; +colordata = '../example_controls/'; +dosedata = '../example_assay/'; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Examples of flow data %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% pure scatter +% pure scatter - often hard to interpret fcs_scatter([dosedata 'LacI-CAGop_C4_C04_P3.fcs'],'PE-Tx-Red-YG-A','Pacific Blue-A',0,[0 0; 6 6],1); fcs_scatter([colordata '07-29-11_EYFP_P3.fcs'],'FITC-A','Pacific Blue-A',0,[0 0; 6 6],1); -% smoothed density plot +% smoothed density plot omits details but often summarizes collective better data1 = fcs_scatter([dosedata 'LacI-CAGop_C4_C04_P3.fcs'],'PE-Tx-Red-YG-A','Pacific Blue-A',1,[0 0; 6 6],1); data2 = fcs_scatter([colordata '07-29-11_EYFP_P3.fcs'],'FITC-A','Pacific Blue-A',1,[0 0; 6 6],1); @@ -68,15 +68,16 @@ data(data(:,7)>260000,7) % ans = 262143 -% How high was this really? We cannot know... +% How high was this really? We cannot know because it is saturated! channels = {}; -channels{1} = Channel('', 'Pacific Blue-A', '',234,456); -channels{2} = Channel('', 'PE-Tx-Red-YG-A', '',890,123); -channels{3} = Channel('', 'FITC-A', '',789,345); + +channels{1} = Channel('Pacific Blue-A', 405, 450, 50); +channels{2} = Channel('PE-Texas Red-A', 561, 610, 20); +channels{3} = Channel('FITC-A', 488, 530, 30); CM = ColorModel('','',channels,{{},{},{}},{}); filtered = read_filtered_au(CM,[colordata '07-29-11_EYFP_P3.fcs']); @@ -88,4 +89,4 @@ xc = dequantized(:,10); yc = dequantized(:,11); pos = xc>0 & yc>0; figure; smoothhist2D(log10([xc(pos) yc(pos)]),10,[200, 200],[],'image',[0 0; 6 6]); -% quantization gets smoothed out by introduction of small noise +% if desired, quantization can be smoothed out by introduction of small noise diff --git a/02_flow_compensation/exercises.m b/02_flow_compensation/exercises.m index 551c1bd..8d4f294 100644 --- a/02_flow_compensation/exercises.m +++ b/02_flow_compensation/exercises.m @@ -2,13 +2,13 @@ % Preliminaries: set up TASBE analytics package: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% addpath('~/cur_proj/SynBioIRAD/TASBE_Analytics/'); +% example: addpath('~/Downloads/TASBEFlowAnalytics/'); addpath('your-path-to-analytics'); % turn off sanitized filename warnings: warning('off','TASBE:SanitizeName'); -colordata = '../../colortest/'; -dosedata = '../../plasmidtest/'; +colordata = '../example_controls/'; +dosedata = '../example_assay/'; @@ -38,17 +38,23 @@ [raw hdr data] = fca_readfcs([colordata '07-29-11_blank_P3.fcs']); % histogram of EBFP2: figure; hist(data(:,10),100); -% with randomization: +% with random blurring to damp quanization: figure; hist(data(:,10)+(rand(size(data(:,10)))-0.5),100); % Notice that the presence of negative values means that we are necessarily dealing with a combination -% of autofluorescence and read error. We currently don't know how to separate these from one another. +% of autofluorescence and instrument error. There is not currently any elegant way of separating these. % fit to a gaussian model: -mean(data(:,10)) -std(data(:,10)) +mu = mean(data(:,10)) +sigma = std(data(:,10)) + +% Notice that the fit is pretty good: +range = -100:5:150; +figure; +plot(range,histc(data(:,10),range),'b-'); hold on; +plot(range,numel(data(:,10))*5*normpdf(range,mu,sigma),'r--'); -% we can simulate a distribution as a sum of three terms: random (bled) signal, autofluorescence, and read error +% we can simulate a distribution as a sum of three terms: random (bleed) signal, autofluorescence, and read error % here are some arbitrary values to explore as an example: n = 1e5; signal = 10.^(randn(n,1)*1+2.5); @@ -85,24 +91,25 @@ blankfile = [colordata '2012-03-12_blank_P3.fcs']; channels = {}; colorfiles = {}; -channels{1} = Channel('Pacific Blue-A', 405,0,0); +channels{1} = Channel('Pacific Blue-A', 405,450,50); channels{1} = setPrintName(channels{1},'Blue'); colorfiles{1} = [colordata '2012-03-12_ebfp2_P3.fcs']; channels{2} = Channel('PE-Tx-Red-YG-A', 561,610,20); channels{2} = setPrintName(channels{2},'Red'); colorfiles{2} = [colordata '2012-03-12_mkate_P3.fcs']; -channels{3} = Channel('FITC-A', 488,515,20); +channels{3} = Channel('FITC-A', 488,530,30); channels{3} = setPrintName(channels{3},'Yellow'); colorfiles{3} = [colordata '2012-03-12_EYFP_P3.fcs']; colorpairfiles = {}; CM = ColorModel(beadfile, blankfile, channels, colorfiles, colorpairfiles); +CM = set_FITC_channel_name(CM, 'FITC-A'); % We'll explain this in the next exercise settings = TASBESettings(); % Now let's read some files... raw = read_filtered_au(CM,[dosedata 'LacI-CAGop_C3_C03_P3.fcs']); compensated = readfcs_compensated_au(CM,[dosedata 'LacI-CAGop_C3_C03_P3.fcs'],0,1); -% oops! Need to resolve our color model first! +% You should see an error: need to "resolve" the color model first! CM = resolve(CM,settings); @@ -163,11 +170,3 @@ % An important question for the future: % We need to be able to set error bars on the data points that we correct. Can we? - - - - - - - - diff --git a/03_flow_MEFL/exercises.m b/03_flow_MEFL/exercises.m index 9f07452..29f53be 100644 --- a/03_flow_MEFL/exercises.m +++ b/03_flow_MEFL/exercises.m @@ -2,20 +2,20 @@ % Preliminaries: set up TASBE analytics package: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% addpath('~/cur_proj/SynBioIRAD/TASBE_Analytics/'); +% example: addpath('~/Downloads/TASBEFlowAnalytics/'); addpath('your-path-to-analytics'); % turn off sanitized filename warnings: warning('off','TASBE:SanitizeName'); -colordata = '../../colortest/'; -dosedata = '../../plasmidtest/'; +colordata = '../example_controls/'; +dosedata = '../example_assay/'; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Calibration beads: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% Let's look at an example of RCP-30-5A calibration beads: +% Let's look at an example of SpheroTech RCP-30-5A calibration beads: fcs_scatter([colordata '2012-03-12_Beads_P3.fcs'],'Pacific Blue-A','PE-Tx-Red-YG-A',1,[0 0; 6 6],1); % and without blending... fcs_scatter([colordata '2012-03-12_Beads_P3.fcs'],'Pacific Blue-A','PE-Tx-Red-YG-A',0,[0 0; 6 6],1); @@ -52,13 +52,13 @@ blankfile = [colordata '2012-03-12_blank_P3.fcs']; channels = {}; colorfiles = {}; -channels{1} = Channel('Pacific Blue-A', 405,0,0); +channels{1} = Channel('Pacific Blue-A', 405,450,50); channels{1} = setPrintName(channels{1},'Blue'); colorfiles{1} = [colordata '2012-03-12_ebfp2_P3.fcs']; channels{2} = Channel('PE-Tx-Red-YG-A', 561,610,20); channels{2} = setPrintName(channels{2},'Red'); colorfiles{2} = [colordata '2012-03-12_mkate_P3.fcs']; -channels{3} = Channel('FITC-A', 488,515,20); +channels{3} = Channel('FITC-A', 488,530,30); channels{3} = setPrintName(channels{3},'Yellow'); colorfiles{3} = [colordata '2012-03-12_EYFP_P3.fcs']; @@ -69,6 +69,7 @@ CM = ColorModel(beadfile, blankfile, channels, colorfiles, colorpairfiles); settings = TASBESettings(); +CM = set_FITC_channel_name(CM, 'FITC-A'); % Name the channel we'll use for MEFL units CM=set_dequantization(CM, 1); % important at low levels CM=set_bead_plot(CM, 2); % 2 = show beads for all channels, even though only FITC will be used CM=set_bead_min(CM, 1); % Don't consider beads less than this amount diff --git a/README.md b/README.md index 39d009c..51e30aa 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,8 @@ This tutorial has three units: 1. How Flow Cytometry Works 2. Autofluorescence and Compensation in Cells 3. From Arbitrary to Absolute Units + +Example code in this tutorial is distributed, insofar as possible, in +the public domain. + +Example flow cytometry files are provided courtesy of Prof. Ron Weiss (MIT). diff --git a/example_assay/LacI-CAGop_B10_B10_P3.fcs b/example_assay/LacI-CAGop_B10_B10_P3.fcs new file mode 100644 index 0000000..44dfc28 Binary files /dev/null and b/example_assay/LacI-CAGop_B10_B10_P3.fcs differ diff --git a/example_assay/LacI-CAGop_B11_B11_P3.fcs b/example_assay/LacI-CAGop_B11_B11_P3.fcs new file mode 100644 index 0000000..1af2f64 Binary files /dev/null and b/example_assay/LacI-CAGop_B11_B11_P3.fcs differ diff --git a/example_assay/LacI-CAGop_B12_B12_P3.fcs b/example_assay/LacI-CAGop_B12_B12_P3.fcs new file mode 100644 index 0000000..d969db8 Binary files /dev/null and b/example_assay/LacI-CAGop_B12_B12_P3.fcs differ diff --git a/example_assay/LacI-CAGop_B3_B03_P3.fcs b/example_assay/LacI-CAGop_B3_B03_P3.fcs new file mode 100644 index 0000000..ea78f4e Binary files /dev/null and b/example_assay/LacI-CAGop_B3_B03_P3.fcs differ diff --git a/example_assay/LacI-CAGop_B4_B04_P3.fcs b/example_assay/LacI-CAGop_B4_B04_P3.fcs new file mode 100644 index 0000000..e5345c2 Binary files /dev/null and b/example_assay/LacI-CAGop_B4_B04_P3.fcs differ diff --git a/example_assay/LacI-CAGop_B5_B05_P3.fcs b/example_assay/LacI-CAGop_B5_B05_P3.fcs new file mode 100644 index 0000000..f86e855 Binary files /dev/null and b/example_assay/LacI-CAGop_B5_B05_P3.fcs differ diff --git a/example_assay/LacI-CAGop_B6_B06_P3.fcs b/example_assay/LacI-CAGop_B6_B06_P3.fcs new file mode 100644 index 0000000..14e26bd Binary files /dev/null and b/example_assay/LacI-CAGop_B6_B06_P3.fcs differ diff --git a/example_assay/LacI-CAGop_B7_B07_P3.fcs b/example_assay/LacI-CAGop_B7_B07_P3.fcs new file mode 100644 index 0000000..e5bca5f Binary files /dev/null and b/example_assay/LacI-CAGop_B7_B07_P3.fcs differ diff --git a/example_assay/LacI-CAGop_B8_B08_P3.fcs b/example_assay/LacI-CAGop_B8_B08_P3.fcs new file mode 100644 index 0000000..7005a9d Binary files /dev/null and b/example_assay/LacI-CAGop_B8_B08_P3.fcs differ diff --git a/example_assay/LacI-CAGop_B9_B09_P3.fcs b/example_assay/LacI-CAGop_B9_B09_P3.fcs new file mode 100644 index 0000000..bb46a42 Binary files /dev/null and b/example_assay/LacI-CAGop_B9_B09_P3.fcs differ diff --git a/example_assay/LacI-CAGop_C1_C01_P3.fcs b/example_assay/LacI-CAGop_C1_C01_P3.fcs new file mode 100644 index 0000000..741506f Binary files /dev/null and b/example_assay/LacI-CAGop_C1_C01_P3.fcs differ diff --git a/example_assay/LacI-CAGop_C2_C02_P3.fcs b/example_assay/LacI-CAGop_C2_C02_P3.fcs new file mode 100644 index 0000000..bea06a3 Binary files /dev/null and b/example_assay/LacI-CAGop_C2_C02_P3.fcs differ diff --git a/example_assay/LacI-CAGop_C3_C03_P3.fcs b/example_assay/LacI-CAGop_C3_C03_P3.fcs new file mode 100644 index 0000000..0150d3c Binary files /dev/null and b/example_assay/LacI-CAGop_C3_C03_P3.fcs differ diff --git a/example_assay/LacI-CAGop_C4_C04_P3.fcs b/example_assay/LacI-CAGop_C4_C04_P3.fcs new file mode 100644 index 0000000..b026e5c Binary files /dev/null and b/example_assay/LacI-CAGop_C4_C04_P3.fcs differ diff --git a/example_assay/LacI-Hef1a-mkate_A3_A03_P3.fcs b/example_assay/LacI-Hef1a-mkate_A3_A03_P3.fcs new file mode 100644 index 0000000..fe7832a Binary files /dev/null and b/example_assay/LacI-Hef1a-mkate_A3_A03_P3.fcs differ diff --git a/example_controls/07-29-11_A_006_P3.fcs b/example_controls/07-29-11_A_006_P3.fcs new file mode 100644 index 0000000..13fe065 Binary files /dev/null and b/example_controls/07-29-11_A_006_P3.fcs differ diff --git a/example_controls/07-29-11_B_006_P3.fcs b/example_controls/07-29-11_B_006_P3.fcs new file mode 100644 index 0000000..89a384f Binary files /dev/null and b/example_controls/07-29-11_B_006_P3.fcs differ diff --git a/example_controls/07-29-11_C_006_P3.fcs b/example_controls/07-29-11_C_006_P3.fcs new file mode 100644 index 0000000..3a861b7 Binary files /dev/null and b/example_controls/07-29-11_C_006_P3.fcs differ diff --git a/example_controls/07-29-11_EBFP2_P3.fcs b/example_controls/07-29-11_EBFP2_P3.fcs new file mode 100644 index 0000000..ed2e9f0 Binary files /dev/null and b/example_controls/07-29-11_EBFP2_P3.fcs differ diff --git a/example_controls/07-29-11_EYFP_P3.fcs b/example_controls/07-29-11_EYFP_P3.fcs new file mode 100644 index 0000000..16b1d0b Binary files /dev/null and b/example_controls/07-29-11_EYFP_P3.fcs differ diff --git a/example_controls/07-29-11_blank_P3.fcs b/example_controls/07-29-11_blank_P3.fcs new file mode 100644 index 0000000..a85c30d Binary files /dev/null and b/example_controls/07-29-11_blank_P3.fcs differ diff --git a/example_controls/07-29-11_mkate_P3.fcs b/example_controls/07-29-11_mkate_P3.fcs new file mode 100644 index 0000000..c07131d Binary files /dev/null and b/example_controls/07-29-11_mkate_P3.fcs differ diff --git a/example_controls/2012-03-12_Beads_P3.fcs b/example_controls/2012-03-12_Beads_P3.fcs new file mode 100644 index 0000000..432de2a Binary files /dev/null and b/example_controls/2012-03-12_Beads_P3.fcs differ diff --git a/example_controls/2012-03-12_EBFP2_EYFP_P3.fcs b/example_controls/2012-03-12_EBFP2_EYFP_P3.fcs new file mode 100644 index 0000000..5b57bdc Binary files /dev/null and b/example_controls/2012-03-12_EBFP2_EYFP_P3.fcs differ diff --git a/example_controls/2012-03-12_EBFP2_mkate_P3.fcs b/example_controls/2012-03-12_EBFP2_mkate_P3.fcs new file mode 100644 index 0000000..3adc124 Binary files /dev/null and b/example_controls/2012-03-12_EBFP2_mkate_P3.fcs differ diff --git a/example_controls/2012-03-12_EYFP_P3.fcs b/example_controls/2012-03-12_EYFP_P3.fcs new file mode 100644 index 0000000..2e73848 Binary files /dev/null and b/example_controls/2012-03-12_EYFP_P3.fcs differ diff --git a/example_controls/2012-03-12_blank_P3.fcs b/example_controls/2012-03-12_blank_P3.fcs new file mode 100644 index 0000000..05ed722 Binary files /dev/null and b/example_controls/2012-03-12_blank_P3.fcs differ diff --git a/example_controls/2012-03-12_ebfp2_P3.fcs b/example_controls/2012-03-12_ebfp2_P3.fcs new file mode 100644 index 0000000..ea04135 Binary files /dev/null and b/example_controls/2012-03-12_ebfp2_P3.fcs differ diff --git a/example_controls/2012-03-12_mkate_EBFP2_EYFP_P3.fcs b/example_controls/2012-03-12_mkate_EBFP2_EYFP_P3.fcs new file mode 100644 index 0000000..21da40a Binary files /dev/null and b/example_controls/2012-03-12_mkate_EBFP2_EYFP_P3.fcs differ diff --git a/example_controls/2012-03-12_mkate_EYFP_P3.fcs b/example_controls/2012-03-12_mkate_EYFP_P3.fcs new file mode 100644 index 0000000..9d13758 Binary files /dev/null and b/example_controls/2012-03-12_mkate_EYFP_P3.fcs differ diff --git a/example_controls/2012-03-12_mkate_P3.fcs b/example_controls/2012-03-12_mkate_P3.fcs new file mode 100644 index 0000000..e4c087f Binary files /dev/null and b/example_controls/2012-03-12_mkate_P3.fcs differ