Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Lifeware
biocham
Commits
d8ee360d
Commit
d8ee360d
authored
Apr 30, 2020
by
SOLIMAN Sylvain
Browse files
It's all persistency now!
parent
78f4eb0d
Changes
1
Hide whitespace changes
Inline
Side-by-side
rate_independence.pl
View file @
d8ee360d
...
...
@@ -434,7 +434,6 @@ add_merge_reaction(M, Reaction1, Reaction2):-
add_reaction
(
Kin1
*
Kin2
,
Reac
,
Inhib
,
Prod
,
false
).
% Dynamic predicate for storing structural information of the graph
:-
dynamic
(
sur_invariant
/
1
).
:-
dynamic
(
p_invariant
/
1
).
:-
dynamic
(
output
/
1
).
:-
dynamic
(
siphon
/
1
).
...
...
@@ -445,7 +444,6 @@ add_merge_reaction(M, Reaction1, Reaction2):-
test_rate_independence_invariants
:-
biocham_command
,
doc
(
'Tests invariant sufficient conditions for rate independence of the current model for all output species (assuming well-formed kinetics).'
),
retractall
(
sur_invariant
(
_
)),
retractall
(
p_invariant
(
_
)),
retractall
(
output
(
_
)),
retractall
(
siphon
(
_
)),
...
...
@@ -454,8 +452,6 @@ test_rate_independence_invariants :-
retract
(
invariants
:
base_mol
(
B
)),
(
normalize
(
B
,
BB
),
assertz
(
sur_invariant
(
BB
)),
debug
(
rate
,
"sur_invariant: ~w"
,
[
BB
]),
(
B
=
[
Out
]
->
...
...
@@ -496,34 +492,17 @@ test_rate_independence_invariants :-
%! test_rate_independence_invariants(+Output, -Id) is det.
%
% check the rate independence of species Output in reaction graph Id
test_rate_independence_invariants
(
Output
,
Id
)
:-
test_rate_independence_invariants
(
Output
,
_
Id
)
:-
debug
(
rate
,
"Trying for output ~w"
,
[
Output
]),
(
is_covered_by_p_invariant_with_single_surinv
(
Output
,
Output
,
_
)
is_persistent
(
Output
),
p_invariant
(
P
),
member
(
Output
,
P
)
->
debug
(
rate
,
"
~w is t
h
e
s
in
gle output of a P-invaria
nt"
,
[
Output
])
format
(
"The output
~w is
ra
te in
depende
nt
.
"
,
[
Output
])
;
format
(
"Undecided, ~w not
isolat
ed
in
any P-invariant."
,
[
Output
]),
format
(
"Undecided, ~w not
persistent or not cover
ed
by
any P-invariant."
,
[
Output
]),
fail
),
retractall
(
seen
(
_
)),
retractall
(
visiting
(
_
)),
iterate_on_parents
(
Output
,
Id
),
format
(
"The output ~w is rate independent."
,
[
Output
]).
%! is_covered_by_p_invariant_with_single_surinv(+Species, ?Output, -P) is det.
%
% check if Species is covered by a P-invariant P, Output is an Output, and P
% does not contain any other sur-invariant than Output
is_covered_by_p_invariant_with_single_surinv
(
Species
,
Output
,
P
)
:-
p_invariant
(
P
),
member
(
Species
,
P
),
output
(
Output
),
\
+
(
sur_invariant
(
S
),
S
\
=
[
Output
],
ord_subset
(
S
,
P
)
).
...
...
@@ -536,62 +515,6 @@ is_persistent(Species) :-
\
+
member
(
Species
,
S
),
!.
is_persistent
(
Species
)
:-
output
(
Species
).
%! iterate_on_parents(+Species, +GraphId) is det.
%
% iteratively search if all parents either are presistent or in different P-invariants
iterate_on_parents
(
Species
,
GraphId
)
:-
assertz
(
seen
(
Species
)),
debug
(
rate
,
"Searching for ~w parents"
,
[
Species
]),
forall
(
(
item
([
parent
:
GraphId
,
kind
:
edge
,
id
:
EdgeId1
,
item
:
(
Reaction
->
Species
)]),
\
+
(
item
([
parent
:
GraphId
,
kind
:
edge
,
id
:
EdgeId2
,
item
:
(
Species
->
Reaction
)]),
debug
(
rate
,
"parent reaction ~w also has ~w as input"
,
[
Reaction
,
Species
]),
reaction_graphs
:
get_stoichiometry
(
EdgeId1
,
Stoich1
),
reaction_graphs
:
get_stoichiometry
(
EdgeId2
,
Stoich2
),
debug
(
rate
,
"stoichiometries ~w -> ~w"
,
[
Stoich2
,
Stoich1
]),
Stoich1
=
Stoich2
)
),
(
debug
(
rate
,
"parent reaction: ~w"
,
[
Reaction
]),
retractall
(
visiting
(
Species
-
_
)),
assertz
(
visiting
(
Species
-
[])),
forall
(
item
([
parent
:
GraphId
,
kind
:
edge
,
item
:
(
Reactant
->
Reaction
)]),
(
debug
(
rate
,
"parent: ~w"
,
[
Reactant
]),
visiting
(
Species
-
ParentPinvs
),
(
seen
(
Reactant
)
->
debug
(
rate
,
"parent ~w already seen"
,
[
Reactant
])
;
is_persistent
(
Reactant
)
->
debug
(
rate
,
"parent ~w persistent"
,
[
Reactant
])
;
is_covered_by_p_invariant_with_single_surinv
(
Reactant
,
_
,
P
),
\
+
member
(
P
,
ParentPinvs
)
->
retract
(
visiting
(
Species
-
ParentPinvs
)),
assertz
(
visiting
(
Species
-
[
P
|
ParentPinvs
])),
debug
(
rate
,
"parent ~w in P-invariant, iterating"
,
[
Reactant
]),
iterate_on_parents
(
Reactant
,
GraphId
)
;
format
(
"Undecided, ~w needed for an output and non-absorbed."
,
[
Reactant
]),
fail
)
)
)
)
).
%! normalize(+Invar, -Normalized) is det.
%
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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