Commit 21646af9 authored by Mathieu Hemery's avatar Mathieu Hemery
Browse files

Implement the correct handling for catalyst

parent c8678513
......@@ -1347,9 +1347,10 @@ formal_inhibitor(Mol, _Reactants/Inhibitors => _Products) :- !,
% is_present(Mol, Expr)
is_present(A, A) :- !.
is_present(A, A+_Tail) :- !.
is_present(A, _K*A+_Tail) :- !.
is_present(A, _H+Tail) :- is_present(A, Tail).
is_present(A, _K*A) :- !.
is_present(A, _Tail+A) :- !.
is_present(A, _Tail+_K*A) :- !.
is_present(A, Tail+_H) :- is_present(A, Tail).
%! test_wellformed(+List_Molecule, +Reaction)
......@@ -1428,29 +1429,32 @@ test_wf_other(Molecule, Expression) :-
test_strictness(_List_Molecules, []).
test_strictness(List_Molecules, [Expr for Reaction|TailReac]) :-
ode:substitute_functions(Expr, Expression),
test_strictness_sr(List_Molecules, Expression for Reaction),
(
Expr = 'MA'(_R)
->
true
;
ode:substitute_functions(Expr, Expression),
test_strictness_sr(List_Molecules, Expression for Reaction)
),
test_strictness(List_Molecules, TailReac).
test_strictness_sr(_Molecules, 'MA'(_R) => _).
test_strictness_sr([], _).
test_strictness_sr([Molecule|Tail], Expression for Reaction) :-
formal_reactant(Molecule, Reaction),
!,
substitute([Molecule], [0], Expression, Output),
(
formal_catalyst(Molecule, Reaction),
test_strictness_sr(Tail, Expression for Reaction)
;
formal_reactant(Molecule, Reaction)
is_null(Output)
->
substitute([Molecule], [0], Expression, Output),
(
is_null(Output)
;
format("Due to: ~w while checking ~w;~n", [Expression, Molecule]),
fail
),!
;
test_strictness_sr(Tail, Expression for Reaction)
;
format("Due to: ~w while checking ~w;~n", [Expression, Molecule]),
fail
).
test_strictness_sr([_Molecule|Tail], Expression for Reaction) :-
test_strictness_sr(Tail, Expression for Reaction).
......@@ -51,6 +51,7 @@ test('test_wf_inhibitor', []) :-
with_output_to(atom(_), (
test_wf_inhibitor(a, b/(1+a)),
test_wf_inhibitor(a, b/(k+a)^2),
test_wf_inhibitor(c1, v10*t3^n/(k100^n+t3^n+c1^n)),
\+(test_wf_inhibitor(a, k*a*b))
)).
......@@ -60,12 +61,12 @@ test('test_wf_other', []) :-
\+(test_wf_other(a, k*b*c/exp(a)))
)).
test('test_strictness', []):-
with_output_to(atom(_), (
test_strictness(a, a*b+a^2.5/c),
\+(test_strictness(mapk, j0*mk/(1+(mapk/j1)^j2)/(j1+mk))),
\+(test_strictness(a, k1*a - k2*b))
)).
%test('test_strictness', []):-
% with_output_to(atom(_), (
% models:test_strictness_sr([a,b,c], a*b for a+b=>c),
% \+(models:test_strictness_sr([mapk], j0*mk/(1+(mapk/j1)^j2)/(j1+mk)) for mapk => mk),
% \+(models:test_strictness_sr([a], k1*a - k2*b) for a => b)
% )).
test('test_model_with_function', []) :-
(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment