biocrnpyler.components.membrane
Classes
|
Molecule that diffuses passively through a membrane. |
|
Transmembrane protein that integrates into the membrane. |
|
Membrane channel for facilitated transport across membranes. |
|
ATP-dependent membrane pump for active transport. |
|
Two-component system (TCS) membrane sensor protein. |
- class biocrnpyler.components.membrane.DiffusibleMolecule(substrate: Species | str | Component, internal_compartment: str | Compartment = 'Internal', external_compartment: str | Compartment = 'External', attributes=None, **kwargs)[source]
Molecule that diffuses passively through a membrane.
A
DiffusibleMoleculecomponent represents a molecule that undergoes passive diffusion across a membrane between two compartments. The component uses a ‘diffusion’ mechanism to generate bidirectional diffusion reactions based on concentration gradients.- Parameters:
- substrateSpecies, str, or Component
The diffusible molecule species. Can be a
Speciesobject, string name, orComponentwith an associated species.- internal_compartmentstr or Compartment, default=’Internal’
The internal compartment. Can be a string name (creates new Compartment) or an existing
Compartmentobject.- external_compartmentstr or Compartment, default=’External’
The external compartment. Can be a string name (creates new Compartment) or an existing
Compartmentobject.- attributeslist of str, optional
List of attribute tags to associate with the substrate species.
- **kwargs
Additional keyword arguments passed to the
Componentbase class constructor.
- Attributes:
- substrateSpecies
The substrate species in the internal compartment.
- productSpecies
The same substrate species in the external compartment (diffusion product).
See also
MembraneChannelActive transport through membrane channels.
MembranePumpATP-dependent active transport.
ComponentBase class for biomolecular components.
Notes
Passive diffusion follows concentration gradients and does not require energy. The diffusion mechanism generates bidirectional reactions:
Forward: substrate_internal –> substrate_external
Reverse: substrate_external –> substrate_internal
If not specified using the
namekeyword, the component name is automatically generated as: ‘<substrate_name>_<internal_compartment_name>’Examples
Create a simple diffusible molecule:
>>> glucose = bcp.DiffusibleMolecule( ... substrate='Glucose', ... internal_compartment='Cytoplasm', ... external_compartment='Extracellular' ... )
Use with a mixture and diffusion mechanism:
>>> mixture = bcp.Mixture( ... components=[glucose], ... mechanisms={'diffusion': bcp.Simple_Diffusion()}, ... parameters={'k_diff': 0.01} ... ) >>> crn = mixture.compile_crn()
- add_attribute(attribute: str)[source]
Add a single attribute to the component.
Adds an attribute tag to the component’s attribute list and to its associated species object, if one exists. Attributes can be used for mechanism selection, species filtering, and tracking special properties.
- Parameters:
- attributestr
Attribute string to add to the component. Must be a non-None string value.
- Raises:
- AssertionError
If
attributeis not a string or is None.- Warning
If the component has no internal species to which the attribute can be added.
Notes
Attributes are commonly used to tag components with properties such as:
Degradation tags (e.g., ‘degtagged’, ‘ssrAtagged’, )
Functional properties (e.g., ‘fluorescent’, ‘membranebound’)
Regulatory elements (e.g., ‘inducible’, ‘repressible’)
Examples
Add attributes to tag a protein with special properties:
>>> protein = bcp.Protein('GFP') >>> protein.add_attribute('fluorescent') >>> protein.add_attribute('ssrAtagged') >>> protein.attributes ['fluorescent', 'ssrAtagged']
- add_mechanism(mechanism: Mechanism, mech_type=None, overwrite=False, optional_mechanism=False)[source]
Add a mechanism to this component’s mechanism dictionary.
- Parameters:
- mechanismMechanism
The mechanism object to add.
- mech_typestr, optional
The type key under which to store the mechanism. If None, uses the mechanism’s
mechanism_typeattribute.- overwritebool, default=False
If True, replaces any existing mechanism with the same key. If False, raises ValueError when key already exists.
- optional_mechanismbool, default=False
If True, suppresses the ValueError when a mechanism key conflict occurs and
overwriteis False.
- Raises:
- TypeError
If
mechanismis not a Mechanism object, or ifmech_typeis not a string.- ValueError
If mechanism key already exists,
overwriteis False, andoptional_mechanismis False.
- add_mechanisms(mechanisms: Mechanism | GlobalMechanism, overwrite=False, optional_mechanism=False)[source]
Add multiple mechanisms to this component.
Accepts mechanisms as a single object, list, or dictionary and adds them to the component’s mechanism dictionary.
- Parameters:
- mechanismsMechanism, GlobalMechanism, dict, or list
The mechanism(s) to add. Can be a single mechanism, a dict with mechanism types as keys and mechanisms as values, or a list of mechanisms.
- overwritebool, default=False
If True, replaces any existing mechanisms with the same keys. If False, raises ValueError when keys already exist.
- optional_mechanismbool, default=False
If True, suppresses ValueError when mechanism key conflicts occur and
overwriteis False.
- Raises:
- ValueError
If
mechanismsis not a valid type, or if mechanism key conflicts occur withoverwrite=Falseandoptional_mechanism=False.
- property compartment
Compartment or None: The compartment containing this component.
- enumerate_components(previously_enumerated=None) List[source]
Enumerate derived components created from this component.
This method generates new components based on the current component, typically used during CRN compilation to expand higher-level components into their constituent parts and products.
- Parameters:
- previously_enumeratedset or list, optional
Collection of components that have already been enumerated, used to prevent infinite recursion in component enumeration.
- Returns:
- list
List of new components created from this component. This base implementation returns an empty list.
Notes
Subclasses override this method to implement specific enumeration behavior. For example:
A
DNA_constructreturns copies of its parts andRNA_constructobjects representing transcripts.An
RNA_constructreturns copies of its parts andProteincomponents representing translation products.
- get_mechanism(mechanism_type, optional_mechanism=False)[source]
Retrieve a mechanism by type from the component or its mixture.
Searches first in the component’s mechanism dictionary, then falls back to the mixture’s mechanisms if not found.
- Parameters:
- mechanism_typestr
The type identifier of the mechanism to retrieve (e.g., ‘transcription’, ‘translation’, ‘binding’).
- optional_mechanismbool, default=False
If True, returns None when mechanism not found. If False, raises KeyError when mechanism not found.
- Returns:
- Mechanism or None
The requested mechanism object, or None if not found and
optional_mechanismis True.
- Raises:
- TypeError
If
mechanism_typeis not a string.- KeyError
If mechanism not found and
optional_mechanismis False.
- get_parameter(param_name: str, part_id=None, mechanism=None, return_numerical=False, return_none=False, check_mixture=True) Parameter | Real[source]
Retrieve parameter from component or mixture parameter database.
Searches first in the component’s parameter database, then falls back to the mixture’s parameter database if not found.
- Parameters:
- param_namestr
Name of the parameter to retrieve.
- part_idstr, optional
Part identifier for the parameter lookup key.
- mechanismstr, optional
Mechanism identifier for the parameter lookup key.
- return_numericalbool, default=False
If True, returns the numerical value. If False, returns the
Parameterobject.- return_nonebool, default=False
If True, returns None when parameter not found. If False, raises ValueError when parameter not found.
- check_mixturebool, default=True
If True, searches the mixture’s parameter database if not found in the component’s database.
- Returns:
- Parameter, Real, or None
The parameter object or its numerical value, or None if not found and
return_noneis True.
- Raises:
- ValueError
If parameter not found and
return_noneis False.
Notes
Parameter lookup follows the hierarchy:
Component.parameter_database
Component.mixture.parameter_database (if
check_mixtureis True)
- get_species()[source]
Get the substrate species in the internal compartment.
- Returns:
- Species
The substrate species in the internal compartment.
- set_attributes(attributes: List[str])[source]
Set multiple attributes for the component.
Adds a list of attribute tags to the component and its associated species by calling
add_attributefor each attribute in the list.- Parameters:
- attributeslist of str or None
List of attribute strings to add to the component. If None, no action is taken.
See also
add_attributeAdd a single attribute to the component.
Examples
>>> comp = bcp.Protein(name="MyProtein") >>> comp.set_attributes(["degtagged", "fluorescent"]) >>> comp.attributes ['degtagged', 'fluorescent']
- set_mixture(mixture) None[source]
Set the mixture containing this component.
- Parameters:
- mixtureMixture or None
The mixture object that contains this component and provides default mechanisms and parameters.
- classmethod set_species(species: Species | str, material_type=None, compartment=None, attributes=None) Species[source]
Convert various inputs into Species objects.
- Parameters:
- speciesSpecies, str, Component, or list
The species to convert. Can be a
Speciesobject (returned as-is), a string (creates new Species), aComponent(extracts its species), or a list of any of these types.- material_typestr, optional
Material type for the species (e.g., ‘dna’, ‘rna’, ‘protein’). Only used when creating new Species from strings.
- compartmentCompartment, optional
Compartment to assign to the species. Only used when creating new Species from strings.
- attributeslist of str, optional
Attributes to assign to the species. Only used when creating new Species from strings.
- Returns:
- Species or list of Species
The converted Species object(s). Returns a list if input was a list.
- Raises:
- ValueError
If the input cannot be converted to a valid Species.
- update_parameters(parameter_file=None, parameters=None, parameter_database=None, overwrite_parameters=True)[source]
Update the parameter database with new parameters.
- Parameters:
- parameter_filestr, optional
Path to a CSV or TSV file containing parameters to load.
- parametersdict, optional
Dictionary of parameters to add. Keys follow the format (mechanism, part_id, param_name).
- parameter_databaseParameterDatabase, optional
Another parameter database to merge into component’s database.
- overwrite_parametersbool, default=True
If True, new parameter values overwrite existing ones. If False, existing parameters are preserved.
- update_reactions()[source]
Use ‘diffusion’ mechanism to generate diffusion reactions.
Uses the ‘diffusion’ mechanism to generate reactions for passive diffusion between compartments.
- Returns:
- list of Reaction
List of diffusion reactions (forward and reverse) between internal and external compartments.
- class biocrnpyler.components.membrane.IntegralMembraneProtein(membrane_protein: Species | str | Component, product: Species | str | Component, direction: str = None, size: int = None, compartment: str | Compartment = 'Internal', membrane_compartment: str | Compartment = 'Membrane', attributes=None, **kwargs)[source]
Transmembrane protein that integrates into the membrane.
An
IntegralMembraneProteincomponent represents a membrane protein that integrates into a membrane compartment. The component uses a ‘membrane_insertion’ mechanism to generate reactions for protein insertion into the membrane. The size parameter allows modeling of oligomeric channels (dimers, trimers, etc.).- Parameters:
- membrane_proteinSpecies, str, or Component
The membrane protein species before insertion. Can be a
Speciesobject, string name, orComponentwith an associated species.- productSpecies, str, or Component
The integrated membrane protein species. Can be a
Speciesobject, string name, orComponent.- directionstr, optional
Transport direction attribute for the integrated protein. Default is ‘Passive’. Common values: ‘Passive’, ‘Importer’, ‘Exporter’.
- sizeint, optional
Number of monomers needed to form the functional channel. Used to model oligomeric channels (e.g., size=2 for dimers, size=3 for trimers). Default is 1.
- compartmentstr or Compartment, default=’Internal’
The compartment containing the membrane protein before insertion. Can be a string name or
Compartmentobject.- membrane_compartmentstr or Compartment, default=’Membrane’
The membrane compartment where the protein integrates. Can be a string name or
Compartmentobject.- attributeslist of str, optional
List of attribute tags to associate with the membrane protein.
- **kwargs
Additional keyword arguments passed to the
Componentbase class constructor.
- Attributes:
- membrane_proteinSpecies
The membrane protein species before insertion.
- productSpecies
The integrated transmembrane protein species in the membrane compartment.
See also
MembraneChannelMembrane channel for substrate transport.
ComponentBase class for biomolecular components.
Notes
The membrane_insertion mechanism generates reactions for protein integration into the membrane. For oligomeric channels, the size parameter determines the stoichiometry:
size=1: Monomer insertion
size=2: Dimer formation (2 proteins –> 1 channel)
size=3: Trimer formation (3 proteins –> 1 channel)
The component name is automatically generated as: ‘<membrane_protein_name>_<compartment_name>’
Examples
Create a simple membrane protein:
>>> channel = bcp.IntegralMembraneProtein( ... membrane_protein='ChannelProtein', ... product='ChannelProtein_membrane', ... direction='Passive' ... )
Create a dimeric channel protein:
>>> dimer = bcp.IntegralMembraneProtein( ... membrane_protein='Aquaporin', ... product='Aquaporin_channel', ... size=2, ... direction='Passive' ... )
- add_attribute(attribute: str)[source]
Add a single attribute to the component.
Adds an attribute tag to the component’s attribute list and to its associated species object, if one exists. Attributes can be used for mechanism selection, species filtering, and tracking special properties.
- Parameters:
- attributestr
Attribute string to add to the component. Must be a non-None string value.
- Raises:
- AssertionError
If
attributeis not a string or is None.- Warning
If the component has no internal species to which the attribute can be added.
Notes
Attributes are commonly used to tag components with properties such as:
Degradation tags (e.g., ‘degtagged’, ‘ssrAtagged’, )
Functional properties (e.g., ‘fluorescent’, ‘membranebound’)
Regulatory elements (e.g., ‘inducible’, ‘repressible’)
Examples
Add attributes to tag a protein with special properties:
>>> protein = bcp.Protein('GFP') >>> protein.add_attribute('fluorescent') >>> protein.add_attribute('ssrAtagged') >>> protein.attributes ['fluorescent', 'ssrAtagged']
- add_mechanism(mechanism: Mechanism, mech_type=None, overwrite=False, optional_mechanism=False)[source]
Add a mechanism to this component’s mechanism dictionary.
- Parameters:
- mechanismMechanism
The mechanism object to add.
- mech_typestr, optional
The type key under which to store the mechanism. If None, uses the mechanism’s
mechanism_typeattribute.- overwritebool, default=False
If True, replaces any existing mechanism with the same key. If False, raises ValueError when key already exists.
- optional_mechanismbool, default=False
If True, suppresses the ValueError when a mechanism key conflict occurs and
overwriteis False.
- Raises:
- TypeError
If
mechanismis not a Mechanism object, or ifmech_typeis not a string.- ValueError
If mechanism key already exists,
overwriteis False, andoptional_mechanismis False.
- add_mechanisms(mechanisms: Mechanism | GlobalMechanism, overwrite=False, optional_mechanism=False)[source]
Add multiple mechanisms to this component.
Accepts mechanisms as a single object, list, or dictionary and adds them to the component’s mechanism dictionary.
- Parameters:
- mechanismsMechanism, GlobalMechanism, dict, or list
The mechanism(s) to add. Can be a single mechanism, a dict with mechanism types as keys and mechanisms as values, or a list of mechanisms.
- overwritebool, default=False
If True, replaces any existing mechanisms with the same keys. If False, raises ValueError when keys already exist.
- optional_mechanismbool, default=False
If True, suppresses ValueError when mechanism key conflicts occur and
overwriteis False.
- Raises:
- ValueError
If
mechanismsis not a valid type, or if mechanism key conflicts occur withoverwrite=Falseandoptional_mechanism=False.
- property compartment
Compartment or None: The compartment containing this component.
- enumerate_components(previously_enumerated=None) List[source]
Enumerate derived components created from this component.
This method generates new components based on the current component, typically used during CRN compilation to expand higher-level components into their constituent parts and products.
- Parameters:
- previously_enumeratedset or list, optional
Collection of components that have already been enumerated, used to prevent infinite recursion in component enumeration.
- Returns:
- list
List of new components created from this component. This base implementation returns an empty list.
Notes
Subclasses override this method to implement specific enumeration behavior. For example:
A
DNA_constructreturns copies of its parts andRNA_constructobjects representing transcripts.An
RNA_constructreturns copies of its parts andProteincomponents representing translation products.
- get_mechanism(mechanism_type, optional_mechanism=False)[source]
Retrieve a mechanism by type from the component or its mixture.
Searches first in the component’s mechanism dictionary, then falls back to the mixture’s mechanisms if not found.
- Parameters:
- mechanism_typestr
The type identifier of the mechanism to retrieve (e.g., ‘transcription’, ‘translation’, ‘binding’).
- optional_mechanismbool, default=False
If True, returns None when mechanism not found. If False, raises KeyError when mechanism not found.
- Returns:
- Mechanism or None
The requested mechanism object, or None if not found and
optional_mechanismis True.
- Raises:
- TypeError
If
mechanism_typeis not a string.- KeyError
If mechanism not found and
optional_mechanismis False.
- get_parameter(param_name: str, part_id=None, mechanism=None, return_numerical=False, return_none=False, check_mixture=True) Parameter | Real[source]
Retrieve parameter from component or mixture parameter database.
Searches first in the component’s parameter database, then falls back to the mixture’s parameter database if not found.
- Parameters:
- param_namestr
Name of the parameter to retrieve.
- part_idstr, optional
Part identifier for the parameter lookup key.
- mechanismstr, optional
Mechanism identifier for the parameter lookup key.
- return_numericalbool, default=False
If True, returns the numerical value. If False, returns the
Parameterobject.- return_nonebool, default=False
If True, returns None when parameter not found. If False, raises ValueError when parameter not found.
- check_mixturebool, default=True
If True, searches the mixture’s parameter database if not found in the component’s database.
- Returns:
- Parameter, Real, or None
The parameter object or its numerical value, or None if not found and
return_noneis True.
- Raises:
- ValueError
If parameter not found and
return_noneis False.
Notes
Parameter lookup follows the hierarchy:
Component.parameter_database
Component.mixture.parameter_database (if
check_mixtureis True)
- get_species()[source]
Get the membrane protein species before insertion.
- Returns:
- Species
The membrane protein species in the compartment before integration into the membrane.
- set_attributes(attributes: List[str])[source]
Set multiple attributes for the component.
Adds a list of attribute tags to the component and its associated species by calling
add_attributefor each attribute in the list.- Parameters:
- attributeslist of str or None
List of attribute strings to add to the component. If None, no action is taken.
See also
add_attributeAdd a single attribute to the component.
Examples
>>> comp = bcp.Protein(name="MyProtein") >>> comp.set_attributes(["degtagged", "fluorescent"]) >>> comp.attributes ['degtagged', 'fluorescent']
- set_mixture(mixture) None[source]
Set the mixture containing this component.
- Parameters:
- mixtureMixture or None
The mixture object that contains this component and provides default mechanisms and parameters.
- classmethod set_species(species: Species | str, material_type=None, compartment=None, attributes=None) Species[source]
Convert various inputs into Species objects.
- Parameters:
- speciesSpecies, str, Component, or list
The species to convert. Can be a
Speciesobject (returned as-is), a string (creates new Species), aComponent(extracts its species), or a list of any of these types.- material_typestr, optional
Material type for the species (e.g., ‘dna’, ‘rna’, ‘protein’). Only used when creating new Species from strings.
- compartmentCompartment, optional
Compartment to assign to the species. Only used when creating new Species from strings.
- attributeslist of str, optional
Attributes to assign to the species. Only used when creating new Species from strings.
- Returns:
- Species or list of Species
The converted Species object(s). Returns a list if input was a list.
- Raises:
- ValueError
If the input cannot be converted to a valid Species.
- update_parameters(parameter_file=None, parameters=None, parameter_database=None, overwrite_parameters=True)[source]
Update the parameter database with new parameters.
- Parameters:
- parameter_filestr, optional
Path to a CSV or TSV file containing parameters to load.
- parametersdict, optional
Dictionary of parameters to add. Keys follow the format (mechanism, part_id, param_name).
- parameter_databaseParameterDatabase, optional
Another parameter database to merge into component’s database.
- overwrite_parametersbool, default=True
If True, new parameter values overwrite existing ones. If False, existing parameters are preserved.
- update_reactions()[source]
Use ‘membrane_insertion’ to generate membrane insertion reactions.
Uses the ‘membrane_insertion’ mechanism to generate reactions for protein integration into the membrane.
- Returns:
- list of Reaction
List of reactions for protein insertion into the membrane.
- update_species()[source]
Use ‘membrane_insertion’ to generate membrane insertion species.
Uses the ‘membrane_insertion’ mechanism to generate species for the protein before and after insertion.
- Returns:
- list of Species
List of species generated by the membrane_insertion mechanism, including the protein and integrated product.
- class biocrnpyler.components.membrane.MembraneChannel(integral_membrane_protein: Species | str | Component, substrate: Species | str | Component, direction: str = None, internal_compartment: str | Compartment = 'Internal', external_compartment: str | Compartment = 'External', attributes=None, **kwargs)[source]
Membrane channel for facilitated transport across membranes.
A
MembraneChannelcomponent represents a membrane channel or transporter that facilitates substrate movement across a membrane following concentration gradients. The direction of transport depends on the specific transporter type. The component uses a ‘transport’ mechanism to generate transport reactions.- Parameters:
- integral_membrane_proteinSpecies, str, or Component
The integral membrane protein that forms the channel. Can be a
Speciesobject, string name, orComponent. If a string, automatically creates a protein species with appropriate direction attribute.- substrateSpecies, str, or Component
The substrate to be transported through the channel. Can be a
Speciesobject, string name, orComponent.- directionstr, optional
Direction of transport. If None, extracted from integral_membrane_protein attributes. Common values: ‘Importer’ (external –> internal), ‘Exporter’ (internal –> external), ‘Passive’ (bidirectional).
- internal_compartmentstr or Compartment, default=’Internal’
The internal compartment. Can be a string name (creates new Compartment) or an existing
Compartmentobject.- external_compartmentstr or Compartment, default=’External’
The external compartment. Can be a string name (creates new Compartment) or an existing
Compartmentobject.- attributeslist of str, optional
List of attribute tags to associate with substrate species.
- **kwargs
Additional keyword arguments passed to the
Componentbase class constructor.
- Attributes:
- integral_membrane_proteinSpecies
The membrane channel protein species.
- substrateSpecies
The substrate species in the source compartment (depends on direction).
- productSpecies
The same substrate in the destination compartment.
See also
IntegralMembraneProteinProtein insertion into membranes.
MembranePumpATP-dependent active transport.
DiffusibleMoleculePassive diffusion without channels.
ComponentBase class for biomolecular components.
Notes
The transport mechanism generates reactions based on the direction:
- ‘Importer’: substrate_external + channel
–> substrate_internal + channel
- ‘Exporter’: substrate_internal + channel
–> substrate_external + channel
‘Passive’: bidirectional transport following gradients
The component name is automatically generated as: ‘<integral_membrane_protein_name>_<compartment_name>’
Examples
Create a glucose importer:
>>> importer = bcp.MembraneChannel( ... integral_membrane_protein='GlucoseTransporter', ... substrate='Glucose', ... direction='Importer' ... )
Create a passive channel:
>>> channel = bcp.MembraneChannel( ... integral_membrane_protein='WaterChannel', ... substrate='Water', ... direction='Passive' ... )
Use with a mixture:
>>> mixture = bcp.Mixture( ... components=[importer], ... mechanisms={'transport': bcp.Facilitated_Transport_MM()}, ... parameter_file='mechanisms/transport_parameters.tsv' ... ) >>> crn = mixture.compile_crn()
- add_attribute(attribute: str)[source]
Add a single attribute to the component.
Adds an attribute tag to the component’s attribute list and to its associated species object, if one exists. Attributes can be used for mechanism selection, species filtering, and tracking special properties.
- Parameters:
- attributestr
Attribute string to add to the component. Must be a non-None string value.
- Raises:
- AssertionError
If
attributeis not a string or is None.- Warning
If the component has no internal species to which the attribute can be added.
Notes
Attributes are commonly used to tag components with properties such as:
Degradation tags (e.g., ‘degtagged’, ‘ssrAtagged’, )
Functional properties (e.g., ‘fluorescent’, ‘membranebound’)
Regulatory elements (e.g., ‘inducible’, ‘repressible’)
Examples
Add attributes to tag a protein with special properties:
>>> protein = bcp.Protein('GFP') >>> protein.add_attribute('fluorescent') >>> protein.add_attribute('ssrAtagged') >>> protein.attributes ['fluorescent', 'ssrAtagged']
- add_mechanism(mechanism: Mechanism, mech_type=None, overwrite=False, optional_mechanism=False)[source]
Add a mechanism to this component’s mechanism dictionary.
- Parameters:
- mechanismMechanism
The mechanism object to add.
- mech_typestr, optional
The type key under which to store the mechanism. If None, uses the mechanism’s
mechanism_typeattribute.- overwritebool, default=False
If True, replaces any existing mechanism with the same key. If False, raises ValueError when key already exists.
- optional_mechanismbool, default=False
If True, suppresses the ValueError when a mechanism key conflict occurs and
overwriteis False.
- Raises:
- TypeError
If
mechanismis not a Mechanism object, or ifmech_typeis not a string.- ValueError
If mechanism key already exists,
overwriteis False, andoptional_mechanismis False.
- add_mechanisms(mechanisms: Mechanism | GlobalMechanism, overwrite=False, optional_mechanism=False)[source]
Add multiple mechanisms to this component.
Accepts mechanisms as a single object, list, or dictionary and adds them to the component’s mechanism dictionary.
- Parameters:
- mechanismsMechanism, GlobalMechanism, dict, or list
The mechanism(s) to add. Can be a single mechanism, a dict with mechanism types as keys and mechanisms as values, or a list of mechanisms.
- overwritebool, default=False
If True, replaces any existing mechanisms with the same keys. If False, raises ValueError when keys already exist.
- optional_mechanismbool, default=False
If True, suppresses ValueError when mechanism key conflicts occur and
overwriteis False.
- Raises:
- ValueError
If
mechanismsis not a valid type, or if mechanism key conflicts occur withoverwrite=Falseandoptional_mechanism=False.
- property compartment
Compartment or None: The compartment containing this component.
- enumerate_components(previously_enumerated=None) List[source]
Enumerate derived components created from this component.
This method generates new components based on the current component, typically used during CRN compilation to expand higher-level components into their constituent parts and products.
- Parameters:
- previously_enumeratedset or list, optional
Collection of components that have already been enumerated, used to prevent infinite recursion in component enumeration.
- Returns:
- list
List of new components created from this component. This base implementation returns an empty list.
Notes
Subclasses override this method to implement specific enumeration behavior. For example:
A
DNA_constructreturns copies of its parts andRNA_constructobjects representing transcripts.An
RNA_constructreturns copies of its parts andProteincomponents representing translation products.
- get_mechanism(mechanism_type, optional_mechanism=False)[source]
Retrieve a mechanism by type from the component or its mixture.
Searches first in the component’s mechanism dictionary, then falls back to the mixture’s mechanisms if not found.
- Parameters:
- mechanism_typestr
The type identifier of the mechanism to retrieve (e.g., ‘transcription’, ‘translation’, ‘binding’).
- optional_mechanismbool, default=False
If True, returns None when mechanism not found. If False, raises KeyError when mechanism not found.
- Returns:
- Mechanism or None
The requested mechanism object, or None if not found and
optional_mechanismis True.
- Raises:
- TypeError
If
mechanism_typeis not a string.- KeyError
If mechanism not found and
optional_mechanismis False.
- get_parameter(param_name: str, part_id=None, mechanism=None, return_numerical=False, return_none=False, check_mixture=True) Parameter | Real[source]
Retrieve parameter from component or mixture parameter database.
Searches first in the component’s parameter database, then falls back to the mixture’s parameter database if not found.
- Parameters:
- param_namestr
Name of the parameter to retrieve.
- part_idstr, optional
Part identifier for the parameter lookup key.
- mechanismstr, optional
Mechanism identifier for the parameter lookup key.
- return_numericalbool, default=False
If True, returns the numerical value. If False, returns the
Parameterobject.- return_nonebool, default=False
If True, returns None when parameter not found. If False, raises ValueError when parameter not found.
- check_mixturebool, default=True
If True, searches the mixture’s parameter database if not found in the component’s database.
- Returns:
- Parameter, Real, or None
The parameter object or its numerical value, or None if not found and
return_noneis True.
- Raises:
- ValueError
If parameter not found and
return_noneis False.
Notes
Parameter lookup follows the hierarchy:
Component.parameter_database
Component.mixture.parameter_database (if
check_mixtureis True)
- get_species()[source]
Get the integral membrane protein species.
- Returns:
- Species
The integral membrane protein species that forms the channel.
- set_attributes(attributes: List[str])[source]
Set multiple attributes for the component.
Adds a list of attribute tags to the component and its associated species by calling
add_attributefor each attribute in the list.- Parameters:
- attributeslist of str or None
List of attribute strings to add to the component. If None, no action is taken.
See also
add_attributeAdd a single attribute to the component.
Examples
>>> comp = bcp.Protein(name="MyProtein") >>> comp.set_attributes(["degtagged", "fluorescent"]) >>> comp.attributes ['degtagged', 'fluorescent']
- set_mixture(mixture) None[source]
Set the mixture containing this component.
- Parameters:
- mixtureMixture or None
The mixture object that contains this component and provides default mechanisms and parameters.
- classmethod set_species(species: Species | str, material_type=None, compartment=None, attributes=None) Species[source]
Convert various inputs into Species objects.
- Parameters:
- speciesSpecies, str, Component, or list
The species to convert. Can be a
Speciesobject (returned as-is), a string (creates new Species), aComponent(extracts its species), or a list of any of these types.- material_typestr, optional
Material type for the species (e.g., ‘dna’, ‘rna’, ‘protein’). Only used when creating new Species from strings.
- compartmentCompartment, optional
Compartment to assign to the species. Only used when creating new Species from strings.
- attributeslist of str, optional
Attributes to assign to the species. Only used when creating new Species from strings.
- Returns:
- Species or list of Species
The converted Species object(s). Returns a list if input was a list.
- Raises:
- ValueError
If the input cannot be converted to a valid Species.
- update_parameters(parameter_file=None, parameters=None, parameter_database=None, overwrite_parameters=True)[source]
Update the parameter database with new parameters.
- Parameters:
- parameter_filestr, optional
Path to a CSV or TSV file containing parameters to load.
- parametersdict, optional
Dictionary of parameters to add. Keys follow the format (mechanism, part_id, param_name).
- parameter_databaseParameterDatabase, optional
Another parameter database to merge into component’s database.
- overwrite_parametersbool, default=True
If True, new parameter values overwrite existing ones. If False, existing parameters are preserved.
- class biocrnpyler.components.membrane.MembranePump(membrane_pump: Species | str | Component, substrate: Species | str | Component, direction: str = None, internal_compartment: str | Compartment = 'Internal', external_compartment: str | Compartment = 'External', ATP: int = None, attributes=None, **kwargs)[source]
ATP-dependent membrane pump for active transport.
A
MembranePumpcomponent represents an active transporter or pump that uses ATP to transport substrates across membranes against concentration gradients. The pump operates unidirectionally and requires energy in the form of ATP. The component uses a ‘transport’ mechanism to generate ATP-dependent transport reactions.- Parameters:
- membrane_pumpSpecies, str, or Component
The membrane pump protein species. Can be a
Speciesobject, string name, orComponent. If a string, automatically creates a protein species with appropriate direction attribute.- substrateSpecies, str, or Component
The substrate to be transported by the pump. Can be a
Speciesobject, string name, orComponent.- directionstr, optional
Direction of active transport. Common values: ‘Importer’ (external –> internal), ‘Exporter’ (internal –> external), ‘Passive’ (default). Affects substrate and ATP compartment placement.
- internal_compartmentstr or Compartment, default=’Internal’
The internal compartment. Can be a string name (creates new Compartment) or an existing
Compartmentobject.- external_compartmentstr or Compartment, default=’External’
The external compartment. Can be a string name (creates new Compartment) or an existing
Compartmentobject.- ATPint, optional
Number of ATP molecules required per transport cycle. Default is 1.
- attributeslist of str, optional
List of attribute tags to associate with substrate species.
- **kwargs
Additional keyword arguments passed to the
Componentbase class constructor.
- Attributes:
- membrane_pumpSpecies
The membrane pump protein species.
- substrateSpecies
The substrate species in the source compartment.
- productSpecies
The same substrate in the destination compartment.
- energySpecies
ATP species used for energy (compartment depends on direction).
- wasteSpecies
ADP species produced (compartment depends on direction).
See also
MembraneChannelFacilitated transport without ATP.
DiffusibleMoleculePassive diffusion.
ComponentBase class for biomolecular components.
Notes
Active transport requires ATP hydrolysis and can move substrates against concentration gradients. The typical reaction scheme is:
- Exporter: substrate_internal + ATP + pump –>
substrate_external + ADP + pump
- Importer: substrate_external + ATP + pump –>
substrate_internal + ADP + pump
The ATP parameter controls the stoichiometry of ATP consumption per transport event.
The component name is automatically generated as: ‘<membrane_pump_name>_<compartment_name>’
Examples
Create a simple ATP-dependent exporter:
>>> pump = bcp.MembranePump( ... membrane_pump='CalciumPump', ... substrate='Calcium', ... direction='Exporter', ... ATP=2 ... )
Create an ABC transporter (importer):
>>> abc = bcp.MembranePump( ... membrane_pump='ABC_Transporter', ... substrate='Maltose', ... direction='Importer', ... ATP=1 ... )
Use with a mixture:
>>> mixture = bcp.Mixture( ... components=[pump], ... mechanisms={'transport': bcp.Primary_Active_Transport_MM()}, ... parameter_file='mechanisms/transport_parameters.tsv' ... ) >>> crn = mixture.compile_crn()
- add_attribute(attribute: str)[source]
Add a single attribute to the component.
Adds an attribute tag to the component’s attribute list and to its associated species object, if one exists. Attributes can be used for mechanism selection, species filtering, and tracking special properties.
- Parameters:
- attributestr
Attribute string to add to the component. Must be a non-None string value.
- Raises:
- AssertionError
If
attributeis not a string or is None.- Warning
If the component has no internal species to which the attribute can be added.
Notes
Attributes are commonly used to tag components with properties such as:
Degradation tags (e.g., ‘degtagged’, ‘ssrAtagged’, )
Functional properties (e.g., ‘fluorescent’, ‘membranebound’)
Regulatory elements (e.g., ‘inducible’, ‘repressible’)
Examples
Add attributes to tag a protein with special properties:
>>> protein = bcp.Protein('GFP') >>> protein.add_attribute('fluorescent') >>> protein.add_attribute('ssrAtagged') >>> protein.attributes ['fluorescent', 'ssrAtagged']
- add_mechanism(mechanism: Mechanism, mech_type=None, overwrite=False, optional_mechanism=False)[source]
Add a mechanism to this component’s mechanism dictionary.
- Parameters:
- mechanismMechanism
The mechanism object to add.
- mech_typestr, optional
The type key under which to store the mechanism. If None, uses the mechanism’s
mechanism_typeattribute.- overwritebool, default=False
If True, replaces any existing mechanism with the same key. If False, raises ValueError when key already exists.
- optional_mechanismbool, default=False
If True, suppresses the ValueError when a mechanism key conflict occurs and
overwriteis False.
- Raises:
- TypeError
If
mechanismis not a Mechanism object, or ifmech_typeis not a string.- ValueError
If mechanism key already exists,
overwriteis False, andoptional_mechanismis False.
- add_mechanisms(mechanisms: Mechanism | GlobalMechanism, overwrite=False, optional_mechanism=False)[source]
Add multiple mechanisms to this component.
Accepts mechanisms as a single object, list, or dictionary and adds them to the component’s mechanism dictionary.
- Parameters:
- mechanismsMechanism, GlobalMechanism, dict, or list
The mechanism(s) to add. Can be a single mechanism, a dict with mechanism types as keys and mechanisms as values, or a list of mechanisms.
- overwritebool, default=False
If True, replaces any existing mechanisms with the same keys. If False, raises ValueError when keys already exist.
- optional_mechanismbool, default=False
If True, suppresses ValueError when mechanism key conflicts occur and
overwriteis False.
- Raises:
- ValueError
If
mechanismsis not a valid type, or if mechanism key conflicts occur withoverwrite=Falseandoptional_mechanism=False.
- property compartment
Compartment or None: The compartment containing this component.
- enumerate_components(previously_enumerated=None) List[source]
Enumerate derived components created from this component.
This method generates new components based on the current component, typically used during CRN compilation to expand higher-level components into their constituent parts and products.
- Parameters:
- previously_enumeratedset or list, optional
Collection of components that have already been enumerated, used to prevent infinite recursion in component enumeration.
- Returns:
- list
List of new components created from this component. This base implementation returns an empty list.
Notes
Subclasses override this method to implement specific enumeration behavior. For example:
A
DNA_constructreturns copies of its parts andRNA_constructobjects representing transcripts.An
RNA_constructreturns copies of its parts andProteincomponents representing translation products.
- get_mechanism(mechanism_type, optional_mechanism=False)[source]
Retrieve a mechanism by type from the component or its mixture.
Searches first in the component’s mechanism dictionary, then falls back to the mixture’s mechanisms if not found.
- Parameters:
- mechanism_typestr
The type identifier of the mechanism to retrieve (e.g., ‘transcription’, ‘translation’, ‘binding’).
- optional_mechanismbool, default=False
If True, returns None when mechanism not found. If False, raises KeyError when mechanism not found.
- Returns:
- Mechanism or None
The requested mechanism object, or None if not found and
optional_mechanismis True.
- Raises:
- TypeError
If
mechanism_typeis not a string.- KeyError
If mechanism not found and
optional_mechanismis False.
- get_parameter(param_name: str, part_id=None, mechanism=None, return_numerical=False, return_none=False, check_mixture=True) Parameter | Real[source]
Retrieve parameter from component or mixture parameter database.
Searches first in the component’s parameter database, then falls back to the mixture’s parameter database if not found.
- Parameters:
- param_namestr
Name of the parameter to retrieve.
- part_idstr, optional
Part identifier for the parameter lookup key.
- mechanismstr, optional
Mechanism identifier for the parameter lookup key.
- return_numericalbool, default=False
If True, returns the numerical value. If False, returns the
Parameterobject.- return_nonebool, default=False
If True, returns None when parameter not found. If False, raises ValueError when parameter not found.
- check_mixturebool, default=True
If True, searches the mixture’s parameter database if not found in the component’s database.
- Returns:
- Parameter, Real, or None
The parameter object or its numerical value, or None if not found and
return_noneis True.
- Raises:
- ValueError
If parameter not found and
return_noneis False.
Notes
Parameter lookup follows the hierarchy:
Component.parameter_database
Component.mixture.parameter_database (if
check_mixtureis True)
- get_species()[source]
Get the membrane pump protein species.
- Returns:
- Species
The membrane pump protein species.
- set_attributes(attributes: List[str])[source]
Set multiple attributes for the component.
Adds a list of attribute tags to the component and its associated species by calling
add_attributefor each attribute in the list.- Parameters:
- attributeslist of str or None
List of attribute strings to add to the component. If None, no action is taken.
See also
add_attributeAdd a single attribute to the component.
Examples
>>> comp = bcp.Protein(name="MyProtein") >>> comp.set_attributes(["degtagged", "fluorescent"]) >>> comp.attributes ['degtagged', 'fluorescent']
- set_mixture(mixture) None[source]
Set the mixture containing this component.
- Parameters:
- mixtureMixture or None
The mixture object that contains this component and provides default mechanisms and parameters.
- classmethod set_species(species: Species | str, material_type=None, compartment=None, attributes=None) Species[source]
Convert various inputs into Species objects.
- Parameters:
- speciesSpecies, str, Component, or list
The species to convert. Can be a
Speciesobject (returned as-is), a string (creates new Species), aComponent(extracts its species), or a list of any of these types.- material_typestr, optional
Material type for the species (e.g., ‘dna’, ‘rna’, ‘protein’). Only used when creating new Species from strings.
- compartmentCompartment, optional
Compartment to assign to the species. Only used when creating new Species from strings.
- attributeslist of str, optional
Attributes to assign to the species. Only used when creating new Species from strings.
- Returns:
- Species or list of Species
The converted Species object(s). Returns a list if input was a list.
- Raises:
- ValueError
If the input cannot be converted to a valid Species.
- update_parameters(parameter_file=None, parameters=None, parameter_database=None, overwrite_parameters=True)[source]
Update the parameter database with new parameters.
- Parameters:
- parameter_filestr, optional
Path to a CSV or TSV file containing parameters to load.
- parametersdict, optional
Dictionary of parameters to add. Keys follow the format (mechanism, part_id, param_name).
- parameter_databaseParameterDatabase, optional
Another parameter database to merge into component’s database.
- overwrite_parametersbool, default=True
If True, new parameter values overwrite existing ones. If False, existing parameters are preserved.
- update_reactions()[source]
Use ‘trasnport’ mechanism to generate ATP-dependent reactions.
Uses the ‘transport’ mechanism to generate reactions for active transport coupled to ATP hydrolysis.
- Returns:
- list of Reaction
List of ATP-dependent transport reactions.
- update_species()[source]
Use ‘trasnport’ mechanism to generate ATP-dependent species.
Uses the ‘transport’ mechanism to generate species including the pump protein, substrate, product, ATP, and ADP.
- Returns:
- list of Species
List of species generated by the transport mechanism, including pump, substrate, product, energy, and waste.
- class biocrnpyler.components.membrane.MembraneSensor(membrane_sensor_protein: Species | str | Component, response_protein: Species | str | Component, assigned_substrate: Species | str | Component, signal_substrate: Species | str | Component, product: Species | str | Component = None, internal_compartment: str | Compartment = 'Internal', external_compartment: str | Compartment = 'External', ATP: int = 2, attributes=None, **kwargs)[source]
Two-component system (TCS) membrane sensor protein.
A
MembraneSensorcomponent represents a membrane sensor protein in a two-component signaling system. The sensor detects external signal substrates and catalyzes the transfer of a chemical group (typically phosphate) to a response protein, activating it. The component uses a ‘membrane_sensor’ mechanism to generate signal transduction reactions.- Parameters:
- membrane_sensor_proteinSpecies, str, or Component
The membrane sensor protein (histidine kinase) that detects the signal. Can be a
Speciesobject, string name, orComponent.- response_proteinSpecies, str, or Component
The cytoplasmic response regulator protein that receives the signal. Can be a
Speciesobject, string name, orComponent.- assigned_substrateSpecies, str, or Component
The chemical group to be transferred (typically phosphate). Can be a
Speciesobject, string name, orComponent.- signal_substrateSpecies, str, or Component
The external signal molecule that activates the sensor. Can be a
Speciesobject, string name, orComponent.- productSpecies, str, or Component, optional
The activated response protein product. If None, automatically named as ‘<response_protein>active’.
- internal_compartmentstr or Compartment, default=’Internal’
The internal compartment containing response protein. Can be a string name (creates new Compartment) or an existing
Compartmentobject.- external_compartmentstr or Compartment, default=’External’
The external compartment containing signal. Can be a string name (creates new Compartment) or an existing
Compartmentobject.- ATPint, default=2
Number of ATP molecules required for the signaling process.
- attributeslist of str, optional
List of attribute tags to associate with species.
- **kwargs
Additional keyword arguments passed to the
Componentbase class constructor.
- Attributes:
- membrane_sensor_proteinSpecies
The membrane sensor protein species.
- response_proteinSpecies
The response regulator protein species.
- assigned_substrateSpecies
The substrate to be transferred (e.g., phosphate).
- signal_substrateSpecies
The external signal molecule species.
- productSpecies
The activated response protein species.
- energySpecies
ATP species used for energy.
- wasteSpecies
ADP species produced.
See also
ComponentBase class for biomolecular components.
Notes
Two-component systems (TCS) are common bacterial signal transduction pathways. The typical mechanism involves:
Signal detection by membrane sensor (histidine kinase)
Autophosphorylation of sensor using ATP
Phosphotransfer to response regulator
Activated response regulator regulates gene expression
The general reaction scheme:
signal + sensor + ATP + response_protein –> signal + sensor + ADP + response_protein-P
The component name is automatically generated as: ‘<membrane_sensor_protein_name>_<compartment_name>’
Examples
Create a simple two-component system:
>>> tcs = bcp.MembraneSensor( ... membrane_sensor_protein='EnvZ', ... response_protein='OmpR', ... assigned_substrate='Phosphate', ... signal_substrate='Osmolarity', ... ATP=2 ... )
Create a chemotaxis receptor:
>>> chemoreceptor = bcp.MembraneSensor( ... membrane_sensor_protein='CheA', ... response_protein='CheY', ... assigned_substrate='Phosphate', ... signal_substrate='Aspartate', ... product='CheY_P' ... )
Use with a mixture:
>>> mixture = bcp.Mixture( ... components=[tcs], ... mechanisms={ ... 'membrane_sensor': bcp.Membrane_Signaling_Pathway_MM()}, ... parameter_file='mechanisms/transport_parameters.tsv' ... ) >>> crn = mixture.compile_crn()
- add_attribute(attribute: str)[source]
Add a single attribute to the component.
Adds an attribute tag to the component’s attribute list and to its associated species object, if one exists. Attributes can be used for mechanism selection, species filtering, and tracking special properties.
- Parameters:
- attributestr
Attribute string to add to the component. Must be a non-None string value.
- Raises:
- AssertionError
If
attributeis not a string or is None.- Warning
If the component has no internal species to which the attribute can be added.
Notes
Attributes are commonly used to tag components with properties such as:
Degradation tags (e.g., ‘degtagged’, ‘ssrAtagged’, )
Functional properties (e.g., ‘fluorescent’, ‘membranebound’)
Regulatory elements (e.g., ‘inducible’, ‘repressible’)
Examples
Add attributes to tag a protein with special properties:
>>> protein = bcp.Protein('GFP') >>> protein.add_attribute('fluorescent') >>> protein.add_attribute('ssrAtagged') >>> protein.attributes ['fluorescent', 'ssrAtagged']
- add_mechanism(mechanism: Mechanism, mech_type=None, overwrite=False, optional_mechanism=False)[source]
Add a mechanism to this component’s mechanism dictionary.
- Parameters:
- mechanismMechanism
The mechanism object to add.
- mech_typestr, optional
The type key under which to store the mechanism. If None, uses the mechanism’s
mechanism_typeattribute.- overwritebool, default=False
If True, replaces any existing mechanism with the same key. If False, raises ValueError when key already exists.
- optional_mechanismbool, default=False
If True, suppresses the ValueError when a mechanism key conflict occurs and
overwriteis False.
- Raises:
- TypeError
If
mechanismis not a Mechanism object, or ifmech_typeis not a string.- ValueError
If mechanism key already exists,
overwriteis False, andoptional_mechanismis False.
- add_mechanisms(mechanisms: Mechanism | GlobalMechanism, overwrite=False, optional_mechanism=False)[source]
Add multiple mechanisms to this component.
Accepts mechanisms as a single object, list, or dictionary and adds them to the component’s mechanism dictionary.
- Parameters:
- mechanismsMechanism, GlobalMechanism, dict, or list
The mechanism(s) to add. Can be a single mechanism, a dict with mechanism types as keys and mechanisms as values, or a list of mechanisms.
- overwritebool, default=False
If True, replaces any existing mechanisms with the same keys. If False, raises ValueError when keys already exist.
- optional_mechanismbool, default=False
If True, suppresses ValueError when mechanism key conflicts occur and
overwriteis False.
- Raises:
- ValueError
If
mechanismsis not a valid type, or if mechanism key conflicts occur withoverwrite=Falseandoptional_mechanism=False.
- property compartment
Compartment or None: The compartment containing this component.
- enumerate_components(previously_enumerated=None) List[source]
Enumerate derived components created from this component.
This method generates new components based on the current component, typically used during CRN compilation to expand higher-level components into their constituent parts and products.
- Parameters:
- previously_enumeratedset or list, optional
Collection of components that have already been enumerated, used to prevent infinite recursion in component enumeration.
- Returns:
- list
List of new components created from this component. This base implementation returns an empty list.
Notes
Subclasses override this method to implement specific enumeration behavior. For example:
A
DNA_constructreturns copies of its parts andRNA_constructobjects representing transcripts.An
RNA_constructreturns copies of its parts andProteincomponents representing translation products.
- get_mechanism(mechanism_type, optional_mechanism=False)[source]
Retrieve a mechanism by type from the component or its mixture.
Searches first in the component’s mechanism dictionary, then falls back to the mixture’s mechanisms if not found.
- Parameters:
- mechanism_typestr
The type identifier of the mechanism to retrieve (e.g., ‘transcription’, ‘translation’, ‘binding’).
- optional_mechanismbool, default=False
If True, returns None when mechanism not found. If False, raises KeyError when mechanism not found.
- Returns:
- Mechanism or None
The requested mechanism object, or None if not found and
optional_mechanismis True.
- Raises:
- TypeError
If
mechanism_typeis not a string.- KeyError
If mechanism not found and
optional_mechanismis False.
- get_parameter(param_name: str, part_id=None, mechanism=None, return_numerical=False, return_none=False, check_mixture=True) Parameter | Real[source]
Retrieve parameter from component or mixture parameter database.
Searches first in the component’s parameter database, then falls back to the mixture’s parameter database if not found.
- Parameters:
- param_namestr
Name of the parameter to retrieve.
- part_idstr, optional
Part identifier for the parameter lookup key.
- mechanismstr, optional
Mechanism identifier for the parameter lookup key.
- return_numericalbool, default=False
If True, returns the numerical value. If False, returns the
Parameterobject.- return_nonebool, default=False
If True, returns None when parameter not found. If False, raises ValueError when parameter not found.
- check_mixturebool, default=True
If True, searches the mixture’s parameter database if not found in the component’s database.
- Returns:
- Parameter, Real, or None
The parameter object or its numerical value, or None if not found and
return_noneis True.
- Raises:
- ValueError
If parameter not found and
return_noneis False.
Notes
Parameter lookup follows the hierarchy:
Component.parameter_database
Component.mixture.parameter_database (if
check_mixtureis True)
- get_species()[source]
Get the membrane sensor protein species.
- Returns:
- Species
The membrane sensor protein (histidine kinase) species.
- set_attributes(attributes: List[str])[source]
Set multiple attributes for the component.
Adds a list of attribute tags to the component and its associated species by calling
add_attributefor each attribute in the list.- Parameters:
- attributeslist of str or None
List of attribute strings to add to the component. If None, no action is taken.
See also
add_attributeAdd a single attribute to the component.
Examples
>>> comp = bcp.Protein(name="MyProtein") >>> comp.set_attributes(["degtagged", "fluorescent"]) >>> comp.attributes ['degtagged', 'fluorescent']
- set_mixture(mixture) None[source]
Set the mixture containing this component.
- Parameters:
- mixtureMixture or None
The mixture object that contains this component and provides default mechanisms and parameters.
- classmethod set_species(species: Species | str, material_type=None, compartment=None, attributes=None) Species[source]
Convert various inputs into Species objects.
- Parameters:
- speciesSpecies, str, Component, or list
The species to convert. Can be a
Speciesobject (returned as-is), a string (creates new Species), aComponent(extracts its species), or a list of any of these types.- material_typestr, optional
Material type for the species (e.g., ‘dna’, ‘rna’, ‘protein’). Only used when creating new Species from strings.
- compartmentCompartment, optional
Compartment to assign to the species. Only used when creating new Species from strings.
- attributeslist of str, optional
Attributes to assign to the species. Only used when creating new Species from strings.
- Returns:
- Species or list of Species
The converted Species object(s). Returns a list if input was a list.
- Raises:
- ValueError
If the input cannot be converted to a valid Species.
- update_parameters(parameter_file=None, parameters=None, parameter_database=None, overwrite_parameters=True)[source]
Update the parameter database with new parameters.
- Parameters:
- parameter_filestr, optional
Path to a CSV or TSV file containing parameters to load.
- parametersdict, optional
Dictionary of parameters to add. Keys follow the format (mechanism, part_id, param_name).
- parameter_databaseParameterDatabase, optional
Another parameter database to merge into component’s database.
- overwrite_parametersbool, default=True
If True, new parameter values overwrite existing ones. If False, existing parameters are preserved.
- update_reactions()[source]
Use ‘membrane_sensor’ to generate species signaling reactions.
Uses the ‘membrane_sensor’ mechanism to generate reactions for signal detection, ATP-dependent phosphorylation, and phosphotransfer to the response regulator.
- Returns:
- list of Reaction
List of signal transduction reactions including sensing, autophosphorylation, and phosphotransfer.
- update_species()[source]
Use ‘membrane_sensor’ to generate species signaling species.
Uses the ‘membrane_sensor’ mechanism to generate all species involved in the signaling pathway including sensor, response protein, substrates, signal, product, ATP, and ADP.
- Returns:
- list of Species
List of species generated by the membrane_sensor mechanism.