vivarium.processes.translation module

Stochastic Translation

class vivarium.processes.translation.Ribosome(config)[source]

Bases: vivarium.library.polymerize.Polymerase

class vivarium.processes.translation.Transcript(config)[source]

Bases: vivarium.library.polymerize.Template

class vivarium.processes.translation.Translation(initial_parameters=None)[source]

Bases: vivarium.core.process.Process

A stochastic translation model

Warning

Vivarium’s knowledge base uses the gene name to name the protein. This means that for a gene acrA that codes for protein ArcA, you must refer to the gene, transcript, and protein each as acrA.

Danger

This documentation will need to be updated to reflect the changes in #185

Ports:

  • ribosomes: Expects the ribosomes variable, whose value is a list of the configurations of the ribosomes currently active.

  • molecules: Expects variables for each of the RNA nucleotides.

  • transcripts: Expects variables for each transcript to translate. Translation will read transcripts from this port.

  • proteins: Expects variables for each protein product. The produced proteins will be added to this port as counts.

  • concentrations: Expects variables for each key in concentration_keys. This will be used by a deriver to convert counts to concentrations.

Parameters

initial_parameters

A dictionary of configuration options. Accepts the following keys:

  • sequences (dict): Maps from operon name to the RNA sequence of the operon, as a str.

  • templates (dict): Maps from the name of an transcript to a template specification. The template specification may be generated by vivarium.library.polymerize.generate_template() like so:

    >>> from vivarium.library.polymerize import (
    ...     generate_template)
    >>> from vivarium.library.pretty import format_dict
    >>> terminator_index = 5
    >>> template = generate_template(
    ...     'oA', terminator_index, ['product1'])
    >>> print(format_dict(template))
    {
        "direction": 1,
        "id": "oA",
        "position": 0,
        "sites": [],
        "terminators": [
            {
                "position": 5,
                "products": [
                    "product1"
                ],
                "strength": 1.0
            }
        ]
    }
    
  • transcript_affinities (dict): A map from the name of a transcript to the binding affinity (a float) of the ribosome for the transcript.

  • elongation_rate (float): The elongation rate of the ribosome.

  • polymerase_occlusion (int): The number of base pairs behind the polymerase where another polymerase is occluded and so cannot bind.

  • symbol_to_monomer (dict): Maps from the symbols used to represent monomers in the RNA sequence to the name of the free monomer. This should generally be vivarium.data.amino_acids.amino_acids.

  • monomer_ids (list): A list of the names of the free monomers consumed by translation. This can generally be computed as:

    >>> import pprint
    >>>
    >>> from vivarium.data.amino_acids import amino_acids
    >>> monomer_ids = amino_acids.values()
    >>> pp = pprint.PrettyPrinter()
    >>> pp.pprint(list(monomer_ids))
    ['Alanine',
     'Arginine',
     'Asparagine',
     'Aspartate',
     'Cysteine',
     'Glutamate',
     'Glutamine',
     'Glycine',
     'Histidine',
     'Isoleucine',
     'Leucine',
     'Lysine',
     'Methionine',
     'Phenylalanine',
     'Proline',
     'Serine',
     'Threonine',
     'Tryptophan',
     'Tyrosine',
     'Valine']
    

    Note that we only included the list() transformation to make the output prettier. The dict_values object returned by .values() is sufficiently list-like for use here. Also note that pprint just makes the output prettier.

  • concentration_keys (list): A list of variables you want to be able to access as concentrations from the concentrations port. The actual conversion is handled by a deriver.

Example configuring the process (uses :py:func:vivarium.library.pretty.format_dict):

