biocrnpyler.core.ParameterEntry
- class biocrnpyler.core.ParameterEntry(parameter_name: str, parameter_value: str | Real, parameter_key=None, parameter_info=None, **kwargs)[source]
Bases:
ParameterParameter with database lookup key and metadata.
A
ParameterEntryextendsParameterwith a lookup key for database storage and retrieval, plus additional metadata about the parameter’s origin and context.- Parameters:
parameter_name (
str) – Name of the parameter.parameter_value (
floatorstr) – Value of the parameter.parameter_key (
dict,ParameterKey,str, orNone, optional) – Lookup key for the parameter database.parameter_info (
dict, optional) – Additional metadata about the parameter (e.g., source file, comments). If dict contains ‘unit’ key, it will update the parameter’s unit.**kwargs – Additional keyword arguments passed to Parameter constructor, including ‘unit’.
- Attributes:
parameter_key (
ParameterKey) – The lookup key as a named tuple (mechanism, part_id, name).parameter_info (
dict) – Dictionary of additional parameter metadata.
See also
ParameterBase parameter class.
ModelParameterParameter with search and found keys.
ParameterDatabaseDatabase for storing parameter entries.
Notes
The
parameter_keyvalue can be any of the following:dict: {‘mechanism’: …, ‘part_id’: …, ‘name’: …}
ParameterKey namedtuple: (mechanism, part_id, name)
str: parameter name (other fields set to None)
None: creates key with all fields None except name
using the following conventions:
mechanism: str or None (mechanism name or type)
part_id: str or None (component/part identifier)
name: str (parameter name)
These keys enable flexible parameter lookup with defaulting behavior in the ParameterDatabase.
Examples
Create a parameter entry with full key:
>>> entry = bcp.ParameterEntry( ... 'kb', ... 100.0, ... parameter_key={'mechanism': 'binding', 'part_id': 'promoter1'}, ... unit='1/s' ... )
Create a parameter entry with just a name:
>>> entry = bcp.ParameterEntry('ku', 0.01, parameter_key='ku') >>> entry.parameter_key ParameterKey(mechanism=None, part_id=None, name='ku')
Methods
Convert various input types to a ParameterKey namedtuple.
Generate SBML-compatible identifier for the parameter.
- __eq__(other)[source]
Test equality between parameters or parameter and number.
- Parameters:
other (
Parameterorfloat) – Object to compare with. Can be another Parameter object or a numerical value.- Returns:
True if values are equal, False otherwise.
- Return type:
bool- Raises:
TypeError – If
othercannot be compared (not a Parameter or number).
- static create_parameter_key(new_key: Dict | ParameterKey | str, parameter_name=None) ParameterKey[source]
Convert various input types to a ParameterKey namedtuple.
- Parameters:
new_key (
dict,ParameterKey,tuple,str, orNone) –Input to convert to ParameterKey:
dict: Must have keys matching ParameterKey fields
ParameterKey: Returned as-is
3-tuple: Converted to ParameterKey with proper field mapping
str: Used as ‘name’, other fields set to None
None: All fields set to None (requires parameter_name)
parameter_name (
str, optional) – Parameter name to use if not specified in new_key. Overridesnamefield if provided in dict.
- Returns:
Named tuple with fields (mechanism, part_id, name).
- Return type:
ParameterKey- Raises:
ValueError – If
new_keyis not a valid type or format.
Examples
>>> key = bcp.ParameterEntry.create_parameter_key('kb') >>> key ParameterKey(mechanism=None, part_id=None, name='kb')
>>> key = bcp.ParameterEntry.create_parameter_key( ... {'mechanism': 'transcription', 'part_id': 'prom1'}, ... parameter_name='ktx' ... ) >>> key ParameterKey(mechanism='transcription', part_id='prom1', name='ktx')
- get_sbml_id()[source]
Generate SBML-compatible identifier for the parameter.
Constructs an identifier string from the parameter key fields, formatted as: ‘<name>_<part_id>_<mechanism>’.
- Returns:
SBML-compatible identifier string.
- Return type:
str
- property parameter_info: Dict
Additional metadata about the parameter.
- Type:
dict
- property parameter_key: ParameterKey
The database lookup key for this parameter.
- Type:
ParameterKey
- property parameter_name: str
The name of the parameter.
- Type:
str
- property unit: str
The unit string for the parameter.
- Type:
str
- property value: Real
The numerical value of the parameter.
- Type:
float