pyRBM.Build package
Submodules
pyRBM.Build.Classes module
pyRBM.Build.Compartment module
pyRBM.Build.ProcessDescriptionFiles module
Module to load compartments from file and create a function to be used in model creation.
pyRBM.Build.RuleMatching module
Generic framework to match metarules to compartments, find all compartment indices that match and rewrite the propensities and stoichiometries to use array indices.
- isSubtypeOf(parent_type: str, child_type: str) bool
Indicates whether the “child_type” rule type is a subtype of the parent_type.
Current returns parent_type == child_type.
In the future this should be determined by a tree based hierachical graph.
- obtainPropensity(rule: dict[str, Any], compartments: list[dict[str, Any]], builtin_classes: list[list[str]]) list[str]
- obtainStochiometry(rule: dict[str, Any], compartments: list[dict[str, Any]]) list[list[numpy.float64]]
Remaps the rule to fit the class size found in each compartment
Example: Original Rule mapping {0:”Class1”, 1:”Class2”} (size of input to Stochiometry and Propensity functions: 2)
Compartment and Fitted Rule mapping {0:”ClassA”, 1:”Class1”, 2:”ClassB”, 3:”Class2”} (size of input to Stochiometry and Propensity functions: 4)
- Parameters:
rule (-) – the Rule that we are remapping the propensity and stochiometry to fit each compartment.
compartments (-) – compartment instances (a list the length of rule.types) that fit each of the rule.types.
Returns: list of expanded stochiometries for all rule compartments
pyRBM.Build.RuleTemplates module
Provides classes to initialise common types of rules with simpler init functions.
- class ExitEntranceRule(target: str, transport_class: str, transport_amount: float | int, propensity: str, propensity_classes: list[str] | str, rule_name: str = 'EXIT/ENTRANCE RULE')
Bases:
RuleA template for either an exit rule or an entrance rule for a single class for a single compartment.
- class SingleLocationProductionRule(target: str, reactant_classes: list[str] | str, reactant_amount: list[Union[float, int]], product_classes: list[str] | str, product_amount: list[Union[float, int]], propensity: str, propensity_classes: list[str] | str, rule_name: str = 'SINGLE LOCATION PRODUCTION RULE')
Bases:
SingleLocationRule
- class SingleLocationRule(target: str, propensity: str, stoichiomety, propensity_classes: list[str] | str, stoichiometry_classes: str | list[str], rule_name: str = 'SINGLE LOCATION RULE')
Bases:
RuleA template for a rule at a single compartment.
- class TransportRule(source: str, target: str, transport_class: str, propensities: list[str], transport_amount: float | int, propensity_classes: list[list[str]], rule_name: str = 'TRANSPORT RULE')
Bases:
RuleA template for a transport rule for a single class between a single source compartment and a single target compartment.
pyRBM.Build.Rules module
Defines a Rule class and a Rules helper class
- class Rule(rule_name: str, targets: Sequence[str])
Bases:
object- addLinearStoichiomety(target_indices: list[int], stoichiometies, required_target_classes: list[list[str]]) None
- addSimplePropensityFunction(target_indices: list[int], values, required_target_classes: list[list[str]]) None
- addWaitTimeDistribution(wait_time_distrib: str | Distribution)
- checkRuleDefinition(builtin_class_symbols: dict[str, sympy.core.symbol.Symbol] | None, compartments_constant_symbols: dict[str, sympy.core.symbol.Symbol] | None) None
- Perform the following validation on the rule definition:
self.stoichiometies, self.propensities, self.propensity_classes are of the same length as the rule targets.
each element of self.stoichiometies, self.propensities, self.propensity_classes are not None.
- each propensity at index i, in self.propensities, evaluates to a number when the builtin_class_symbols,
compartments_constant_symbols and the propensity_classes[i] symbols are evaluated as 1 (i.e. the propensity is a valid numerical formula).
- Parameters:
builtin_class_symbols –
compartments_constant_symbols –
- class Rules(defined_classes: Iterable[str], compartment_constants: list[str] | None)
Bases:
object
pyRBM.Build.Utils module
- createArgsDict(default_values_dict, user_provided_dict)