-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbound_frac.m
105 lines (68 loc) · 2.37 KB
/
bound_frac.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
function [ ad ] = bound_frac( d ,bnd_spec)
%Function to analyze fluorescent spectra titration series
%For use with Fluor_reduce output and assumes bnd and unbnd spectra are
%last and first spectra of structure respectively
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Define bound and unbound spectra:
bnd = d.mdata_SR(:,bnd_spec);
ubnd = d.mdata_SR(:,1);
wvl = d.wvl;
%Generate plot of unbound and bound:
ub = figure();
plot(wvl, bnd,'o','MarkerSize', 6);
hold on;
plot(wvl, ubnd,'or','MarkerSize', 6);
pause
legend('100nM Unbound',strcat('100nM Bound -',num2str(d.lipid_con(end)),'uM'));
xlabel('Wavelength (nm)')
ylabel('Signal Normalized Intensity (counts/sec)');
%Define ratio of bnd to ubnd for use in this plot:
ad.bu_ratio = max(bnd)/max(ubnd);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %Generate plot of all spectra in series
% ss = figure();
%
% %Plot starting with high concentration data so legend is oriented properly
% plot(wvl,fliplr(d.mdata_SR),fliplr(d.std_SR))
%
% for j = 1:length(d.lipid_con)
%
% lipid_context(j) = num2str(d.lipid_con(length(d.lipid_con)-j+1));
%
% end
%
% legend(lipid_context);
%
% xlabel('Wavelength (nm)')
% ylabel('Signal Normalized Intensity (counts/sec)');
% title(strcat(t,' - b/u ratio = ', num2str(ad.bu_ratio)));
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Perform fitting of bnd/unbnd to extract % Bound
%First generate full range of values
b_inc = 0:.01:1;
for m = 1:length(d.lipid_con)
for j = 1:length(b_inc)
test_spectra = b_inc(j)*bnd + (1-b_inc(j))*ubnd;
resid_sqr = (test_spectra - d.mdata_SR(:,m)).^2;
chi_sqr(j) = sum(resid_sqr);
end
ind = find(chi_sqr == min(chi_sqr));
ad.bnd_frac(m) = b_inc(ind);
ad.fit_spec(:,m) = ad.bnd_frac(m)*bnd + (1-ad.bnd_frac(m))*ubnd;
ad.min_chi(m) = min(chi_sqr);
h = figure;
plot(wvl, d.mdata_SR(:,m),'ok','MarkerSize',6);
hold on;
plot(wvl, ad.fit_spec(:,m),'r','LineWidth', 1.5)
xlabel('Wavelength (nm)')
ylabel('Signal Normalized Intensity (counts/sec)');
legend('Data', strcat('Fit - ', 'chi =', num2str(ad.min_chi(m))));
pause
close(h);
end
figure;
ad.ps_percent = input('Input vesicle PS %');
plot(d.lipid_con*ad.ps_percent,ad.bnd_frac,'o','MarkerSize',6);
xlabel('PS concentration (uM)')
ylabel('% of max bound')
end