Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
cody2 authored Oct 29, 2021
1 parent e408c5c commit 13fcfdd
Showing 1 changed file with 36 additions and 23 deletions.
59 changes: 36 additions & 23 deletions N803_model_1.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
% and NK cells during a subcutaneously administered regimen of N803

% /--------------------------------------------------------------\
% | Date: 06/29/2019 |
% | Date: 12/05/2019 |
% | Author: Jonathan Cody |
% | Affiliation: Pienaar Computational Systems Pharmacology Lab |
% | Weldon School of Biomedical Engineering |
Expand Down Expand Up @@ -56,7 +56,7 @@

% P(21) = killing stimulation factor []
% P(22)
% P(23) = proliferation stimulation factor []
% P(23) = maximum expansion rate [/d] (will convert to rho)
% P(24)
% P(25) = tolerance effect factor []
% P(26)
Expand All @@ -65,6 +65,7 @@
% P(28)
% P(29) = proliferation regulation factor []
% P(30)
% P(31) = tolerance recovery []

%% ========================================================================
% OPTIONAL INPUTS
Expand Down Expand Up @@ -100,6 +101,8 @@
function [Y_MAIN,extra] = N803_model_1(SoluTimes,DoseTimes,P,...
EquatedPars,timeOut,normOut)

warning off

% convert inputs to column vectors
if size(SoluTimes ,1)==1 ; SoluTimes = SoluTimes' ; end
if size(DoseTimes ,1)==1 ; DoseTimes = DoseTimes' ; end
Expand All @@ -109,9 +112,11 @@
% times, and end time (used for piecewise solution of ODEs)
PieceIn = [ 1 ; find(ismember(SoluTimes,DoseTimes)) ; length(SoluTimes) ] ;

% declare index in Y (see 'system' function) for C, last tolerance
% variable, and last regulation variable
TolRegIn = [ 6 ; 6+P(10) ; 6+P(10)+P(11) ] ;
% declare index in Y (see 'system' function) for tolerance variables
TolIn = 7:(6+P(10)) ;

% declare index in Y (see 'system' function) for regulation variables
RegIn = (7+P(10)):(6+P(10)+P(11)) ;

% equate parameters in 'P' based on indices in 'EquatedPars'
if ~isempty(EquatedPars) ; P = P(EquatedPars) ; end
Expand All @@ -126,8 +131,11 @@
P(01) = 10^(P(01)-3) ;% [log(#/mL)] to [#/無]
P(16) = P(16)*P(15) ;% [*P(15)] to [#/無-d]

% convert maximum expansion rate [/d] to prolif. stimulation factor []
P(23:24) = P(23:24)./P(17:18) ;

% declare initial conditions for Y (see 'system' function)
Yic = zeros(1,TolRegIn(3)) ;% zero except for...
Yic = zeros(1,6+P(10)+P(11)) ;% zero except for...
Yic(1:4) = [ P(01)*[1-P(02) P(02)] P(03:04)' ] ;% V,W,E,K

% declare proliferation rate constants 'q_V','q_W','r_E','r_K' [/d]
Expand Down Expand Up @@ -171,10 +179,8 @@
% Y(4) = K = NK cells [#/無]
% Y(5) = X = N803 at absorption site [pmol/kg]
% Y(6) = C = N803 plasma concentration [pM]
% Y(7 :5+P(10) ) = tolerance delay variables
% Y( 6+P(10) ) = tolerance acting variable
% Y(7+P(10):5+P(10)+P(11)) = regulation delay variables
% Y( 6+P(10)+P(11)) = regulation acting variable
% Y( 7 : (6+P(10)) ) = tolerance variables
% Y( (7+P(10)) : (6+P(10)+P(11)) ) = regulation variables

% throw error if 'solvertime' exceeds 'timeOut' limit
if toc(solvertime) >= timeOut
Expand All @@ -200,17 +206,24 @@
%% --------------------------------------------------------------------
% Calculate rates of change for tolerance & regulation variables ------

% for tolerance and regulation
for m = 1:2
% if number of variables is not zero
if P(09+m) ~= 0
% update variable rates of change
dY(TolRegIn(m)+1:TolRegIn(m+1)) = P(11+m) * ...
( [ Y_terms(1) ; Y(TolRegIn(m)+1:TolRegIn(m+1)-1) ] ...
- Y(TolRegIn(m)+1:TolRegIn(m+1)) ) ;
end
% if number of tolerance variables is not zero
if P(10) ~= 0
% update variable rates of change
dY(TolIn(1:end-2)) = P(12) * [ Y_terms(1) ; Y(TolIn(1:end-3)) ] ...
- P(12) * Y(TolIn(1:end-2)) ;
dY(TolIn(end-1)) = P(12) * Y(TolIn(end-2)) ...
- P(12) * (1+P(31)) * Y(TolIn(end-1)) ;
dY(TolIn(end)) = P(12) * P(31) * Y(TolIn(end-1)) ...
- P(12) * P(31) * Y(TolIn(end)) ;
end


% if number of regulation variables is not zero
if P(11) ~= 0
% update variable rates of change
dY(RegIn) = P(13) * [ Y_terms(1) ; Y(RegIn(1:end-1)) ] ...
- P(13) * Y(RegIn) ;
end

end

%% ------------------------------------------------------------------------
Expand All @@ -219,22 +232,22 @@
function Y_terms = terms(Y)

% percolate vector for storing terms
Y_terms = zeros(12,1) ;
Y_terms = zeros(11,1) ;

% Y_terms(1) = N803 effect []
Y_terms(1) = Y(6) / ( P(09) + Y(6) ) ;

% Y_terms(2) = N803 effect for E (with tolerance) []
% Y_terms(3) = N803 effect for K (with tolerance) []
Y_terms(2:3) = [Y_terms(1);Y_terms(1)]./ ...
( 1 + P(25:26) * Y(TolRegIn(2)) ) ;
( 1 + P(25:26) * sum(Y((5:6)+P(10))) ) ;

% Y_terms(4) = killing modifier for E (with effect & regulation) []
% Y_terms(5) = killing modifier for K (with effect & regulation) []
% Y_terms(6) = proliferation modifier for E (w/ effect & regulation) []
% Y_terms(7) = proliferation modifier for K (w/ effect & regulation) []
Y_terms(4:7) = ( 1 + P(21:24).* [Y_terms(2:3);Y_terms(2:3)] )./ ...
( 1 + P(27:30) * Y(TolRegIn(3)) ) ;
( 1 + P(27:30) * Y(6+P(10)+P(11)) ) ;

% Y_terms(8) = total killing rate applied to V by E [/d]
% Y_terms(9) = total killing rate applied to V by K [/d]
Expand Down

0 comments on commit 13fcfdd

Please sign in to comment.