From b4fc38c87c6512e73d510df89901bf4a2ca683f4 Mon Sep 17 00:00:00 2001 From: "Cody, Jonathan William" Date: Sun, 25 Dec 2022 09:01:06 -0600 Subject: [PATCH] Delete plotter_model_4.m --- Legacy Code/plotter_model_4.m | 272 ---------------------------------- 1 file changed, 272 deletions(-) delete mode 100644 Legacy Code/plotter_model_4.m diff --git a/Legacy Code/plotter_model_4.m b/Legacy Code/plotter_model_4.m deleted file mode 100644 index ed882cc..0000000 --- a/Legacy Code/plotter_model_4.m +++ /dev/null @@ -1,272 +0,0 @@ -%% -% /--------------------------------------------------------------\ -% | Date: 04/17/2019 | -% | Author: Jonathan Cody | -% | Affiliation: Purdue University | -% | Weldon School of Biomedical Engineering | -% | Pienaar Computational Systems Pharmacology Lab | -% \--------------------------------------------------------------/ - -close all - -%% ======================================================================== -% INPUT -% ======================================================================== - -%% ------------------------------------------------------------------------ -% 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 = 'test' ;% suffix for output filenames -ext = 'jpg' ;% file extension for figure files - -extra = 1 ;% 1 = plot extended outputs - % 0 = plot calibrated outputs only -legspace = 21 ;% extra xunits to append to figures - % (allows space for legend) - -manualpars = 1 ;% 1 = enter pars manually (see section) - % 0 = retrieve pars from calibrator.m file - -% Docking all plotted figures -set(0,'DefaultFigureWindowStyle','docked') % comment out to undock figures - -%% ------------------------------------------------------------------------ -% calibrator.m Parameter Inputs -% ------------------------------------------------------------------------ - -PlotRanks = 1:6 ;% run(s) in data file to plot (as ranked in C) -tend = 420 ;% ending time point for plotting results - -COLORS = {[1 0 0]*0.8,[1 1 0]*0.8,[0 1 0]*0.8,... - [0 1 1]*0.8,[0 0 1]*0.8,[1 0 1]*0.8,}; - -% I use this line when plotting pairs of parameter sets from calibrator.m -% COLORS = {COLORS{PlotRanks(1)},COLORS{PlotRanks(2)}} ; - -%% ------------------------------------------------------------------------ -% Manual Parameter Inputs (arbitrary) -% ------------------------------------------------------------------------ - -for n = 1:4 - IC(n) = mean([D.Y_ellis3{n}{1}(1:5)... - ;D.Y_ellis3{n}{2}(1:5)... - ;D.Y_ellis3{n}{3}(1:5)]) ; - for m = 1:3 - X{n}{m} = D.X_ellis3{n}{m} ; %#ok<*SAGROW> - if n == 1 % for viral load - Y{n}{m} = D.Y_ellis3{n}{m} - mean(D.Y_ellis3{n}{m}(1:5)) ; - else % for cells - Y{n}{m} = D.Y_ellis3{n}{m} / mean(D.Y_ellis3{n}{m}(1:5)) ; - end - end -end - -tt = -28:0.1:420 ;% model x-values (before conversion) - -% model handle -plotmodel = @(P) HIV_model_4(tt,D.td,P',[],[],1) ; - -P = zeros(42,4) ; - -% Fixed Parameters -P([01:03 34],:) = IC'.*[1 1 1 1] ;% V, E, K, T i.c. -P(04,:) = [1 1 1 1] * 877 ;% Q i.c. [pmol/kg] -P(05,:) = [1 1 1 1] * 0.75 ;% C absorption rate const. [/d] -P(06,:) = [1 1 1 1] * 0.75/1.64 ;% P(05) * 'bioavail.'/'voldist.' [kg/L-d] -P(07,:) = [1 1 1 1] * 2.1 ;% C elimination rate const. [/d] -P(24,:) = [1 1 1 1] * 5 ;% # of TOL delay chambers [] -P(25,:) = [1 1 1 1] * 5 ; -P(26,:) = [1 1 1 1] * 1 ;% # of REG delay chambers [] -P(27,:) = [1 1 1 1] * 1 ; - -% Varied Parameters -P(08,:) = [0.1 0.1 0.1 0.1] ;% death rate constant [/d] -P(09,:) = [0.1 0.1 0.1 0.1] ; -P(10,:) = [2 2 2 2]*P(02,1) ;% max proliferating conc. [/µL] -P(11,:) = [2 2 2 2]*P(03,1) ; - -P(12,:) = [1 1 1 1]*0.05 ;% total initial killing rate [/d] -P(13,:) = [1 1 1 1]*0.05 ;% [*P(12)] -P(14,:) = [10 10 10 10] ;% drug killing modifier [] -P(15,:) = [10 10 10 10] ; - -P(16,:) = [0.2 0.2 20 20] ;% drug half saturation [pM] -P(17,:) = [0.2 0.2 20 20] ; -P(18,:) = [1 1 1 1] ;% drug max prolif rate [/d] -P(19,:) = [1 1 1 1] ; - -P(20,:) = [0.1 1 0.1 1] ;% TOL delay rate constant [/d] -P(21,:) = [0.1 1 0.1 1]*0 ; -P(22,:) = [0.5 2 0.5 2]*0 ;% REG delay rate constant [/d] -P(23,:) = [0.5 2 0.5 2] ; - -P(28,:) = [2 2 2 2]*0 ;% tolerance modifier [] -P(29,:) = [2 2 2 2]*0 ; -P(30,:) = [0.1 0.1 0.1 0.1]*0 ;% regulation-induced decay [*P(18)] -P(31,:) = [0.1 0.1 0.1 0.1]*0 ;% [*P(19)] -P(32,:) = [100 100 100 100]*0 ;% regulation killing modifier [] -P(33,:) = [0 0 0 0]*0 ;% - -% T Parameters -P(35,:) = [1 1 1 1]*0 ;% T death rate constant [/d] -P(36,:) = [1 1 1 1]*0 ;% T max proliferating conc. [/µL] -P(37,:) = [1 1 1 1]*0 ;% T infection by V1 rate [/µL-d] -P(38,:) = [1 1 1 1]*0 ;% infected T death rate [*P(35)] - -% V2 Parameters -P(39,:) = [1 1 1 1]*0 ;% V2 initial frequency [] -P(40,:) = [1 1 1 1]*0 ;% mutation probability [] -P(41,:) = [1 1 1 1]*0 ;% V2 targeting factor [] -P(42,:) = [1 1 1 1]*0 ;% - -% Declare parameter table labels and values -ParLabels = strsplit(num2str(1:size(P,1))) ; -ParMatrix = P ; -RowLabels = {'red';'yellow';'green';'cyan';'blue';'magenta'} ; - - -%% ======================================================================== -% BODY -% ======================================================================== - -%% ------------------------------------------------------------------------ -% Setup -% ------------------------------------------------------------------------ - -% Flip so best fit plots on top -PlotRanks = flip(PlotRanks) ; -COLORS = flip(COLORS) ; -RowLabels = flip(RowLabels) ; - -% 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.07 0.02] ;% top, bottom, left, right margins -axheight = (1-sum(margs(1:2))-3*gap)/4 ;% axis height -ypos = 1 - margs(1) - axheight ;% axis y position - -name = ['Fullplot ' suffix ' part 1'] ; -if manualpars == 0 - name = [name ' rank ' num2str(PlotRanks)]; -end -F = figure('Name',name,'Color',[1 1 1]) ; -for n = 1:3 - 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},'k:o',... - 'MarkerSize',4,'MarkerFaceColor','k','MarkerEdgeColor','k') - end - for m = 1:length(YM) - plot(tt,YM{m}(:,n),'Color',COLORS{m},'LineWidth',1.5) - end - axis([tt(1) tt(end) -inf 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','FontSize',10,'RowName',RowLabels,... - 'Position',[margs(3) ypos 1-sum(margs(3:4)) axheight-0.04]) ; -else - -end - -saveas(F,name,ext) - -if extra == 1 -% Plot extended outputs -gap = 0.02 ;% gap between subplots -margs = [0.02 0.07 0.07 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 ' part ' num2str(i)] ; - if manualpars == 0 - name = [name ' rank ' num2str(PlotRanks)]; %#ok - end - 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},... - 'LineStyle',YE{m}{n}{o,2},'LineWidth',1.5) - leg{o} = YE{m}{n}{o,3} ; - end - end - axis([-1 tt(end)+legspace*xconv -inf inf]) - ylabel(YE{1}{n}{1,4}) - legend(leg,'Location','east','FontSize',9) - 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!')