biocrnpyler.core.ProportionalHillPositive

class biocrnpyler.core.ProportionalHillPositive(k: float, s1: Species, K: float, n: float, d: Species)[source]

Bases: HillPositive

Proportional positive Hill function propensity.

Implements a positive Hill function with rate proportional to a species concentration. Commonly used for regulated production where the rate depends on both an activator and a template/enzyme.

Parameters:
  • k (float or ParameterEntry) – Maximum rate constant per unit of d. Must be positive.

  • s1 (Species) – Input species that activates the reaction (e.g., transcription factor).

  • K (float or ParameterEntry) – Half-saturation constant for s1. Must be positive.

  • n (float or ParameterEntry) – Hill coefficient (cooperativity). Must be positive.

  • d (Species) – Proportional species (e.g., DNA template, enzyme). Rate scales linearly with this species concentration.

Attributes:

name (str) – Set to ‘proportionalhillpositive’ for this propensity type.

See also

HillPositive

Non-proportional positive Hill.

ProportionalHillNegative

Proportional negative Hill.

Notes

The following mathematical formula: is used for the popensity:

\[p(s_1, d; k, K, n) = \frac{k d s_1^n}{K^n + s_1^n} \]

This is commonly used for transcription, where

  • d = DNA template concentration

  • s1 = transcription factor concentration

  • Rate is proportional to both template and TF activation

This results in the following behaviors:

  • When d = 0: rate = 0 (no template/enzyme)

  • When s1 = 0: rate ≈ 0 (no activation)

  • When s1 \(\gg\) \(K\): rate \(\rightarrow\) \(k\) d (fully activated, proportional to d)

Examples

Model regulated transcription:

>>> TF = bcp.Species('TF')  # Transcription factor
>>> DNA = bcp.Species('DNA')  # DNA template
>>> prop = bcp.ProportionalHillPositive(
...     k=0.1, s1=TF, K=50.0, n=2.0, d=DNA)

Model enzyme with allosteric activator:

>>> activator = bcp.Species('activator')
>>> enzyme = bcp.Species('enzyme')
>>> kcat = bcp.ParameterEntry('kcat', 10.0)
>>> Ka = bcp.ParameterEntry('Ka', 100.0)
>>> prop = bcp.ProportionalHillPositive(
...     k=kcat, s1=activator, K=Ka, n=2.0, d=enzyme)

Methods

create_kinetic_law

Create SBML kinetic law for Hill propensity.

from_dict

Create a propensity from a dictionary.

get_available_propensities

Get all available propensity subclasses.

is_valid_propensity

Check if an object is a valid Propensity subclass instance.

pretty_print

Generate human-readable string representation of propensity.

pretty_print_parameters

Generate formatted string of all propensity parameters.

pretty_print_rate

Generate human-readable rate formula string.

property K

Half-saturation (dissociation) constant value.

Type:

float

__eq__(other)[source]

Test equality between propensities.

Parameters:

other (Propensity) – Other propensity to compare with.

Returns:

True if propensities have the same class and propensity_dict.

Return type:

bool

create_kinetic_law(model, sbml_reaction, stochastic, **kwargs)[source]

Create SBML kinetic law for Hill propensity.

This method is shared by all Hill subclasses.

Parameters:
  • model (libsbml.Model) – SBML model object.

  • sbml_reaction (libsbml.Reaction) – SBML reaction to add kinetic law to.

  • stochastic (bool) – If True, uses stochastic formulation (same as deterministic for Hill functions).

  • **kwargs – Additional arguments. ‘reverse_reaction’ is not supported.

Returns:

Created SBML kinetic law object.

Return type:

libsbml.KineticLaw

Raises:

ValueError – If reverse_reaction=True (Hill propensities cannot be reversible) or if rate formula is invalid.

property d

Proportional species (None if not proportional).

Type:

Species

classmethod from_dict(propensity_dict)[source]

Create a propensity from a dictionary.

Parameters:

propensity_dict (dict) – Dictionary with ‘parameters’ and ‘species’ keys containing parameter and species values.

Returns:

New instance of the propensity class.

Return type:

Propensity

static get_available_propensities() Set[source]

Get all available propensity subclasses.

Returns:

Set of all Propensity subclass types available in BioCRNpyler.

Return type:

set

Examples

>>> propensities = bcp.Propensity.get_available_propensities()
>>> bcp.MassAction in propensities
True
property is_reversible

Whether the propensity represents a reversible reaction.

Default is False. Subclasses override this for reversible kinetics.

Type:

bool

static is_valid_propensity(propensity_type) bool[source]

Check if an object is a valid Propensity subclass instance.

Recursively checks all subclasses of Propensity to determine if the given object is a valid propensity type.

Parameters:

propensity_type (object) – Object to check for Propensity validity.

Returns:

True if propensity_type is an instance of Propensity or any of its subclasses, False otherwise.

Return type:

bool

Examples

>>> prop = bcp.MassAction(k_forward=100.0)
>>> bcp.Propensity.is_valid_propensity(prop)
True
>>> bcp.Propensity.is_valid_propensity("not a propensity")
False
property k

Maximum rate constant value.

Type:

float

property k_forward

Forward rate constant.

Raises:

NotImplementedError – Must be implemented by subclasses that use rate constants.

Type:

Float

property k_reverse

Reverse rate constant for reversible reactions.

Raises:

NotImplementedError – Must be implemented by subclasses that use rate constants.

Type:

Float or None

property n

Hill coefficient (cooperativity) value.

Type:

float

pretty_print(show_parameters=True, **kwargs)[source]

Generate human-readable string representation of propensity.

Parameters:
  • show_parameters (bool, default True) – If True, includes parameter values in output.

  • **kwargs – Additional keyword arguments passed to formatting methods.

Returns:

Formatted string showing rate formula and optionally parameters.

Return type:

str

pretty_print_parameters(show_keys=True, **kwargs)[source]

Generate formatted string of all propensity parameters.

Parameters:
  • show_keys (bool, default True) – If True, shows search and found keys for ModelParameter objects (useful for debugging parameter lookup).

  • **kwargs – Additional formatting keyword arguments.

Returns:

Formatted string listing all parameters and their values.

Return type:

str

pretty_print_rate(show_parameters=True, **kwargs)[source]

Generate human-readable rate formula string.

Returns:

Formatted proportional Hill positive formula.

Return type:

str

property s1

Input species driving the Hill function.

Type:

Species

property species: List

All species used in the propensity function.

Type:

List of Species