Commit 189e7486 authored by SOLIMAN Sylvain's avatar SOLIMAN Sylvain

option name change, allow sources up

parent 7cd45e3a
......@@ -41,11 +41,15 @@
kind/4,
add_vertex/3,
add_edge/3,
add_edge/4
add_edge/4,
proper_source/2
]
).
:- use_module(doc).
:- devdoc('\\section{Grammars}').
......@@ -462,6 +466,7 @@ isolated_vertices(GraphId, VerticesId) :-
VerticesId
).
isolated_or_attributed_vertices(GraphId, VerticesId) :-
findall(
VertexId,
......@@ -478,3 +483,15 @@ isolated_or_attributed_vertices(GraphId, VerticesId) :-
),
VerticesId
).
proper_source(GraphId, VerticesId) :-
findall(
VertexId,
(
item([parent: GraphId, kind: vertex, id: VertexId, item: Vertex]),
\+ item([parent: GraphId, kind: edge, item: (_ -> Vertex)]),
once(item([parent: GraphId, kind: edge, item: (Vertex -> _)]))
),
VerticesId
).
......@@ -12,6 +12,10 @@
]
).
:- use_module(doc).
%:- doc('Bipartite molecule-influence graphs can be associated to both influence and reaction systems. The influence graph of a reaction system is an abstraction defined from the stoichiometry of the reactions, which is equivalent, under general conditions, to the influence graph defined by the signs of the Jacobian matrix of the ODEs \\cite{FS08fmsb,FGS15tcs}.').
:- devdoc('\\section{Commands}').
......@@ -138,7 +142,7 @@ influence_graph(GraphId) :-
)
)
),
reaction_graphs:present_up(GraphId).
set_sources(GraphId).
influence_hypergraph(GraphId) :-
......@@ -185,7 +189,7 @@ influence_hypergraph(GraphId) :-
add_edge(GraphId, TransitionId, OutputId, _)
)
),
reaction_graphs:present_up(GraphId).
set_sources(GraphId).
:- devdoc('\\section{Private predicates}').
......
......@@ -187,7 +187,7 @@
}
],
"source": [
"option(present_species_up:yes). draw_reactions."
"option(force_up: present). draw_reactions."
]
},
{
:- module(
reaction_graphs,
[
up_type/1,
% Commands
reaction_graph/0,
rule_graph/0,
......@@ -8,11 +9,32 @@
draw_reactions/0,
draw_rules/0,
% Public API
reaction_graph/1
reaction_graph/1,
set_sources/1
]
).
:- use_module(doc).
:- use_module(biocham).
:- grammar(up_type).
up_type(none).
up_type(present).
up_type(sources).
:- doc('Defines if some places are forcefully put on top of the graph when
drawing it with Graphviz. \\emphright{The default value is \\texttt{none}}').
:- initial(option(force_up: none)).
:- devdoc('\\section{Commands}').
......@@ -50,14 +72,16 @@ draw_reactions :-
reaction_graph :-
biocham_command,
option(present_species_up, yesno, _PresentUp, 'Put species that are present
option(force_up, up_type, _ForceUp, 'Put species of this type
at the top of the graph when drawing it.'),
doc('Builds the reaction graph of the current model.
\\begin{example}'),
biocham(option(present_species_up: yes)),
biocham(option(force_up: present)),
biocham(draw_reactions),
% biocham(option(force_up: sources)),
% biocham(draw_reactions),
doc('\\end{example}'),
biocham_silent(option(present_species_up: no)),
biocham_silent(option(force_up: none)),
delete_items([kind: graph, key: reaction_graph]),
new_graph,
set_graph_name(reaction_graph),
......@@ -65,9 +89,6 @@ reaction_graph :-
reaction_graph(GraphId).
:- initial('option(present_species_up: no)').
rule_graph :-
biocham_command,
doc('
......@@ -173,13 +194,13 @@ reaction_graph(GraphId) :-
)
)
),
present_up(GraphId).
set_sources(GraphId).
present_up(GraphId) :-
set_sources(GraphId) :-
get_option(force_up, Up),
(
get_option(present_species_up, PresentUp),
PresentUp == yes
Up == present
->
enumerate_molecules(M),
forall(
......@@ -191,6 +212,16 @@ present_up(GraphId) :-
),
set_attribute(SpeciesId, source = true)
)
;
Up == sources
->
forall(
(
proper_source(GraphId, VertexId),
get_attribute(VertexId, kind = place)
),
set_attribute(VertexId, source = true)
)
;
true
).
......
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