MAJ terminée. Nous sommes passés en version 14.6.2 . Pour consulter les "releases notes" associées c'est ici :

https://about.gitlab.com/releases/2022/01/11/security-release-gitlab-14-6-2-released/
https://about.gitlab.com/releases/2022/01/04/gitlab-14-6-1-released/

Commit 15d26b24 authored by BARGAIN Orianne's avatar BARGAIN Orianne
Browse files

add tests for motif reduction

parent 616e9e7c
E+S=>ES.
ES=>E+S.
ES=>E+P.
ES=>_.
......@@ -28,15 +28,22 @@ motif_reduction(Input_file) :-
option(motif, motif, Motif, 'Which motif to reduce'),
debug(motif, "Debugging motif reduction", []),
once(get_graph_info(Input_file, Number_species, Edges, Number_vertex, Id)),
_Graph = [Number_vertex, Number_species, Edges, Id],
Graph = [Number_vertex, Number_species, Edges, Id],
atom_concat(Root, ".bc", Input_file),
atom_concat(Root, "_reduced.bc", Output_file),
open(Output_file, write, Stream),
(
Motif=michaelis_menten
->
michaelis_menten_detection(Number_vertex, Edges, Id)
).
michaelis_menten_detection(Graph, Stream),
debug(motif, "Done looking for Michaelis Menten motifs", []),
write_reactions(Graph, Stream)
),
close(Stream).
/* get_type */
/* get_type(+A, +ID, -Type)
-> get type of a vertex
+A: number representing the vertex
+ID: id of the graph
-Type: return 1 if reaction, 0 if sepcie */
......@@ -50,8 +57,51 @@ get_type(A, ID, Type):-
Type is 0
).
/* michaelis_menten_detection */
/* michaelis_menten_detection(+Graph, +Stream)
-> looks for michaelis menten motifs
+Graph: the graph
+Stream: were to write the new graph */
michaelis_menten_detection(Graph, Stream):-
Graph = [Number_vertex, _, Edges, Id],
assert(seen(Number_vertex)),
Number_vertex_1 is Number_vertex - 1,
numlist(0,Number_vertex_1,Vertex_list),
forall(
(
member(E, Vertex_list),
member(S, Vertex_list),
member(P, Vertex_list),
member(ES, Vertex_list),
member(R1, Vertex_list),
member(R_1, Vertex_list),
member(R2, Vertex_list)
),
(
(
get_type(E, Id, 0),
get_type(S, Id, 0),
get_type(P, Id, 0),
get_type(ES, Id, 0),
get_type(R1, Id, 1),
get_type(R_1, Id, 1),
get_type(R2, Id, 1),
michaelis_menten_motif(E, S, P, ES, R1, R_1, R2, Edges)
->
debug(motif, "Michaelis Menten motif with E:~w S:~w P:~w ES:~w R1:~w R-1:~w R2:~w", [E, S, P, ES, R1, R_1, R2]),
assert(seen(R1)),
assert(seen(R_1)),
assert(seen(R2)),
write_reaction([E, S], [E, P], Id, Stream)
;
true
)
)
).
/* michaelis_menten_motif */
/* michaelis_menten_motif(+E, +S, +P, +ES, +R1, +R_1, +R2, +Edges, -Good_arcs)
/* michaelis_menten_motif(+E, +S, +P, +ES, +R1, +R_1, +R2, +Edges)
-> checks if the concerned species and reactions form a michaelis menten motif
+E: enzyme
+S: substrate
+P: product
......@@ -59,10 +109,8 @@ get_type(A, ID, Type):-
+R1: reaction 1
+R_1: reverse of reaction 1
+R2: reaction 2
+Edges: graph edges list
+Number_vertex: number of vertex in graph
-Good_arcs: list of good arcs */
michaelis_menten_motif(E, S, P, ES, R1, R_1, R2, Edges, Number_vertex, Good_arcs):-
+Edges: graph edges list */
michaelis_menten_motif(E, S, P, ES, R1, R_1, R2, Edges):-
Good_arc1 = (E,R1),
Good_arc2 = (S,R1),
Good_arc3 = (R1,ES),
......@@ -72,116 +120,136 @@ michaelis_menten_motif(E, S, P, ES, R1, R_1, R2, Edges, Number_vertex, Good_arcs
Good_arc7 = (ES,R2),
Good_arc8 = (R2,E),
Good_arc9 = (R2,P),
member(Good_arc1, Edges),
member(Good_arc2, Edges),
member(Good_arc3, Edges),
member(Good_arc4, Edges),
member(Good_arc5, Edges),
member(Good_arc6, Edges),
member(Good_arc7, Edges),
member(Good_arc8, Edges),
member(Good_arc9, Edges),
Good_arcs=[Good_arc1, Good_arc2, Good_arc3, Good_arc4, Good_arc5, Good_arc6, Good_arc7, Good_arc8, Good_arc9],
Number_vertex_1 is Number_vertex - 1,
numlist(0,Number_vertex_1,Vertex_list),
Good_arcs = [Good_arc1, Good_arc2, Good_arc3, Good_arc4, Good_arc5, Good_arc6, Good_arc7, Good_arc8, Good_arc9],
forall(
member(Arc, Good_arcs),
member(Arc, Edges)
),
Isolated_vertices = [ES, R1, R_1, R2],
forall(
member(Arc, Edges),
(
member(Y, Vertex_list)
),
member(Arc, Good_arcs)
;
not_bad_arc(Arc, Isolated_vertices)
)
).
/* not_bad_arc */
/* not_bad_arc(+Arc, +List_vertices)
-> makes sure the arc doesn't contain an isolated vertex
+Arc: the arc
+List_vertices: list of vertices to test */
not_bad_arc(Arc, List_vertices):-
forall(
member(Vertex, List_vertices),
(
Bad_arc1 = (ES,Y),
Bad_arc2 = (Y,ES),
(
not(member(Bad_arc1, Edges))
;
member(Bad_arc1, Good_arcs)
),
(
not(member(Bad_arc2, Edges))
;
member(Bad_arc2, Good_arcs)
),
Bad_arc3 = (R1,Y),
Bad_arc4 = (Y,R1),
(
not(member(Bad_arc3, Edges))
;
member(Bad_arc3, Good_arcs)
),
(
not(member(Bad_arc4, Edges))
;
member(Bad_arc4, Good_arcs)
),
Bad_arc5 = (R_1,Y),
Bad_arc6 = (Y,R_1),
(
not(member(Bad_arc5, Edges))
;
member(Bad_arc5, Good_arcs)
),
(
not(member(Bad_arc6, Edges))
;
member(Bad_arc6, Good_arcs)
),
Bad_arc7 = (R2,Y),
Bad_arc8 = (Y,R2),
(
not(member(Bad_arc7, Edges))
;
member(Bad_arc7, Good_arcs)
),
(
not(member(Bad_arc8, Edges))
;
member(Bad_arc8, Good_arcs)
)
not(Arc = (_, Vertex)),
not(Arc = (Vertex, _))
)
).
/* michaelis_menten_detection */
/* michaelis_menten_detection(+Number_vertex, +Edges, +Id)
+Number_vertex: number of vertex in graph
+Edges: graph edges list
+Id: Id of the graph */
michaelis_menten_detection(Number_vertex, Edges, Id):-
Number_vertex_1 is Number_vertex - 1,
numlist(0,Number_vertex_1,Vertex_list),
/* write_reaction */
/* write_reaction(+Reactant_list, +Product_list, +Id, +Stream)
-> write a reaction in a biocham format
+Reactant_list: reaction's reactants list
+Product_list: reaction's products list
+Id: id of the graph
+Stream: were to write the reaction */
write_reaction(Reactant_list, Product_list, Id, Stream):-
write_list(Reactant_list, Id, Stream),
format(Stream, "=>", []),
write_list(Product_list, Id, Stream),
format(Stream, ".~n", []).
/* write_list */
/* write_list(+List, +Id, +Stream)
-> write a list in a biocham format
+List: list of species
+Id: id of the graph
+Stream: were to write the reaction */
write_list([], _, Stream):-
format(Stream, "_", []).
write_list([Specie], Id, Stream):-
species(Name, Specie, Id),
format(Stream, "~w", [Name]).
write_list([Head|Tail], Id, Stream):-
write_list(Tail, Id, Stream),
species(Name, Head, Id),
format(Stream, "+~w", [Name]).
/* write_reactions */
/* write_reactions(+Graph, +Stream)
-> write all the remaining reactions (not concerned by a motif)
+Graph: the graph
+Stream: were to write the new graph */
write_reactions(Graph, Stream):-
Graph = [Number_vertex, Number_species, _, Id],
Number_reactions is Number_vertex - Number_species - 1,
numlist(0,Number_reactions,Reaction_list),
forall(
(
member(E, Vertex_list),
member(S, Vertex_list),
member(P, Vertex_list),
member(ES, Vertex_list),
member(R1, Vertex_list),
member(R_1, Vertex_list),
member(R2, Vertex_list)
member(Reaction, Reaction_list)
),
(
R is Reaction + Number_species,
(
get_type(E, Id, 0),
get_type(S, Id, 0),
get_type(P, Id, 0),
get_type(ES, Id, 0),
get_type(R1, Id, 1),
get_type(R_1, Id, 1),
get_type(R2, Id, 1),
michaelis_menten_motif(E, S, P, ES, R1, R_1, R2, Edges, Number_vertex, Arcs_to_remove),
Vertex_to_remove = [ES, R1, R_1, R2]
not(seen(R))
->
debug(motif, "Michaelis Menten motif with E:~w S:~w P:~w ES:~w R1:~w R-1:~w R2:~w", [E, S, P, ES, R1, R_1, R2]),
forall(
member(Arc, Arcs_to_remove),
assert(to_remove(Arc))
),
forall(
member(Vertex, Vertex_to_remove),
assert(to_remove(Vertex))
)
find_reactant(R, Graph, Reactant_list),
find_product(R, Graph, Product_list),
write_reaction(Reactant_list, Product_list, Id, Stream),
assert(seen(R))
;
true
)
)
)
.
).
/* find_reactant */
/* find_reactant(+R, +Graph, -Reactant_list)
-> finds reactants of the reaction R
+R: the reaction
+Graph: the graph
-Reactant_list: reaction's reactants list */
find_reactant(R, Graph, Reactant_list):-
Graph = [Number_vertex, _, Edges, _],
find_reactant(R, Edges, Number_vertex, Reactant_list).
find_reactant(_, _, 0, []).
find_reactant(R, Edges, I, Reactant_list):-
I_1 is I - 1,
(
(
Arc = (I_1,R),
member(Arc, Edges)
)
->
append([I_1], Reactant_sub_list, Reactant_list)
;
Reactant_list = Reactant_sub_list
),
find_reactant(R, Edges, I_1, Reactant_sub_list).
/* find_product */
/* find_product(+R, +Graph, -Product_list)
-> finds products of the reaction R
+R: the reaction
+Graph: the graph
-Product_list: reaction's products list */
find_product(R, Graph, Product_list):-
Graph = [Number_vertex, _, Edges, _],
find_product(R, Edges, Number_vertex, Product_list).
find_product(_, _, 0, []).
find_product(R, Edges, I, Product_list):-
I_1 is I - 1,
(
(
Arc = (R,I_1),
member(Arc, Edges)
)
->
append([I_1], Product_sub_list, Product_list)
;
Product_list = Product_sub_list
),
find_product(R, Edges, I_1, Product_sub_list).
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