diff --git a/aliases.pl b/aliases.pl index d5dd6c565910d428b9622e743c0fba2512f29118..fddbd50bed3c0ef5bf45df31537de29abb27bffd 100644 --- a/aliases.pl +++ b/aliases.pl @@ -30,7 +30,7 @@ add_equivalence_class_list(EquivalenceClassList) :- ; list_to_equals(EquivalenceClassList, EquivalenceClass), add_item(alias, EquivalenceClassList, alias(EquivalenceClass)), - simplify_all_rules + simplify_all_reactions ). diff --git a/aliases.plt b/aliases.plt index 3a852a2306ab0ee92fc7a45f937df674c4d6d273..47ee22e642b47b44b5ecc0d18a427569a8bbd42b 100644 --- a/aliases.plt +++ b/aliases.plt @@ -2,10 +2,10 @@ :- begin_tests(aliases). -test('alias', [true(Rules == [2 * a => c])]) :- +test('alias', [true(Reactions == [2 * a => c])]) :- clear_model, - add_rule(a + b => c), + add_reaction(a + b => c), command(alias(a = b)), - all_items([model: current_model, kind: rule], Rules). + all_items([model: current_model, kind: reaction], Reactions). :- end_tests(aliases). diff --git a/conservation_laws.pl b/conservation_laws.pl index cf7e0aa4c593c9da1c086c0d82d1ba2d281e995b..31ba2c8e0e8255792012f11507610b02b2259242 100644 --- a/conservation_laws.pl +++ b/conservation_laws.pl @@ -30,7 +30,7 @@ add_conservation(Conservation) :- these checks are not complete, even a failure will be accepted with a warning.' ), - rule_editor:solution_to_list(Conservation, C), + solution_to_list(Conservation, C), add_item(conservation, C). @@ -38,7 +38,7 @@ delete_conservation(Conservation) :- biocham_command, type(Conservation, solution), doc('removes the given mass conservation law.'), - rule_editor:solution_to_list(Conservation, C), + solution_to_list(Conservation, C), find_item([model: current_model, id: Id, type: conservation, item: C]), delete_item(Id). diff --git a/initial_state.plt b/initial_state.plt index ccfcec87496910a93cde977f912a5921e3278a41..6795e29b4e109036fb91e6f95414bd8748cd64a9 100644 --- a/initial_state.plt +++ b/initial_state.plt @@ -33,7 +33,7 @@ test( [true(InitialState == [present(a), absent(b)])] ) :- clear_model, - add_rule(a => b), + add_reaction(a => b), command(present(a)), make_absent_not_present, all_items([model: current_model, kind: initial_state], InitialState). @@ -43,7 +43,7 @@ test( [true(InitialState == [absent(a), present(b)])] ) :- clear_model, - add_rule(a => b), + add_reaction(a => b), command(absent(a)), make_present_not_absent, all_items([model: current_model, kind: initial_state], InitialState). diff --git a/models.plt b/models.plt index a3092b5897eea7054959056c75b5f44a273e637b..96caa06886995aa91b9ad2184eaa43a6566bc491 100644 --- a/models.plt +++ b/models.plt @@ -3,13 +3,13 @@ :- begin_tests(models). -test('new_model', [true(Rules == [])]) :- +test('new_model', [true(Reactions == [])]) :- new_model, single_model(Id0), - add_rule(a => b), + add_reaction(a => b), new_model, single_model(Id1), - all_items([model: current_model, kind: rule], Rules), + all_items([model: current_model, kind: reaction], Reactions), delete_item(Id0), delete_item(Id1). diff --git a/nusmv.plt b/nusmv.plt index 7a1fba219bee13932c2a9609c257a7b5e877cc9d..bb2eabcbaff83733ac76a9025884143110946aa4 100644 --- a/nusmv.plt +++ b/nusmv.plt @@ -4,8 +4,8 @@ test('nusmv') :- clear_model, - add_rule(a => b), - add_rule(a + b => c), + add_reaction(a => b), + add_reaction(a + b => c), command(present(a)), command(absent(c)), export_nusmv('unittest'). diff --git a/rule_editor.pl b/reaction_editor.pl similarity index 81% rename from rule_editor.pl rename to reaction_editor.pl index d311839feca18980894c405ebc53306d69707ac8..309585d2012eff4f49cedacd2ee585cca69eea92 100644 --- a/rule_editor.pl +++ b/reaction_editor.pl @@ -1,40 +1,41 @@ :- module( - rule_editor, + reaction_editor, [ - add_rule/1, - list_rules/0, - rule/4, - simplify_all_rules/0, - enumerate_molecules/1 + add_reaction/1, + list_reactions/0, + reaction/4, + simplify_all_reactions/0, + enumerate_molecules/1, + solution_to_list/2 ] ). -add_rule(Reaction) :- +add_reaction(Reaction) :- biocham_command, type(Reaction, reaction), - doc('adds reaction rules to the current set of rules.'), - simplify_rule(Reaction, SimplifiedReaction), - add_item(rule, SimplifiedReaction). + doc('adds reaction rules to the current set of reactions.'), + simplify_reaction(Reaction, SimplifiedReaction), + add_item(reaction, SimplifiedReaction). -list_rules :- +list_reactions :- biocham_command, - doc('lists the current set of rules.'), - list_items([model: current_model, kind: rule]). + doc('lists the current set of reactions.'), + list_items([model: current_model, kind: reaction]). -simplify_all_rules :- +simplify_all_reactions :- \+ ( - item([model: current_model, kind: rule, id: Id, item: Rule]), + item([model: current_model, kind: reaction, id: Id, item: Reaction]), \+ ( delete_item(Id), - simplify_rule(Rule, SimplifiedRule), - add_item(rule, SimplifiedRule) + simplify_reaction(Reaction, SimplifiedReaction), + add_item(reaction, SimplifiedReaction) ) ). -rule(Item, Kinetics, Reactants, Products, Reversible) :- +reaction(Item, Kinetics, Reactants, Products, Reversible) :- ( Item = (Kinetics for Body) -> @@ -68,8 +69,8 @@ rule(Item, Kinetics, Reactants, Products, Reversible) :- append(CatalystMolecules, LeftMolecules, Reactants), append(CatalystMolecules, RightMolecules, Products). -rule(Item, Kinetics, Reactants, Products) :- - rule(Item, PairKinetics, LeftMolecules, RightMolecules, Reversible), +reaction(Item, Kinetics, Reactants, Products) :- + reaction(Item, PairKinetics, LeftMolecules, RightMolecules, Reversible), ( Reversible = yes -> @@ -139,16 +140,16 @@ coefficient_object(1 * Object, Object) :- coefficient_object(CoefficientObject, CoefficientObject). -simplify_rule(Rule, SimplifiedRule) :- - rule(Rule, Kinetics, LeftMolecules, RightMolecules, Reversible), +simplify_reaction(Reaction, SimplifiedReaction) :- + reaction(Reaction, Kinetics, LeftMolecules, RightMolecules, Reversible), simplify_kinetics(Kinetics, KineticsSimplified), simplify_solution(LeftMolecules, LeftMoleculesSimplified), simplify_solution(RightMolecules, RightMoleculesSimplified), simplify_catalyst( LeftMoleculesSimplified, RightMoleculesSimplified, Left, Catalyst, Right ), - build_rule( - KineticsSimplified, Left, Catalyst, Right, Reversible, SimplifiedRule + build_reaction( + KineticsSimplified, Left, Catalyst, Right, Reversible, SimplifiedReaction ). @@ -225,13 +226,13 @@ simplify_catalyst([Head | Tail], Right, NewLeft, Catalyst, NewRight) :- ). -build_rule(Kinetics, Left, Catalyst, Right, Reversible, Rule) :- +build_reaction(Kinetics, Left, Catalyst, Right, Reversible, Reaction) :- ( Kinetics = 'MA'(1) -> - Rule = Body + Reaction = Body ; - Rule = (Kinetics for Body) + Reaction = (Kinetics for Body) ), list_to_solution(Left, LeftSolution), list_to_solution(Catalyst, CatalystSolution), @@ -266,8 +267,8 @@ enumerate_molecules(Molecules) :- enumerate_molecule(Molecule) :- - item([model: current_model, kind: rule, item: Item]), - rule(Item, _Kinetics, Reactants, Products, _Reversible), + item([model: current_model, kind: reaction, item: Item]), + reaction(Item, _Kinetics, Reactants, Products, _Reversible), ( member(_ * Molecule, Reactants) ; diff --git a/reaction_editor.plt b/reaction_editor.plt new file mode 100644 index 0000000000000000000000000000000000000000..c3d32135eeb035f70c8d031bc4f16faecfafd9cd --- /dev/null +++ b/reaction_editor.plt @@ -0,0 +1,18 @@ +:- use_module(library(plunit)). + + +:- begin_tests(reaction_editor). + + +test('compound', [true(Reactions == [2 * a + 2 * b => 2 * 'a-b'])]) :- + clear_model, + command(add_reaction(2 * a + 2 * b => 2 * a-b)), + all_items([model: current_model, kind: reaction], Reactions). + +test('catalyst', [true(Reactions == [2 * b <=[ a + c ]=> b])]) :- + clear_model, + add_reaction(a + b + c <=[ b ]=> a + c), + all_items([model: current_model, kind: reaction], Reactions). + + +:- end_tests(reaction_editor). diff --git a/rule_editor.plt b/rule_editor.plt deleted file mode 100644 index 6cd572c9f6a7bef301917729186febd5811c52aa..0000000000000000000000000000000000000000 --- a/rule_editor.plt +++ /dev/null @@ -1,18 +0,0 @@ -:- use_module(library(plunit)). - - -:- begin_tests(rule_editor). - - -test('compound', [true(Rules == [2 * a + 2 * b => 2 * 'a-b'])]) :- - clear_model, - command(add_rule(2 * a + 2 * b => 2 * a-b)), - all_items([model: current_model, kind: rule], Rules). - -test('catalyst', [true(Rules == [2 * b <=[ a + c ]=> b])]) :- - clear_model, - add_rule(a + b + c <=[ b ]=> a + c), - all_items([model: current_model, kind: rule], Rules). - - -:- end_tests(rule_editor). diff --git a/toc.org b/toc.org index 8b975a7c01b9b96129a9933909d3917451adca9a..98192120826f80ab2b1d9e5ef7e89eb02d0ad4cc 100644 --- a/toc.org +++ b/toc.org @@ -32,9 +32,9 @@ *** Graphics files *** Other files - nusmv.pl -** Listing and editing rules and events -*** Rules -- rule_editor.pl +** Listing and editing reactions and events +*** Reactions +- reaction_editor.pl - ode.pl *** Events - events.pl