Tutorial

With the help of the quick start manual you should now be able to run Virtual Microbes. On this page, I will briefly introduce how you can explore what is happening, and how you can build your own “metabolic universe”.

To get started, let’s run a very short simulation which outputs some basic data:

# RUNNING A SHORT SIMULATION
(mypy) user@computer: virtualmicrobes.py evo --name MyFirstMicrobes --plot-time 10 --store-data-time 5 --save-time 50 --duration 100

Watching stuff happen

Al lot of output will be saved at runtime. A folder named after your project (for the above example that is ‘MyFirstMicrobes’) has been made at the start of your simulation. CSV files with information on genomes, cell sizes, resource concentrations, etc. can be found in MyFirstMicrobes/data/. Images of gene regulatory networks, metabolomes, and the grid are stored in MyFirstMicrobes/plots/

For easy exploration of your microbes, use the Firefox webapplication with fully interactive dygraphs.

An example of what you can find on a webpage like this is available here.

Opening pandora’s box

Using the default options might be boring. There’s a lot you can change.

To show all possible options you can modify, use the following command:

# DISPLAY ALL GENERAL OPTIONS
user@computer: virtualmicrobes.py --help
# DISPLAY ALL OPTIONS SPECIFIC TO EVOLUTIONARY SIMULATIONS
user@computer: virtualmicrobes.py evo --help
# DISPLAY ALL OPTIONS FOR ANALYSING LINES OF DESCENT AND TREES
user@computer: virtualmicrobes.py ancestry --help

Here’s some examples to get you started:

# DONT FORGET TO ACTIVATE YOUR LOCAL PYTHON ENVIRONMENT (if you are using one)
user@computer: source ~/mypy/bin/activate
# RUNNING A SHORT SIMULATION WITH MORE FREQUENT DATA
(mypy) user@computer: virtualmicrobes.py evo --name MyFirstMicrobes_MoreData --plot-time 10 --store-data-time 1 --save-time 500 --duration 1000
# CONTINUE PREVIOUS SIMULATION A BIT LONGER IN THE SAME DIRECTORY
(mypy) user@computer: virtualmicrobes.py evo --load-file MyFirstMicrobes_MoreData/MyFirstMicrobes_MoreData_100.sav --duration 150
# CONTINUE PREVIOUS SIMULATION WITH A CHANGE IN THE RULES, AND IN A NEW DIRECTORY by giving it a new name)
(mypy) user@computer: virtualmicrobes.py --universal-mut-rate-scaling 0.0 evo --load-file MyFirstMicrobes_MoreData/MyFirstMicrobes_MoreData_500.sav --
name MyFirstMicrobes_MoreData_nomutations
# RUNNING A SHORT SIMULATION WITH MUCH MORE METABOLITES AND REACTIONS (mind you, this might get slower ;))
(mypy) user@computer: virtualmicrobes.py evo --nr-resource-classes 20 --nr-energy-classes 3 --nr-building-blocks 3 --name MySecondMicrobes --duration 150

What happens at initialisation?

When running Virtual Microbes with default options, it automatically generates:

  1. An artificial chemistry of all possible reactions. This is depicted by the blocks (metabolites) connected by lines (possible reactions)
  2. Generate one (or many) minimally viable microbe(s), with genes to catalyse a basic subset of the possible reactions (black lines) and importer proteins (not shown) to make BUILDING BLOCK and ENERGY.

The artificial chemistry defines all possible reactions within this “universe”, of which only a subset might be used by evolved Virtual Microbes (see figure below). Of course, this automatically generated chemistry will not allow a Virtual Microbe to make ENERGY or BUILDING BLOCKS out of thin air, which must instead be synthesised from one of the other metabolites. Which reactions they will evolve to use, is not specified, and we recommend using the webapplication to browse through the evolved metabolisms.

