Reaction Rule Semantics
From BioNetWiki
This page is a work in progress.
Contents |
Syntax
First we'll do a quick review of reaction rule syntax. A BNGL Reaction Rule has the following syntax in Extended Backus-Naur Form (EBNF):
Reaction_Rule = (Forward_Rule | Reversible_Rule);
Forward_Rule = (Name, ":")?, Pattern_Set, "->", Pattern_Set, WS, RateLaw, WS, Keyword_Set;
Reversible_Rule = (Name, ":")?, Pattern_Set, "<->", Pattern_Set, WS, RateLaw, ",", RateLaw, WS, Keyword_Set?;
Pattern_Set = ("0" | Pattern, ("+", Pattern)*);
RateLaw = (BNGExpression | SpecialRateLaw);
KeywordSet = Keyword,(WS, Keyword)*;
Pattern = (PatternPrefix*,":")?, MoleculeSet;
PatternPrefix = ...todo
MoleculeSet = Molecule,(".", Molecule)*;
Molecule = ...todo
BNGexpression = ...todo
SpecialRateLaw = ...todo
Keyword = ...todo
WS = " "+;
Name = ALPHA,(ALPHA|DIGIT|"_")*
TODO: explain Pattern, BNGExpression, SpecialRateLaw, etc. TODO: check for correctness
Rule Semantics
Mapping reactants to products
Molecules in the reactant side of a reaction rule are mapped to molecules on the product side using a well-defined mapping algorithm. Briefly, reactant molecules are mapped from left-to-right to the first matching molecule on the product side (also left-to-right) that is not already mapped to. A valid pair of matching molecules must have the same molecule type and the same set of listed components (but the component state and bond status do not matter). Reactant molecules without a corresponding product molecule are marked for degradation. Product molecules without a corresponding reactant molecule are synthesized by the reaction rule.
Here's the pseudocode for mapping molecules and components in the reactant patterns to molecules in the product patterns.
Function Molecule_Map = Map_Reactants_to_Products( Reactant_Molecule_List, Product_Molecule_List)
Molecule_Map = ()
Used_Product_Molecules = ()
foreach Reactant_Molecule in Reactant_Molecule_List // left-to-right
foreach Product_Molecule in Product_Molecule_List // left-to-right
// product molecule must not be mapped to already
next if Product_Molecule in Used_Product_Molecules
// molecule type must match
next if Product_Molecule.Type != Reactant_Molecule.Type
// size of component list must match
next if Product_Molecule.Component_List.size() != Reactant_Molecule.Component_List.size()
// now try to map components
component_map_is_ok = TRUE
Component_Map = ()
Used_Product_Components = ()
foreach Reactant_Component in Reactant_Molecule.Component_List // left-to-right
found_component_map = FALSE
foreach Product_Component in Product_Molecule.Component_List // left-to-right
// product component must not be mapped to already
next if Product_Component in Used_Product_Components
// component type must match
next if Product_Component.Type != Reactant_Component.Type
// state and bonds don't matter, so this is a good map
Component_Map.Reactant_Component = Product_Component
found_component_map = TRUE
last
end
if !found_component_map
// no match found for this component, molecule match is no good
component_map_is_ok = FALSE
last
end
end
if component_map_is_ok
Molecule_Map.Reactant_Molecule = (Product_Molecule, Component_Map)
Used_Product_Molecules.add( Product_Molecule )
last
end
end
end
return Molecule_Map
end Function
This algorithm does not consider component states or bonds. As a consequence, membership in a complex may not be preserved if the order of molecules changes from the reactant side to the product side. Molecule tags may be used to force matching between specific reactant and product molecules.
Reactant molecules that do not match a product molecule are assumed to be degraded by the reaction rule. Similarly, Product molecules that are not mapped to from a reactant molecule are assumed to by synthesized by the reaction rule.
TODO: Provide some examples here.
Extracting Transformation Sets from Reaction Rules
After mapping reactants to products, implied transformation are extracted from reaction rules.
Transformations
- component state change
- bond addition
- bond deletion
- molecule deletion
- species deletions
- molecule transport
- species transport
- "include connected" transport
