Commit 6a023dcf authored by Mathieu Hemery's avatar Mathieu Hemery
Browse files

Merge branch 'feature/well_formed' of gitlab.inria.fr:lifeware/biocham into feature/well_formed

parents 87384601 38b63f2e
...@@ -136,7 +136,13 @@ reverse_reaction(Expression for Reactant => Product) :- ...@@ -136,7 +136,13 @@ reverse_reaction(Expression for Reactant => Product) :-
ode:substitute_functions(Expression, - RevExpr) ode:substitute_functions(Expression, - RevExpr)
-> ->
delete_reaction(Expression for Reactant => Product), delete_reaction(Expression for Reactant => Product),
add_reaction(RevExpr for Product => Reactant) (
Reactant = Reac/Inhib
->
add_reaction(RevExpr for Product/Inhib => Reac)
;
add_reaction(RevExpr for Product => Reactant)
)
; ;
true true
). ).
......
...@@ -1373,20 +1373,25 @@ formal_inhibitor(Mol, _Reactants/Inhibitors => _Products) :- !, ...@@ -1373,20 +1373,25 @@ formal_inhibitor(Mol, _Reactants/Inhibitors => _Products) :- !,
% %
% loop on molecule to determine if they follow the condition of wellformedness % loop on molecule to determine if they follow the condition of wellformedness
test_wellformed([], _Reaction).
test_wellformed(_Molecules, 'MA'(_R) for _Reaction). test_wellformed(_Molecules, 'MA'(_R) for _Reaction).
test_wellformed([Molecule|Tail], Expression_raw for Reaction) :- test_wellformed(Molecules, Expression_raw for Reaction) :-
ode:substitute_functions(Expression_raw, Expression), ode:substitute_functions(Expression_raw, Expression),
always_positive(Expression), always_positive(Expression),
( ( % detect null kinetics as a warning
% detect null kinetics as a warning
is_null(Expression) is_null(Expression)
-> ->
format("WARNING: Some kinetics are detected as null: ~w~n", [Expression]), format("WARNING: Some kinetics are detected as null: ~w~n", [Expression]),
fail fail
; ;
test_wellformed_sr(Molecules, Expression for Reaction)
).
test_wellformed_sr([], _Reaction).
test_wellformed_sr([Molecule|Tail], Expression for Reaction) :-
(
formal_reactant(Molecule, Reaction) formal_reactant(Molecule, Reaction)
-> ->
present_in_kinetics(Molecule, Expression), present_in_kinetics(Molecule, Expression),
...@@ -1405,7 +1410,7 @@ test_wellformed([Molecule|Tail], Expression_raw for Reaction) :- ...@@ -1405,7 +1410,7 @@ test_wellformed([Molecule|Tail], Expression_raw for Reaction) :-
test_wf_other(Molecule, Expression) test_wf_other(Molecule, Expression)
) )
), ),
test_wellformed(Tail, Expression for Reaction). test_wellformed_sr(Tail, Expression for Reaction).
%! test_wf_reactant(+Molecule, +Expression) %! test_wf_reactant(+Molecule, +Expression)
......
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