Taxa knockouts

An interesting question concerning any given microbial community is how dependent the growth of one bacteria is one the presence of other bacteria. One strategy to answer that is to perform in silico knockouts for each individual taxa in a community and observe how this changes the growth rates of other bacteria. If the knowckout of one bacteria increases the growth of another one this indicates competitivity whereas a dimished growth rate indicted cooperativity. In order to get unique growth rate solutions we will again use cooperative tradeoff.

For large models as managed in micom running those knockouts can be challenging due to numerical problems and the tendency of the solvers to get stuck in a previous solutions. micom thus implements an optimized knockout algorithms that avoids numerical and solver issues as much as possible.

Still you should be aware that knockouts are computationally instensive due to the large numbers of quadratic and linear programming problems that have to be solved. For realistic communities with 10-500 taxa you should expect a full knockout experiment to take between 1 and 5 hours. Here we will perform the knockouts for our small E. coli example.

In [1]:
from micom import Community, data

tax = data.test_taxonomy()
com = Community(tax, solver="gurobi")

ko = com.knockout_species(fraction=1.0)
ko
100%|██████████| 5/5 [00:00<00:00,  5.91models/s]
100%|██████████| 5/5 [00:00<00:00, 23.65knockout(s)/s]
Out[1]:
compartments Escherichia_coli_1 Escherichia_coli_2 Escherichia_coli_3 Escherichia_coli_4 Escherichia_coli_5
Escherichia_coli_1 -0.873922 0.229162 0.229162 0.229162 0.229162
Escherichia_coli_2 0.229162 -0.873922 0.229162 0.229162 0.229162
Escherichia_coli_3 0.229162 0.229162 -0.873922 0.229162 0.229162
Escherichia_coli_4 0.229162 0.229162 0.229162 -0.873922 0.229162
Escherichia_coli_5 0.229162 0.229162 0.229162 0.229162 -0.873922

By default knockout_species returns the changes in growth rate meaning the difference between the growth rate after the knockout and the growth rate before. Rows denote the taxa that has been kncked out and columns the changes in growth rate. As we can see all knockouts increase the growth rates of the remaining E. coli strains in this example which makes sense since all of them compete for the same resources. Alternatively we can also just get the new growth rates after the knockout

In [2]:
com.knockout_species(fraction=1.0, method="raw")
100%|██████████| 5/5 [00:00<00:00, 23.00knockout(s)/s]
Out[2]:
compartments Escherichia_coli_1 Escherichia_coli_2 Escherichia_coli_3 Escherichia_coli_4 Escherichia_coli_5
Escherichia_coli_1 0.000000 1.103083 1.103083 1.103083 1.103083
Escherichia_coli_2 1.103083 0.000000 1.103083 1.103083 1.103083
Escherichia_coli_3 1.103083 1.103083 0.000000 1.103083 1.103083
Escherichia_coli_4 1.103083 1.103083 1.103083 0.000000 1.103083
Escherichia_coli_5 1.103083 1.103083 1.103083 1.103083 0.000000

…or the relative change ((new - old)/old):

In [3]:
com.knockout_species(fraction=1.0, method="relative change")
100%|██████████| 5/5 [00:00<00:00, 23.95knockout(s)/s]
Out[3]:
compartments Escherichia_coli_1 Escherichia_coli_2 Escherichia_coli_3 Escherichia_coli_4 Escherichia_coli_5
Escherichia_coli_1 -1.000000 0.262222 0.262222 0.262222 0.262222
Escherichia_coli_2 0.262222 -1.000000 0.262222 0.262222 0.262222
Escherichia_coli_3 0.262222 0.262222 -1.000000 0.262222 0.262222
Escherichia_coli_4 0.262222 0.262222 0.262222 -1.000000 0.262222
Escherichia_coli_5 0.262222 0.262222 0.262222 0.262222 -1.000000

In certain circumstances the diagonal entries can be confusing since the knocked out taxa always loses its entire growth. We can suppress the diagonal using the diag argument.

In [4]:
com.knockout_species(diag=False)
100%|██████████| 5/5 [00:00<00:00, 21.50knockout(s)/s]
Out[4]:
compartments Escherichia_coli_1 Escherichia_coli_2 Escherichia_coli_3 Escherichia_coli_4 Escherichia_coli_5
Escherichia_coli_1 NaN 0.229162 0.229162 0.229162 0.229162
Escherichia_coli_2 0.229162 NaN 0.229162 0.229162 0.229162
Escherichia_coli_3 0.229162 0.229162 NaN 0.229162 0.229162
Escherichia_coli_4 0.229162 0.229162 0.229162 NaN 0.229162
Escherichia_coli_5 0.229162 0.229162 0.229162 0.229162 NaN