Commit 0ab20881 authored by FAGES Francois's avatar FAGES Francois
Browse files

strict_catalyst

parent ec4de1a9
......@@ -118,6 +118,7 @@ commands = [
"list_graphs",
"list_influences",
"list_initial_state",
"list_input_species",
"list_isolated_vertices",
"list_last_state",
"list_locations",
......@@ -178,7 +179,7 @@ commands = [
"prolog",
"quit",
"rate_independence_reduction",
"rate_independence_reduction_sources_sinks",
"rate_independence_reduction_inputs_sinks",
"reaction_graph",
"reaction_model",
"reduce_model",
......@@ -207,7 +208,7 @@ commands = [
"set_ode_system_name",
"set_p_m_rate",
"test_rate_independence",
"test_rate_independence_sources_sinks",
"test_rate_independence_inputs_sinks",
"transition",
"tropicalize",
"undefined",
......
......@@ -3,12 +3,15 @@
[
pathway/2,
list_source_species/0,
list_input_species/0,
list_sink_species/0,
% API
pathway/3,
input_species/1,
source_species/1,
sink_species/1,
is_source/2,
is_input/2,
is_sink/2
]
).
......@@ -65,15 +68,21 @@ new_successor((A, PathA), (B, [Reaction|PathA]), Forward):-
% Sources and Sinks
list_input_species:-
biocham_command,
doc('Lists the molecular species that are neither a non-strict-catalyst reaction product nor the target of an influence rule in the curent model.Strict catalysts, i.e. catalysts with same stoichiometry in left-hand and right side of reactions, are allowed as inputs.'),
input_species(Molecules),
writeln(Molecules).
list_source_species:-
biocham_command,
doc('Lists the molecular species that are neither a reaction product, nor the target of an influence rule, in the curent model.'),
doc('Lists the molecular species that are neither a reaction product nor the target of an influence rule in the curent model.'),
source_species(Molecules),
writeln(Molecules).
list_sink_species:-
biocham_command,
doc('Lists the molecular species that are neither a reactant, nor a (positive) source of an influence rule, in the curent model.'),
doc('Lists the molecular species that are neither a reactant nor a positive source of an influence rule in the curent model.'),
sink_species(Molecules),
writeln(Molecules).
......@@ -84,6 +93,10 @@ list_sink_species:-
:-devdoc('Prolog lists of graph sources and sinks.').
input_species(L):-
enumerate_molecules(Molecules),
realsetof(M, is_input(M, Molecules), L).
source_species(L):-
enumerate_molecules(Molecules),
realsetof(M, is_source(M, Molecules), L).
......@@ -103,6 +116,15 @@ is_source(M, Molecules):-
is_target(M,_)
).
is_input(M, Molecules):-
member(M, Molecules),
\+ (
is_strict_product(M,_)
),
\+ (
is_target(M,_)
).
is_sink(M, Molecules):-
member(M, Molecules),
\+ (
......
......@@ -3,9 +3,9 @@
[
% Commands
test_rate_independence/0,
test_rate_independence_sources_sinks/0,
test_rate_independence_inputs_sinks/0,
test_rate_independence/2,
rate_independence_reduction_sources_sinks/0,
rate_independence_reduction_inputs_sinks/0,
rate_independence_reduction/2
]
).
......@@ -49,13 +49,13 @@ test_rate_independence(Inputs, Outputs):-
rate_independence_reduction(Inputs, Outputs),
test_rate_independence.
test_rate_independence_sources_sinks :-
test_rate_independence_inputs_sinks :-
biocham_command,
doc('Test graphical sufficient conditions for rate independence of the current model for the computation of graph sink species from graph source species (assuming well-formed kinetics).'),
source_species(Inputs),
doc('Test graphical sufficient conditions for rate independence of the current model for the computation of graph output species from graph input species (assuming well-formed kinetics). The input species are the species that are not a reaction product or a strict catalyst (i.e. with same stoichiometry). The output species are the species that are not reactant.'),
input_species(Inputs),
sink_species(Outputs),
write('sources: '), writeln(Inputs),
write('sinks: '), writeln(Outputs),
write('inputs: '), writeln(Inputs),
write('outputs: '), writeln(Outputs),
test_rate_independence(Inputs, Outputs).
......@@ -70,10 +70,10 @@ rate_independence_reduction(Inputs, Outputs):-
writeln('Reduced model:'),
list_model.
rate_independence_reduction_sources_sinks:-
rate_independence_reduction_inputs_sinks:-
biocham_command,
doc('Reduces the current reaction model while preserving rate independence for computing sink species from source species.'),
source_species(Inputs),
doc('Reduces the current reaction model while preserving the rate independence property for computing the graph sink species from the input species. Warning: the reduction does not preserve the computation, only the rate independence property which may be true or false.'),
input_species(Inputs),
sink_species(Outputs),
write('sources: '), writeln(Inputs),
write('sinks: '), writeln(Outputs),
......
......@@ -4,14 +4,14 @@ b => y+c.
x+y => z.
c+z => r.
list_model.
test_rate_independence_sources_sinks.
test_rate_independence_inputs_sinks.
clear_model.
a => b.
b => c.
c => b + d.
list_model.
test_rate_independence_sources_sinks.
test_rate_independence_inputs_sinks.
clear_model.
a => b.
......@@ -19,13 +19,13 @@ b => c.
c => b.
c => d.
list_model.
test_rate_independence_sources_sinks.
test_rate_independence_inputs_sinks.
clear_model.
a+b=>b.
b+c=>_.
list_model.
test_rate_independence_sources_sinks.
test_rate_independence_inputs_sinks.
clear_model.
a+b=>c+d.
......@@ -34,7 +34,7 @@ c+d=>e.
e=>c+d.
e=>f+g.
list_model.
test_rate_independence_sources_sinks.
test_rate_independence_inputs_sinks.
clear_model.
......@@ -42,7 +42,7 @@ a => b.
b => a.
b => c.
list_model.
test_rate_independence_sources_sinks.
test_rate_independence_inputs_sinks.
clear_model.
......@@ -51,6 +51,6 @@ a=>c.
b=>d.
c=>d.
list_model.
test_rate_independence_sources_sinks.
test_rate_independence_inputs_sinks.
......@@ -24,7 +24,10 @@
reactions_with_inhibitor/2,
is_reactant/2,
is_product/2,
is_strict_reactant/2,
is_strict_product/2,
is_catalyst/2,
is_strict_catalyst/2,
is_inhibitor/2,
find_reaction_prefixed/2,
is_reaction_model/0,
......@@ -243,12 +246,23 @@ is_reactant(S, Reaction):-
reaction(Reaction, [kinetics: _,reactants: Reactants,inhibitors: _, products: _]),
member((_*S), Reactants).
is_strict_reactant(S, Reaction):-
item([kind: reaction, item: Reaction]),
reaction(Reaction, [kinetics: _,reactants: Reactants,inhibitors: _, products: Products]),
member((M*S), Reactants),
\+ member((M*S), Products).
is_product(S, Reaction):-
item([kind: reaction, item: Reaction]),
reaction(Reaction, [kinetics: _,reactants: _,inhibitors: _, products: Products]),
member((_*S), Products).
is_strict_product(S, Reaction):-
item([kind: reaction, item: Reaction]),
reaction(Reaction, [kinetics: _,reactants: Reactants,inhibitors: _, products: Products]),
member((M*S), Products),
\+ member((M*S), Reactants).
is_catalyst(S, Reaction):-
item([kind: reaction, item: Reaction]),
......@@ -256,6 +270,13 @@ is_catalyst(S, Reaction):-
member((_*S), Reactants),
member((_*S), Products).
% a strict catalyst has same stoichiometry (cannot be an autocatalyst)
is_strict_catalyst(S, Reaction):-
item([kind: reaction, item: Reaction]),
reaction(Reaction, [kinetics: _,reactants: Reactants,inhibitors: _, products: Products]),
member((C*S), Reactants),
member((C*S), Products).
is_inhibitor(S, Reaction):-
item([kind: reaction, item: Reaction]),
......
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