-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
240 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
%% bca_PE script for looking at BCA results from a spectramax i3 multimode plate reader. | ||
|
||
% Written by Ed Emmott, Northeastern University, Boston MA, 2018. | ||
|
||
% Note this script is designed to work only on assay results generated | ||
% using the standard plate format. | ||
|
||
% Requires: Matlab, Matlab Stats and machine learning toolbox. | ||
|
||
% [results, fit, data ] = bca_PE ( 'testdata_SM.csv' , 5 , 'auto' , 'Conc' , 1 , 'Vol' , 50 , 'Dil' , 5 , 'LB' , 5 ) | ||
% | ||
% The only required parameters are the filename and number of samples. The others are: | ||
% * 'conc' : desired sample concentration in microgram/mL. Default is 1. | ||
% * 'vol' : desired sample volume in microlitres. Default is 50. | ||
% * 'dil' : dilution of your sample used for the assay. Default assumes 1 in 5 dilution. | ||
% * 'lb' : Laemelli loading buffer concentration. Is your loading buffer 5x, 6x etc. Default is 5x. | ||
% * 'force' : If a sample is too low concentration, force the function to give list the required amount of sample even if this means going over volume. Default is false which has the function instead scale the achievable maximum concentration down for your samples. Options True/False. | ||
% | ||
% The minimal call would be: | ||
% BCA_PE('testdata_SM.csv',5) | ||
% This would assume all the defaults given above. | ||
|
||
function [results,bcaFit,data] = bca_PE(filename,samples,varargin) | ||
% parses the various optional and required inputs | ||
p = inputParser; | ||
|
||
% list defaults | ||
defaultAuto = 'auto'; % autoscales down concentration if theres an issue | ||
validAuto = {'auto','force'}; | ||
checkAuto = @(x) any(validatestring(x,validAuto)); | ||
|
||
defaultConc = 1; % 1mg/mL default | ||
defaultVol = 50; % 50uL default | ||
defaultDil = 5; % samples diluted 5-fold prior to assay default | ||
defaultLB = 5; % using 5x loading buffer default | ||
|
||
% list inputs | ||
addRequired(p,'filename',@ischar); | ||
addRequired(p,'samples',@isnumeric); | ||
addOptional(p,'auto', defaultAuto , checkAuto); | ||
addParameter(p,'conc' , defaultConc , @isnumeric); | ||
addParameter(p,'vol' , defaultVol , @isnumeric); | ||
addParameter(p,'dil' , defaultDil , @isnumeric); | ||
addParameter(p,'lb' , defaultLB , @isnumeric); | ||
|
||
parse(p,filename , samples , varargin{:}) | ||
|
||
%% Import .csv | ||
% Modified from matlab generated import code. | ||
delimiter = ','; | ||
startRow = 7; | ||
endRow = 14; | ||
|
||
formatSpec = '%*s%f%f%f%f%f%f%f%f%f%f%f%f%*s%[^\n\r]'; | ||
fileID = fopen(p.Results.filename,'r','n','UTF-8'); | ||
fseek(fileID, 3, 'bof'); | ||
|
||
textscan(fileID, '%[^\n\r]', startRow-1, 'WhiteSpace', '', 'ReturnOnError', false); | ||
dataArray = textscan(fileID, formatSpec, endRow-startRow+1, 'Delimiter', delimiter, 'TextType', 'string', 'EmptyValue', NaN, 'ReturnOnError', false, 'EndOfLine', '\r\n'); | ||
fclose(fileID); | ||
|
||
data = [dataArray{1:end-1}]; | ||
|
||
%% Remove background, calculate fit. | ||
% calculate mean background | ||
bg = mean(mean(data(6:8,1:2))); | ||
% subtract background from all wells | ||
data = data(:,:) - bg; | ||
% concentrations of standard curve | ||
concY = [0.125 0.25 0.5 1 2]; | ||
% mean intensity of the standard curve | ||
intX = [mean(data(5,1:2)) mean(data(4,1:2)) mean(data(3,1:2)) mean(data(2,1:2)) mean(data(1,1:2))]; | ||
|
||
bcaFit = fitlm(intX,concY); | ||
|
||
colNum = 3; | ||
rowNum = 1; | ||
results = {}; | ||
|
||
for i = 1:p.Results.samples | ||
% averages duplicate readings | ||
meanResult = mean(data( rowNum , colNum:colNum + 1 )); | ||
% names samples | ||
results{i,1} = strcat('Sample_',num2str(i)); | ||
% predicts concentration and adjusts for sample dilution | ||
results{i,2} = round(predict(bcaFit,meanResult) * p.Results.dil,2); | ||
% if/else works through the rows and columns of the 96 well plate with increasing sample number. | ||
if rowNum == 8 | ||
colNum = colNum + 2; | ||
rowNum = 1; | ||
else | ||
rowNum = rowNum + 1; | ||
end | ||
end | ||
results = cell2table(results); | ||
|
||
% Amount of Loading buffer | ||
for i = 1:p.Results.samples | ||
results{i,3} = round(p.Results.vol / p.Results.lb,1); | ||
end | ||
|
||
% Amount of Sample | ||
for i = 1:p.Results.samples | ||
results{i,4} = round((p.Results.vol * p.Results.conc) / results{i,2},1); | ||
end | ||
|
||
% Amount of Lysis buffer to make up to volume | ||
for i = 1:p.Results.samples | ||
results{i,5} = round(p.Results.vol - (results{i,3} + results{i,4}),1); | ||
% TODO: ADD ERROR HANDLING LOOP HERE FOR IF TOTAL IS -ve. | ||
end | ||
|
||
results.Properties.VariableNames = {'Sample_name','Conc_in_mg_per_mL','uL_LB','uL_sample','uL_Lysis_buff'}; | ||
|
||
%% Rename your samples | ||
|
||
|
||
%% Plot and generate pdf of results | ||
%% | ||
% generate short figure name | ||
if contains(p.Results.filename,'/') == 1; | ||
indx = strfind(p.Results.filename, '/'); | ||
sfilename = extractAfter(p.Results.filename,indx(numel(indx))); | ||
sfilename = extractBefore(sfilename,'.csv'); | ||
else | ||
sfilename = extractBefore(p.Results.filename,'.csv'); | ||
end | ||
|
||
f1 = figure | ||
%ax1 = subplot (1,2,1) | ||
|
||
plot(bcaFit) | ||
title ( strcat('BCA_Assay_of_',sfilename)) | ||
xlabel ( 'Concentration in mg/mL') | ||
ylabel ( 'Absorbance') | ||
|
||
resultsString = evalc('disp(bcaFit.Rsquared)'); | ||
resultsString = strrep(resultsString,'<strong>','\bf'); | ||
resultsString = strrep(resultsString,'</strong>','\rm'); | ||
resultsString = strrep(resultsString,'_','\_'); | ||
FixedWidth = get(0,'FixedWidthFontName'); | ||
annotation(gcf,'Textbox','String',resultsString,'Interpreter','Tex','FontName',FixedWidth,'FitBoxToText', 'on','Position',[0.68 0.25 0.2 0.16]); % these values 'work for me (TM)' | ||
|
||
% generate printout of plot | ||
saveas(gcf,strcat(sfilename,'_scurve.pdf')) | ||
% write .csv of table | ||
writetable(results,strcat(sfilename,'_analysis.csv')) | ||
|
||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
Plate information | ||
Plate,Plate Repeat,Barcode,Chamber temperature at start,Chamber temperature at end,Ambient temperature at start,Ambient temperature at end,ScanX,ScanY,Well Repeat,Measurement date,excwavelength,emswavelength,trfwindowindex | ||
1,0,V_BC_1/22/2018 12:15:38 PM_Instr:1412121,,,,,,,1,,,, | ||
|
||
|
||
Results for ABS mono | ||
|
||
Plate: 1, PlateRepeat: 0, WellRepeat: 1 | ||
,1,2,3,4,5,6,7,8,9,10,11,12 | ||
A,1.9093049050937685,1.9704030018080061,0.59130312783878825,0.552166615266548,,,,,,,, | ||
B,1.0841976144527712,1.1114009480242988,0.8497110067378556,0.82880236182543476,,,,,,,, | ||
C,0.64547301506379406,0.65236008692352287,0.82952908720135243,0.84973246213918352,,,,,,,, | ||
D,0.33056893757180633,0.34614616955975364,0.8466952073782148,0.85004381201667278,,,,,,,, | ||
E,0.25853938128948467,0.24829000795214454,1.0158142566075319,0.99055917244233238,,,,,,,, | ||
F,0.068563483985029816,0.06675897960916502,0.94888318836627528,0.93073984013539568,,,,,,,, | ||
G,0.069596748440471951,0.067779090803971709,0.043319132285120812,0.043203520466502145,,,,,,,, | ||
H,0.06924614068750462,0.06965015752094407,0.043163304520765333,0.0428701968724642,,,,,,,, | ||
|
||
Analysis Result | ||
|
||
Screen Basic Information | ||
Software version:,,1.0 | ||
Screen Started:,,2018-01-22T12:15:38.4649042-05:00 | ||
Screen Finished:,,2018-01-22T12:16:13.2478937-05:00 | ||
instrument Serial Number:,,1412121 | ||
Protocol ID:,,143 | ||
|
||
Protocol Owner:,,EnSight-PC\Admin | ||
Protocol Name:,,BCA assay | ||
|
||
Number of plate repeats,,1 | ||
Start plate repeat each [s],,0 | ||
|
||
Plate Type | ||
Plate Type Name:,,96 General | ||
Number of rows:,,8 | ||
Number of columns:,,12 | ||
Plate Height [mm]:,,14.35 | ||
Bottom Height [mm]:,,0 | ||
Bottom thickness [mm]:,,0 | ||
Well diameter (bottom) [mm]:,,6.5 | ||
Well shape:,,Round | ||
Volume of the well [µl]:,,300 | ||
|
||
Optical index:,,1.58 | ||
Platemap | ||
Plate | ||
,1,2,3,4,5,6,7,8,9,10,11,12 | ||
A,-,-,-,-,,,,,,,, | ||
B,-,-,-,-,,,,,,,, | ||
C,-,-,-,-,,,,,,,, | ||
D,-,-,-,-,,,,,,,, | ||
E,-,-,-,-,,,,,,,, | ||
F,-,-,-,-,,,,,,,, | ||
G,-,-,-,-,,,,,,,, | ||
H,-,-,-,-,,,,,,,, | ||
|
||
|
||
|
||
|
||
|
||
Operations: | ||
|
||
|
||
Measurements: | ||
|
||
Meas,,,, | ||
Tech,,,,ABS mono | ||
Exc. filter [nm],,,, | ||
Excitation wavelength [nm],,,,562 | ||
Measurement mode,,,,Single | ||
Measurement height [mm],,,,7.5 | ||
Number of flashes,,,,100 | ||
Number of flashes integrated,,,,100 | ||
Flash power,,,,100 | ||
|
||
Analysis: | ||
|
||
|
||
Comments: | ||
TimeStamp,AuthenticationType,CreatorID,Type,ProtocolID,ProtocolVersion,ScreenID,Text, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Sample_name,Conc_in_mg_per_mL,uL_LB,uL_sample,uL_Lysis_buff | ||
Sample_1,2.31,10,21.6,18.4 | ||
Sample_2,3.78,10,13.2,26.8 | ||
Sample_3,3.79,10,13.2,26.8 | ||
Sample_4,3.83,10,13.1,26.9 | ||
Sample_5,4.69,10,10.7,29.3 |
Binary file not shown.