You might want to have more control over the exact reactions that our possible in your “universe”. For example, you might want to study a very specific metabolic pathway, or edit some details of the automatically generated universe.

The ‘environment’-file

The automatically generated artificial chemistry, influxes, and the size of the grid, are stored in ‘environment.env’ file, in the root of you simulation:

<molecules>
class=A,energy_level=3,has_building_block=True,is_energy=False
[name=a.0,energy_level=3,toxic_level=0,is_building_block=True,is_energy=False]
class=B,energy_level=4,has_building_block=False,is_energy=False
[name=b.0,energy_level=4,toxic_level=0.8432175308333292,is_building_block=False,is_energy=False]
class=C,energy_level=7,has_building_block=False,is_energy=False
[name=c.0,energy_level=7,toxic_level=0.3499051365912331,is_building_block=False,is_energy=False]
class=D,energy_level=3,has_building_block=False,is_energy=False
[name=d.0,energy_level=3,toxic_level=0.5702760189878372,is_building_block=False,is_energy=False]
class=E,energy_level=6,has_building_block=True,is_energy=False
[name=e.0,energy_level=6,toxic_level=0,is_building_block=True,is_energy=False]
class=F,energy_level=1,has_building_block=False,is_energy=True
[name=f.0,energy_level=1,toxic_level=0.5587038039135277,is_building_block=False,is_energy=True]
<conversion reactions>
1B -> 1F + 1A
1C -> 1F + 2D
1C -> 1F + 1E
1C -> 1F + 2A
1D -> 1A
1C -> 1A + 1D
1B -> 1A
1C + 1E -> 2B
1A + 1D + 1E -> 1B + 1C
1C + 1D -> 1B + 1E
1B + 1D -> 1A
1A + 2B -> 2D
1F + 2B + 1D -> 2E
1A -> 1D
<transport reaction>
1F -> 1C
1F -> 1B
<degradation rates>
a.0=0.001
b.0=0.0001
c.0=0.0001
d.0=0.0001
e.0=0.001
f.0=0.01
<membrane diffusion rates>
a.0=0.01
b.0=0.01
c.0=0.01
d.0=0.01
e.0=0.01
f.0=0.01
<grid>
rows=32,cols=32
subrows=1,subcols=1
influx0:c.0=3.90865033713e-05

This file can be modified, and used to start another simulation. For example, if one would like to run with a different BUILDING BLOCK, edit the molecules at the top. We will define a custom environment file later in this tutorial.

The ‘cell’-files

The fittest (living cell with most offspring) and/or oldest cells (living cells with highest age) are stored in data/best_dat/ every so many time points.

A ‘cell-file’ describes all currently transcribed genes and their concentrations (“proteins”), the genome (ordered list of the genes), molecule concentrations, cell properties such as volume, and all mutations that happened in this cell.

# This is a cell representation. Be careful to retain the structure in terms of brackets/spaces etc, as not every fallback is accounted for
<genes>
[id:16,concentration:0.07177105219677994,reaction:None],[gid:16, Prom_str:1.49998880629, operator:0001001000, bind_seq:0111011111, ligand_class:A, binding_coop:1, eff_apo:1.25527012589, eff_bound:1.63322868587, fixed_length:None, k_bind_op:1.12863677214, ligand_coop:1, ligand_ks:{a.0:3.14429022581}, sense_external:True, type:tf]
[id:13,concentration:0.11558786359938378,reaction:1F -> 1B],[gid:13, Prom_str:2.42727135252, operator:0100101010, ene_ks:{f.0:1.78288452557}, exporting:True, fixed_length:None, subs_ks:{b.0:1.70614950922}, type:pump, v_max:0.517984059077]
[id:32,concentration:0.03178361601446762,reaction:None],[gid:32, Prom_str:0.653746223737, operator:0100010001, bind_seq:1111110110, ligand_class:C, binding_coop:1, eff_apo:2.17124852652, eff_bound:0.495385070839, fixed_length:None, k_bind_op:2.52634926218, ligand_coop:1, ligand_ks:{c.0:0.650127721324}, sense_external:False, type:tf]
[id:1,concentration:0.01779497865343642,reaction:1C -> 1F + 1E],[gid:1, Prom_str:0.35770872454, operator:1011010111, fixed_length:None, subs_ks:{c.0:1.31795299488}, type:enz, v_max:0.657355385785]
[id:7,concentration:0.01726130313293958,reaction:1A + 1D + 1E -> 1B + 1C],[gid:7, Prom_str:0.346414703371, operator:0101111000, fixed_length:None, subs_ks:{a.0:2.36914385181 d.0:1.78389592066 e.0:0.406751591412}, type:enz, v_max:2.30400705474]
[id:10,concentration:0.04207267631695064,reaction:1F -> 1C],[gid:10, Prom_str:0.865740505459, operator:1011110110, ene_ks:{f.0:1.71167496734}, exporting:False, fixed_length:None, subs_ks:{c.0:1.51339942844}, type:pump, v_max:0.813978328587]
[id:24,concentration:0.08685815270368316,reaction:None],[gid:24, Prom_str:1.81927276432, operator:0001101110, bind_seq:1011011010, ligand_class:D, binding_coop:1, eff_apo:0.664429560405, eff_bound:0.735606560425, fixed_length:None, k_bind_op:0.470174808439, ligand_coop:1, ligand_ks:{d.0:2.00929359104}, sense_external:True, type:tf]
[id:4,concentration:0.037054533584920515,reaction:1C -> 1F + 2A],[gid:4, Prom_str:0.784918313181, operator:1011001010, fixed_length:None, subs_ks:{c.0:0.431468678876}, type:enz, v_max:0.332402878937]
[id:28,concentration:0.07945375599696886,reaction:None],[gid:28, Prom_str:1.66257565169, operator:0110011101, bind_seq:1010001111, ligand_class:E, binding_coop:1, eff_apo:0.964842208159, eff_bound:1.79529201596, fixed_length:None, k_bind_op:2.00817231376, ligand_coop:1, ligand_ks:{e.0:0.479277236038}, sense_external:True, type:tf]
[id:20,concentration:0.031244928427681642,reaction:None],[gid:20, Prom_str:0.642346133655, operator:0110110111, bind_seq:0101101100, ligand_class:F, binding_coop:1, eff_apo:1.29409368408, eff_bound:2.13558685373, fixed_length:None, k_bind_op:2.33844080856, ligand_coop:1, ligand_ks:{f.0:2.25908715911}, sense_external:True, type:tf]
<genome>
chrom0: 16 13 32 1 7 10 24 4 28 20
<molecule_concs>
a.0=2.8295616635054975e-12
b.0=9.903367038002808e-24
c.0=1.937138602330429e-09
d.0=9.903367038002812e-24
e.0=4.4193495408746124e-13
f.0=1.8563750205349677e-12
<cell_properties>
volume=1.0140699024991695
genome_size=10
raw_production=1.4213933774855818e-26
pos_production=1.2504822038489425e-24
raw_production_change_rate=0
toxicity=0.0
toxicity_change_rate=0
raw_death_rate=0.05
uptake_dna=1.0
alive=False
divided=False
wiped=False
iterage=0
lineage=0
time_birth=-1
unique_key=0
parent_key=0
version=2.8
<point_mutations> 0
<sequence_mutations> 0
<chromosomal_mutations> 0
<deletions> 0
<duplications> 0
<translocations> 0
<inversions> 0
<horizontal_transfer> 0
<gene_discoveries> 0

Since this cell is the initial clone, it has a time_birth of -1, and not a single mutation has happened. Like the environment file, this file can be modified and used to initialise a new simulation.

Custom initialisation – Building a simplified TCA-cycle

W.i.p.

Trouble? See trouble shooting in the quick install manual.