Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit fd40556b authored by SOLIMAN Sylvain's avatar SOLIMAN Sylvain
Browse files

import_reac/infl => load and add

parent d495047f
......@@ -15,8 +15,10 @@
list_ode/0,
ode_system/0,
import_ode/1,
import_reactions_from_ode_system/0,
import_influences_from_ode_system/0,
load_reactions_from_ode_system/0,
load_influences_from_ode_system/0,
add_reactions_from_ode_system/0,
add_influences_from_ode_system/0,
(init)/1,
% load_ode_system/1,
load_reactions_from_ode/1,
......@@ -339,19 +341,19 @@ init(InitList) :-
)
).
import_reactions_from_ode_system :-
add_reactions_from_ode_system :-
biocham_command,
doc('adds a set of reactions equivalent to the current ODE system.'),
get_current_ode_system(Id),
!,
retractall(flag_influences),
import_reactions_from_ode_system(Id).
import_reactions_from_ode_system :-
add_reactions_from_ode_system :-
print_message(warning,'there is no current ode system').
import_influences_from_ode_system :-
add_influences_from_ode_system :-
biocham_command,
doc('adds a set of influences equivalent to the current ODE system.'),
get_current_ode_system(Id),
......@@ -359,10 +361,27 @@ import_influences_from_ode_system :-
(assertz(flag_influences);retractall(flag_influences)),
import_influences_from_ode_system(Id),
retractall(flag_influences).
import_influences_from_ode_system :-
add_influences_from_ode_system :-
print_message(warning,'there is no current ode system').
load_reactions_from_ode_system :-
biocham_command,
doc('Replaces the current reactions with those from
\\command{add_reactions_from_ode_system/0}.'),
delete_reactions,
add_reactions_from_ode_system.
load_influences_from_ode_system :-
biocham_command,
doc('Replaces the current reactions with those from
\\command{add_influences_from_ode_system/0}.'),
delete_reactions,
add_influences_from_ode_system.
:- devdoc('\\section{Public API}').
......@@ -591,6 +610,13 @@ non_decomposable_term_in_additive_normal_form(Coefficient, Term, Coefficient * T
integer(Coefficient),
!.
non_decomposable_term_in_additive_normal_form(-1, NCoeff * Term, Coefficient *
Term) :-
number(Coefficient),
Coefficient < 0,
!,
NCoeff is -Coefficient.
non_decomposable_term_in_additive_normal_form(1, Term, Term).
......@@ -1027,11 +1053,13 @@ models:add_file_suffix('ode', add_ode_system_file).
add_ode_system_file(InputFile) :-
import_ode(InputFile),
(flag_influences
->
import_influences_from_ode_system
;
import_reactions_from_ode_system),
(
flag_influences
->
add_influences_from_ode_system
;
add_reactions_from_ode_system
),
get_current_ode_system(Id),
delete_item(Id).
......
......@@ -42,7 +42,7 @@ done
all_items([parent: Id], ODEs).
test(
'import_reactions_from_ode_system',
'add_reactions_from_ode_system',
[true(Reactions == [v*a/(a+k) for a => b])]
) :-
clear_model,
......@@ -51,7 +51,9 @@ test(
add_ode(db/dt = v*a/(a+k)),
add_ode(dc/dt = 1),
delete_ode([c]),
import_reactions_from_ode_system,
add_reactions_from_ode_system,
all_items([kind: reaction], Reactions),
load_reactions_from_ode_system,
all_items([kind: reaction], Reactions).
......
......@@ -6,6 +6,7 @@
list_reactions/0,
list_rules/0,
delete_reaction/1,
delete_reactions/0,
delete_reaction_named/1,
delete_reaction_prefixed/1,
merge_reactions/2,
......@@ -37,14 +38,14 @@ add_reaction(Reaction) :-
type(Reaction, reaction),
doc('
adds reaction rules to the current set of reactions.
This command is implicit: reaction rules are directly added when reading them.
'),
This command is implicit: reaction rules are directly added when reading them.
'),
\+ (
reaction_named(Reaction, Name, Kinetics, Reactants, Inhibitors, Products),
\+ (
reaction_named(Reaction, Name, Kinetics, Reactants, Inhibitors, Products),
\+ (
add_reaction(Name, Kinetics, Reactants, Inhibitors, Products, false)
)
).
add_reaction(Name, Kinetics, Reactants, Inhibitors, Products, false)
)
).
:- doc('\\begin{remark}In Biocham v4, a reaction network is represented by a multiset of reactions. Reactions can thus be added in multiple copies in which case their reaction rates are summed.\\end{remark}').
......@@ -66,12 +67,19 @@ delete_reaction_named(Name):-
removes reaction rules by their name from the current set of reactions.
'),
Item=(Name--_),
\+ (
\+ (
item([kind:reaction, id: Id, item:Item]),
\+ (
delete_item(Id)
)
).
\+ (
delete_item(Id)
)
).
delete_reactions :-
biocham_command,
doc('Removes all reaction rules from the current model.'),
forall(item([kind: reaction, id: Id]), delete_item(Id)).
delete_reaction_prefixed(Prefix):-
biocham_command,
......@@ -80,25 +88,25 @@ delete_reaction_prefixed(Prefix):-
removes the reaction rules that match a name prefix.
'),
Item=(Name--_),
\+ (
\+ (
item([kind:reaction, id: Id, item:Item]),
atom_concat(Prefix,_,Name),
\+ (
delete_item(Id)
)
).
\+ (
delete_item(Id)
)
).
find_reaction_prefixed(Prefix,Name):-
biocham_command,
type(Prefix, name),
type(Name, name),
devdoc('
biocham_command,
type(Prefix, name),
type(Name, name),
devdoc('
Name is the name of a reaction prefixed by Prefix.
'),
Item=(Name--_),
item([kind:reaction, id: _Id, item:Item]),
atom_concat(Prefix,_,Name).
'),
Item=(Name--_),
item([kind:reaction, id: _Id, item:Item]),
atom_concat(Prefix,_,Name).
merge_reactions(Reaction1, Reaction2):-
......
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