Commit 53505883 authored by Antonio Politi's avatar Antonio Politi

first commit of expdata and some code

parents
HeLa4D.xls contains the analyzed innercore and non-core intensities for dividing cells
2xZFN mEGFP-Nup107 26, 31
and
CRISPR mEGFP-Nup358/RanBP2 118
from file HeLaNup358-2h-background-individually-average-intensity-forAntonio.xls
from file HeLaNup107-2h-160121-background-individual-average-intensity-forAntonio.xls
data acquired by Shotaro Otsuka
Pom121_siRNA.xls contains the analyzed innercore and non-core intensities for dividing cells
CRISPR mEGFP-Nup358/RanBP2 118
data acquired by Joe Padget
Pom121 has been knocked-down for 48h (?)
This diff is collapsed.
This diff is collapsed.
%%
% find confidence Interval using likelihood profile method for ode model.
% The scaling coefficients are not varied
% pM: class of model
% filenames: 4 filenames containing parameter values
function findCI_poreMaturation(pM, filenames)
try
k1_pm = load(filenames{1});
k2_pm = load(filenames{2});
k1_ip = load(filenames{3});
k2_ip = load(filenames{4});
catch
%priming
tpm = [4 4];
% time begin interphase assembly for Non-core and core region
tip = [10 10];
hb = [2 2 2 2 2 2 2 2];
lb = [0 0 0 0 0 0 0 0];
opti = optimset('Display', 'iter');
solB = [0.3549 0.0449 0.0435 0.0492 0.92 0.5 1 1 1 1]; %bset solution
ifit = [1 2 3 4]; %parameters to fit
for i=1:4
iv = hb.*rand(1,length(hb))
[parFit{i}, norm(i)] = lsqnonlin(@pM.distData,iv, lb, hb, opti, [1:4], solB);
end
normB = min(norm);
ibf = find(norm == normB);
solB = pM.getparset(parFit{ibf}, ifit, solB);
%% vary each one parameter
minP = 0.2;
fitParCI = {[2 3 4], [1 3 4], [1 2 4], [1 2 3]};
%fit parameter [2 3 4] and vary parameter 1 step by step, etc.
step_p = 100;
for i=1:4
hb = [2 2 2];
lb = [0 0 0];
fidloc = fopen(filenames{i}, 'w');
fprintf(fidloc, '%%k1_pm \t k2_pm \t k1_ip \t k2_ip \t norm \t normBest\n');
ifit = fitParCI{i};
solLoc = solB;
parVar = solB(i)*10.^((-minP+minP*2*[1:step_p]/step_p));
for j = 1:step_p
solLoc(i) = parVar(j);
iv = solLoc(ifit);
[parFit, norm] = lsqnonlin(@pM.distData,iv, lb, hb, opti, ifit, solLoc);
sol = pM.getparset(parFit, ifit, solLoc);
fprintf(fidloc, '%.3e \t %.3e \t %.3e \t %.3e \t %.3e \t %.3e\n', sol(1), sol(2), sol(3), sol(4), norm, normB);
end
fclose(fidloc);
end
k1_pm = load(filenames{1});
k2_pm = load(filenames{2});
k1_ip = load(filenames{3});
k2_ip = load(filenames{4});
end
%%
NrDataPts = size(pM.protF(1).core,1)+size(pM.protF(2).core,1) + size(pM.protF(1).noncore,1)+size(pM.protF(2).noncore,1);
parList = {k1_pm, k2_pm, k1_ip, k2_ip};
for i=1:4
par = parList{i};
CI = par(:,i).*((abs(NrDataPts*log(par(:,end-1)/NrDataPts) - NrDataPts*log(par(:,end)/NrDataPts)))<chi2inv(0.95,1));
CIL(i,:) = [par(find(par(:,end-1)-par(:,end)<1e-5), i) min(CI(find(CI>0))) max(CI(find(CI>0)))];
end
end
%%
% find confidence Interval using likelihood profile method for ode model.
% The scaling coefficients are varied
% pM: Class of model
% filenames: 4 filenames containing parameter values
function findCI_poreMaturation_coeffMax(pM, filenames)
try
k1_pm = load(filenames{1});
k2_pm = load(filenames{2});
k1_ip = load(filenames{3});
k2_ip = load(filenames{4});
catch
%priming
tpm = [4 4];
% time begin interphase assembly for Non-core and core region
tip = [10 10];
hb = [2 2 2 2 2 2 2 2];
lb = [0 0 0 0 0 0 0 0];
opti = optimset('Display', 'iter');
solB = [0.3549 0.0449 0.0435 0.0492 0.92 0.5 1 1 1 1]; %bset solution
ifit = [1 2 3 4 7:10]; %parameters to fit
for i=1:4
iv = hb.*rand(1,length(hb))
[parFit{i}, norm(i)] = lsqnonlin(@pM.distData,iv, lb, hb, opti, ifit, solB);
end
normB = min(norm);
ibf = find(norm == normB);
solB = pM.getparset(parFit{ibf}, ifit, solB);
%% vary each one parameter
minP = 0.2;
fitParCI = {[2 3 4 7:10], [1 3 4 7:10], [1 2 4 7:10], [1 2 3 7:10]};
step_p = 100;
for i=1:4
hb = [2 2 2 1.2 1.2 1.2 1.2];
lb = [0 0 0 0 0 0 0];
fidloc = fopen(filenames{i}, 'w');
fprintf(fidloc, '%%k1_pm \t k2_pm \t k1_ip \t k2_ip \t norm \t normBest\n');
ifit = fitParCI{i};
solLoc = solB;
parVar = solB(i)*10.^((-minP+minP*2*[1:step_p]/step_p));
for j = 1:step_p
solLoc(i) = parVar(j);
iv = solLoc(ifit);
[parFit, norm] = lsqnonlin(@pM.distData,iv, lb, hb, opti, ifit, solLoc);
sol = pM.getparset(parFit, ifit, solLoc);
fprintf(fidloc, '%.3e \t %.3e \t %.3e \t %.3e \t %.3e \t %.3e \t %.3e \t %.3e \t %.3e \t %.3e \n', sol(1), sol(2), sol(3), ...
sol(4), sol(7), sol(8), sol(9), sol(10), norm, normB);
end
fclose(fidloc);
end
k1_pm = load(filenames{1});
k2_pm = load(filenames{2});
k1_ip = load(filenames{3});
k2_ip = load(filenames{4});
end
%%
NrDataPts = size(pM.protF(1).core,1)+size(pM.protF(2).core,1) + size(pM.protF(1).noncore,1)+size(pM.protF(2).noncore,1);
parList = {k1_pm, k2_pm, k1_ip, k2_ip};
for i=1:4
par = parList{i};
CI = par(:,i).*((abs(NrDataPts*log(par(:,end-1)/NrDataPts) - NrDataPts*log(par(:,end)/NrDataPts)))<chi2inv(0.95,1));
CIL(i,:) = [par(50, i) min(CI(find(CI>0))) max(CI(find(CI>0)))];
end
CIL
end
% %systematically change tauM and kM with fixed parameters (do not refit)
% function findCI(par, fileout1, fileout2)
% try
% kM = load(fileout1);
% tauM = load(fileout2);
% catch
% stepi = 50;
% stepj = 50;
% parloc = par;
% data = getData(density, 0, 0);
% %options = odeset('MaxStep', 0.1);
% clear('normFit')
% minTMv = 0.2;
% minkMV = 1.6;
%
% tauMv = par.tauM*10.^((-minTMv+minTMv*2*[1:stepi]/stepi));
% kMv = par.kM*10.^((-minkMV + minkMV*2*[1:stepj]/stepj));
% tofit_names_loc = {'tauM', 'P01', 'M01', 'P02', 'M02'};
% normO = sum(distModel(getfields(par, tofit_names_loc), tofit_names_loc, par, data, options).^2);
%
% tofit_names_loc = {'tauM', 'P01', 'M01', 'P02', 'M02'};
% fidloc = fopen(fileout1, 'w');
% fprintf(fidloc, '%%kM \t tauM \t P01 \t M01 \t P02 \t M02 \t norm \t normBest\n');
% parloc = par;
% for idx = 1:stepj
% parloc.tauM = par.tauM;
% parloc.kM = kMv(idx);
% [parfit_kM, norm_kM(idx)] = performFit(tofit_names_loc, lbStruct, hbStruct, parloc, 5, 0.1)
% parloc = setfields(parloc, tofit_names_loc, parfit_kM);
% fprintf(fidloc, '%.3e \t %.3e \t %.3e \t %.3e \t %.3e \t %.3e \t %.3e \t %.3e\n', parloc.kM, parloc.tauM, parloc.P01, parloc.M01, parloc.P02, parloc.M02, norm_kM(idx), normO);
% end
% fclose(fidloc);
%
% tofit_names_loc = {'kM', 'P01', 'M01', 'P02', 'M02'};
% fidloc = fopen(fileout2, 'w');
% fprintf(fidloc, '%%kM \t tauM \t P01 \t M01 \t P02 \t M02 \t norm \t normBest\n');
% parloc = par;
% for idx = 1:31
% parloc.tauM = tauMv(idx);
% parloc.kM = 2;
% [parfit_tauM, norm_tauM(idx)] = performFit(tofit_names_loc, lbStruct, hbStruct, parloc, 5, 0.1)
% parloc = setfields(parloc, tofit_names_loc, parfit_tauM);
% fprintf(fidloc, '%.3e \t %.3e \t %.3e \t %.3e \t %.3e \t %.3e \t %.3e \t %.3e\n', parloc.kM, parloc.tauM, parloc.P01, parloc.M01, parloc.P02, parloc.M02, norm_tauM(idx), normO);
% end
% fclose(fidloc);
% end
% %%
% data = getData(density, 0, 0);
% NrDataPts = (size(data,1)-1)/2*size(data,2);
% CIkM = kM(:,1).*((abs(NrDataPts*log(kM(:,end-1)/NrDataPts) - NrDataPts*log(kM(:,end)/NrDataPts)))<chi2inv(0.95,1));
% CIkM = [min(CIkM(find(CIkM>0))) max(CIkM(find(CIkM>0)))]
% CItauM = tauM(:,2).*((abs(NrDataPts*log(tauM(:,end-1)/NrDataPts) - NrDataPts*log(tauM(:,end)/NrDataPts)))<chi2inv(0.95,1));
% CItauM = [min(CItauM(find(CItauM>0))) max(CItauM(find(CItauM>0)))]
% end
\ No newline at end of file
classdef poreMaturationDen < absPoreMaturation
%% Multi step maturation process N1 steps with rate equal k1 and N2 steps with rate equal k2
% Use surface area to compute density
% k1 set the rate for formation of protein1 containing complex
% k2 set the rate of intermediate steps until protein2 is
% integrated
% X_1 -k1> X_2 ... -k1> X_(N1+1) -k2> X_(N1+2) ... -k2> X_(N1+N2+1)
% sum X_(i=N1+1)_end: protein1
% X_(N1+N2+1): protein2
methods
function MO = poreMaturationDen(N1, N2, tpm, ti, force, showplot)
MO@absPoreMaturation(N1, N2, tpm, ti,force, showplot)
MO.protF = MO.protA;
for i=1:2
MO.protF(i).core = MO.protA(i).d_core;
MO.protF(i).noncore = MO.protA(i).d_noncore;
end
end
function setTimeStart(MO, tpm, ti)
% set time of start of assembly of postmitotic and interphase
assert(length(tpm) > 1)
assert(length(ti) > 1)
MO.tpm = round(tpm);
MO.ti = round(ti);
end
function [prot] = computeProteins(MO, par,iprot, varargin)
%% compute distance model to data
% par: par(1) - k1 for postmitotic
% par(2) - k2 for postmitotic
% par(3) - k1 for interphase
% par(4) - k2 for interphase
% par(5) - fraction postmitotic in non-core region
% par(6) - fraction postmitotic in core region
% par(7) - coefficient scaling non-core protein 1
% par(8) - coefficient scaling non-core protein 2
% par(9) - coefficient scaling core protein 1
% par(10) - coefficient scaling core protein 2
if nargin <= 3
tend = 125;
else
tend = varargin{1};
end
%experimental data has 1 min time resolution
p1_NC_pm = MO.solveModelN([par(1) par(2)], [MO.tpm(1) tend],iprot(1));
p1_NC_ip = MO.solveModelN([par(3) par(4)], [MO.ti(1) tend],iprot(1));
p2_NC_pm = MO.solveModelN([par(1) par(2)], [MO.tpm(1) tend],iprot(2));
p2_NC_ip = MO.solveModelN([par(3) par(4)], [MO.ti(1) tend],iprot(2));
p1_C_pm = MO.solveModelN([par(1) par(2)], [MO.tpm(2) tend],iprot(1));
p1_C_ip = MO.solveModelN([par(3) par(4)], [MO.ti(2) tend],iprot(1));
p2_C_pm = MO.solveModelN([par(1) par(2)], [MO.tpm(2) tend],iprot(2));
p2_C_ip = MO.solveModelN([par(3) par(4)], [MO.ti(2) tend],iprot(2));
pm = deval(p1_NC_pm,[MO.tpm(1):1:tend]);
ip = deval(p1_NC_ip,[MO.ti(1):1:tend]);
p1NC_pm = [zeros(1,MO.tpm(1)-4) sum(pm(MO.N1+1:end,:))]*par(5)*par(7);
p1NC_ip = [zeros(1,MO.ti(1)-4) sum(ip(MO.N1+1:end,:))]*(1-par(5))*par(7);
p1NC = (p1NC_pm+p1NC_ip);
pm = deval(p2_NC_pm,[MO.tpm(1):1:tend]);
ip = deval(p2_NC_ip,[MO.ti(1):1:tend]);
p2NC_pm = [zeros(1,MO.tpm(1)-4) pm(end,:)]*par(5)*par(8);
p2NC_ip = [zeros(1,MO.ti(1)-4) ip(end,:)]*(1-par(5))*par(8);
p2NC = (p2NC_pm + p2NC_ip);
pm = deval(p1_C_pm,[MO.tpm(2):1:tend]);
ip = deval(p1_C_ip,[MO.ti(2):1:tend]);
p1C_pm = [zeros(1,MO.tpm(2)-4) sum(pm(MO.N1+1:end,:))]*par(6)*par(9);
p1C_ip = [zeros(1,MO.ti(2)-4) sum(ip(MO.N1+1:end,:))]*(1-par(6))*par(9);
p1C = (p1C_pm + p1C_ip);
pm = deval(p2_C_pm,[MO.tpm(2):1:tend]);
ip = deval(p2_C_ip,[MO.ti(2):1:tend]);
p2C_pm = [zeros(1,MO.tpm(2)-4) pm(end,:)]*par(6)*par(10);
p2C_ip = [zeros(1,MO.ti(2)-4) ip(end,:)]*(1-par(6))*par(10);
p2C = (p2C_pm + p2C_ip);
p1 = struct('time_NC', [4:tend],'time_C', [4:tend], 'NC', p1NC, 'NC_pm', p1NC_pm, 'NC_ip', p1NC_ip,...
'C', p1C, 'C_pm', p1C_pm, 'C_ip', p1C_ip, 'C_pm_pure', p1C_pm/par(6)/par(9), 'C_ip_pure', p1C_ip/(1-par(6))/par(9));
p2 = struct('time_NC',[4:tend],'time_C',[4:tend], 'NC', p2NC, 'NC_pm', p2NC_pm, 'NC_ip', p2NC_ip, ...
'C', p2C, 'C_pm', p2C_pm, 'C_ip', p2C_ip, 'C_pm_pure', p2C_pm/par(6)/par(10), 'C_ip_pure', p2C_ip/(1-par(6))/par(10));
prot = [p1;p2];
end
function [idxm, idxd] = findIdxs(MO)
idxm = [1 1];
idxd = [1 1];
end
function A = modelMatrix(MO, par)
%% Generate matrix for multi step maturation process N1 steps with rate equal k1 and N2 steps with rate equal k2
% k1 set the rate for formation of protein1 containing complex
% k2 set the rate of intermediate steps until protein2 is
% integrated
% X_1 -k1> X_2 ... -k1> X_(N1+1) -k2> X_(N1+2) ... -k2> X_(N1+N2+1)
k1 = par(1);
k2 = par(2);
vrate = [k1*ones(MO.N1,1); k2*ones(MO.N2,1); 0];
A1 = diag(-vrate,0);
A2 = diag(vrate,-1);
A = A2(1:end-1,1:end-1)+A1;
end
function dydt = model(MO, t, y, par, iprot)
%% model to integrate
A = MO.modelMatrix(par);
areaDeg = fnval(MO.protF(iprot).dsurfspl,t)/fnval(MO.protF(iprot).surfspl,t);
if isnan(areaDeg)
areaDeg = fnval(MO.protF(iprot).dsurfspl,125)/fnval(MO.protF(iprot).surfspl,125);
end
dydt = A*y - y*areaDeg;
end
function dist = distData(MO,parfit, ifit, par)
%% calculate distance model to data
prot = MO.computeProteins(par, [1 2]);
% if useStd == 0 do not divide by standard deviation
useStd = 0;
distNC = [];
distC = [];
for i=1:2
if useStd
distNC = [distNC (MO.protF(i).noncore(:,1)' - prot(i).NC)./MO.protF(i).noncore(:,2)'];
distC = [distC (MO.protF(i).core(:,1)' - prot(i).C)./MO.protF(i).core(:,2)'];
else
distNC = [distNC MO.protF(i).noncore(:,1)' - prot(i).NC];
distC = [distC MO.protF(i).core(:,1)' - prot(i).C];
end
end
dist = [distNC distC];
end
end
end
classdef poreMaturationTotal < absPoreMaturation
%% Multi step maturation process N1 steps with rate equal k1 and N2 steps with rate equal k2
% Compute total number of pores so no need to use the surface area
% k1 set the rate for formation of protein1 containing complex
% k2 set the rate of intermediate steps until protein2 is
% integrated
% X_1 -k1> X_2 ... -k1> X_(N1+1) -k2> X_(N1+2) ... -k2> X_(N1+N2+1)
% sum X_(i=N1+1)_end: protein1
% X_(N1+N2+1): protein2
methods
function MO = poreMaturationTotal(N1, N2, tpm, ti, force, showplot)
MO@absPoreMaturation(N1, N2, tpm, ti,force, showplot)
MO.protF = MO.protA;
for i=1:2
MO.protF(3-i).core = MO.protA(i).tot_core;
MO.protF(3-i).noncore = MO.protA(i).tot_noncore;
end
end
function setTimeStart(MO, tpm, ti)
% set time of start of assembly of postmitotic and interphase
assert(length(tpm) > 1)
assert(length(ti) > 1)
MO.tpm = round(tpm);
MO.ti = round(ti);
end
function [prot] = computeProteins(MO, par, iprot)
%% compute distance model to data
% par: par(1) - k1 for postmitotic
% par(2) - k2 for postmitotic
% par(3) - k1 for interphase
% par(4) - k2 for interphase
% par(5) - fraction postmitotic in non-core region
% par(6) - fraction postmitotic in core region
% par(7) - coefficient scaling non-core protein 1
% par(8) - coefficient scaling non-core protein 2
% par(9) - coefficient scaling core protein 1
% par(10) - coefficient scaling core protein 2
%experimental data has 1 min time resolution
smoothedArea = fnval(MO.protF(1).surfspl, MO.protF(1).time');
PM = MO.solveModelN([par(1) par(2)], MO.timeI,1);
IP = MO.solveModelN([par(3) par(4)], MO.timeI,1);
%compute solution for specific time
PM_t = deval(PM, MO.timeI);
IP_t = deval(IP, MO.timeI);
%% compute protein amounts in non-core and core regions
tend = MO.protF(1).time(end);
iend = MO.protF(1).time(end) + 1;
p1NC_pm = [zeros(1,MO.tpm(1)-4) sum(PM_t(MO.N1+1:end,1:iend-MO.tpm(1)))]*par(5)*par(7);
p1NC_ip = [zeros(1,MO.ti(1)-4) sum(IP_t(MO.N1+1:end,1:iend-MO.ti(1)))]*(1-par(5))*par(7);
p1NC = (p1NC_pm+p1NC_ip);
p1NC = p1NC./smoothedArea;
p2NC_pm = [zeros(1,MO.tpm(1)-4) PM_t(end,1:iend-MO.tpm(1))]*par(5)*par(8);
p2NC_ip = [zeros(1,MO.ti(1)-4) IP_t(end,1:iend-MO.ti(1))]*(1-par(5))*par(8);
p2NC = (p2NC_pm + p2NC_ip);
p2NC_den = p2NC./smoothedArea;
p1C_pm = [zeros(1,MO.tpm(2)-4) sum(PM_t(MO.N1+1:end,1:iend-MO.tpm(2)))]*par(6)*par(9);
p1C_ip = [zeros(1,MO.ti(2)-4) , sum(IP_t(MO.N1+1:end,1:iend-MO.ti(2)))]*(1-par(6))*par(9);
p1C_ip_den = p1C_ip/(1-par(6))/par(9)./smoothedArea*max(smoothedArea);
p1C = (p1C_pm + p1C_ip);
p1C_den = p1C./smoothedArea;
p2C_pm = [zeros(1,MO.tpm(2)-4) PM_t(end,1:iend-MO.tpm(2))]*par(6)*par(10);
p2C_ip = [zeros(1,MO.ti(2)-4) IP_t(end,1:iend-MO.ti(2))]*(1-par(6))*par(10);
p2C_ip_den = p2C_ip/(1-par(6))/par(10)./smoothedArea*max(smoothedArea);
p2C = (p2C_pm+ p2C_ip);
p2C_den = p2C./smoothedArea;
%densities
p1 = struct('time_NC', [4:tend],'time_C', [4:tend], 'NC', p1NC, 'NC_pm', p1NC_pm, 'NC_ip', p1NC_ip,...
'C', p1C, 'C_pm', p1C_pm, 'C_ip', p1C_ip, 'C_pm_pure', p1C_pm/par(6)/par(9), 'C_ip_pure', p1C_ip/(1-par(6))/par(9), 'C_ip_den', p1C_ip_den);
p2 = struct('time_NC',[4:tend],'time_C',[4:tend], 'NC', p2NC, 'NC_pm', p2NC_pm, 'NC_ip', p2NC_ip, ...
'C', p2C, 'C_pm', p2C_pm, 'C_ip', p2C_ip, 'C_pm_pure', p2C_pm/par(6)/par(10), 'C_ip_pure', p2C_ip/(1-par(6))/par(10), 'C_ip_den', p2C_ip_den);
prot = [p1;p2];
end
function A = modelMatrix(MO, par)
%% Generate matrix for multi step maturation process N1 steps with rate equal k1 and N2 steps with rate equal k2
% k1 set the rate for formation of protein1 containing complex
% k2 set the rate of intermediate steps until protein2 is
% integrated
% X_1 -k1> X_2 ... -k1> X_(N1+1) -k2> X_(N1+2) ... -k2> X_(N1+N2+1)
k1 = par(1);
k2 = par(2);
vrate = [k1*ones(MO.N1,1); k2*ones(MO.N2,1); 0];
A1 = diag(-vrate,0);
A2 = diag(vrate,-1);
A = A2(1:end-1,1:end-1)+A1;
end
function dydt = model(MO, t, y, par, iprot)
%% model to integrate
A = MO.modelMatrix(par);
dydt = A*y;
end
end
end
%% collections of function calls to run the fits and compute confidence intervals
%% ratio mature to total in inner core density-minipore-to-Antonio-CoreRegion-mean-sd.xlsx at 19.2 min
% compute its distrubution if both processes are random processes
% mature pore
m = 4.3;
v = 2.97^2;
mu = log((m^2)/sqrt(v+m^2));
sigma = sqrt(log(v/(m^2)+1));
X = lognrnd(mu,sigma,1,1e6);
%minipore
m = 3.7;
v = 1.19^2;
mu = log((m^2)/sqrt(v+m^2));
sigma = sqrt(log(v/(m^2)+1));
Y = lognrnd(mu,sigma,1,1e6);
ratio = X./(X+Y);
[prctile(ratio, 50) prctile(ratio, 25) prctile(ratio, 75)]
% ratio 0.385 - 0.617
%% ratio mature to total in outer core 160229-EMdata-density-precursor.xlsx at 19.2 min
m = 11.3;
v = 2.3^2;
mu = log((m^2)/sqrt(v+m^2));
sigma = sqrt(log(v/(m^2)+1));
X = lognrnd(mu,sigma,1,1e6);
%minipore
m = 0.95;
v = 0.36^2;
mu = log((m^2)/sqrt(v+m^2));
sigma = sqrt(log(v/(m^2)+1));
Y = lognrnd(mu,sigma,1,1e6);
ratio = X./(X+Y);
[prctile(ratio, 50) prctile(ratio, 25) prctile(ratio, 75)]
% this yields 0.90-0.94
%+-0.031 for the ratio mature/totalpores in inner-core
%%
tpm = [4 4];
% time begin interphase assembly for Non-core and core region
tip = [10 10];
hb = [10 10 10 10 1.2 1.2 1.2 1.2 ];
lb = [0 0 0 0 0 0 0 0];
pM = poreMaturationTotal(1,1, tpm, tip, 0, 0);
%unconstrained
%hb = [10 10 10 10 1 0.617 10 10 10 10];
%lb = [0 0 0 0 0.8 0.385 1 1 1 1];
opti = optimset('Display', 'iter');
%% fit data obtained for total number of proteins
clear('pM')
pM = poreMaturationTotal(1,1, tpm, tip, 0, 0);
if exist('sol_Tot')
iv = sol_Tot;% hb.*rand(1,10);
else
iv = hb.*rand(1,length(hb));
end
iv = [0.3549 0.0449 0.0435 0.0492 1 1 1 1];
solB = [0.3549 0.0449 0.0435 0.0492 0.92 0.5 1 1 1 1];
ifit = [1:4 7:10];
for i=1
[sol_con{i}, norm_con(i)] = lsqnonlin(@pM.distData,iv, lb, hb, opti, ifit, solB);
end
solB = pM.getparset(sol_con{1}, ifit, solB);
pM.showGraph(solB, [2 1]);
%% compute confidence interval
tpm = [4 4];
tip = [10 10];
hb = [10 10 10 10 ];
lb = [0 0 0 0];
pM = poreMaturationTotal(1,1, tpm, tip, 0, 0);
filenames = {fullfile(pM.outdir, 'k1_pm_CI.txt'), fullfile(pM.outdir,'k2_pm_CI.txt'), fullfile(pM.outdir,'k1_ip_CI.txt'), fullfile(pM.outdir,'k2_ip_CI.txt')};
findCI_poreMaturationx(pM, filenames);
%%
filenames = {fullfile(pM.outdir, 'k1_pm_CI_coeffMax.txt'), fullfile(pM.outdir,'k2_pm_CI_coeffMax.txt'), ...
fullfile(pM.outdir,'k1_ip_CI_coeffMax.txt'), fullfile(pM.outdir,'k2_ip_CI_coeffMax.txt')};
findCI_poreMaturation_coeffMax(pM, filenames);
%% create output
prot = pM.computeProteins(solB, [1 2])
%%
fid(1) = fopen(fullfile(pM.outdir,'simulated_NUP107.csv'), 'w')
fid(2) = fopen(fullfile(pM.outdir,'simulated_NUP358.csv'), 'w')
try
for i=1:2
fprintf(fid(i), '%% Parameters k1_pm k2_pm k1_ip k2_ip NC_frac_pm C_frac_pm factProd_NC_p1 factPro_NC_p2 factProd_C_p1 factPro_C_p2 (only the first 4 parameters are fixed)\n');
for ipar=1:length(solB)
fprintf(fid(i),'%.4f ', solB(ipar));
end
fprintf(fid(i), '\n');
fprintf(fid(i), 'tpm = [%d %d], tip = [%d %d], N1 = %d, N2 = %d\n', tpm(1), tpm(2), tip(1), tip(2), 1, 1);
fprintf(fid(i), 'time\tNC\tNC_pm\tNC_ip\tC\tC_pm\tC_ip\tC_ip_pure\tC_ip_density\n');
for it = 1:length(prot(i).time_C)
try
fprintf(fid(i), '%d\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\t%.3e\n', prot(i).time_NC(it), prot(i).NC(it), prot(i).NC_pm(it), prot(i).NC_ip(it), ...
prot(i).C(it), prot(i).C_pm(it), prot(i).C_ip(it), prot(i).C_ip_pure(it), prot(i).C_ip_den(it));
catch