>>> from vivarium.library.pretty import format_dict
>>> from vivarium.data.amino_acids import amino_acids
>>> from vivarium.library.polymerize import generate_template
>>> random.seed(0)  # Needed because process is stochastic
>>> np.random.seed(0)
>>> configurations = {
...     'sequences': {
...         ('oA', 'eA'): 'AWDPT',
...         ('oAZ', 'eZ'): 'YVEGELENGGMFISC',
...     },
...     'templates': {
...         ('oA', 'eA'): generate_template(('oA', 'eA'), 5, ['eA']),
...         ('oAZ', 'eZ'): generate_template(('oAZ', 'eZ'), 15, ['eA', 'eZ']),
...     },
...     'transcript_affinities': {
...         ('oA', 'eA'): 1.0,
...         ('oAZ', 'eZ'): 1.0,
...     },
...     'elongation_rate': 10.0,
...     'polymerase_occlusion': 10,
...     'symbol_to_monomer': amino_acids,
...     'monomer_ids': amino_acids.values(),
...     'concentration_keys': []
... }
>>> # make the translation process, and initialize the states
>>> translation = Translation(configurations)  
>>> states = {
...     'ribosomes': {},
...     'molecules': {},
...     'proteins': {UNBOUND_RIBOSOME_KEY: 2},
...     'transcripts': {
...         'oA': 10,
...         'oAZ': 10,
...     }
... }
>>> states['molecules'].update(
...     {
...         molecule_id: 100
...         for molecule_id in translation.monomer_ids
...     }
... )
>>> update = translation.next_update(1, states)
>>> print(update['ribosomes'])
{'_add': [{'path': (1,), 'state': <class 'vivarium.processes.translation.Ribosome'>: {'id': 1, 'state': 'occluding', 'position': 9, 'template': ('oAZ', 'eZ'), 'template_index': 0, 'terminator': 0}}, {'path': (2,), 'state': <class 'vivarium.processes.translation.Ribosome'>: {'id': 2, 'state': 'occluding', 'position': 9, 'template': ('oAZ', 'eZ'), 'template_index': 0, 'terminator': 0}}], '_delete': []}
defaults = {'concentration_keys': [], 'concentrations_deriver_key': 'translation_concentrations', 'elongation_rate': 5.0, 'mass_deriver_key': 'mass_deriver', 'monomer_ids': ['Alanine', 'Arginine', 'Asparagine', 'Aspartate', 'Cysteine', 'Glutamate', 'Glutamine', 'Glycine', 'Histidine', 'Isoleucine', 'Leucine', 'Lysine', 'Methionine', 'Phenylalanine', 'Proline', 'Serine', 'Threonine', 'Tryptophan', 'Tyrosine', 'Valine'], 'polymerase_occlusion': 10, 'sequences': {('oA', 'eA'): 'MFNTKASGQDHPCTVEFIHE', ('oAZ', 'eA'): 'MFNTKASGQDHPCTVEFIHE', ('oAZ', 'eZ'): 'STMPQSRCEANLLSVLAGTRRTCCATHPVPWTRTFTESLKIFNTWQWRYWDNCGQHEFKY', ('oB', 'eB'): 'HLMKWHMYQQWFKAIGMYYLFRAAAEAVSY', ('oBY', 'eB'): 'HLMKWHMYQQWFKAIGMYYLFRAAAEAVSY', ('oBY', 'eY'): 'RMSFCQCPMRWALALKMFGYKRVFNIVLVNKNWHMEQHKC'}, 'symbol_to_monomer': {'A': 'Alanine', 'C': 'Cysteine', 'D': 'Aspartate', 'E': 'Glutamate', 'F': 'Phenylalanine', 'G': 'Glycine', 'H': 'Histidine', 'I': 'Isoleucine', 'K': 'Lysine', 'L': 'Leucine', 'M': 'Methionine', 'N': 'Asparagine', 'P': 'Proline', 'Q': 'Glutamine', 'R': 'Arginine', 'S': 'Serine', 'T': 'Threonine', 'V': 'Valine', 'W': 'Tryptophan', 'Y': 'Tyrosine'}, 'templates': {('oA', 'eA'): {'direction': 1, 'id': ('oA', 'eA'), 'position': 0, 'sites': [], 'terminators': [{'position': 20, 'strength': 1.0, 'products': ['eA']}]}, ('oAZ', 'eA'): {'direction': 1, 'id': ('oAZ', 'eA'), 'position': 0, 'sites': [], 'terminators': [{'position': 20, 'strength': 1.0, 'products': ['eA']}]}, ('oAZ', 'eZ'): {'direction': 1, 'id': ('oAZ', 'eZ'), 'position': 0, 'sites': [], 'terminators': [{'position': 60, 'strength': 1.0, 'products': ['eZ']}]}, ('oB', 'eB'): {'direction': 1, 'id': ('oB', 'eB'), 'position': 0, 'sites': [], 'terminators': [{'position': 30, 'strength': 1.0, 'products': ['eB']}]}, ('oBY', 'eB'): {'direction': 1, 'id': ('oBY', 'eB'), 'position': 0, 'sites': [], 'terminators': [{'position': 30, 'strength': 1.0, 'products': ['eB']}]}, ('oBY', 'eY'): {'direction': 1, 'id': ('oBY', 'eY'), 'position': 0, 'sites': [], 'terminators': [{'position': 40, 'strength': 1.0, 'products': ['eY']}]}}, 'time_step': 1.0, 'transcript_affinities': {('oA', 'eA'): 1.0, ('oAZ', 'eA'): 2.0, ('oAZ', 'eZ'): 5.0, ('oB', 'eB'): 1.0, ('oBY', 'eB'): 2.0, ('oBY', 'eY'): 5.0}}
derivers()[source]
name = 'translation'
next_update(timestep, states)[source]
ports_schema()[source]
vivarium.processes.translation.UNBOUND_RIBOSOME_KEY = 'Ribosome'

Variable name for unbound ribosomes

vivarium.processes.translation.gather_genes(affinities)[source]
vivarium.processes.translation.random_string(alphabet, length)[source]
vivarium.processes.translation.shuffle(l)[source]
vivarium.processes.translation.test_translation()[source]
vivarium.processes.translation.transcripts_to_gene_counts(transcripts, operons)[source]