biocrnpyler.components.ComponentEnumerator
- class biocrnpyler.components.ComponentEnumerator(name: str)[source]
Bases:
objectBase class for enumerating new components from existing components.
A
ComponentEnumeratorcreates new components in a process similar to mechanisms. Component enumerators are used during CRN compilation to expand or transform components, generating derived components that are then compiled into species and reactions.- Parameters:
name (
str) – Name identifier for the component enumerator.- Attributes:
name (
str) – The name of the enumerator.
See also
LocalComponentEnumeratorEnumerator for single-component processing.
GlobalComponentEnumeratorEnumerator requiring all mixture components.
MechanismBase class for reaction generation.
Notes
This is a base class that should be subclassed to implement specific enumeration behavior. The key method to override is
enumerate_components.Component enumerators are used during the mixture compilation process to:
Generate derived components (e.g., transcripts from DNA)
Transform components based on context
Create component variants or states
Examples
Create a custom component enumerator:
>>> class MyEnumerator(bcp.ComponentEnumerator): ... def __init__(self): ... super().__init__(name='MyEnumerator') ... ... def enumerate_components(self, component=None): ... # Custom enumeration logic ... new_components = [] ... # ... generate new components ... ... return new_components
Methods
Enumerate new components from an input component.
- enumerate_components(component=None) List[source]
Enumerate new components from an input component.
This method creates new components based on the input component. The base implementation returns an empty list and issues a warning. Subclasses should override this method to provide specific enumeration behavior.
- Parameters:
component (
Component, optional) – The input component to enumerate from. Can be None for enumerators that do not require an input component.- Returns:
List of newly enumerated components. Base implementation returns an empty list.
- Return type:
listofComponent- Warns:
UserWarning – Issues a warning when the default implementation is called, indicating that a subclass should override this method.
See also
Component.enumerate_componentsComponent-level enumeration method.
Notes
This method is called during CRN compilation as part of the component enumeration phase. Subclasses should implement specific logic to generate derived components.