Commit 47aba29e authored by BAUDIER Adrien's avatar BAUDIER Adrien
Browse files

Option to test transpositions only and simple example notebook

parent 3a77aca8
%% Cell type:code id: tags:
```
load('library:biomodels/BIOMD0000000270.xml').
draw_influences.
```
%% Cell type:code id: tags:
```
check_multistability.
```
%% Cell type:markdown id: tags:
Model 27 : One level MAPK with double phosphorilation written with catalytic reactions.
%% Cell type:code id: tags:
```
load('library:biomodels/BIOMD0000000027.xml').
list_model.
```
%% Cell type:code id: tags:
```
draw_influences.
```
%% Cell type:code id: tags:
```
check_multistability(test_permutations: yes).
```
%% Cell type:markdown id: tags:
Model 26 : One level MAPK with double phosphorilation written with intermediate complexes.
%% Cell type:code id: tags:
```
load('library:biomodels/BIOMD0000000026.xml').
list_model.
```
%% Cell type:code id: tags:
```
draw_influences.
```
%% Cell type:code id: tags:
```
check_multistability(test_transpositions: yes).
```
......@@ -14,33 +14,23 @@
:- devdoc('\\section{Commands}').
permute(L,P,PF) :-
perm(L,P,L,PF).
perm([],[],[],[]).
perm(L,[H|T],[OH|OT],PF) :-
\+ (member([],PF)),
append(V,[H|U],L),
append(V,U,W),
updatePF(OH,H,PF,NPF),
perm(W,T,OT,NPF).
updatePF(_,_,[],[]).
updatePF(O,O,[C|T],[NC|NT]) :-
(member(O,C)
->
select(O,C,NC);
NC=C
),
updatePF(O,O,T,NT).
updatePF(O,H,[C|T],NPF) :-
\+(O==H),
updatePF(O,H,T,NT),
((member(H,C); member(O,C))
->
NPF = NT;
NPF = [C|NT]
).
transposition(L,L).
transposition(L,Perm) :-
transposition_aux(L,L,Perm).
transposition_aux(L,[H1|T],Perm) :-
transposition_aux(L,T,Perm);
member(H2,T),
transpo_2_perm(L,H1,H2,Perm).
transpo_2_perm([],_,_,[]).
transpo_2_perm([H1|T],H1,H2,[H2|PermT]) :-
transpo_2_perm(T,H1,H2,PermT).
transpo_2_perm([H2|T],H1,H2,[H1|PermT]) :-
transpo_2_perm(T,H1,H2,PermT).
transpo_2_perm([H|T],H1,H2,[H|PermT]) :-
\+(H==H1;H==H2),
transpo_2_perm(T,H1,H2,PermT).
permute([],[]).
permute([H|T],P) :-
......@@ -52,19 +42,14 @@ assemble([S_head|S_tail],[P_head|P_tail],[[S_head,P_head]|Swaps_tail]) :-
assemble(S_tail,P_tail,Swaps_tail).
get_swaps(Species,Swaps) :-
% findall(S,species_conflict_fixed_point(S),PF),
permute(Species,Perm),
get_option(test_permutations, TP),
(TP == yes
->
permute(Species,Perm);
transposition(Species,Perm)
),
% write(Perm),write('\n'),
assemble(Species,Perm,Swaps).
% ((Perm == [mdegu,dim,degu,degup,mapre,apre]; Perm == [dim,mdegu,degu,degup,mapre,apre])
% ->
% (
% write(Perm),write('\n'),
% assemble(Species,Perm,Swaps)
% );
% (
% !,fail
% )
% ).
list_union([],L,L) :- !.
list_union(L,[],L) :- !.
......@@ -157,9 +142,8 @@ multistability_graph :-
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).
......@@ -276,7 +260,8 @@ multistability_graph(GraphId) :-
)
)
)
).
),
conserv_laws_for_multistability_graph.
copy_multistability_graph(ParentId,Swaps) :-
......@@ -397,6 +382,7 @@ conserv_laws_for_multistability_graph :-
),
ConservList
),
% write('Conserv laws are : '),write(ConservList),write('\n'),
asserta(conservLaws([])),
asserta(conservLawsParent(ConservList)).
......@@ -448,18 +434,9 @@ reset_gauss_system :-
asserta(loop_system_complete([])),
asserta(loop_gauss_system([])).
generate_conflict([],[],[],[]) :- !.
generate_conflict([[[P|_],_]|TSystem], [[S,_]|TSystem_complete], [P|TPivots], Species_conflict) :-
generate_conflict(TSystem,TSystem_complete,TPivots,Species_conflict_aux),
conserv_names_to_id(S_Name_aux,S),
list_to_ord_set(S_Name_aux,S_Name),
ord_union(Species_conflict_aux,S_Name,Species_conflict),!.
generate_conflict([_|TSystem], [_|TSystem_complete], Pivots, Species_conflict) :-
generate_conflict(TSystem,TSystem_complete,Pivots,Species_conflict),!.
add_loop_to_system(Loop) :-
loop_gauss_system(System),
pass_loop_in_system(Loop, System, [Species, Sign], Pivots_Used),
pass_loop_in_system(Loop, System, [Species, Sign], _Pivots_Used),
(Species = [_|_]
->
(
......@@ -475,10 +452,6 @@ add_loop_to_system(Loop) :-
(Sign == +
->
(
loop_system_complete(System_complete),
generate_conflict(System, System_complete, Pivots_Used, _Species_conflict),
% asserta(species_conflict_fixed_point(Species_conflict)),
% write(Species_conflict),write("\n"),
!,fail
);
(
......@@ -756,7 +729,8 @@ get_all_species(Species) :-
get_current_graph(MId),
findall(VertexName,
item([parent: MId, kind: vertex, item: VertexName]),
Species).
SpeciesUnsorted),
sort(SpeciesUnsorted,Species).
check_acyclicity(0) :- !.
check_acyclicity(N) :-
......@@ -775,15 +749,16 @@ check_acyclicity :-
retractall(species_conflict_fixed_point(_)),
get_all_species(Species),
get_swaps(Species,Swaps),
get_option(test_swaps, TS),
(TS == no
get_option(test_permutations, TP),
get_option(test_transpositions, TT),
((TP == no,TT == no)
->
!;
true
),
copy_multistability_graph(ParentId,Swaps),
select_graph(multistability_graph),
list_graph_objects,
% list_graph_objects,
remove_self_loops,
reset_gauss_system,
get_number_of_nodes(N),
......@@ -796,7 +771,8 @@ identity_swap([[X,X]|T]) :-
check_multistability :-
biocham_command,
doc('Check the multistability of the current model'),
option(test_swaps, yesno, _TestSwaps, 'Test with possible swap species'),
option(test_permutations, yesno, _TestSwaps, 'Test with all possible swap species'),
option(test_transpositions, yesno, _TestTranspo, 'Test with possible swap between two species'),
multistability_graph,
get_time(Start_time),
(check_acyclicity
......@@ -856,7 +832,8 @@ check_multistability :-
)
).
:- initial(option(test_swaps: no)).
:- initial(option(test_permutations: no)).
:- initial(option(test_transpositions: no)).
check_directory(Path) :-
% biocham_command,
......
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