diff --git a/Legacy Code/plotter.m b/Legacy Code/plotter.m deleted file mode 100644 index e7b05cd..0000000 --- a/Legacy Code/plotter.m +++ /dev/null @@ -1,246 +0,0 @@ -%% -% /--------------------------------------------------------------\ -% | Date: 01/25/2018 | -% | Author: Jonathan Cody | -% | Affiliation: Purdue University | -% | Weldon School of Biomedical Engineering | -% | Pienaar Computational Systems Pharmacology Lab | -% \--------------------------------------------------------------/ - -%% ======================================================================== -% INPUT -% ======================================================================== - -clear all %#ok -close all - -%% ------------------------------------------------------------------------ -% General Inputs -% ------------------------------------------------------------------------ - -D = load('DATA') ;% N803 project data file - -xconv = 1/7 ;% x-axis tick conversion -xunits = 'Weeks Post-Treatment' ;% x-axis labels -Yunits = D.Yu ;% y-axis labels for main outputs -suffix = 'pt4b' ;% suffix for output filenames -ext = 'jpg' ;% file extension for figure files -extra = 1 ;% 1 = plot extended outputs - % 0 = plot calibrated outputs only - -% Docking all plotted figures -set(0,'DefaultFigureWindowStyle','docked') % comment out to undock figures - -%% ------------------------------------------------------------------------ -% calibrator.m Parameter Inputs -% ------------------------------------------------------------------------ - -PlotRanks = [1,2,3] ;% run(s) in data file to plot (as ranked in C) -tend = 350 ;% maximum time point for plotting results - -%% ------------------------------------------------------------------------ -% Manual Parameter Inputs -% ------------------------------------------------------------------------ - -manualpars = 1 ;% logical variable that indicates manual parameters - -monkey = 2 ;% monkey -for n = 1:4 - X{n} = {D.X_ellis3{n}{monkey}} ; %#ok<*SAGROW> - Y{n} = {D.Y_ellis3{n}{monkey}} ; - IC(n,1) = mean(Y{n}{1}(1:5)) ; -end - -tt = -28:105 ;% model x-values - -plotmodel = @(P) HIV_model_3(tt,D.td,[0 35],P,[2 2 3 3],[],[]) ;% model handle - -% Varied Parameters -P(08,:) = [0.2 0.2 0.2 0.2] ;% death rate constant [/d] -P(10,:) = [2 2 2 2]*IC(2) ;% max proliferating conc. [/µL] -P(12,:) = [1 1 2 2]*1e-3 ;% killing rate constant [µL/d] -P(14,:) = [1 2 1 2] ;% drug killing modifier [] -P(16,:) = [4 4 4 4] ;% drug half saturation [pM] -P(18,:) = [0.3 0.3 0.3 0.3] ;% drug max prolif rate [/d] - -P(20,:) = 1./[0.5 0.5 0.5 0.5] ;% 1/(Ct half-inhibition level) [] -P(22,:) = [0.2 0.2 0.2 0.2] ;% Ct delay rate constant [/d] -P(24,:) = 1./[0.2 0.2 0.2 0.2] ;% 1/(Cy half-inhibition level) [] -P(26,:) = [0.5 0.5 0.5 0.5] ;% Cy delay rate constant [/d] - -P(28,:) = [2 2 2 2]*1e-4 ;% escape mutation rate [] -P(29,:) = [0.9 0.9 0.9 0.9] ;% initial escape proportion [] -P(30,:) = [0.7 0.7 0.7 0.7] ;% response activation threshold [/µL] -P(31,:) = [0.4 0.4 0.4 0.4] ;% response prolif. rate const. [/d] - -P(33,:) = P(08,:) ;% T death rate constant [/d] -P(34,:) = P(10,:)/IC(2)*IC(4) ;% T max proliferating conc. [/µL] -P(35,:) = 0*[1 1 1 1]*1e-3 ;% T infection rate constant [/µL-d] -P(36,:) = 0*[2 2 2 2] ;% inf T decay rate constant [*(P(33)] - -% Fixed Parameters -P(01:03,:) = [IC(1:3) IC(1:3) IC(1:3) IC(1:3)] ;% V, E, K i.c. -P(04,:) = P(04,:) + 877 ;% N i.c. [pmol/kg] -P(05,:) = P(05,:) + 0.75 ;% C absorption rate const. [/d] -P(06,:) = P(05,:) / 1.64 ;% P(05) * 'bioavail.'/'vol. of dist.' [kg/L-d] -P(07,:) = P(07,:) + 2.1 ;% C elimination rate const. [/d] -P(32,:) = [IC(4) IC(4) IC(4) IC(4)] ;% T i.c. - -% NK Parameters (equivalent fold change, but no killing) -P([09 17:2:27],:) = P([08 16:2:26],:) ; -P(11,:) = P(10,:)/IC(2)*IC(3) ; - -% Declare parameter table colum labels and values -ParLabels{01} = 'd' ; ParMatrix(01,:) = P(08,:) ; -ParLabels{02} = 'max/0' ; ParMatrix(02,:) = P(10,:)/IC(2) ; -ParLabels{03} = 'c' ; ParMatrix(03,:) = P(12,:) ; -ParLabels{04} = 'sig' ; ParMatrix(04,:) = P(14,:) ; -ParLabels{05} = 'eta' ; ParMatrix(05,:) = P(16,:) ; -ParLabels{06} = 'rho' ; ParMatrix(06,:) = P(18,:) ; -ParLabels{07} = 'sig_t' ; ParMatrix(07,:) = 1./P(20,:) ; -ParLabels{08} = 'del_t' ; ParMatrix(08,:) = P(22,:) ; -ParLabels{09} = 'sig_y' ; ParMatrix(09,:) = 1./P(24,:) ; -ParLabels{10} = 'del_y' ; ParMatrix(10,:) = P(26,:) ; -ParLabels{11} = 'm' ; ParMatrix(11,:) = P(28,:) ; -ParLabels{12} = 'esc' ; ParMatrix(12,:) = P(29,:) ; -ParLabels{13} = 'thresh'; ParMatrix(13,:) = P(30,:) ; -ParLabels{14} = 'respo' ; ParMatrix(14,:) = P(31,:) ; -ParLabels{15} = 'inf' ; ParMatrix(15,:) = P(35,:) ; -ParLabels{16} = 'd_I' ; ParMatrix(16,:) = P(36,:) ; - -[ColumnWidths{1:16}] = deal(62) ;% parameter table column width - -% Declare parameter row labels -if size(P,2) == 3 - RowLabels = {'red';'green';'blue'} ; -elseif size(P,2) == 4 - RowLabels = {'red';'green';'teal';'purple'} ; -end - -%% ======================================================================== -% BODY -% ======================================================================== - -%% ------------------------------------------------------------------------ -% Setup -% ------------------------------------------------------------------------ - -% If calibrator output file parameters are used... -if manualpars == 0 - - % Load structure file to structure variable 'C' - load(['C_' suffix],'C') ; - - % Define time points to evaluate model - tt = [C(1).setup.Xeval ; ((C(1).setup.Xeval(end)+1):tend)'] ; - plotmodel = @(P) C(1).setup.modelfun(tt,P) ; - - % Load parameter sets into cell array 'P' - P = ones(length(C(1).Parameters),length(PlotRanks)) ; - for n = 1:length(PlotRanks) - P(:,n) = (C(PlotRanks(n)).Parameters)' ; - end - - % Define data to plot against - X = C(1).setup.X ; - Y = C(1).setup.Y ; -end - -% Load model outputs (see model file) into cell arrays 'YM' and 'YE' -YM = cell(1,size(P,2)) ; -YE = cell(1,size(P,2)) ; -for n = 1:size(P,2) - [YM{n},YE{n}] = plotmodel(P(:,n)) ;% model solution -end - -%% ------------------------------------------------------------------------ -% Plotter -% ------------------------------------------------------------------------ - -tt = tt*xconv ;% converting x-axis - -% Plot extended outputs -gap = 0.02 ;% gap between subplots -margs = [0.02 0.07 0.05 0.02] ;% top, bottom, left, right margins -axheight = (1-sum(margs(1:2))-4*gap)/5 ;% axis height -ypos = 1 - margs(1) - axheight ;% axis y position - -COLORS = hsv(length(YM)) ; -name = ['Fullplot_' suffix '_1'] ; -F = figure('Name',name,'Color',[1 1 1]) ; -for n = 1:size(YM{1},2) - axes('Units','normalized','Position',... - [margs(3) ypos 1-sum(margs(3:4)) axheight]) - ypos = ypos - axheight - gap ; - hold on - for m = 1:length(Y{n}) - plot(X{n}{m}*xconv,Y{n}{m},':o',... - 'MarkerSize',4,'MarkerFaceColor','k','MarkerEdgeColor','k') - end - for m = 1:length(YM) - plot(tt,YM{m}(:,n),'Color',COLORS(m,:)*0.8,'LineWidth',1.5) - end - axis([tt(1) tt(end) 0+(n==1) inf]) - ylabel(Yunits{n}) - set(gca,'FontSize',10,'FontName','Arial','LineWidth',1) - set(gca,'XTickLabel',[],'XTick',tt(1):1:tt(end)) - grid on -end -set(gca,'XTickLabel',tt(1):2:tt(end),'XTick',tt(1):2:tt(end)) -xlabel(xunits) - -% Plotting table of parameters for manual calibration -if manualpars == 1 - uitable('Data',num2cell(ParMatrix'),'ColumnName',ParLabels,... - 'Units','normalized','ColumnWidth',ColumnWidths,... - 'Position',[margs(3) ypos 1-sum(margs(3:4)) axheight-0.04],... - 'FontSize',10,'RowName',RowLabels) ; -end - -saveas(F,name,ext) - -if extra == 1 -% Plot extended outputs -gap = 0.02 ;% gap between subplots -margs = [0.02 0.07 0.05 0.02] ;% top, bottom, left, right margins -axheight = (1-sum(margs(1:2))-4*gap)/5 ;% axis height -ypos = 1 - margs(1) - axheight ;% axis y position - -i = 1 ;% index -j = 0 ;% index -for n = 1:length(YE{1}) - j = j + 1 ; - if j == 1 - i = i + 1 ; - name = ['Fullplot_' suffix '_' num2str(i)]; - F = figure('Name',name,'Color',[1 1 1]) ; - end - leg = cell(1,size(YE{1}{n},1)) ; - axes('Units','normalized','Position',... - [margs(3) ypos 1-sum(margs(3:4)) axheight]) - ypos = ypos - axheight - gap ; - hold on - for m = 1:length(YE) - for o = 1:size(YE{1}{n},1) - plot(tt,YE{m}{n}{o,1},'Color',COLORS(m,:)*0.8,... - 'LineStyle',YE{m}{n}{o,2},'LineWidth',1.5) - leg{o} = YE{m}{n}{o,3} ; - end - end - axis([tt(1) tt(end)+3 -inf inf]) - ylabel(YE{1}{n}{1,4}) - legend(leg,'Location','east') - set(gca,'XTickLabel',[],'XTick',tt(1):1:tt(end)) - set(gca,'FontSize',11,'FontName','Arial','LineWidth',1) - grid on - if j == 5 - j = 0 ; - ypos = 1 - margs(1) - axheight ; - xlabel(xunits) - set(gca,'XTickLabel',tt(1):1:tt(end)) - saveas(F,name,ext) - end -end -saveas(F,name,ext) -end -disp('Done!')