biocrnpyler.components.combinatorial_complex
Classes
|
A class to represent a Complex of many Species which can bind together in many different ways. |
- class biocrnpyler.components.combinatorial_complex.CombinatorialComplex(final_states, initial_states=None, intermediate_states=None, excluded_states=None, name=None, **keywords)[source]
A class to represent a Complex of many Species which can bind together in many different ways.
Binding reactions will be generated to form all the ComplexSpecies in final_states from all the species in initial_states (or, if initial_states is None, from all the individual species inside each ComplexSpecies). Intermediate states restricts the binding reactions to only form species in this list. Excluded states are not allowed to be reactants or products. At a high level this generates the following reactions:
- If just final_states are given:
final_states_internal_species <-[Combinatorial Binding]-> final_states
- if initial_states are given:
intial_states <-[Combinatorial Binding]-> final_states
- if intermediate_states are given:
final_states_internal_species <-[Combinatorial Binding]-> intermediate_states <-[Combinatorial Binding]->final_states
- if initial_states and intermediate_states are given:
intial_states <-[Combinatorial Binding]-> intermediate_states <-[Combinatorial Binding]->final_states
- Parameters:
final_states – a single ComplexSpecies or a list of ComplexSpecies.
initial_states – a list of initial Species which are bound together to form the ComplexSpecies in final_states. If None defaults to the members of the ComplexSpecies in final_states.
intermediate_states – a list of intermediate ComplexSpecies formed when converting initial_states to final_states. If None: all possible intermediate ComplexSpecies are enumerated.
excluded_states – a list of ComplexSpecies which are NOT allowed to form when converting initial states to final states. If None: no ComplexSpecies are excluded.
- Example 1: final_states = ComplexSpecies([A, B, C]). initial_states = None, intermediate_states = None.
initial_states will default to A, B, C. All intermediate states [A, B], [A, C], [B, C] will be enumerated. This results in the 6 reversible reactions: 1. A + B <–> Complex([A, B]) 2. A + C <–> Complex([A, C]) 3. B + C <–> Complex([B, C]) 4. Complex([A, B]) + C <–> Complex([A, B, C]) 5. Complex([A, C]) + B <–> Complex([A, B, C]) 6. Complex([B, C]) + A <–> Complex([A, B, C])
- Example 2: final_states = ComplexSpecies([A, B, C]), intial_states = [Complex([A, B]), Complex([A, C])], intermediate_states = None
This results in the reactions: 1. Complex([A, B]) + C <–> Complex([A, B, C]) 2. Complex([A, C]) + B <–> Complex([A, B, C])
- Example 3: final_states = ComplexSpecies([A, B, C]). initial_states = None, intermaied_states = [Complex([A, B]), Complex([A, C])].
This results in reactions: 1. A + B <–> Complex([A, B]) 2. A + C <–> Complex([A, C]) 3. Complex([A, B]) + C <–> Complex([A, B, C]) 4. Complex([A, C]) + B <–> Complex([A, B, C])
- Example 4: final_states = [Complex([A, A, B], Complex([A, B, B]))], initial_states = None, intermediate_states = None
This results in the reactions: 1. A + A <–> Complex([A, A]) 2. Complex([A, A]) + B <–> Complex ([A, A, B]) 3. B + B <–> Complex([B, B]) 4. Complex([B, B]) + A <–> Complex ([A, B, B]) 5. A + B <–> Complex([A, B]) 6. Complex([A, B]) + A <–> Complex ([A, A, B]) 7. Complex([A, B]) + B <–> Complex ([A, B, B])
- add_mechanism(mechanism: Mechanism, mech_type=None, overwrite=False, optional_mechanism=False)[source]
adds a mechanism of type mech_type to the Component Mechanism dictionary.
- Parameters:
mechanism
mech_type
overwrite – toggles whether the mechanism is added overwriting any mechanism with the same key.
optional_mechanism – toggles whether an error is thrown if a Mechanism is added that conflicts with an exising Mechanism
- Returns:
- add_mechanisms(mechanisms: Mechanism | GlobalMechanism, overwrite=False, optional_mechanism=False)[source]
This function adds a list or dictionary of mechanisms to the mixture.
- Parameters:
mechanisms – Can take both GlobalMechanisms and Mechanisms
overwrite – toggles whether the mechanism is added overwriting any mechanism with the same key.
optional_mechanism – toggles whether an error is thrown if a Mechanism is added that conflicts with an exising Mechanism
- Returns:
- property compartment
The compartment of the Component.
- Returns:
Compartment
- enumerate_components(**keywords) List[source]
this is for component enumeration. Usually you will return a list of components that are copies of existing ones (first list) and new components (second list). For example, A DNA_construct makes a list of copies of its parts as the first output, and a list of RNA_constructs as the second output. An RNA_construct will make a list of copies of its parts as the first output, and a list of Protein components as its second output (if it makes any proteins)
- get_combinations_between(s0, sf)[source]
Returns all combinations of Species to create the Complex sf from s0.
- get_mechanism(mechanism_type, optional_mechanism=False)[source]
Searches the Component for a Mechanism of the correct type.
If the Component does not have the mechanism, searches the Components’ Mixture for the Mechanism.
- Parameters:
mechanism_type
optional_mechanism – toggles whether an error is thrown if no mechanism is found
- Returns:
- get_parameter(param_name: str, part_id=None, mechanism=None, return_numerical=False, return_none=False, check_mixture=True) Parameter | Real[source]
Get a parameter from different objects that hold parameters.
- Hierarchy:
tries to find the Parameter in Component.parameter_database
tries to find the parameter in Component.mixture.parameter_database
- Parameters:
param_name
part_id
mechanism
return_numerical – numerical value or the parameter object is returned
return_none – returns None instead of throwing an error if a parameter isn’t found
check_mixture – toggle whether or not to check the Component’s Mixture as well
- Returns:
Parameter object or a Real number
- set_mixture(mixture) None[source]
Set the mixture the Component is in.
- Parameters:
mixture
- Returns:
None
- classmethod set_species(species: Species | str, material_type=None, compartment=None, attributes=None) Species[source]
Helper function that allows species to be set from strings, species, or Components
- Parameters:
species – Species, str, Component
material_type
compartment
attributes
- Returns:
Species