pykappa.rule

Classes

BimolecularRule(left, right, stochastic_rate)

Rule that acts between two distinct components.

Rule(left, right, stochastic_rate)

Standard Kappa rule with left-hand side, right-hand side, and rate.

UnimolecularRule(left, right, stochastic_rate)

Rule that acts within a single component.

class pykappa.rule.Rule(left, right, stochastic_rate)[source]

Standard Kappa rule with left-hand side, right-hand side, and rate.

Parameters:
classmethod list_from_kappa(kappa_str)[source]

Parse Kappa string into a list of rules.

Note

Forward-reverse rules (with “<->”) represent two rules.

Parameters:

kappa_str (str)

Return type:

list[Self]

classmethod from_kappa(kappa_str)[source]

Parse a single Kappa rule from string.

Raises:

AssertionError – If the string represents more than one rule.

Parameters:

kappa_str (str)

Return type:

Self

left: Pattern
right: Pattern
stochastic_rate: Expression
property kappa_str: str
reactivity(system)[source]

Calculate the total reactivity of this rule in the given system, i.e. the number of embeddings times the reaction rate, accounting for rule symmetry.

Parameters:

system (System)

Return type:

float

property n_symmetries: int

The number of distinct automorphisms of the graph containing both left- and right-hand side agents, augmented with edges between positionally corresponding agents. For example, if a rule looks like “l1(…), l2(…) -> r1(…), r2(…)”, this method draws artifical edges between l1 and r1, and between l2 and r2, then returns the number of symmetries of the resulting graph by counting how many ways it can be mapped onto itself.

rate(system)[source]
Parameters:

system (System)

Return type:

float

n_embeddings(mixture)[source]

Count embeddings in the mixture.

Note

This doesn’t do any symmetry correction, though System applies this correction when calculating rule reactivities.

Parameters:

mixture (Mixture)

Return type:

int

class pykappa.rule.UnimolecularRule(left, right, stochastic_rate)[source]

Rule that acts within a single component.

Parameters:
n_embeddings(mixture)[source]

Count the total number of embeddings in the mixture.

Parameters:

mixture (Mixture)

Return type:

int

class pykappa.rule.BimolecularRule(left, right, stochastic_rate)[source]

Rule that acts between two distinct components.

Parameters:
n_embeddings(mixture)[source]

Count the total number of embeddings in the mixture.

Parameters:

mixture (Mixture)

Return type:

int