Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Lifeware
biocham
Commits
80a808e5
Commit
80a808e5
authored
Dec 13, 2019
by
SOLIMAN Sylvain
Browse files
FIX remove_stoichiometry_and_sort does not rely on reaction/2 output order any more
parent
5ab9ee85
Changes
1
Hide whitespace changes
Inline
Side-by-side
revision.pl
View file @
80a808e5
...
...
@@ -379,6 +379,10 @@ rules_from_trace([_], _, []).
rules_from_trace
([
S1
,
S2
|
States
],
Molecules
,
[
R
|
Rules
])
:-
rules_from_states
(
S1
,
S2
,
Molecules
,
R
),
debug
(
revision
,
"possible use of reaction ~p between states ~w and ~w"
,
[
R
,
S1
,
S2
]
),
rules_from_trace
([
S2
|
States
],
Molecules
,
Rules
).
...
...
@@ -434,10 +438,20 @@ del_reaction_backtracking(R) :-
compatible
(
SInc
,
SDec
,
SPres
,
Reaction
)
:-
debug
(
revision
,
"Testing compatibility with SInc: ~w, SDec: ~w and SPres: ~w"
,
[
SInc
,
SDec
,
SPres
]
),
item
([
kind
:
reaction
,
item
:
Reaction
]),
reaction
(
Reaction
,
[
reactants
:
Reactants
,
products
:
Products
]),
% TODO something with inhibitors
remove_stoichiometry_and_sort
(
Reactants
,
Products
,
UReac
,
UProd
,
UCata
),
debug
(
revision
,
"Reaction ~w (~w, ~w) has UReac: ~w, UProd: ~w and UCata: ~w"
,
[
Reaction
,
Reactants
,
Products
,
UReac
,
UProd
,
UCata
]
),
% products are true at the end
ord_union
(
SInc
,
SPres
,
SAfter
),
ord_subset
(
UProd
,
SAfter
),
...
...
@@ -450,17 +464,14 @@ compatible(SInc, SDec, SPres, Reaction) :-
ord_subset
(
UCata
,
SPres
).
% Based on reaction/5 implementation, we know catalysts come first
remove_stoichiometry_and_sort
([
_
*
M
|
Reac
],
[
_
*
M
|
Prod
],
UReac
,
UProd
,
UUCata
)
:-
!,
remove_stoichiometry_and_sort
(
Reac
,
Prod
,
UReac
,
UProd
,
UCata
),
ord_add_element
(
UCata
,
M
,
UUCata
).
remove_stoichiometry_and_sort
(
Reactants
,
Products
,
UReac
,
UProd
,
[])
:-
maplist
(
remove_stoich
,
Reactants
,
Reac
),
msort
(
Reac
,
UReac
),
maplist
(
remove_stoich
,
Products
,
Prod
),
msort
(
Prod
,
UProd
).
remove_stoichiometry_and_sort
(
Reactants
,
Products
,
UReac
,
UProd
,
UCata
)
:-
maplist
(
remove_stoich
,
Reactants
,
UR
),
maplist
(
remove_stoich
,
Products
,
UP
),
msort
(
UR
,
SR
),
msort
(
UP
,
SP
),
ord_subtract
(
SR
,
SP
,
UReac
),
ord_subtract
(
SP
,
SR
,
UProd
),
ord_intersection
(
SR
,
SP
,
UCata
).
remove_stoich
(
_
*
X
,
X
).
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment