The Complex represents a protein complex in the simulation. Each complex is made up of between 1 and max_complex_length proteins. A protein is stored only as a list of chemicals, so a length one complex is equivalent to a protein, and is often refered to as such. The primary feature of a complex is it’s function vector (see Function Vectors); it’s utility for gathering chemicals. Throughout the simulation, there is only one Complex everything else references that instance.
At the simulation level, the ComplexTracker class manages Complexes, creating them and providing lookup capabilities. Each complex is created automatically the first time something tries to look it up and a reference is returned for all subsequent attempts.
At the organism level each organism has a dictionary of the complexes it owns. Each entry has a link to the complex, an amount, and a list of all the other owned complexes that it binds to.
Each complex binds only as its Family binds. Every time an organism gets a new complex (that it didn’t own already) it checks its family binding with its other complexes. For the ones that bind, it looks up the resulting complex and adds it to its known complexes. This means that an organism generally only needs to check its own list, rather than checking the over dictionary every time it manufactures a protein or complex.
You can allow complexes to bind with other complexes, or only allow proteins to be added onto existing complexes. This can be set using complex_complex_binding. Disabling complex-complex binding tends to force organisms to grow one level of complexity at a time, rather than leaping from level 3 to level 6. It also tends to reduce the number of unique complexes in existence as there are fewer possible mechanisms for complexes to form.
Pykaryote Complexes
Complex(composition, function, family)
The Complex class represents combinations of proteins from 1 (a protein) to many.
Each instance of Complex is stored in the ComplexTracker class, and referenced by the various organisms that build it.
Args:
composition (list): The chemical list versions of the proteins making up the complex
function (array): The complex’s function vector
family: The family to which the complex belongs
binding_affinity: ‘float’
family: object
function: numpy.ndarray
is_functional: ‘int’
length: ‘int’
name: str
ComplexTracker(environment, str name=’‘, str data=’‘, log=True)
Tracks and manages all existing proteins
Args:
environment: A reference to the simulation Environment
name (str): The name of the simulation, used for logging
data (str): The data directory of the simulation, used for logging
complex_lookup: dict
Return a complex by name, creating it if it does not exist.
If looking up a complex of length 1, let family = None.
Args:
complex (str): A STRING representation of the complex’s composition
family: None for proteins (len 1 complexes) A Family for complexes - the family to which the complex will belong
Converts a function vector into a string for displaying
mutates the family function vector to create a complex vector
Tweaks the supplied vector to create a new function vector. Used for individualizing relative functions for a new protein
Args:
base_vec: The function vector to be tweaked
length (int): the length of the complex in question