vivarium.processes.transcription module

Stochastic Transcription

class vivarium.processes.transcription.Transcription(initial_parameters=None)[source]

Bases: vivarium.core.process.Process

A stochastic transcription 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 AcrA, you must refer to the gene, transcript, and protein each as acrA.

Ports:

  • chromosome: The linked store should hold a representation of the chromosome in the form returned by vivarium.states.chromosome.Chromosome.to_dict().

  • molecules: Expects variables with the names in the molecule_ids configuration. These are the monomers consumed by transcription.

  • factors: Expects variables for each transcription factor’s concentration.

  • transcripts: The linked store should store the concentrations of the transcripts.

  • proteins: The linked store should hold the concentrations of the transcription factors and the RNA polymerase.

Parameters

initial_parameters

The following configuration options may be provided:

  • promoter_affinities (dict): Maps from binding state tuples to the binding affinity of RNA polymerase and the promoter when the promoter is at that binding state. The binding state of a promoter is which (if any) transcription factors are bound to the promoter. Such a binding state can be represented by a binding state tuple, which is a tuple whose first element is the name of the promoter. All bound transcription factors are listed as subsequent elements. If no transcription factors are bound, the sole subsequent element is None.

  • transcription_factors (list): A list of all modeled transcription factors.

  • sequence: The DNA sequence that includes all the genes whose transcription is being modeled.

  • templates (dict): Maps from the name of an operon to that operon’s template specification.

  • genes (dict): Maps from operon name to a list of the names of the genes in that operon.

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

  • 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.nucleotides.nucleotides.

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

    >>> from vivarium.data.nucleotides import nucleotides
    >>> monomer_ids = nucleotides.values()
    >>> print(list(monomer_ids))
    ['ATP', 'GTP', 'UTP', 'CTP']
    

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

  • molecule_ids (list): A list of all the molecules needed by the process. This will generally be the same as monomer_ids.

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

>>> import random
>>>
>>> import numpy as np
>>>
>>> from vivarium.states.chromosome import (
...     toy_chromosome_config,
...     Chromosome,
... )
>>> from vivarium.data.nucleotides import nucleotides
>>> # format_dict lets us print dictionaries prettily
>>> from vivarium.library.pretty import format_dict
>>>
>>> random.seed(0)  # Needed because process is stochastic
>>> np.random.seed(0)
>>> # We will use the toy chromosome from toy_chromosome_config
>>> print(toy_chromosome_config)
{'sequence': 'ATACGGCACGTGACCGTCAACTTA', 'genes': {'oA': ['eA'], 'oAZ': ['eA', 'eZ'], 'oB': ['eB'], 'oBY': ['eB', 'eY']}, 'promoter_order': ['pA', 'pB'], 'promoters': {'pA': {'id': 'pA', 'position': 3, 'direction': 1, 'sites': [{'position': 0, 'length': 3, 'thresholds': {'tfA': <Quantity(0.3, 'millimolar')>}}], 'terminators': [{'position': 6, 'strength': 0.5, 'products': ['oA']}, {'position': 12, 'strength': 1.0, 'products': ['oAZ']}]}, 'pB': {'id': 'pB', 'position': -3, 'direction': -1, 'sites': [{'position': 0, 'length': 3, 'thresholds': {'tfB': <Quantity(0.5, 'millimolar')>}}], 'terminators': [{'position': -9, 'strength': 0.5, 'products': ['oB']}, {'position': -12, 'strength': 1.0, 'products': ['oBY']}]}}, 'promoter_affinities': {('pA', None): 1.0, ('pA', 'tfA'): 10.0, ('pB', None): 1.0, ('pB', 'tfB'): 10.0}, 'domains': {0: {'id': 0, 'lead': 0, 'lag': 0, 'children': []}}, 'rnaps': {}}
>>> monomer_ids = list(nucleotides.values())
>>> configuration = {
...     'promoter_affinities': {
...         ('pA', None): 1.0,
...         ('pA', 'tfA'): 10.0,
...         ('pB', None): 1.0,
...         ('pB', 'tfB'): 10.0},
...     'transcription_factors': ['tfA', 'tfB'],
...     'sequence': toy_chromosome_config['sequence'],
...     'templates': toy_chromosome_config['promoters'],
...     'genes': toy_chromosome_config['genes'],
...     'elongation_rate': 10.0,
...     'polymerase_occlusion': 5,
...     'symbol_to_monomer': nucleotides,
...     'monomer_ids': monomer_ids,
...     'molecule_ids': monomer_ids,
... }
>>> # At this point we haven't used the toy chromosome yet
>>> # because it will be specified in the chromosome port.
>>> # Notice that the parameters are specific to the chromosome.
>>> transcription_process = Transcription(configuration)
>>> # Now we need to initialize the simulation stores
>>> state = {
...     'chromosome': toy_chromosome_config,
...     'molecules': {
...         nucleotide: 10
...         for nucleotide in monomer_ids
...     },
...     'proteins': {UNBOUND_RNAP_KEY: 10},
...     'factors': {'tfA': 0.2 * units.mM, 'tfB': 0.7 * units.mM},
... }
>>> update = transcription_process.next_update(1.0, state)
>>> print(update['chromosome'])
{'rnaps': {'_add': [{'path': (2,), 'state': <class 'vivarium.states.chromosome.Rnap'>: {'id': 2, 'template': 'pA', 'template_index': 0, 'terminator': 1, 'domain': 0, 'state': 'polymerizing', 'position': 7}}, {'path': (3,), 'state': <class 'vivarium.states.chromosome.Rnap'>: {'id': 3, 'template': 'pB', 'template_index': 1, 'terminator': 0, 'domain': 0, 'state': 'occluding', 'position': 3}}, {'path': (4,), 'state': <class 'vivarium.states.chromosome.Rnap'>: {'id': 4, 'template': 'pA', 'template_index': 0, 'terminator': 0, 'domain': 0, 'state': 'occluding', 'position': 0}}], '_delete': []}, 'rnap_id': 4, 'domains': {0: <class 'vivarium.states.chromosome.Domain'>: {'id': 0, 'lead': 0, 'lag': 0, 'children': []}}, 'root_domain': 0}
build_affinity_vector(promoters, factors)[source]
chromosome_config(chromosome_states)[source]
defaults = {'concentrations_deriver_key': 'transcription_concentrations', 'elongation_rate': 1.0, 'genes': {}, 'initial_domains': {0: {'children': [], 'id': 0, 'lag': 0, 'lead': 0}}, 'molecule_ids': ['ATP', 'GTP', 'UTP', 'CTP'], 'monomer_ids': ['ATP', 'GTP', 'UTP', 'CTP'], 'polymerase_occlusion': 5, 'promoter_affinities': {}, 'sequence': '', 'symbol_to_monomer': {'A': 'ATP', 'C': 'CTP', 'G': 'GTP', 'U': 'UTP'}, 'templates': {}, 'time_step': 1.0, 'transcription_factors': []}
derivers()[source]
name = 'transcription'
next_update(timestep, states)[source]
ports_schema()[source]
vivarium.processes.transcription.UNBOUND_RNAP_KEY = 'RNA Polymerase'

Variable name for unbound RNA polymerase

vivarium.processes.transcription.choose_element(elements)[source]
vivarium.processes.transcription.test_transcription()[source]