-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmcsLP.lp4
37 lines (27 loc) · 1.43 KB
/
mcsLP.lp4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
% mcs[LP].lp4
% Logic Program in Clingo[LP] - Clingcon ASP format
% Finds fluxes that belongs to the stoichiometric matrix kernel
% Defines an heuristic for them to be enumerated subset minimal
% Used to compute Minimal Cut Sets in metabolic networks
% Domain upper bound for flux values
#const nb=200000.
% Tells clingo that it is okay if the input file does not contain these predicates
reversible(do_not_use, do_not_use).
% Rule A: Since all reactions are irreversible, they must have a nonnegative flux
&dom{0..nb} = flux(R) :- reaction(R).
% Rule B: Two irreversible reactions issued from the splitting of one reversible reaction are mutually exclusive
:- support(R1); support(R2); 1 {reversible(R1, R2); reversible(R2, R1)} 1; reaction(R1); reaction(R2).
% Rule C : At least one reaction that is not the target reaction must be used
:- not support(R) : reaction(R).
:- not cutset(R) : reaction(R).
% Rule D : For each metabolite, the sum, weighted by the stoichiometry, of fluxes of all active reactions is null
&sum{C*flux(R) : stoichiometry(M, R, C), reaction(R)} >= 0 :- metabolite(M); mirrev(M).
&sum{C*flux(R) : stoichiometry(M, R, C), reaction(R)} = 0 :- metabolite(M); not mirrev(M).
% Compute support
support(R) :- &sum{flux(R)} > 0; reaction(R); not stoichreac(R).
% Atoms in which we are interested in
cutset(R) :- support(R); interest(R).
% Support minimization heuristic
#heuristic cutset(R). [1, false]
% Show support atoms
#show cutset/1.