Complexes — Pykaryote 1.1.0d documentation

### Navigation

- index
- modules |
- next |
- previous |
- Pykaryote 1.1.0d documentation »
- Modules »

# Complexes

## Overview

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.

### Storage

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.

### Binding

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.

## Documentation

Pykaryote Complexes

class `pykaryote.sim.complexes.` `Complex`

  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`

    binding_affinity: ‘float’

  `family`

    family: object

  `function`

    function: numpy.ndarray

  `is_functional`

    is_functional: ‘int’

  `length`

    length: ‘int’

  `name`

    name: str

class `pykaryote.sim.complexes.` `ComplexTracker`

  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`

    complex_lookup: dict

  `get_complex`(self, str complex, family=None)

    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

`pykaryote.sim.complexes.` `function_string`(function)

  Converts a function vector into a string for displaying

`pykaryote.sim.complexes.` `mutate_family_vector`(vec)

  mutates the family function vector to create a complex vector

`pykaryote.sim.complexes.` `mutate_function_vector`(base_vec, length)

  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

`pykaryote.sim.complexes.` `random`() → x in the interval [0, 1).

### Navigation

- index
- modules |
- next |
- previous |
- Pykaryote 1.1.0d documentation »
- Modules »