seed2lp 2.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- seed2lp/__init__.py +12 -0
- seed2lp/__main__.py +837 -0
- seed2lp/_version.py +2 -0
- seed2lp/argument.py +717 -0
- seed2lp/asp/atom_for_transfers.lp +7 -0
- seed2lp/asp/community_heuristic.lp +3 -0
- seed2lp/asp/community_search.lp +14 -0
- seed2lp/asp/constraints_targets.lp +15 -0
- seed2lp/asp/definition_atoms.lp +87 -0
- seed2lp/asp/enum-cc.lp +50 -0
- seed2lp/asp/flux.lp +70 -0
- seed2lp/asp/limit_transfers.lp +9 -0
- seed2lp/asp/maximize_flux.lp +2 -0
- seed2lp/asp/maximize_produced_target.lp +7 -0
- seed2lp/asp/minimize.lp +8 -0
- seed2lp/asp/seed-solving.lp +116 -0
- seed2lp/asp/seed_external.lp +1 -0
- seed2lp/asp/show_seeds.lp +2 -0
- seed2lp/asp/show_tranfers.lp +1 -0
- seed2lp/asp/test.lp +61 -0
- seed2lp/clingo_lpx.py +236 -0
- seed2lp/color.py +34 -0
- seed2lp/config.yaml +56 -0
- seed2lp/description.py +424 -0
- seed2lp/file.py +151 -0
- seed2lp/flux.py +365 -0
- seed2lp/linear.py +431 -0
- seed2lp/log_conf.yaml +25 -0
- seed2lp/logger.py +112 -0
- seed2lp/metabolite.py +46 -0
- seed2lp/network.py +1921 -0
- seed2lp/reaction.py +207 -0
- seed2lp/reasoning.py +459 -0
- seed2lp/reasoningcom.py +753 -0
- seed2lp/reasoninghybrid.py +791 -0
- seed2lp/resmod.py +74 -0
- seed2lp/sbml.py +307 -0
- seed2lp/scope.py +124 -0
- seed2lp/solver.py +333 -0
- seed2lp/temp_flux_com.py +74 -0
- seed2lp/utils.py +237 -0
- seed2lp-2.0.0.dist-info/METADATA +404 -0
- seed2lp-2.0.0.dist-info/RECORD +53 -0
- seed2lp-2.0.0.dist-info/WHEEL +5 -0
- seed2lp-2.0.0.dist-info/entry_points.txt +2 -0
- seed2lp-2.0.0.dist-info/licenses/LICENCE.txt +145 -0
- seed2lp-2.0.0.dist-info/top_level.txt +2 -0
- tests/__init__.py +0 -0
- tests/fba.py +147 -0
- tests/full_network.py +166 -0
- tests/normalization.py +188 -0
- tests/target.py +286 -0
- tests/utils.py +181 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
%%%%%%%%%%%%%%%%%%%%%%% COMMUNITY METABOLITES ACTIVATION %%%%%%%%%%%%%%%%%%%%%%%
|
|
2
|
+
%*
|
|
3
|
+
A metabolite is activated by transfer between networks.
|
|
4
|
+
We choose the transferred metabolites that needed to be activate.
|
|
5
|
+
*%
|
|
6
|
+
activated(S) :- seed(S,_,_,_).
|
|
7
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
%%%%%%%%%%%%%%%%%%%%%%% COMMUNITY METABOLITES ACTIVATION %%%%%%%%%%%%%%%%%%%%%%%
|
|
2
|
+
%*
|
|
3
|
+
A metabolite is activated by transfer between networks.
|
|
4
|
+
We choose the transferred metabolites that needed to be activate.
|
|
5
|
+
*%
|
|
6
|
+
{transferred(N,B1,B2,M1,M2)} :- activated(M1), metabolite(M1,_,N,B1), metabolite(M2,_,N,B2),
|
|
7
|
+
B1 != B2, B1 != "pool", B2 != "pool";
|
|
8
|
+
not seed(M1,_,N,_), not transported_meta(M1).
|
|
9
|
+
activated(M) :- metabolite(M,_,N,B2), transferred(N,B1,B2,_,_).
|
|
10
|
+
|
|
11
|
+
% Contraintes a rajouté a partir du fichier de forbidden transfers rajouté a l'init dans l'instance
|
|
12
|
+
% :- transferred()
|
|
13
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
14
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
% Discard any model that is not activating all targets when not possible seeds
|
|
2
|
+
% given by the user.
|
|
3
|
+
% This constraint is needed both for seed search (seed_solving.asp)
|
|
4
|
+
% and for the second step of the bistep mode in community
|
|
5
|
+
% (where seed_solving.asp is not used anymore)
|
|
6
|
+
:- target(N,M) ; not activated(M), subseed=0.
|
|
7
|
+
|
|
8
|
+
% no_scope(N,M) :- target(N,M) ; not activated(M), subseed=0.
|
|
9
|
+
% #show no_scope/2.
|
|
10
|
+
% #show p_seed/2.
|
|
11
|
+
% #show new_seed/1.
|
|
12
|
+
% #show authorized_accu/1.
|
|
13
|
+
% #show target/2.
|
|
14
|
+
% #show can_reach/1.
|
|
15
|
+
% #show forbidden/1.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#const subseed=0. % mode select sub seed amoung possible seeds given by user
|
|
2
|
+
#const run_mode=target. % full/target/fba
|
|
3
|
+
#const accu=0.
|
|
4
|
+
|
|
5
|
+
%*
|
|
6
|
+
A metabolite is a reactant or product.
|
|
7
|
+
M: Metabolite composed ID
|
|
8
|
+
X: Exchange tag of metabolite (exchange / transport / other / internal_exchange)
|
|
9
|
+
N: Metabolite Real ID
|
|
10
|
+
B: Species Name
|
|
11
|
+
*%
|
|
12
|
+
metabolite(M,X,N,B) :- reactant(M,_,_,X,N,B).
|
|
13
|
+
metabolite(M,X,N,B) :- product(M,_,_,X,N,B).
|
|
14
|
+
|
|
15
|
+
%*
|
|
16
|
+
Define which non exchange metabolite is an imported metabolite
|
|
17
|
+
meaning, there is a reation that transport the metabolite frome extracellular (tagued exchange)
|
|
18
|
+
into intracellular (tagued other)
|
|
19
|
+
*%
|
|
20
|
+
transported_meta(M) :- product(M,_,_,"transport",_,_).
|
|
21
|
+
transported_meta(M) :- reactant(M,_,_,"transport",_,_).
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% INITIAL COMPUTATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
25
|
+
% An initial seed is activated
|
|
26
|
+
activated_initial(S) :- seed_user(S).
|
|
27
|
+
activated_initial(S) :- seed_external(S).
|
|
28
|
+
|
|
29
|
+
% Compute the initial scope from intial seeds
|
|
30
|
+
activated_initial(M) :- metabolite(M,_,_,_) ; product(M,_,R,_,_,_) ;
|
|
31
|
+
activated_initial(T): reactant(T,_,R,_,_,_);
|
|
32
|
+
% We reject de reaction created for flux mode to not have
|
|
33
|
+
% as activated initial the seed and the reaction
|
|
34
|
+
% can creates problems for cycles
|
|
35
|
+
not reac_import(M), not reac_export(M),
|
|
36
|
+
not import_exch(R), not import_exch_created(M), not export_exch_created(M).
|
|
37
|
+
|
|
38
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
%%%%%%%%%%%%%%%%%%%% ACTIVATE METABOLITES %%%%%%%%%%%%%%%%%%%%%%%
|
|
42
|
+
activated(M) :- activated_initial(M).
|
|
43
|
+
activated(S) :- new_seed(S).
|
|
44
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
45
|
+
|
|
46
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SCOPE DETERMINATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
47
|
+
%*
|
|
48
|
+
A metabolite is activated if produced by a reaction
|
|
49
|
+
with all its reactants activated.
|
|
50
|
+
*%
|
|
51
|
+
scopeR(R) :- reaction(R) ; activated(M): reactant(M,_,R,_,_,_).
|
|
52
|
+
activated(M) :- product(M,_,R,_,_,_) ; scopeR(R).
|
|
53
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ACCUMULATION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
57
|
+
%*
|
|
58
|
+
Avoid metabolite accumulation for target and full network mode
|
|
59
|
+
The authorized accumulation of metabolites are for compounds that are never
|
|
60
|
+
consumed by any reaction in the sbml file
|
|
61
|
+
If FBA mode, all compounds are allowed to be accumulated, the fba will select
|
|
62
|
+
the model without accumulation by itself with flux calculation
|
|
63
|
+
*%
|
|
64
|
+
authorized_accu(M) :- product(M,_,_,_,_,_), not reactant(M,_,R,_,_,_): reaction(R),
|
|
65
|
+
R != reac_export(M), R!= export_exch_created(M).
|
|
66
|
+
|
|
67
|
+
%*
|
|
68
|
+
Consumed at least one time
|
|
69
|
+
%%%%%%% TARGET OR FULL NETWORK %%%%%%%
|
|
70
|
+
Target or Full mode, when accumulation not allowed
|
|
71
|
+
*%
|
|
72
|
+
is_conso(M) :- reactant(M,_,R,_,_,_), scopeR(R), activated(M), accu=0,
|
|
73
|
+
R != reac_export(M), R!= export_exch_created(M); run_mode!=fba.
|
|
74
|
+
:- product(M,_,R,_,_,_), activated(M), not is_conso(M),
|
|
75
|
+
accu=0, not authorized_accu(M), run_mode!=fba.
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
%*
|
|
79
|
+
%%%%%%% FBA %%%%%%%
|
|
80
|
+
FBA mode, for checking if a seed is here to create export reaction and avoid
|
|
81
|
+
accumulation
|
|
82
|
+
*%
|
|
83
|
+
is_conso(M) :- reactant(M,_,R,_,_,_), scopeR(R), activated(M),
|
|
84
|
+
R != reac_export(M), R!= export_exch_created(M); run_mode=fba.
|
|
85
|
+
seed_accu(M) :- not is_conso(M), seed(M,_,_,_); run_mode=fba.
|
|
86
|
+
|
|
87
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
seed2lp/asp/enum-cc.lp
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
% Enumeration of Connected Components.
|
|
2
|
+
% INPUTS:
|
|
3
|
+
% - reaction(R): R is a reaction.
|
|
4
|
+
% - reactant(T,R): T is a reactant of reaction R.
|
|
5
|
+
% - product(P,R): P is a product of reaction R.
|
|
6
|
+
reaction(R) :- dreaction(R).
|
|
7
|
+
% OUTPUTS:
|
|
8
|
+
#show scc/2. % nodes in each SCC
|
|
9
|
+
#show noinput/1. % root SCC
|
|
10
|
+
#show sccedge/2. % link between SCC
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
% the edges are linking reactants to products of each reaction.
|
|
14
|
+
oedge(T,P) :- reactant(T,R) ; product(P,R).
|
|
15
|
+
|
|
16
|
+
% the nodes
|
|
17
|
+
node(M) :- reactant(M,_).
|
|
18
|
+
node(M) :- product(M,_).
|
|
19
|
+
|
|
20
|
+
% #show oedge/2.
|
|
21
|
+
% #show node/1.
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
% recursive definition of link between nodes
|
|
25
|
+
link(A,B) :- oedge(A,B).
|
|
26
|
+
link(A,C) :- oedge(A,B) ; link(B,C).
|
|
27
|
+
|
|
28
|
+
% definitions of cycle
|
|
29
|
+
% A is in a cycle
|
|
30
|
+
cycle(A) :- link(A,A).
|
|
31
|
+
% A and B are in the same cycle
|
|
32
|
+
cycle(A,B) :- link(A,B) ; link(B,A) ; cycle(A) ; cycle(B) ; A<=B.
|
|
33
|
+
|
|
34
|
+
% defining strongly connected components (scc)
|
|
35
|
+
scc_(A,C) :- cycle(A,C) ; not cycle(B,A) : cycle(B), B<A.
|
|
36
|
+
% singleton scc
|
|
37
|
+
sscc(M) :- node(M) ; not scc_(_,M).
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
scc(A,A) :- sscc(A).
|
|
41
|
+
scc(A,C) :- scc_(A,C).
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
% link between SCCs A and B.
|
|
45
|
+
sccedge(A,B) :- oedge(Va, Vb) ; scc(A,Va) ; scc(B,Vb) ; A!=B.
|
|
46
|
+
|
|
47
|
+
% a scc without an incoming edge is a root.
|
|
48
|
+
noinput(A) :- sccedge(A,_) ; not sccedge(_,A).
|
|
49
|
+
% a scc without any edge to other scc is also a root.
|
|
50
|
+
noinput(A) :- scc(A,_) ; not sccedge(A,_) ; not sccedge(_,A).
|
seed2lp/asp/flux.lp
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
%metabolite(M,X) :- reactant(M,_,_,X).
|
|
2
|
+
%metabolite(M,X) :- product(M,_,_,X).
|
|
3
|
+
|
|
4
|
+
%%%%%%%%%%%%%%%%%%% IMPORTING SINK METABOLITES %%%%%%%%%%%%%%%%%%%%
|
|
5
|
+
% Create import reactions for seeds not taggued as exchange
|
|
6
|
+
% (meaning to involved in exchange reaction)
|
|
7
|
+
% First create an import reaction forward with reactant
|
|
8
|
+
reac_import(M) :- seed(M,X,N,B), X!="exchange".
|
|
9
|
+
reaction(reac_import(M)) :- reac_import(M).
|
|
10
|
+
product(M,"1.0000",reac_import(M),X,N,B) :- reac_import(M), seed(M,X,N,B).
|
|
11
|
+
bounds(reac_import(M),"0","1000") :- reac_import(M).
|
|
12
|
+
|
|
13
|
+
% Because we are adding an import reaction reaction, this reaction become an exchange
|
|
14
|
+
% reaction and has to be tggued as exchange for seed_external definition
|
|
15
|
+
exchange(reac_import(M)) :- reac_import(M).
|
|
16
|
+
|
|
17
|
+
% then create the export reaction
|
|
18
|
+
reac_export(M) :- seed(M,X,N,B), X!="exchange".
|
|
19
|
+
reaction(reac_export(M)) :- reac_export(M).
|
|
20
|
+
reactant(M,"1.0000",reac_export(M),X,N,B) :- reac_export(M), seed(M,X,N,B).
|
|
21
|
+
bounds(reac_export(M),"0","1000") :- reac_export(M).
|
|
22
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
%%%%%%%%%%%%%%%%%%%% IMPORTING EXCHANGE METABOLITES %%%%%%%%%%%%%%%%%%%%
|
|
26
|
+
% add the reverse of an already existing exchange reaction
|
|
27
|
+
% in order to do that, we need to create a reaction having the metabolite in product
|
|
28
|
+
% we do that only if we remove import reaction and though the reversible does not exist
|
|
29
|
+
% we do it only for reaction that are also exchange reaction
|
|
30
|
+
% the boundary is [0,1000] because the forward reaction already exists
|
|
31
|
+
import_exch(R) :- seed(M,"exchange",N,B), rm_product(M,_,R,"exchange",_,B).
|
|
32
|
+
reaction(R) :- import_exch(R).
|
|
33
|
+
product(M,S,R,X,N,B) :- rm_product(M,S,R,X,N,B), import_exch(R).
|
|
34
|
+
bounds(R,"0","1000") :- import_exch(R).
|
|
35
|
+
|
|
36
|
+
% if the sbml doesn't have an exchange reaction reversible, it is possible to have
|
|
37
|
+
% only the export reaction written and not the import, so there is no atom rm_product
|
|
38
|
+
% or rm_reaction. So we create from scratch this import reaction for an exchange metabolite
|
|
39
|
+
import_exch_created(M,B) :- seed(M,"exchange",N,B), not rm_product(M,_,_,"exchange",_,_).
|
|
40
|
+
reaction(import_exch_created(B)) :- import_exch_created(M,B).
|
|
41
|
+
product(M,"1.0000",import_exch_created(M),"exchange",M,B) :- import_exch_created(M,B).
|
|
42
|
+
bounds(import_exch_created(M),"0","1000") :- import_exch_created(M,B).
|
|
43
|
+
|
|
44
|
+
% if the sbml doesn't have an exchange reaction reversible, it is possible to have
|
|
45
|
+
% only the import reaction written and not the export, so there is an atom rm_product
|
|
46
|
+
% for an exchange reaction, but the reversible doesn't exist.
|
|
47
|
+
% We create an export reaction
|
|
48
|
+
export_exch_created(M,B) :- seed(M,"exchange",N,B), rm_product(M,_,R,"exchange",_,_), exchange(R),
|
|
49
|
+
not reversible(R,_), not reversible(_,R).
|
|
50
|
+
reaction(export_exch_created(M)) :- export_exch_created(M,B).
|
|
51
|
+
reactant(M,"1.0000",export_exch_created(M),"exchange",M,B) :- export_exch_created(M,B).
|
|
52
|
+
bounds(export_exch_created(M),"0","1000") :- export_exch_created(M,B).
|
|
53
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
%%%%%%%%%%%%%%%%%%%%%%% FLUX BALANCE ANALYSIS DEFINITION %%%%%%%%%%%%%%%%%%%%%%%%
|
|
57
|
+
% domain definition; default dom{(x,0,inf)}
|
|
58
|
+
&dom{L..U} = R :- bounds(R,L,U), reaction(R).
|
|
59
|
+
|
|
60
|
+
% FBA definition
|
|
61
|
+
%OS: Product stoicihiometry by producting reaction OR
|
|
62
|
+
%IS: Consumed stoichiometry by consuming reaction IR
|
|
63
|
+
|
|
64
|
+
&sum{ OS*OR : reactant(M,OS,OR,_,_,_);
|
|
65
|
+
-IS*IR : product(M,IS,IR,_,_,_)
|
|
66
|
+
} = 0 :- metabolite(M,_,_,_).
|
|
67
|
+
|
|
68
|
+
% goal condition: target flux > 0
|
|
69
|
+
&sum{ R :objective(R) } >= "0.0001".
|
|
70
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#const limit_transfers=1.
|
|
2
|
+
%%%%%%%%%%%%%%%%%%%%%%% COMMUNITY METABOLITES ACTIVATION %%%%%%%%%%%%%%%%%%%%%%%
|
|
3
|
+
%*
|
|
4
|
+
A metabolite is activated by transfer between networks.
|
|
5
|
+
We choose the transferred metabolites that needed to be activate.
|
|
6
|
+
*%
|
|
7
|
+
nb_transfers(N) :- N=#count{M : transferred(M,_,_,_,_)}.
|
|
8
|
+
:- nb_transfers(N), N>limit_transfers.
|
|
9
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
% Maximization
|
|
2
|
+
% When possible seeds given by the user, a subset of these seeds is choosen
|
|
3
|
+
% by maximizing the targets into the scope
|
|
4
|
+
nb_produced_targets(X) :- X = #count{ M : target(N,M), activated(M) }.
|
|
5
|
+
|
|
6
|
+
% maximize number produced target has a higher priority than minimize seed (from minimize.lp)
|
|
7
|
+
#maximize{X@2, X:nb_produced_targets(X)}.
|
seed2lp/asp/minimize.lp
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
% Add minimze option and show the total number of seeds in a set
|
|
2
|
+
% Ensure the minimality of the set of seeds
|
|
3
|
+
|
|
4
|
+
nb_seed(N) :- N=#count{M,X : seed(M,X,_,_)}.
|
|
5
|
+
|
|
6
|
+
% minimize seed has a lower priority than maximize number produced target (from maximize_produced_targets.lp)
|
|
7
|
+
#minimize{N@1, N:nb_seed(N)}.
|
|
8
|
+
%#show nb_seed/1.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
%*
|
|
2
|
+
Search of the minimal set of seeds in all graph activating all targets or specific targets.
|
|
3
|
+
|
|
4
|
+
INPUTS:
|
|
5
|
+
- seed_user(S): node S is a seed given by users
|
|
6
|
+
- forbidden(S): node S cannot be a seed
|
|
7
|
+
- target(T): node T must be activated
|
|
8
|
+
- reaction(R): R is a reaction.
|
|
9
|
+
- reactant(T,_,R,_): T is a reactant of reaction R.
|
|
10
|
+
- product(P,_,R,_): P is a product of reaction R.
|
|
11
|
+
|
|
12
|
+
OUTPUTS: one model for each set of seed that activate all metabolites
|
|
13
|
+
- seed(S,_): node S is a seed
|
|
14
|
+
*%
|
|
15
|
+
%#const run_mode=target. % full/target/fba % Defined in definition_atoms
|
|
16
|
+
%#const accu=0. % Defined in definition_atoms
|
|
17
|
+
%#const subseed=0. % Defined in definition_atoms
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
%%%%%%%%%%%%%%%%%%%%%%% POSSIBLE SEEDS WHEN GIVEN BY USER %%%%%%%%%%%%%%%%%%%%%%%
|
|
22
|
+
%*
|
|
23
|
+
When user gives a file of possible seeds, we want to find a subset of this seeds
|
|
24
|
+
that respects the constraints (in any mode)
|
|
25
|
+
*%
|
|
26
|
+
p_seed(M,N) :- sub_seed(N), metabolite(M,_,N,_), subseed=1.
|
|
27
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
%%%%%%%%%%%%%%%%%%%%%%%%% TARGET SPECIFIC SEEDS SEARCH %%%%%%%%%%%%%%%%%%%%%%%%%
|
|
31
|
+
% Try to cut the set of possible seeds
|
|
32
|
+
can_reach(N) :- target(N,M), metabolite(M,_,N,_); run_mode=target, subseed=0, accu=1.
|
|
33
|
+
can_reach(N) :- reactant(M,_,R,_,N,_) ; product(P,_,R,_,O,_) ; can_reach(O) ;
|
|
34
|
+
run_mode=target, subseed=0, accu=1.
|
|
35
|
+
|
|
36
|
+
%*
|
|
37
|
+
Possible seed detection when the user do not give them:
|
|
38
|
+
Determine possible seeds when accumulation allowed
|
|
39
|
+
Eliminate the metabolite imported (having an import reaction)
|
|
40
|
+
Eliminate for example all the combination :
|
|
41
|
+
M_S1_e, M_S2_e, M_S3_e with M_S1_C, M_S2_c, M_S3_c
|
|
42
|
+
keep only M_S1_e, M_S2_e, M_S3_e
|
|
43
|
+
*%
|
|
44
|
+
p_seed(M,N) :- can_reach(N), metabolite(M,_,N,_), not seed_user(M),
|
|
45
|
+
not transported_meta(M);
|
|
46
|
+
run_mode=target, accu=1, subseed=0.
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
%*
|
|
50
|
+
Case accumulation not allowed, we need to reach more metabolite
|
|
51
|
+
to access to solution without accumulation
|
|
52
|
+
*%
|
|
53
|
+
p_seed(M,N) :- metabolite(M,_,N,_), not seed_user(M),
|
|
54
|
+
not transported_meta(M);
|
|
55
|
+
run_mode=target, accu=0, subseed=0.
|
|
56
|
+
|
|
57
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
58
|
+
|
|
59
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%% FULL NETWORK SEEDS SEARCH %%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
60
|
+
%*
|
|
61
|
+
A metabolite which is not a product of any reaction except
|
|
62
|
+
except his own exchange reaction is an external seed and must be a seed
|
|
63
|
+
when the search is full network
|
|
64
|
+
Also there is some cases when we have a reaction reversible where there is no
|
|
65
|
+
exchange reaction. Such as B_m <-> B_c, then None -> A_c and B_c + A_c -> C_c
|
|
66
|
+
We need to select one of the metabolite B as seed, but because of the reversibility
|
|
67
|
+
it is not selected if we don't take the reversible reaction into account.
|
|
68
|
+
*%
|
|
69
|
+
seed_external(M) :- reactant(M,_,_,_,_,_),
|
|
70
|
+
not product(M,_,R,_,_,_): reaction(R),
|
|
71
|
+
not exchange(R), not reversible(_,R);
|
|
72
|
+
not transported_meta(M);
|
|
73
|
+
run_mode=full, subseed=0.
|
|
74
|
+
seed_external(M) :- reactant(M,_,_,_,_,_),
|
|
75
|
+
not product(M,_,R,_,_,_): reaction(R),
|
|
76
|
+
not exchange(R), not reversible(R,_);
|
|
77
|
+
not transported_meta(M);
|
|
78
|
+
run_mode=full, subseed=0.
|
|
79
|
+
|
|
80
|
+
% A metabolite which is only product of reaction cannot be a seed
|
|
81
|
+
impossible_seed(M) :- product(M,_,_,_,_,_) ; not reactant(M,_,_,_,_,_) ; run_mode=full, subseed=0.
|
|
82
|
+
|
|
83
|
+
target(N,M) :- metabolite(M,_,N,_) ; run_mode=full.
|
|
84
|
+
|
|
85
|
+
% Determine possible seeds all the time (with or without accumulation)
|
|
86
|
+
p_seed(M,N) :- metabolite(M,_,N,_); not transported_meta(M) ;
|
|
87
|
+
not impossible_seed(M) ; not activated_initial(M) ;
|
|
88
|
+
run_mode=full, subseed=0.
|
|
89
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% FBA SEEDS SEARCH %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
93
|
+
%*
|
|
94
|
+
Determine possible seeds for FBA : All metabolites are possible seeds
|
|
95
|
+
Randomly choose metabolites, excepts the metabolite that are never consumed
|
|
96
|
+
otherwise the flux will create an import/Export reaction to avoid accumulation
|
|
97
|
+
*%
|
|
98
|
+
p_seed(M,N) :- metabolite(M,_,N,_), not transported_meta(M),
|
|
99
|
+
not activated_initial(M), not authorized_accu(M),
|
|
100
|
+
run_mode=fba, subseed=0.
|
|
101
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SEED SELECTION %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
107
|
+
% Choose a set of seed from the possible seeds
|
|
108
|
+
{ new_seed(M): p_seed(M,N), not forbidden(N) }.
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
% A seed is a seed given by the user, or an external seed
|
|
112
|
+
% or a new seed coming from the combinations of possible seeds
|
|
113
|
+
seed(M,X,N,B) :- seed_user(M), metabolite(M,X,N,B).
|
|
114
|
+
seed(M,X,N,B) :- seed_external(M), metabolite(M,X,N,B).
|
|
115
|
+
seed(M,X,N,B) :- new_seed(M), metabolite(M,X,N,B).
|
|
116
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#external seed(A,B,C,D): metabolite(A,B,C,D).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#show transferred/5.
|
seed2lp/asp/test.lp
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
solseed("abc","A").
|
|
2
|
+
solseed("abc","B").
|
|
3
|
+
solseed("abc","C").
|
|
4
|
+
|
|
5
|
+
solseed("abcde","A").
|
|
6
|
+
solseed("abcde","B").
|
|
7
|
+
solseed("abcde","C").
|
|
8
|
+
solseed("abcde","D").
|
|
9
|
+
solseed("abcde","E").
|
|
10
|
+
|
|
11
|
+
solseed("efg","E").
|
|
12
|
+
solseed("efg","F").
|
|
13
|
+
solseed("efg","G").
|
|
14
|
+
|
|
15
|
+
solseed("mnopq","M").
|
|
16
|
+
solseed("mnopq","N").
|
|
17
|
+
solseed("mnopq","O").
|
|
18
|
+
solseed("mnopq","P").
|
|
19
|
+
solseed("mnopq","Q").
|
|
20
|
+
|
|
21
|
+
soltransfert("12345","1").
|
|
22
|
+
soltransfert("12345","2").
|
|
23
|
+
soltransfert("12345","3").
|
|
24
|
+
soltransfert("12345","4").
|
|
25
|
+
soltransfert("12345","5").
|
|
26
|
+
|
|
27
|
+
soltransfert("678","6").
|
|
28
|
+
soltransfert("678","7").
|
|
29
|
+
soltransfert("678","8").
|
|
30
|
+
|
|
31
|
+
soltransfert("5678","5").
|
|
32
|
+
soltransfert("5678","6").
|
|
33
|
+
soltransfert("5678","7").
|
|
34
|
+
soltransfert("5678","8").
|
|
35
|
+
|
|
36
|
+
psolseedname("abc").
|
|
37
|
+
psolseedname("abcde").
|
|
38
|
+
psolseedname("efg").
|
|
39
|
+
psolseedname("mnopq").
|
|
40
|
+
|
|
41
|
+
psoltransfertname("12345").
|
|
42
|
+
psoltransfertname("678").
|
|
43
|
+
psoltransfertname("5678").
|
|
44
|
+
|
|
45
|
+
1{solseedname(A): psolseedname(A)}1.
|
|
46
|
+
1{soltransfertname(A): psoltransfertname(A)}1.
|
|
47
|
+
|
|
48
|
+
%seed(M) :- solseed(A,M), solseedname(A).
|
|
49
|
+
seed("A"). seed("B"). seed("C").
|
|
50
|
+
|
|
51
|
+
transfert(M) :- soltransfert(A,M), soltransfertname(A).
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
#heuristic seed(_). [2,false]
|
|
55
|
+
#heuristic transfert(_). [1,false]
|
|
56
|
+
|
|
57
|
+
%#show solseedname/1.
|
|
58
|
+
%#show soltransfertname/1.
|
|
59
|
+
|
|
60
|
+
#show seed/1.
|
|
61
|
+
#show transfert/1.
|