Boolean Logic Modeling in COPASI

49 views

Anamul Haque

May 2, 2023, 12:33:56 PM5/2/23
to COPASI User Forum
Hi All,
Say I have 5 species = A, B, C, D, E
Reaction Rules -
=> A
=> B

A => C

B => D

C & !D => E

E => C44

These rules follow Boolean logic,  & stand for AND, ! stands for inhibition, => indicates activation/inhibition.

1. In MATLAB, I have the following ODEs

function dydt=Toy_NetfluxODE(t,y,params)
[rpar,tau,ymax,speciesNames]=params{:};
A = 1;
B = 2;
C = 3;
D = 4;
E = 5;
dydt = zeros(5,1);
dydt(A) = (rpar(1,1)*ymax(A) - y(A))/tau(A);
dydt(B) = (rpar(1,2)*ymax(B) - y(B))/tau(B);
dydt(C) = (OR(act(y(A),rpar(:,3)),act(y(E),rpar(:,6)))*ymax(C) - y(C))/tau(C);
dydt(D) = (act(y(B),rpar(:,4))*ymax(D) - y(D))/tau(D);
dydt(E) = (AND(rpar(:,5),act(y(C),rpar(:,5)),inhib(y(D),rpar(:,5)))*ymax(E) - y(E))/tau(E);

2. act, inhib, AND, OR are described by the following utility function -

% utility functions
function fact = act(x,rpar)
% hill activation function with parameters w (weight), n (Hill coeff), EC50
w = rpar(1);
n = rpar(2);
EC50 = rpar(3);
beta = (EC50.^n - 1)./(2*EC50.^n - 1);
K = (beta - 1).^(1./n);
fact = w.*(beta.*x.^n)./(K.^n + x.^n);
if fact>w,                 % cap fact(x)<= 1
fact = w;
end

function finhib = inhib(x,rpar)
% inverse hill function with parameters w (weight), n (Hill coeff), EC50
finhib = rpar(1) - act(x,rpar);

function z = OR(x,y)
% OR logic gate
z = x + y - x*y;

function z = AND(rpar,varargin)
% AND logic gate, multiplying all of the reactants together
w = rpar(1);
if w == 0,
z = 0;
else
v = cell2mat(varargin);
z = prod(v)/w^(nargin-2);
end

3. The parameters are

% species parameters
speciesNames = {'A','B','C','D','E',};
tau = [1, 1, 1, 1, 1, ];
ymax = [1, 1, 1, 1, 1, ];

% reaction parameters
w = [0, 0, 1, 1, 1, 1, ];
n = [1.400000e+00, 1.400000e+00, 1.400000e+00, 1.400000e+00, 1.400000e+00, 1.400000e+00, ];
EC50 = [5.000000e-01, 5.000000e-01, 5.000000e-01, 5.000000e-01, 5.000000e-01, 5.000000e-01, ];
rpar = [w;n;EC50];

params = {rpar,tau,ymax,speciesNames};

y0 = [0, 0, 0, 0, 0, ];

I have two questions -

1. How to use these logical rules in writing reactions (AND/OR/NOT). COPASI only allows writing in +/-/! ?

2. How to write my own rate laws using those above utility functions?

Thank you to the creators of COPASI. It is an excellent piece of software for novices like me.

Best,
Anamul