%%% When sending this program, the PNG images of the roots must be included % To run this program in Matlab: % 1) Save this file with ".m" as the extension instead of ".txt" % It is easiest to save in the MATLAB folder (which is automatically % visible to Matlab), but anywhere will do. % 2) Save the PNG images in the same folder. % 3) Open Matlab. Find the "Current Folder" window (likely on left). If you % you did not save to the MATLAB folder, you can drag and drop the .m & % .png files there. Alternatively, you can navigate from "Current Folder" % to where you saved this file, right click on the containing folder, and % select "Add to path", but this needs to be redone every time you open % Matlab before the program can be used. % 4) In the panel labeled "Command Window", next to the ">>", type % "AllModels()" (without the quotes), and press Enter. From the window % that pops up, you can choose which model to run, then which parameters % to use. The model output will display when the "Solve" button is % pushed, sometimes with a delay of a few seconds. % Most tools for changing model constants are contained in the GUI. A few % are not, and are as follows: % To edit: For model: Go to lines: % simulation end time Single Cell 650 % simulation end time C/W 739 % simulation end time alternate C/W 947 % simulation end time C/W/X 1161 % initial values C/W 693-697 % initial values alternate C/W 900-904 % Edited 10 April 2015, Matlab version R2015a function AllModels() % Sets up figure and popup menu for model selection fig = figure('position',[500 20 1000 700]); h = guihandles(fig); h.fig = fig; % Set up Model Popup Menu h.ModelPopup = uicontrol('style','popupmenu',... 'position',[50 600 400 40],'string',{'Single-Cell Model'... 'C/W Multi-Cell Model (C restricts W expression)'... 'Alternate C/W Multi-Cell Model (C restricts W mobility)'... 'C/W/X Multi-Cell Model'}); set(h.ModelPopup,'callback',{@modelpopup,fig}); guidata(fig,h); end function modelpopup(hObject,eventdata,fig)% Executes on Model Selection h = guidata(fig); % Switch between models h.ModOpts = get(h.ModelPopup, 'String'); h.ModEntry = get(h.ModelPopup,'Value'); h.Model=h.ModOpts{h.ModEntry}; switch h.Model; case 'Single-Cell Model' %Make Other parameter panels invisible if isfield(h, 'P1')==1 set(h.P1,'visible','off') end if isfield(h, 'P3')==1 set(h.P3,'visible','off') end if isfield(h, 'P4')==1 set(h.P4,'visible','off') end if isfield(h, 'P5')==1 set(h.P5,'visible','off') end if isfield(h, 'P6')==1 set(h.P6,'visible','off') end %Create Parameters Box h.P2 = uipanel('Title','Set Parameters','FontSize',12,... 'Position',[0 0 .5 .75]); % Fill panel i=20;% space reserved per line %Create sliders for initial WOX5 and CLE40 concentrations h.W0=uicontrol('Parent',h.P2,'style','slider','position',[100 470-12*i 390 20],... 'HorizontalAlignment','left','Max',0,'Max',50); h.C0=uicontrol('Parent',h.P2,'style','slider','position',[100 470-13*i 390 20],... 'HorizontalAlignment','left','Max',0,'Max',10); %Create text boxes for displayed description of parameters h.bws=uicontrol('Parent',h.P2,'style','text','position',[100 470 390 20],... 'HorizontalAlignment','left','string',{'Bw:Max W production rate'}); h.bcs=uicontrol('Parent',h.P2,'style','text','position',[100 470-i 390 20],... 'HorizontalAlignment','left','string',{'Bc:Max C production rate'}); h.kcws=uicontrol('Parent',h.P2,'style','text','position',[100 470-3*i 390 20],... 'HorizontalAlignment','left','string',{'Kcw:C at halved W production rate'}); h.aws=uicontrol('Parent',h.P2,'style','text','position',[100 470-5*i 390 20],... 'HorizontalAlignment','left','string',{'Aw:W degradation rate'}); h.acs=uicontrol('Parent',h.P2,'style','text','position',[100 470-6*i 390 20],... 'HorizontalAlignment','left','string',{'Ac:C degradation rate'}); h.ns=uicontrol('Parent',h.P2,'style','text','position',[100 470-7*i 390 20],... 'HorizontalAlignment','left','string',{'n:steepness of CC to CSC curve'}); h.ms=uicontrol('Parent',h.P2,'style','text','position',[100 470-8*i 390 20],... 'HorizontalAlignment','left','string',{'m:steepness of CSC to QC curve'}); h.Was=uicontrol('Parent',h.P2,'style','text','position',[100 470-9*i 390 20],... 'HorizontalAlignment','left','string',{'Wa:W cutoff between CC and CSC'}); h.Wbs=uicontrol('Parent',h.P2,'style','text','position',[100 470-10*i 390 20],... 'HorizontalAlignment','left','string',{'Wb:W cuttoff between CSC and QC'}); h.W0s=uicontrol('Parent',h.P2,'style','text','position',[5 467-12*i 80 20],... 'HorizontalAlignment','left','string',{'Initial W'}); h.C0s=uicontrol('Parent',h.P2,'style','text','position',[5 467-13*i 80 20],... 'HorizontalAlignment','left','string',{'Initial C'}); %Create editable text boxes for user input of parameter values h.bw=uicontrol('Parent',h.P2,'style','edit','position',[5 473 80 20],... 'HorizontalAlignment','left','string',{'13'}); h.bc=uicontrol('Parent',h.P2,'style','edit','position',[5 473-i 80 20],... 'HorizontalAlignment','left','string',{'3'}); h.kcw=uicontrol('Parent',h.P2,'style','edit','position',[5 473-3*i 80 20],... 'HorizontalAlignment','left','string',{'2'}); h.aw=uicontrol('Parent',h.P2,'style','edit','position',[5 473-5*i 80 20],... 'HorizontalAlignment','left','string',{'1'}); h.ac=uicontrol('Parent',h.P2,'style','edit','position',[5 473-6*i 80 20],... 'HorizontalAlignment','left','string',{'1'}); h.n=uicontrol('Parent',h.P2,'style','edit','position',[5 473-7*i 80 20],... 'HorizontalAlignment','left','string',{'10'}); h.m=uicontrol('Parent',h.P2,'style','edit','position',[5 473-8*i 80 20],... 'HorizontalAlignment','left','string',{'10'}); h.Wa=uicontrol('Parent',h.P2,'style','edit','position',[5 473-9*i 80 20],... 'HorizontalAlignment','left','string',{'2'}); h.Wb=uicontrol('Parent',h.P2,'style','edit','position',[5 473-10*i 80 20],... 'HorizontalAlignment','left','string',{'6'}); % Create Solve Button h.SolveButton2 = uicontrol('Parent',h.P2,'style','pushbutton',... 'position',[350 300 100 40],'string','Solve!'); set(h.SolveButton2,'callback',{@solvebutton2,fig}) case 'C/W Multi-Cell Model (C restricts W expression)' %Make Other parameter panels invisible if isfield(h, 'P1')==1 set(h.P1,'visible','off') end if isfield(h, 'P2')==1 set(h.P2,'visible','off') end if isfield(h, 'P4')==1 set(h.P4,'visible','off') end if isfield(h, 'P5')==1 set(h.P5,'visible','off') end if isfield(h, 'P6')==1 set(h.P6,'visible','off') end %Create Box for parameters for model 3 h.P3 = uipanel('Title','Set Parameters','FontSize',12,... 'Position',[0 0 .5 .75]); i=20; m = 5; %Create text boxes for displayed description of parameters h.bws=uicontrol('Parent',h.P3,'style','text','position',[100 470-i 390 20],... 'HorizontalAlignment','left','string',{'Bw:Max W production rate'}); h.bcs=uicontrol('Parent',h.P3,'style','text','position',[100 470-2*i 390 20],... 'HorizontalAlignment','left','string',{'Bc:Max C production rate'}); h.kcws=uicontrol('Parent',h.P3,'style','text','position',[100 470-3*i 390 20],... 'HorizontalAlignment','left','string',{'Kcw:C at halved W production rate'}); h.Was=uicontrol('Parent',h.P3,'style','text','position',[100 470-4*i 390 20],... 'HorizontalAlignment','left','string',{'Wa:W at differentiation cut-off'}); h.aws=uicontrol('Parent',h.P3,'style','text','position',[100 470-5*i 390 20],... 'HorizontalAlignment','left','string',{'Aw:W degradation rate'}); h.acs=uicontrol('Parent',h.P3,'style','text','position',[100 470-6*i 390 20],... 'HorizontalAlignment','left','string',{'Ac:C degradation rate'}); h.ns=uicontrol('Parent',h.P3,'style','text','position',[100 470-7*i 390 20],... 'HorizontalAlignment','left','string',{'n:steepness of CC to CSC curve'}); h.grphs=uicontrol('Parent',h.P3,'style','text','position',[330 470-2*i 100 20],... 'HorizontalAlignment','left','string',{'Graph over time'}); h.wox5miss=uicontrol('Parent',h.P3,'style','text','position',[330 470-3*i 140 20],... 'HorizontalAlignment','left','string',{'Produce W everywhere'}); h.CLE40ps=uicontrol('Parent',h.P3,'style','text','position',[330 470-4*i 150 20],... 'HorizontalAlignment','left','string',{'Flood root with C'}); h.CLE40ps2=uicontrol('Parent',h.P3,'style','text','position',[330 470-5*i 155 20],... 'HorizontalAlignment','left','string',{'(Bc determines concentration.)'}); %Create editable text boxes for user input of parameter values h.bw=uicontrol('Parent',h.P3,'style','edit','position',[5 473-i 80 20],... 'HorizontalAlignment','left','string',{'34'}); h.bc=uicontrol('Parent',h.P3,'style','edit','position',[5 473-2*i 80 20],... 'HorizontalAlignment','left','string',{'30'}); h.kcw=uicontrol('Parent',h.P3,'style','edit','position',[5 473-3*i 80 20],... 'HorizontalAlignment','left','string',{'2'}); h.Wa=uicontrol('Parent',h.P3,'style','edit','position',[5 473-4*i 80 20],... 'HorizontalAlignment','left','string',{'1'}); h.aw=uicontrol('Parent',h.P3,'style','edit','position',[5 473-5*i 80 20],... 'HorizontalAlignment','left','string',{'2'}); h.ac=uicontrol('Parent',h.P3,'style','edit','position',[5 473-6*i 80 20],... 'HorizontalAlignment','left','string',{'2'}); h.n=uicontrol('Parent',h.P3,'style','edit','position',[5 473-7*i 80 20],... 'HorizontalAlignment','left','string',{'2'}); h.grph=uicontrol('Parent',h.P3,'style','checkbox','position',[310 473-2*i 20 20]); h.wox5mis=uicontrol('Parent',h.P3,'style','checkbox','position',[310 473-3*i 20 20]); h.CLE40p=uicontrol('Parent',h.P3,'style','checkbox','position',[310 473-4*i 20 20]); % generate Diffusion constant edits for each cell and their text % descriptions h.DIFFCONST=cell(2*m-2,1); h.Ds1 = uicontrol('Parent',h.P3,'style','text','position',[100 470-i*1-8*i 390 20],... 'HorizontalAlignment','left','string','WOX5 mobility constant between QC and D1'); h.Ds2 = uicontrol('Parent',h.P3,'style','text','position',[100 470-i*2-8*i 390 20],... 'HorizontalAlignment','left','string','WOX5 mobility constant between D1 and D2'); h.Ds3 = uicontrol('Parent',h.P3,'style','text','position',[100 470-i*3-8*i 390 20],... 'HorizontalAlignment','left','string','WOX5 mobility constant between D2 and D3'); h.Ds4 = uicontrol('Parent',h.P3,'style','text','position',[100 470-i*4-8*i 390 20],... 'HorizontalAlignment','left','string','WOX5 mobility constant between D3 and D4'); h.Ds5 = uicontrol('Parent',h.P3,'style','text','position',[100 470-i*(m+1)-8*i 390 20],... 'HorizontalAlignment','left','string','CLE40 mobility constant between QC and D1'); h.Ds6 = uicontrol('Parent',h.P3,'style','text','position',[100 470-i*(m+2)-8*i 390 20],... 'HorizontalAlignment','left','string','CLE40 mobility constant between D1 and D2'); h.Ds7 = uicontrol('Parent',h.P3,'style','text','position',[100 470-i*(m+3)-8*i 390 20],... 'HorizontalAlignment','left','string','CLE40 mobility constant between D2 and D3'); h.Ds8 = uicontrol('Parent',h.P3,'style','text','position',[100 470-i*(m+4)-8*i 390 20],... 'HorizontalAlignment','left','string','CLE40 mobility constant between D3 and D4'); for j=1:m-1 %editable text boxes h.DIFFCONST{j,1}=uicontrol('Parent',h.P3,'style','edit','position',[5 473-i*j-8*i 80 20],... 'HorizontalAlignment','left','string',{'1.2'}); h.DIFFCONST{m+j-1,1}=uicontrol('Parent',h.P3,'style','edit','position',[5 473-i*(m+j)-8*i 80 20],... 'HorizontalAlignment','left','string',{'1'}); end % Create Solve Button h.SolveButton3 = uicontrol('Parent',h.P3,'style','pushbutton',... 'position',[350 473-9*i 100 40],'string','Solve!'); set(h.SolveButton3,'callback',{@solvebutton3,fig}) case 'Alternate C/W Multi-Cell Model (C restricts W mobility)' %Make Other parameter panels invisible if isfield(h, 'P1')==1 set(h.P1,'visible','off') end if isfield(h, 'P2')==1 set(h.P2,'visible','off') end if isfield(h, 'P3')==1 set(h.P3,'visible','off') end if isfield(h, 'P5')==1 set(h.P5,'visible','off') end if isfield(h, 'P6')==1 set(h.P6,'visible','off') end %Create Box for parameters for model 3 h.P4 = uipanel('Title','Set Parameters','FontSize',12,... 'Position',[0 0 .5 .75]); i=20; m = 5; % number of cells used to be a variable %Create text boxes for displayed description of parameters h.bws=uicontrol('Parent',h.P4,'style','text','position',[100 470-i 390 20],... 'HorizontalAlignment','left','string',{'Bw:Max W production rate'}); h.bcs=uicontrol('Parent',h.P4,'style','text','position',[100 470-2*i 390 20],... 'HorizontalAlignment','left','string',{'Bc:Max C production rate'}); h.kcws=uicontrol('Parent',h.P4,'style','text','position',[100 470-3*i 390 20],... 'HorizontalAlignment','left','string',{'Kcw:C at halved W mobility'}); h.Was=uicontrol('Parent',h.P4,'style','text','position',[100 470-4*i 390 20],... 'HorizontalAlignment','left','string',{'Wa:W at differentiation cut-off'}); h.aws=uicontrol('Parent',h.P4,'style','text','position',[100 470-5*i 390 20],... 'HorizontalAlignment','left','string',{'Aw:W degradation rate'}); h.acs=uicontrol('Parent',h.P4,'style','text','position',[100 470-6*i 390 20],... 'HorizontalAlignment','left','string',{'Ac:C degradation rate'}); h.ns=uicontrol('Parent',h.P4,'style','text','position',[100 470-7*i 390 20],... 'HorizontalAlignment','left','string',{'n:steepness of CC to CSC curve'}); h.grphs=uicontrol('Parent',h.P4,'style','text','position',[330 470-2*i 100 20],... 'HorizontalAlignment','left','string',{'Graph over time'}); h.wox5miss=uicontrol('Parent',h.P4,'style','text','position',[330 470-3*i 140 20],... 'HorizontalAlignment','left','string',{'Produce W everywhere'}); h.CLE40ps=uicontrol('Parent',h.P4,'style','text','position',[330 470-4*i 150 20],... 'HorizontalAlignment','left','string',{'Flood root with C'}); h.CLE40ps2=uicontrol('Parent',h.P4,'style','text','position',[330 470-5*i 155 20],... 'HorizontalAlignment','left','string',{'(Bc determines concentration.)'}); %Create editable text boxes for user input of parameter values h.bw=uicontrol('Parent',h.P4,'style','edit','position',[5 473-i 80 20],... 'HorizontalAlignment','left','string',{'150'}); h.bc=uicontrol('Parent',h.P4,'style','edit','position',[5 473-2*i 80 20],... 'HorizontalAlignment','left','string',{'75'}); h.kcw=uicontrol('Parent',h.P4,'style','edit','position',[5 473-3*i 80 20],... 'HorizontalAlignment','left','string',{'2'}); h.Wa=uicontrol('Parent',h.P4,'style','edit','position',[5 473-4*i 80 20],... 'HorizontalAlignment','left','string',{'1'}); h.aw=uicontrol('Parent',h.P4,'style','edit','position',[5 473-5*i 80 20],... 'HorizontalAlignment','left','string',{'2'}); h.ac=uicontrol('Parent',h.P4,'style','edit','position',[5 473-6*i 80 20],... 'HorizontalAlignment','left','string',{'2'}); h.n=uicontrol('Parent',h.P4,'style','edit','position',[5 473-7*i 80 20],... 'HorizontalAlignment','left','string',{'2'}); h.grph=uicontrol('Parent',h.P4,'style','checkbox','position',[310 473-2*i 20 20]); h.wox5mis=uicontrol('Parent',h.P4,'style','checkbox','position',[310 473-3*i 20 20]); h.CLE40p=uicontrol('Parent',h.P4,'style','checkbox','position',[310 473-4*i 20 20]); % generate Diffusion constant edits for each cell and their text % descriptions h.DIFFCONST=cell(2*m-2,1); h.Ds1 = uicontrol('Parent',h.P4,'style','text','position',[100 470-i*1-8*i 390 20],... 'HorizontalAlignment','left','string','WOX5 mobility constant between QC and D1'); h.Ds2 = uicontrol('Parent',h.P4,'style','text','position',[100 470-i*2-8*i 390 20],... 'HorizontalAlignment','left','string','WOX5 mobility constant between D1 and D2'); h.Ds3 = uicontrol('Parent',h.P4,'style','text','position',[100 470-i*3-8*i 390 20],... 'HorizontalAlignment','left','string','WOX5 mobility constant between D2 and D3'); h.Ds4 = uicontrol('Parent',h.P4,'style','text','position',[100 470-i*4-8*i 390 20],... 'HorizontalAlignment','left','string','WOX5 mobility constant between D3 and D4'); h.Ds5 = uicontrol('Parent',h.P4,'style','text','position',[100 470-i*(m+1)-8*i 390 20],... 'HorizontalAlignment','left','string','CLE40 mobility constant between QC and D1'); h.Ds6 = uicontrol('Parent',h.P4,'style','text','position',[100 470-i*(m+2)-8*i 390 20],... 'HorizontalAlignment','left','string','CLE40 mobility constant between D1 and D2'); h.Ds7 = uicontrol('Parent',h.P4,'style','text','position',[100 470-i*(m+3)-8*i 390 20],... 'HorizontalAlignment','left','string','CLE40 mobility constant between D2 and D3'); h.Ds8 = uicontrol('Parent',h.P4,'style','text','position',[100 470-i*(m+4)-8*i 390 20],... 'HorizontalAlignment','left','string','CLE40 mobility constant between D3 and D4'); for j=1:m-1 %editable text boxes h.DIFFCONST{j,1}=uicontrol('Parent',h.P4,'style','edit','position',[5 473-i*j-8*i 80 20],... 'HorizontalAlignment','left','string',{'1'}); h.DIFFCONST{m+j-1,1}=uicontrol('Parent',h.P4,'style','edit','position',[5 473-i*(m+j)-8*i 80 20],... 'HorizontalAlignment','left','string',{'1'}); end % Create Solve Button h.SolveButton4 = uicontrol('Parent',h.P4,'style','pushbutton',... 'position',[350 473-9*i 100 40],'string','Solve!'); set(h.SolveButton4,'callback',{@solvebutton4,fig}) case 'C/W/X Multi-Cell Model' %Make Other parameter panels invisible if isfield(h, 'P1')==1 set(h.P1,'visible','off') end if isfield(h, 'P2')==1 set(h.P2,'visible','off') end if isfield(h, 'P3')==1 set(h.P3,'visible','off') end if isfield(h, 'P4')==1 set(h.P4,'visible','off') end if isfield(h, 'P5')==1 set(h.P5,'visible','off') end %Create Box for parameters h.P6 = uipanel('Title','Set Parameters','FontSize',12,... 'Position',[0 0 .5 .75]); i=20; m = 5;% number of cells, used to be a variable % Model Inputs %Create text boxes for displayed description of parameters h.bws=uicontrol('Parent',h.P6,'style','text','position',[100 470-i 390 20],... 'HorizontalAlignment','left','string',{'Bw:Max W production rate'}); h.bcs=uicontrol('Parent',h.P6,'style','text','position',[100 470-2*i 390 20],... 'HorizontalAlignment','left','string',{'Bc:Max C production rate'}); h.bxs=uicontrol('Parent',h.P6,'style','text','position',[100 470-3*i 390 20],... 'HorizontalAlignment','left','string',{'Bx:Max X production rate'}); h.kcws=uicontrol('Parent',h.P6,'style','text','position',[100 470-4*i 390 20],... 'HorizontalAlignment','left','string',{'Kcw:C at halved W production'}); h.kcxs=uicontrol('Parent',h.P6,'style','text','position',[100 470-5*i 390 20],... 'HorizontalAlignment','left','string',{'Kcx:C at halved X production'}); h.Was=uicontrol('Parent',h.P6,'style','text','position',[100 470-6*i 390 20],... 'HorizontalAlignment','left','string',{'Sa:W+X at differentiation cut-off'}); h.aws=uicontrol('Parent',h.P6,'style','text','position',[100 470-7*i 390 20],... 'HorizontalAlignment','left','string',{'Aw:W degradation rate'}); h.acs=uicontrol('Parent',h.P6,'style','text','position',[100 470-8*i 390 20],... 'HorizontalAlignment','left','string',{'Ac:C degradation rate'}); h.axs=uicontrol('Parent',h.P6,'style','text','position',[100 470-9*i 390 20],... 'HorizontalAlignment','left','string',{'Ax:X degradation rate'}); h.axs=uicontrol('Parent',h.P6,'style','text','position',[100 470-10*i 390 20],... 'HorizontalAlignment','left','string',{'n:Steepness of CC to CSC curve'}); h.Dws = uicontrol('Parent',h.P6,'style','text','position',[100 470-12*i 120 20],... 'HorizontalAlignment','left','string','Dw:W mobility constant'); h.Dcs = uicontrol('Parent',h.P6,'style','text','position',[100 470-13*i 120 20],... 'HorizontalAlignment','left','string','Dc:C mobility constant'); h.Dxs = uicontrol('Parent',h.P6,'style','text','position',[100 470-14*i 120 20],... 'HorizontalAlignment','left','string','Dx:X mobility constant'); h.W0s = uicontrol('Parent',h.P6,'style','text','position',[100 470-16*i 390 20],... 'HorizontalAlignment','left','string','Initial W'); h.C0s = uicontrol('Parent',h.P6,'style','text','position',[100 470-17*i 390 20],... 'HorizontalAlignment','left','string','Initial C'); h.X0s = uicontrol('Parent',h.P6,'style','text','position',[100 470-18*i 390 20],... 'HorizontalAlignment','left','string','Initial X'); h.grphs=uicontrol('Parent',h.P6,'style','text','position',[330 470-2*i 100 20],... 'HorizontalAlignment','left','string',{'Graph over time'}); h.wox5miss=uicontrol('Parent',h.P6,'style','text','position',[330 470-3*i 140 20],... 'HorizontalAlignment','left','string',{'Produce W everywhere'}); h.Xmiss=uicontrol('Parent',h.P6,'style','text','position',[330 470-4*i 140 20],... 'HorizontalAlignment','left','string',{'Produce X everywhere'}); h.CLE40ps=uicontrol('Parent',h.P6,'style','text','position',[330 470-5*i 150 20],... 'HorizontalAlignment','left','string',{'Flood root with C'}); h.CLE40ps2=uicontrol('Parent',h.P6,'style','text','position',[330 470-6*i 155 20],... 'HorizontalAlignment','left','string',{'(Bc determines concentration.)'}); %Create editable text boxes for user input of parameter values h.bw=uicontrol('Parent',h.P6,'style','edit','position',[5 473-i 80 20],... 'HorizontalAlignment','left','string',{'34'}); h.bc=uicontrol('Parent',h.P6,'style','edit','position',[5 473-2*i 80 20],... 'HorizontalAlignment','left','string',{'45'}); h.bx=uicontrol('Parent',h.P6,'style','edit','position',[5 473-3*i 80 20],... 'HorizontalAlignment','left','string',{'25'}); h.kcw=uicontrol('Parent',h.P6,'style','edit','position',[5 473-4*i 80 20],... 'HorizontalAlignment','left','string',{'2'}); h.kcx=uicontrol('Parent',h.P6,'style','edit','position',[5 473-5*i 80 20],... 'HorizontalAlignment','left','string',{'2'}); h.Wa=uicontrol('Parent',h.P6,'style','edit','position',[5 473-6*i 80 20],... 'HorizontalAlignment','left','string',{'1'}); h.aw=uicontrol('Parent',h.P6,'style','edit','position',[5 473-7*i 80 20],... 'HorizontalAlignment','left','string',{'2'}); h.ac=uicontrol('Parent',h.P6,'style','edit','position',[5 473-8*i 80 20],... 'HorizontalAlignment','left','string',{'2'}); h.ax=uicontrol('Parent',h.P6,'style','edit','position',[5 473-9*i 80 20],... 'HorizontalAlignment','left','string',{'2'}); h.n=uicontrol('Parent',h.P6,'style','edit','position',[5 473-10*i 80 20],... 'HorizontalAlignment','left','string',{'2'}); h.Dw = uicontrol('Parent',h.P6,'style','edit','position',[5 473-12*i 80 20],... 'HorizontalAlignment','left','string','1'); h.Dc = uicontrol('Parent',h.P6,'style','edit','position',[5 473-13*i 80 20],... 'HorizontalAlignment','left','string','1'); h.Dx = uicontrol('Parent',h.P6,'style','edit','position',[5 473-14*i 80 20],... 'HorizontalAlignment','left','string','1'); h.W0 = uicontrol('Parent',h.P6,'style','edit','position',[5 473-16*i 80 20],... 'HorizontalAlignment','left','string','5; 4; 3; 2; 1'); h.C0 = uicontrol('Parent',h.P6,'style','edit','position',[5 473-17*i 80 20],... 'HorizontalAlignment','left','string','1; 2; 3; 4; 5'); h.X0 = uicontrol('Parent',h.P6,'style','edit','position',[5 473-18*i 80 20],... 'HorizontalAlignment','left','string','5; 4; 3; 2; 1'); h.grph=uicontrol('Parent',h.P6,'style','checkbox','position',[310 473-2*i 20 20]); h.wox5mis=uicontrol('Parent',h.P6,'style','checkbox','position',[310 473-3*i 20 20]); h.Xmis=uicontrol('Parent',h.P6,'style','checkbox','position',[310 473-4*i 20 20]); h.CLE40p=uicontrol('Parent',h.P6,'style','checkbox','position',[310 473-5*i 20 20]); % Create Solve Button h.SolveButton6 = uicontrol('Parent',h.P6,'style','pushbutton',... 'position',[350 473-9*i 100 40],'string','Solve!'); set(h.SolveButton6,'callback',{@solvebutton6,fig}) end guidata(fig,h); end function solvebutton2(hObject,eventdata,fig)% end of program. No need to save variables in struct % Single-cell model h = guidata(fig); %Get parameter handles, solve, display results % Delete Irrelevant Display Axes if isfield(h,'results')==1 rmfield(h,'results'); end h.results = uipanel('Title','Results','FontSize',12,... 'Position',[.57 0 .43 1]); % Create Display Axes h.r1 = axes('Parent',h.results,'position',[.1 .55 .85 .40]); h.r2 = axes('Parent',h.results,'position',[.1 .05 .85 .40]); Tstart=0; Tstop=100; W0=get(h.W0,'Value');% initial WOX5 concentration from slider C0=get(h.C0,'Value');% initial CLE40 concentration from slider bw=str2double(get(h.bw,'String'));% parameter values from editable text boxes bc=str2double(get(h.bc,'String')); kcw=str2double(get(h.kcw,'String')); Wa=str2double(get(h.Wa,'String')); aw=str2double(get(h.aw,'String')); ac=str2double(get(h.ac,'String')); n=str2double(get(h.n,'String')); m=str2double(get(h.m,'String')); Wb=str2double(get(h.Wb,'String')); % Various Warning messages for dumb parameter entries from the GUI if ge(Wa,Wb) disp('WARNING: Wa should be less than Wb.') end if ge(aw,bw) & bw>0 disp('WARNING: Bw should be greater than Aw, so that WOX5 can be produced faster than it is degraded') end if ge(ac,bc) & bc>0 disp('WARNING: Bc should be greater than Ac, so that CLE40 can be produced faster than it is degraded') end %Find Fixed Points p=zeros(1,m+n+2);% roots of this polynomial give values of W at fixed pts. p(1,m+n+1)=p(1,m+n+1)+aw*Wa^n*Wb^m*(bw*kcw+ac*kcw); p(1,n+1)=p(1,n+1)+aw*Wa^n*(bc+ac*kcw); p(1,m+1)=p(1,m+1)+aw*kcw*ac*Wb^m; p(1,1)=p(1,1)+aw*kcw*ac; p(1,2)=p(1,2)-bw*kcw*ac; p(1,n+2)=p(1,n+2)-bw*kcw*ac*Wa^n; FPW=roots(p);% find roots of polynomial FPW=FPW(FPW == real(FPW));%take only real roots FPW=FPW(ge(FPW,0));%take only positive roots FPC=bc*Wa^n./(ac*(FPW.^n+Wa^n));% find value of C at fixed point(s) % RHS of system F = @(X) [bw*kcw*X(:,1).^m./((X(:,2)+kcw).*(X(:,1).^m+Wb^m))-aw*X(:,1) ... bc*Wa^n./(X(:,1).^n+Wa^n)-ac*X(:,2)]; f = @(t,X) [bw*kcw*X(1)^m./((X(2)+kcw)*(X(1)^m+Wb^m))-aw*X(1); ... bc*Wa^n./(X(1).^n+Wa^n)-ac*X(2)]; % set min/max values for what shows up on graph Xmin=0; Xmax=1.25*max(FPW); if (Xmax==0) Xmax=10; end Ymin=0; Ymax=1.25*max(FPC); FixedPoints=[FPW FPC]; %make grid points for evaluation (using min and max x and y values) [A,B] = meshgrid(Xmin:(Xmax-Xmin)/20:Xmax, Ymin:(Ymax-Ymin)/20:Ymax); X=[A(:) B(:)];% forms xy pairs which make up grid % finds values of derivative at grid points FuncVals=F(X); % plots vector field in first graph of GUI quiver(h.r1,X(:,1),X(:,2),FuncVals(:,1),FuncVals(:,2),'k') % plot flow of vector field axis(h.r1,[Xmin Xmax Ymin Ymax]); xlabel(h.r1,'WOX5 concentration'); ylabel(h.r1,'CLE40 concentration'); % more graphs to overlap on first graph of GUI hold(h.r1,'on') % plot initial value given by GUI scatter(h.r1,W0,C0,50,[0 1 0],'filled') % plot initial value % solve differential equation given initial value [t,X] = ode45(f,[0 100],[W0;C0]); % edit here ^ to adjust time when simulation stops % plot solution to differential equation on first graph of GUI plot(h.r1,X(:,1),X(:,2),'g') axis([Xmin Xmax Ymin Ymax]); % plot WOX5 and CLE40 values against time in 2nd graph of GUI plot(h.r2,t,X(:,1),'r',t,X(:,2),'c') legend(h.r2,'WOX5 concentration','CLE40 concentration') xlabel(h.r2,'time') axis(h.r2,[0 100 Xmin Xmax]); % plot fixed points scatter(h.r1,FPW,FPC,50,[0 0 0],'filled') % reset GUI graph so that it can be overwritten when program runs next hold(h.r1,'off') guidata(fig,h); end function solvebutton3(hObject,eventdata,fig)% last function called. No need to save variables in struct % C/W Multi-cell model (CLE40 regulates WOX5 expression) h = guidata(fig); %Get parameter handles, solve, display results % Delete Irrelevant Display Axes if isfield(h,'results')==1 rmfield(h,'results'); end h.results = uipanel('Title','Results','FontSize',12,... 'Position',[.57 0 .43 1]); % Create Display Axes, get initial values and diffusion constants m = 5; h.graphs=cell(m); W0=zeros(m,1); %To make initial values in cells i=1...5 different, %replace "zeros(m,1)" with "[5 4 3 2 1]'" or some % other sequence of 5 numbers. They should be % decreasing. C0=zeros(m,1); D=zeros(m-1,1); % get diffusion constants for count=1:2*m-2 D(count)=str2double(get(h.DIFFCONST{count,1},'String')); end Dw = D(1:m-1); Dc = D(m:2*m-2); % Take in parameters (from edit boxes) which are independent of cell number bw = str2double(get(h.bw,'String')); bc = str2double(get(h.bc,'String')); kcw = str2double(get(h.kcw,'String')); Wa = str2double(get(h.Wa,'String')); aw = str2double(get(h.aw,'String')); ac = str2double(get(h.ac,'String')); n = 2; CLE40p=get(h.CLE40p,'Value');% 1 if CLE40p box checked, 0 otherwise; C concentration held at level entered into max C production rate wox5mis=get(h.wox5mis,'Value');% same deal with box checking; WOX5 produced at max rate in every cell % Warnings for dumb parameter values if ge(aw,bw) & bw>0 disp('WARNING: Bw should be greater than Aw, so that WOX5 can be produced faster than it is degraded') end if ge(ac,bc) & bc>0 disp('WARNING: Bc should be greater than Ac, so that CLE40 can be produced faster than it is degraded') end if CLE40p==1 C0(:,1)=bc;% all initial values of C in each cell set to parameter bc end % solve differential equation given initial values [t,X] = ode45(@model3f,[0 100],[W0;C0]); % edit here ^ to adjust time when simulation stops % define function so that ode45 knows what @model3f is function [dydt] = model3f(t,y) % y is a 2m x 1 matrix with WOX5 concentrations in rows 1 to m (one % concentration per cell) and CLE40 concentrations in rows m+1 % to 2m (one concentration per cell) %dydt is the derivative vector, which depends on y (and t). dydt=zeros(2*m,1); % function handles for cell 1 dydt(1,1) = bw*kcw/(y(m+1,1)+kcw)+Dw(1)*(y(2,1)-y(1,1))-aw*y(1,1); if CLE40p==1 dydt(m+1,1) = 0;% if CLE40p is added, C is held constant else dydt(m+1,1) = Dc(1)*(y(m+2,1)-y(m+1,1))-ac*y(m+1,1); end if wox5mis==0 % function handles for cells 2...m-1 for sa=2:m-1 dydt(sa,1) = Dw(sa)*(y(sa+1,1)-y(sa,1))+Dw(sa-1)*(y(sa-1,1)-y(sa,1))-aw*y(sa,1); dydt(m+sa,1) = bc*Wa^n/((y(sa,1))^n+Wa^n)+Dc(sa)*(y(m+sa+1,1)-y(m+sa,1))+Dc(sa-1)*(y(m+sa-1,1)-y(m+sa,1))-ac*y(m+sa,1); end % function handles for cell m dydt(m,1) = Dw(m-1)*(y(m-1,1)-y(m,1))-aw*y(m,1); dydt(2*m,1) = bc*Wa^n/((y(m,1))^n+Wa^n)+Dc(m-1)*(y(2*m-1,1)-y(2*m,1))-ac*y(2*m,1); elseif wox5mis==1 % function handles for cells 2...m-1 for sa=2:m-1 dydt(sa,1) = bw + Dw(sa)*(y(sa+1,1)-y(sa,1))+Dw(sa-1)*(y(sa-1,1)-y(sa,1))-aw*y(sa,1); dydt(m+sa,1) = bc*Wa^n/((y(sa,1))^n+Wa^n)+Dc(sa)*(y(m+sa+1,1)-y(m+sa,1))+Dc(sa-1)*(y(m+sa-1,1)-y(m+sa,1))-ac*y(m+sa,1); end % function handles for cell m dydt(m,1) = bw + Dw(m-1)*(y(m-1,1)-y(m,1))-aw*y(m,1); dydt(2*m,1) = bc*Wa^n/((y(m,1))^n+Wa^n)+Dc(m-1)*(y(2*m-1,1)-y(2*m,1))-ac*y(2*m,1); end end % Y is a matrix with Columns 1 to m with W values (cells 1 to m) and columns m+1 % to 2m with C values (cells 1 to m). Rows indicate time index when % the W and C concentrations are reached (actual time is accessible from vector t) grph=get(h.grph,'Value'); if grph == 0 W=zeros(2*m,1); Xdiff=zeros(2*m,1); for dummy=1:2*m W(dummy,1)=X(length(X(:,1)),dummy);% W = values of X at last time point Xdiff(dummy,1)=X(length(X(:,1)),dummy)-X(length(X(:,1))-1,dummy); % difference between X at last two values of t (to check for % equilibrium) end if any(gt(abs(Xdiff),1e-3)) disp('WARNING: Equilibrium not reached. Increase simulation end time. See instructions at start of program.') end % Choose which cells are differentiated and display image if gt(W(1,1),Wa)>(W(2,1),Wa)>(W(3,1),Wa)>(W(4,1),Wa)>(W(5,1),Wa) I = imread('Model3Diagram5.png'); elseif gt(W(1,1),Wa)>(W(2,1),Wa)>(W(3,1),Wa)>(W(4,1),Wa)&le(W(5,1),Wa) I = imread('Model3Diagram4.png'); elseif gt(W(1,1),Wa)>(W(2,1),Wa)>(W(3,1),Wa)&le(W(4,1),Wa)&le(W(5,1),Wa) I = imread('Model3Diagram3.png'); elseif gt(W(1,1),Wa)>(W(2,1),Wa)&le(W(3,1),Wa)&le(W(4,1),Wa)&le(W(5,1),Wa) I = imread('Model3Diagram2.png'); elseif gt(W(1,1),Wa)&le(W(2,1),Wa)&le(W(3,1),Wa)&le(W(4,1),Wa)&le(W(5,1),Wa) I = imread('Model3Diagram1.png'); elseif le(W(1,1),Wa)&le(W(2,1),Wa)&le(W(3,1),Wa)&le(W(4,1),Wa)&le(W(5,1),Wa) I = imread('Model3Diagram1.png'); else disp('Something really weird happened. The WOX5 gradient is irregular, and there are CCs between QC cells and CSCs. Tell Sarah.') end ImgSize = size(I); Axes3 = axes('Units', 'pixels',... 'parent', h.results,... 'position', [50 100 320 500]); axis(Axes3, 'off') image(I, 'Parent', Axes3); else W=X(:,1:m); C=X(:,m+1:2*m); % plot WOX5, CLE40, X values in each cell against time in graphs of GUI axes1 = axes('Units', 'pixels',... 'parent', h.results,... 'position', [75 560 200 100]); axes2 = axes('Units', 'pixels',... 'parent', h.results,... 'position', [150 420 200 100]); axes3 = axes('Units', 'pixels',... 'parent', h.results,... 'position', [75 290 200 100]); axes4 = axes('Units', 'pixels',... 'parent', h.results,... 'position', [150 160 200 100]); axes5 = axes('Units', 'pixels',... 'parent', h.results,... 'position', [75 30 200 100]); plot(axes1,t,W(:,1),'r',t,C(:,1),'c') legend(axes1,'WOX5 concentration','CLE40 concentration') xlabel(axes1,'time') plot(axes2,t,W(:,2),'r',t,C(:,2),'c') plot(axes3,t,W(:,3),'r',t,C(:,3),'c') plot(axes4,t,W(:,4),'r',t,C(:,4),'c') plot(axes5,t,W(:,5),'r',t,C(:,5),'c') end guidata(fig,h); end function solvebutton4(hObject,eventdata,fig)% last function called. No need to save variables in struct % C/W multi-cell ALTERNATE model (CLE40 regulates WOX5 mobility) h = guidata(fig); %Get parameter handles, solve, display results % Delete Irrelevant Display Axes if isfield(h,'results')==1 rmfield(h,'results'); end h.results = uipanel('Title','Results','FontSize',12,... 'Position',[.57 0 .43 1]); % Create Display Axes, get initial values and diffusion constants m = 5; h.graphs=cell(m); W0=zeros(m,1);%To make initial values in cells i=1...5 different, %replace "zeros(m,1)" with "[5 4 3 2 1]'" or some % other sequence of 5 numbers. They should be % decreasing. C0=zeros(m,1); D=zeros(m-1,1); % get diffusion(mobility) constants for count=1:2*m-2 D(count)=str2double(get(h.DIFFCONST{count,1},'String')); end Dw = D(1:m-1); Dc = D(m:2*m-2); % Take in parameters (from edit boxes) which are independent of cell number bw = str2double(get(h.bw,'String')); bc = str2double(get(h.bc,'String')); kcw = str2double(get(h.kcw,'String')); Wa = str2double(get(h.Wa,'String')); aw = str2double(get(h.aw,'String')); ac = str2double(get(h.ac,'String')); n = 2; CLE40p=get(h.CLE40p,'Value');% 1 if CLE40p box not checked, 0 otherwise; C concentration held at level entered into max C production rate wox5mis=get(h.wox5mis,'Value');% same deal with box checking; WOX5 produced at max rate in every cell % Warnings for dumb parameter values if ge(aw,bw) & bw > 0 disp('WARNING: Bw should be greater than Aw, so that WOX5 can be produced faster than it is degraded') end if ge(ac,bc) & bc > 0 disp('WARNING: Bc should be greater than Ac, so that CLE40 can be produced faster than it is degraded') end if CLE40p==1 C0(:,1)=bc; end % solve differential equation given initial values [t,X] = ode45(@model3f,[0 100],[W0;C0]); % edit here ^ to adjust time when simulation stops function [dydt] = model3f(t,y) % y is a 2m x 1 matrix with WOX5 concentrations in rows 1 to m (one % concentration per cell) and CLE40 concentrations in rows m+1 % to 2m (one concentration per cell) %dydt is the derivative vector, which depends on y (and t). dydt=zeros(2*m,1); % function handles for cell 1 dydt(1,1) = bw+Dw(1)*(y(2,1)-y(1,1))*kcw/(y(m+1,1)+kcw)-aw*y(1,1); if CLE40p==0 dydt(m+1,1) = Dc(1)*(y(m+2,1)-y(m+1,1))-ac*y(m+1,1); else dydt(m+1,1) = 0;% if CLE40p is added, C is held constant end if wox5mis==0 % function handles for cells 2...m-1 for sa=2:m-1 dydt(sa,1) = Dw(sa)*(y(sa+1,1)-y(sa,1))*kcw/(y(m+sa,1)+kcw)+Dw(sa-1)*(y(sa-1,1)-y(sa,1))*kcw/(y(m+sa-1,1)+kcw)-aw*y(sa,1); dydt(m+sa,1) = bc*Wa^n/((y(sa,1))^n+Wa^n)+Dc(sa)*(y(m+sa+1,1)-y(m+sa,1))+Dc(sa-1)*(y(m+sa-1,1)-y(m+sa,1))-ac*y(m+sa,1); end % function handles for cell m dydt(m,1) = Dw(m-1)*(y(m-1,1)-y(m,1))*kcw/(y(2*m-1,1)+kcw)-aw*y(m,1); dydt(2*m,1) = bc*Wa^n/((y(m,1))^n+Wa^n)+Dc(m-1)*(y(2*m-1,1)-y(2*m,1))-ac*y(2*m,1); elseif wox5mis==1 % function handles for cells 2...m-1 for sa=2:m-1 dydt(sa,1) = bw + Dw(sa)*(y(sa+1,1)-y(sa,1))*kcw/(y(m+sa,1)+kcw)+Dw(sa-1)*(y(sa-1,1)-y(sa,1))*kcw/(y(m+sa-1,1)+kcw)-aw*y(sa,1); dydt(m+sa,1) = bc*Wa^n/((y(sa,1))^n+Wa^n)+Dc(sa)*(y(m+sa+1,1)-y(m+sa,1))+Dc(sa-1)*(y(m+sa-1,1)-y(m+sa,1))-ac*y(m+sa,1); end % function handles for cell m dydt(m,1) = bw + Dw(m-1)*(y(m-1,1)-y(m,1))*kcw/(y(2*m-1,1)+kcw)-aw*y(m,1); dydt(2*m,1) = bc*Wa^n/((y(m,1))^n+Wa^n)+Dc(m-1)*(y(2*m-1,1)-y(2*m,1))-ac*y(2*m,1); end end % Y is a matrix with Columns 1 to m with W values (cells 1 to m) and columns m+1 % to 2m with C values (cells 1 to m). Rows indicate time index when % the W and C concentrations are reached (actual time is accessible from vector t) grph=get(h.grph,'Value'); if grph == 0 W=zeros(m,1); Xdiff=zeros(2*m,1); for dummy=1:2*m W(dummy,1)=X(length(X(:,1)),dummy);% W = values of X at last time point Xdiff(dummy,1)=X(length(X(:,1)),dummy)-X(length(X(:,1))-1,dummy); % difference between X at last two values of t (to check for % equilibrium) end if any(gt(abs(Xdiff),1e-3)) disp('WARNING: Equilibrium not reached. Increase simulation end time. See instructions at start of program.') end % Choose which cells are differentiated and display image if gt(W(1,1),Wa)>(W(2,1),Wa)>(W(3,1),Wa)>(W(4,1),Wa)>(W(5,1),Wa) I = imread('Model3Diagram5.png'); elseif gt(W(1,1),Wa)>(W(2,1),Wa)>(W(3,1),Wa)>(W(4,1),Wa)&le(W(5,1),Wa) I = imread('Model3Diagram4.png'); elseif gt(W(1,1),Wa)>(W(2,1),Wa)>(W(3,1),Wa)&le(W(4,1),Wa)&le(W(5,1),Wa) I = imread('Model3Diagram3.png'); elseif gt(W(1,1),Wa)>(W(2,1),Wa)&le(W(3,1),Wa)&le(W(4,1),Wa)&le(W(5,1),Wa) I = imread('Model3Diagram2.png'); elseif gt(W(1,1),Wa)&le(W(2,1),Wa)&le(W(3,1),Wa)&le(W(4,1),Wa)&le(W(5,1),Wa) I = imread('Model3Diagram1.png'); elseif le(W(1,1),Wa)&le(W(2,1),Wa)&le(W(3,1),Wa)&le(W(4,1),Wa)&le(W(5,1),Wa) I = imread('Model3Diagram1.png'); else disp('Something really weird happened. The WOX5 gradient is irregular, and there are CCs between QC cells and CSCs. Tell Sarah.') end ImgSize = size(I); Axes4 = axes('Units', 'pixels',... 'parent', h.results,... 'position', [50 100 320 500]); axis(Axes4, 'off') image(I, 'Parent', Axes4); else W=X(:,1:m); C=X(:,m+1:2*m); % plot WOX5, CLE40, X values in each cell against time in graphs of GUI axes1 = axes('Units', 'pixels',... 'parent', h.results,... 'position', [75 560 200 100]); axes2 = axes('Units', 'pixels',... 'parent', h.results,... 'position', [150 420 200 100]); axes3 = axes('Units', 'pixels',... 'parent', h.results,... 'position', [75 290 200 100]); axes4 = axes('Units', 'pixels',... 'parent', h.results,... 'position', [150 160 200 100]); axes5 = axes('Units', 'pixels',... 'parent', h.results,... 'position', [75 30 200 100]); plot(axes1,t,W(:,1),'r',t,C(:,1),'c') legend(axes1,'WOX5 concentration','CLE40 concentration') xlabel(axes1,'time') plot(axes2,t,W(:,2),'r',t,C(:,2),'c') plot(axes3,t,W(:,3),'r',t,C(:,3),'c') plot(axes4,t,W(:,4),'r',t,C(:,4),'c') plot(axes5,t,W(:,5),'r',t,C(:,5),'c') end guidata(fig,h); end function solvebutton6(hObject,eventdata,fig)% last function called. No need to save variables in struct % C/W/X multi-cell model h = guidata(fig); %Get parameter handles, solve, display results % Delete Irrelevant Display Axes if isfield(h,'results')==1 rmfield(h,'results'); end h.results = uipanel('Title','Results','FontSize',12,... 'Position',[.57 0 .43 1]); % Create Display Axes, get initial values and diffusion constants m = 5; h.graphs=cell(m); W0=str2num(get(h.W0,'String')); C0=str2num(get(h.C0,'String')); X0=str2num(get(h.X0,'String')); % get diffusion(mobility) constants Dw=str2double(get(h.Dw,'String'))*ones(m-1,1);%%%%%%%%%%%%%%%%%%%% Here, can give different diffusion constants between different cells, not possible in GUI Dc=str2double(get(h.Dc,'String'))*ones(m-1,1); Dx=str2double(get(h.Dx,'String'))*ones(m-1,1); % Take in parameters (from GUI edit boxes) which are independent of cell number bw = str2double(get(h.bw,'String')); bc = str2double(get(h.bc,'String')); bx = str2double(get(h.bx,'String')); kcw = str2double(get(h.kcw,'String')); kcx = str2double(get(h.kcx,'String')); Wa = str2double(get(h.Wa,'String')); aw = str2double(get(h.aw,'String')); ac = str2double(get(h.ac,'String')); ax = str2double(get(h.ax,'String')); n = 2; CLE40p=get(h.CLE40p,'Value');% 1 if CLE40p box not checked, 0 otherwise; C concentration held at level entered into max C production rate wox5mis=get(h.wox5mis,'Value');% same deal with box checking; WOX5 produced at max rate in every cell Xmis = get(h.Xmis,'Value');% same deal; X produced at max rate in every cell % Warnings for dumb parameter values if ge(aw,bw) & bw > 0 disp('WARNING: Bw should be greater than Aw, so that WOX5 can be produced faster than it is degraded') end if ge(ac,bc) & bc > 0 disp('WARNING: Bc should be greater than Ac, so that CLE40 can be produced faster than it is degraded') end if ge(ax,bx) & bx > 0 disp('WARNING: Bx should be greater than Ax, so that X can be produced faster than it is degraded') end if CLE40p~=0 C0(:,1)=bc;%if user chooses to add CLE40p, make initial value of C = C production rate in all cells end % solve differential equation given initial values [t,Y] = ode45(@model3f,[0 100],[W0;C0;X0]); % edit here ^ to adjust time when simulation stops % make a nested function model3f here so that parameter values % (such as m) can determine what function model3f is. function [dydt] = model3f(t,y) % y is a 3m x 1 matrix with WOX5 concentrations in rows 1 to m (one % concentration per cell),CLE40 concentrations in rows m+1 % to 2m (one concentration per cell) and X concentrations in rows 2m+1 to 3m. %dydt is the derivative vector, which depends on y (and t). dydt=zeros(3*m,1); % function handles for cell 1 dydt(1,1) = bw*kcw/(y(m+1,1)+kcw)+Dw(1)*(y(2,1)-y(1,1))-aw*y(1,1); if CLE40p==0 dydt(m+1,1) = Dc(1)*(y(m+2,1)-y(m+1,1))-ac*y(m+1,1); else dydt(m+1,1) = 0;% if CLE40p is added, C is held constant end dydt(2*m+1) = bx*kcx/(y(m+1,1)+kcx)+Dx(1)*(y(2*m+2,1)-y(2*m+1,1))-ax*y(2*m+1,1); if wox5mis==0&Xmis==0 % function handles for cells 2...m-1 for sa=2:m-1 dydt(sa,1) = Dw(sa)*(y(sa+1,1)-y(sa,1))+Dw(sa-1)*(y(sa-1,1)-y(sa,1))-aw*y(sa,1); dydt(m+sa,1) = bc*Wa^n/((y(sa,1))^n+Wa^n)+Dc(sa)*(y(m+sa+1,1)-y(m+sa,1))+Dc(sa-1)*(y(m+sa-1,1)-y(m+sa,1))-ac*y(m+sa,1); dydt(2*m+sa,1) = Dx(sa)*(y(2*m+sa+1,1)-y(2*m+sa,1))+Dx(sa-1)*(y(2*m+sa-1,1)-y(2*m+sa,1))-ax*y(2*m+sa,1); end % function handles for cell m dydt(m,1) = Dw(m-1)*(y(m-1,1)-y(m,1))-aw*y(m,1); dydt(2*m,1) = bc*Wa^n/((y(m,1))^n+Wa^n)+Dc(m-1)*(y(2*m-1,1)-y(2*m,1))-ac*y(2*m,1); dydt(3*m,1) = Dx(m-1)*(y(3*m-1,1)-y(3*m,1))-ax*y(3*m,1); elseif wox5mis==1&Xmis==0 % function handles for cells 2...m-1 for sa=2:m-1 dydt(sa,1) = bw + Dw(sa)*(y(sa+1,1)-y(sa,1))+Dw(sa-1)*(y(sa-1,1)-y(sa,1))-aw*y(sa,1); dydt(m+sa,1) = bc*Wa^n/((y(sa,1))^n+Wa^n)+Dc(sa)*(y(m+sa+1,1)-y(m+sa,1))+Dc(sa-1)*(y(m+sa-1,1)-y(m+sa,1))-ac*y(m+sa,1); dydt(2*m+sa,1) = Dx(sa)*(y(2*m+sa+1,1)-y(2*m+sa,1))+Dx(sa-1)*(y(2*m+sa-1,1)-y(2*m+sa,1))-ax*y(2*m+sa,1); end % function handles for cell m dydt(m,1) = bw + Dw(m-1)*(y(m-1,1)-y(m,1))-aw*y(m,1); dydt(2*m,1) = bc*Wa^n/((y(m,1))^n+Wa^n)+Dc(m-1)*(y(2*m-1,1)-y(2*m,1))-ac*y(2*m,1); dydt(3*m,1) = Dx(m-1)*(y(3*m-1,1)-y(3*m,1))-ax*y(3*m,1); elseif Xmis==1&wox5mis==0 % X is expressed everywhere, WOX5 not % function handles for cells 2...m-1 for sa=2:m-1 dydt(sa,1) = Dw(sa)*(y(sa+1,1)-y(sa,1))+Dw(sa-1)*(y(sa-1,1)-y(sa,1))-aw*y(sa,1); dydt(m+sa,1) = bc*Wa^n/((y(sa,1))^n+Wa^n)+Dc(sa)*(y(m+sa+1,1)-y(m+sa,1))+Dc(sa-1)*(y(m+sa-1,1)-y(m+sa,1))-ac*y(m+sa,1); dydt(2*m+sa,1) = bx + Dx(sa)*(y(2*m+sa+1,1)-y(2*m+sa,1))+Dx(sa-1)*(y(2*m+sa-1,1)-y(2*m+sa,1))-ax*y(2*m+sa,1); end % function handles for cell m dydt(m,1) = Dw(m-1)*(y(m-1,1)-y(m,1))-aw*y(m,1); dydt(2*m,1) = bc*Wa^n/((y(m,1))^n+Wa^n)+Dc(m-1)*(y(2*m-1,1)-y(2*m,1))-ac*y(2*m,1); dydt(3*m,1) = bx + Dx(m-1)*(y(3*m-1,1)-y(3*m,1))-ax*y(3*m,1); else % Both X and WOX5 are exprssed everywhere % function handles for cells 2...m-1 for sa=2:m-1 dydt(sa,1) = bw + Dw(sa)*(y(sa+1,1)-y(sa,1))+Dw(sa-1)*(y(sa-1,1)-y(sa,1))-aw*y(sa,1); dydt(m+sa,1) = bc*Wa^n/((y(sa,1))^n+Wa^n)+Dc(sa)*(y(m+sa+1,1)-y(m+sa,1))+Dc(sa-1)*(y(m+sa-1,1)-y(m+sa,1))-ac*y(m+sa,1); dydt(2*m+sa,1) = bx + Dx(sa)*(y(2*m+sa+1,1)-y(2*m+sa,1))+Dx(sa-1)*(y(2*m+sa-1,1)-y(2*m+sa,1))-ax*y(2*m+sa,1); end % function handles for cell m dydt(m,1) = bw + Dw(m-1)*(y(m-1,1)-y(m,1))-aw*y(m,1); dydt(2*m,1) = bc*Wa^n/((y(m,1))^n+Wa^n)+Dc(m-1)*(y(2*m-1,1)-y(2*m,1))-ac*y(2*m,1); dydt(3*m,1) = bx + Dx(m-1)*(y(3*m-1,1)-y(3*m,1))-ax*y(3*m,1); end end % Y is a matrix with Columns 1 to m with WOX5 values (cells 1 to m), columns m+1 % to 2m with CLE40 values (cells 1 to m), and columns 2*m+1 % to 3m with X values (cells 1 to m). Rows indicate time index when the WOX5, % CLE40 and X concentrations are reached (actual time is accessible from vector t) grph=get(h.grph,'Value'); if grph == 0 Ydiff=zeros(3*m,1); for dummy=1:3*m Ydiff(dummy,1)=Y(length(Y(:,1)),dummy)-Y(length(Y(:,1))-1,dummy); % difference between X at last two values of t (to check for % equilibrium) end if any(gt(abs(Ydiff),1e-3)) disp('WARNING: Equilibrium not reached. Increase simulation end time. See instructions at start of program.') end W = Y(length(Y(:,1)),1:m)'; X = Y(length(Y(:,1)),2*m+1:3*m)'; S = W+X; % S1 % Choose which cells are differentiated and display image if gt(S(1,1),Wa)&>(S(2,1),Wa)&>(S(3,1),Wa)&>(S(4,1),Wa)&>(S(5,1),Wa) I = imread('Model3Diagram5.png'); elseif gt(S(1,1),Wa)&>(S(2,1),Wa)&>(S(3,1),Wa)&>(S(4,1),Wa)&&le(S(5,1),Wa) I = imread('Model3Diagram4.png'); elseif gt(S(1,1),Wa)&>(S(2,1),Wa)&>(S(3,1),Wa)&&le(S(4,1),Wa)&&le(S(5,1),Wa) I = imread('Model3Diagram3.png'); elseif gt(S(1,1),Wa)&>(S(2,1),Wa)&&le(S(3,1),Wa)&&le(S(4,1),Wa)&&le(S(5,1),Wa) I = imread('Model3Diagram2.png'); elseif gt(S(1,1),Wa)&&le(S(2,1),Wa)&&le(S(3,1),Wa)&&le(S(4,1),Wa)&&le(S(5,1),Wa) I = imread('Model3Diagram1.png'); elseif le(S(1,1),Wa)&&le(S(2,1),Wa)&&le(S(3,1),Wa)&&le(S(4,1),Wa)&&le(S(5,1),Wa) I = imread('Model3Diagram1.png'); else disp('Something weird happened. The WOX5/X gradient is irregular, and there are CCs between QC cells and CSCs. Tell Sarah.') end ImgSize = size(I); Axes5 = axes('Units', 'pixels',... 'parent', h.results,... 'position', [50 100 320 500]); axis(Axes5, 'off') image(I, 'Parent', Axes5); else W=Y(:,1:m); C=Y(:,m+1:2*m); X=Y(:,2*m+1:3*m); % plot WOX5, CLE40, X values in each cell against time in graphs of GUI axes1 = axes('Units', 'pixels',... 'parent', h.results,... 'position', [75 560 200 100]); axes2 = axes('Units', 'pixels',... 'parent', h.results,... 'position', [150 420 200 100]); axes3 = axes('Units', 'pixels',... 'parent', h.results,... 'position', [75 290 200 100]); axes4 = axes('Units', 'pixels',... 'parent', h.results,... 'position', [150 160 200 100]); axes5 = axes('Units', 'pixels',... 'parent', h.results,... 'position', [75 30 200 100]); plot(axes1,t,Y(:,1),'r',t,Y(:,6),'c',t,Y(:,11),'g') legend(axes1,'WOX5 concentration','CLE40 concentration','X concentration') xlabel(axes1,'time') plot(axes2,t,Y(:,2),'r',t,Y(:,7),'c',t,Y(:,12),'g') plot(axes3,t,Y(:,3),'r',t,Y(:,8),'c',t,Y(:,13),'g') plot(axes4,t,Y(:,4),'r',t,Y(:,9),'c',t,Y(:,14),'g') plot(axes5,t,Y(:,5),'r',t,Y(:,10),'c',t,Y(:,15),'g') end guidata(fig,h); end