72 this =
this@models.pcdi.BasePCDISystem(model);
75 if model.WithInhibitors
76 this.
f= models.pcdi.InhibitCoreFun2D(
this);
78 this.
f= models.pcdi.CoreFun2D(
this);
82 s = RandStream(
" mt19937ar ",
" Seed ",2);
83 k = kernels.KernelExpansion;
86 k.Centers.xi= [.25 1 1.2 .8 .4
88 k.Ma= s.rand(1,nc)*1e5;
100 setConfig@models.pcdi.BasePCDISystem(
this, mu, inputidx)
109 if ~isempty(varargin) && isa(varargin[1],
" PlotManager ")
119 h = pm.nextPlot([model.
SaveTag " _outputplot "],...
120 sprintf(
" Output plot for model %s ",model.
Name),
" Time ",
" Caspase-3 Concentration ");
122 semilogy(h,t,y,
" r ",
" LineWidth ",2);
140 this.plot1DState(model, t, y, getPM);
142 if any(mode == 2) || any(mode == 3)
151 this.plot2DState(t, y, pm1, pm2);
153 for k=1:length(varargout)
158 if model.WithInhibitors
167 varargout[end+1] = pm;
176 if nargin < 3 || isempty(pm)
186 mu = linspace(0,1,10);
191 [x,y] = meshgrid(0:this.
hs/fineness:o(1,2),0:this.
hs/fineness:o(2,2));
192 apm = this.getAffParamCX(x,y,
" mu ");
195 h = pm.nextPlot(sprintf(
" diff_coeff_%d ",k),...
196 sprintf(
" Spatial diffusion coefficient base c_%d(x) for \\gamma=%g ",...
197 k,this.
Gammas(k)),
" x ",
" y ");
198 surf(
h,x,y,log10(apm.getMatrix(k)),
" EdgeColor ",
" interp ",
" FaceColor ",
" interp ");
199 zlabel(
" Log-scaled diffusivity ");
203 h = pm.nextPlot(sprintf(
" diff_coeff_mu_%d ",k),...
204 sprintf(
" Spatial diffusion coefficient c(x) for mu(5)=%g ",...
206 surf(
h,x,y,log10(apm.compose(0,mu(k))),
" EdgeColor ",
" interp ",
" FaceColor ",
" interp ");
207 zlabel(
" Log-scaled diffusivity ");
222 [x,y] = meshgrid(0:this.
hs:o(1,2),0:this.
hs:o(2,2));
226 x0 = dscomponents.AffineInitialValue;
230 x0part(1:2*m) = [
M(:);
M(:)]*5e-13;
231 x0part(2*m+1:4*m) = [
M(:);
M(:)]*3e-8;
232 if this.
Model.WithInhibitors
233 x0part(4*m+1:6*m) = [
M(:);
M(:)]*3e-8;
234 x0part(6*m+1:end) = [
M(:);
M(:)]*5e-13;
241 this.
A= this.assembleA;
247 d1idx = find(abs((1:d) - d/2) <= d/2 * p);
252 d2idx = find(abs((1:d) - d/2) <= d/2 * p);
256 [d1,d2] = meshgrid(d1idx,d2idx);
261 C(ca3(sel)) = 1/length(sel);
269 function res = assembleA() {
273 res = dscomponents.AffLinCoreFun(
this);
274 res.TimeDependent=
false;
282 add(lso.getFunStr(0),
A);
291 A = this.assembleASpatialDiff;
292 add(lso.getFunStr(k),
A);
296 if this.
Model.WithInhibitors
297 augA = blkdiag(A,D(1)*A,D(2)*A,D(3)*A,...
298 D(4)*A,D(5)*A,D(6)*A,D(7)*A);
300 augA = blkdiag(A,D(1)*A,D(2)*A,D(3)*A);
302 res.addMatrix(str, augA);
308 function A = assembleASpatialDiff() {
310 [x,y] = meshgrid(0:this.
hs:o(1,2),0:this.
hs:o(2,2));
312 if size(x,1) ~= this.
Dims(1) || size(x,2) ~= this.
Dims(2)
320 A1 = bsxfun(@times,A1,this.diffusionCoeff([x(:) y(:)]" ) ");
323 A2 =
MatUtils.divcdivumat(x,y,@this.nablaC);
334 function apm = getAffParamCX(
colvec<
double> x,
matrix<
double> y,muarg) {
335 c = zeros(size(x,1),size(x,2),length(this.
Gammas));
336 apm = general.AffParamMatrix;
338 apm.addMatrix(lso.getFunStr(0),ones(size(x)));
339 for k=1:length(this.
Gammas)
341 hlp = this.diffusionCoeff([x(:) y(:)]^
t);
342 c(:,:,k) =
reshape(hlp,size(x,1),[]);
343 apm.addMatrix(lso.getFunStr(k),c(:,:,k));
357 function c = diffusionCoeff(
colvec<
double> x) {
371 idxmat = zeros(this.Dims);
373 sel = idxmat(:,round(this.
Dims(2)/2));
374 sel = [sel; sel+m; sel+2*m; sel+3*m;...
375 sel+4*m; sel+5*m; sel+6*m; sel+7*m];
380 idx = round(linspace(1,length(t),150));
384 states = [
" dead ",
" alive ",
" unstable "];
385 ss = this.
Model.getSteadyStates(this.
mu(4))^
t;
390 doplot(
" c8 ",
" Caspase-8 (x_a) ",1);
391 doplot(
" c3 ",
" Caspase-3 (y_a) ",2);
392 doplot(
" pc8 ",
" Pro-Caspase-8 (x_i) ",3);
393 doplot(
" pc3 ",
" Pro-Caspase-3 (y_i) ",4);
394 if this.
Model.WithInhibitors
395 doplot(
" iap ",
" IAP (iap) ",5);
396 doplot(
" bar ",
" BAR (bar) ",6);
397 doplot(
" yb ",
" Caspase-3+IAP (yb) ",7);
398 doplot(
" xb ",
" Caspase-8+BAR (xb) ",8);
401 function doplot(tag, thetitle, pnr)
402 yl = y(pos(pnr,:),:);
403 perc = (yl(end) - ss(2,pnr)) / (ss(1,pnr) - ss(2,pnr));
412 tit = sprintf(" %s concentrations\nCell state at T=%.4
g: %s\n%.5
g (%5.2
f%%) ", thetitle,...
413 max(t),states[
id],yl(end),perc*100);
418 tit = sprintf("
Model '%s'\n%s ",model.Name,tit);
420 h = pm.nextPlot(tag,tit," Time [s] "," Cell slice ");
421 surf(
h,
X,
Y,yl," EdgeColor "," none ");
434 x = a(1,1):this.h:a(1,2);
435 y = a(2,1):this.h:a(2,2);
436 [
X,
Y] = meshgrid(x,y);
440 step = round(length(t)/40);
441 for idx=1:step:length(t)
448 if this.
Model.WithInhibitors
456 set(gcf," Name ",sprintf(" Concentration top view at t=%f ",t(idx)));
463 if this.
Model.WithInhibitors
472 set(gcf," Name ",sprintf(" Augmented concentration differences at t=%f ",t(idx)));
481 function imagescplot(dim)
482 V =
reshape(v(pos(dim,:),idx),this.Dims(1),[])^t;
483 h = pm1.nextPlot(sprintf(" PCDI2D_plot2D_%d ",this.
Tags[dim]),...
484 sprintf(" %s concentrations ", this.
Labels[dim])," x "," y ");
485 imagesc(x,y,V," Parent ",h);
486 set(h," DataAspectRatio ",[1 1 1]);
488 colorbar(" peer ",h," SouthOutside ");
491 function surfplot(dim)
493 V =
reshape(v(pos(dim,:),idx),this.Dims(1),[]);
498 diffnorm = norm(diff);
499 V = mv + diff/diffnorm;
501 h = pm2.nextPlot(sprintf(" PCDI2D_plot2D_%d ",this.
Tags[dim]),...
502 sprintf(" %s concentration difference\n Mean %
g, augmented by %g ",...
503 this.
Labels[dim],mv,diffnorm)," x "," y ");
505 surf(h,X,Y,V," FaceColor "," interp "," EdgeColor "," none ");
506 ar = get(h," DataAspectRatio ");
507 set(h," DataAspectRatio ",[1 1 ar(3)]);
function varargout = plotState(models.BaseFullModel model,double t,matrix< double > y, mode)
Dims
The system's dimensions.
char Name
The name of the Model.
Labels
The concentration labels.
Gammas
Gamma values to use as kernel width for diffusivity Gammas = .08;.
Tags
The concentration image tags.
LinearSplitOfOne: Computes a sequence of hat functions at equidistant nodes from [0,len] to enable an efficient, easy way of division of unity.
hs
scaled spatial stepwidth
The base class for any KerMor detailed model.
PCDISystem2D(models.BaseFullModel model)
Model
The Model this System is attached to.
h
Spatial stepwidth (in unscaled size units!) is set in subclasses.
function setConfig(colvec< double > mu,integer inputidx)
function pm = plotDiffusionCoeff(colvec< double > mu, pm, allparts)
reshape
hanges the dimensions of the handle object array to the specified dimensions. See the MATLAB reshape ...
PlotManager: Small class that allows the same plots generated by some script to be either organized a...
inputidx
The current inputindex of the function .
function fx = evaluate(matrix x, varargin)
Evaluates the kernel expansion.
dscomponents.AInitialValue x0
Function handle to initial state evaluation.
function newSysDimension()
Custom updates for new system dimension.
PCDISystem2D The inhibited version programmed cell death model for 2D geometry.
logical LeaveOpen
Flag indicating if the plots should be left open once the PlotManager is deleted (as variable) ...
A variable number of input arguments.
Omega
The spatial width/area/region (in unscaled size units!)
static function [ A , idxmat ] = laplacemat(h, d1, d2)
Computes a 2D diffusion sparse matrix with zero neuman boundary conditions.
mu
The current parameter for simulations, [] is none used.
function J = getStateJacobian(x, varargin)
Evaluates the jacobian matrix of this function at the given point.
BasePCDISystem The base dynamical system class for the the Programmed Cell Death Model by Markus Daub...
kernels.KernelExpansion Kexp
The kernel expansion used to construct the diffusion coefficient distribution.
function varargout = plot(models.BaseFullModel model,double t,matrix< double > y, varargin)
dscomponents.LinearOutputConv C
The output conversion Defaults to an LinearOutputConv instance using a 1-matrix, which just forwards ...
dscomponents.ACoreFun f
The core f function from the dynamical system.
dscomponents.ACoreFun g
The system's algebraic constraints function.
MatUtils: Matrix utility functions.
dscomponents.AMassMatrix M
The system's mass matrix.
Diff
Relative diffusion coefficients ([d2/d1, d3/d1, d4/d1])
dscomponents.LinearCoreFun A
Represents a linear or affine-linear component of the dynamical system.
char SaveTag
A custom tag that can be used as a prefix to files for corresponding model identification.
KernelExpansion: Base class for state-space kernel expansions.
A variable number of output arguments.