Commit 15faf96a authored by BAUDIER Adrien's avatar BAUDIER Adrien

Copy graph instead of creating it

parent f50a5c8f
......@@ -94,11 +94,25 @@ add_edge_to_multistability_graph(VertexAId, VertexBId, Species_Sorted, Reactions
multistability_graph :-
biocham_command,
doc("Creates the influence graph of the current model with the arcs labelled with the reaction they originate from"),
delete_items([kind: graph, key: multistability_graph]),
new_graph,
set_graph_name(multistability_graph),
get_current_graph(GraphId),
multistability_graph(GraphId).
all_items([kind: graph], AllGraphs),
(member(multistability_graph_parent, AllGraphs)
->
(
select_graph(multistability_graph_parent),
get_current_graph(GraphId)
);
(
new_graph,
set_graph_name(multistability_graph_parent),
get_current_graph(GraphId),
multistability_graph(GraphId)
)
),
copy_multistability_graph(GraphId),
conserv_laws_for_multistability_graph,
select_graph(multistability_graph),
get_current_graph(MultiGraphId),
set_sources(MultiGraphId).
multistability_graph(GraphId) :-
lemon:number_reactions,
......@@ -212,11 +226,47 @@ multistability_graph(GraphId) :-
)
)
)
),
conserv_laws_for_multistability_graph,
select_graph(multistability_graph),
set_sources(GraphId).
).
copy_multistability_graph(ParentId) :-
delete_items([kind: graph, key: multistability_graph]),
new_graph,
set_graph_name(multistability_graph),
get_current_graph(GraphId),
retractall(correspond_vertex_name_id(_,_)),
forall(item([parent: ParentId, kind:vertex, item: VertexName, id: VId]),
(
add_vertex(GraphId, VertexName, VertexId),
get_attribute(VId, out_deg=Out),
get_attribute(VId, in_deg=In),
set_attribute(VertexId, out_deg=Out),
set_attribute(VertexId, in_deg=In),
asserta(correspond_vertex_name_id(VertexName, VertexId))
)
),
forall(item([parent: ParentId, kind:edge, item: Edge, id: EId]),
(
Edge = (VertexA->VertexB),
correspond_vertex_name_id(VertexA, VertexAId),
correspond_vertex_name_id(VertexB, VertexBId),
add_edge(GraphId,VertexAId,VertexBId,EdgeId),
get_attribute(EId, sign=Sign),
set_attribute(EdgeId, sign=Sign),
sort([VertexAId, VertexBId],Species_sorted),
get_attribute(EId, label=L),
forall(member([_,_,_,R,S],L),
(get_attribute(EdgeId, label=OldLabel)
->
(
set_attribute(EdgeId, label = [[VertexAId,VertexBId,Species_sorted,R,S]|OldLabel])
);
(
set_attribute(EdgeId, label = [[VertexAId,VertexBId,Species_sorted,R,S]])
)
)
)
)
).
conserv_laws_for_multistability_graph :-
retractall(conservLaws(_)),
......
......@@ -135,7 +135,7 @@ check_acyclicity :-
check_oscilations :-
biocham_command,
doc('Check the multistability of the current model'),
doc('Check the periodic behaviour of the current model'),
multistability:multistability_graph,
get_time(Start_time),
(check_acyclicity
......@@ -176,18 +176,16 @@ check_directory(Path) :-
delete_file(FileToExport)
),
(
check_multistability
check_oscilations
)
).
profiling_acyc :-
load("./library/biomodels/BIOMD0000000270.xml"),
export_ode("10.ode"),
load_reactions_from_ode("10.ode"),
delete_file("10.ode"),
reset_profiler,
profile(check_multistability, [cumulative(true)]),
reset_profiler,
profile(multistability_graph, [cumulative(true)]).
%profiling_acyc :-
% load("./library/biomodels/BIOMD0000000270.xml"),
% export_ode("10.ode"),
% load_reactions_from_ode("10.ode"),
% delete_file("10.ode"),
% reset_profiler,
% profile(check_oscilations, [cumulative(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