This program exports a metabolic reaction network to a file suitable for flux balance analysis..

🔙 To the main page of anvi’o programs and artifacts.


Can consume

contigs-db reaction-network

Can provide



This program exports a metabolic reaction-network from a contigs-db OR a pan-db and genomes-storage-db to a reaction-network-json file formatted for flux balance analysis.

The required input to this program is a contigs-db OR a pan-db in which a reaction-network has been stored by anvi-reaction-network. The pan-db must be accompanied by a genomes-storage-db input.

The reaction-network-json file output contains sections on the metabolites, reactions, and genes (or gene clusters) constituting the reaction-network that had been predicted from the genome (or pangenome). An “objective function” representing the biomass composition of metabolites in the “core metabolism” of E. coli is automatically added as the first entry in the “reactions” section of the file and can be deleted as needed. An objective function is needed for flux balance analysis.


anvi-get-metabolic-model-file requires a contigs-db OR a pan-db and genomes-storage-db as input, plus the path to an output reaction-network-json file.

anvi-get-metabolic-model-file -c /path/to/contigs-db \ -o /path/to/ouput.json

anvi-get-metabolic-model-file -p /path/to/pan-db \ -g /path/to/genomes-storage-db \ -o /path/to/output.json

An existing file at the target output location must be explicitly overwritten with the flag, --overwrite-output-destinations.

anvi-get-metabolic-model-file -c /path/to/contigs-db \ -o /path/to/output.json \ --overwrite-output-destinations

The flag, --remove-missing-objective-metabolites must be used to remove metabolites in the E. coli core biomass objective function from the reaction-network-json file if the metabolites are not produced or consumed by the predicted reaction-network. COBRApy, for instance, cannot load the JSON file if metabolites in the objective function are missing from the model.

anvi-get-metabolic-model-file -c /path/to/contigs-db \ -o /path/to/output.json \ --remove-missing-objective-metabolites

It is possible that the gene KO annotations used to construct the stored reaction network have since been changed in the contigs-db or the genomes-storage-db. By default, without using the flag, --ignore-changed-gene-annotations, this program checks that the set of gene KO annotations that is currently stored was also that used in construction of the reaction-network, and raises an error if this is not the case. Use of this flag ignores that check, permitting the set of gene annotations to have changed since creation of the network.

anvi-get-metabolic-model-file -p /path/to/contigs-db \ -o /path/to/output.json \ --ignore-changed-gene-annotations

For a pangenomic network, the option --record-genomes determines which additional information is added to the output reaction-network-json file regarding genome membership. By default, genome names are recorded for gene clusters and reactions, which is equivalent to --record-genomes cluster reaction. ‘cluster’ records in the ‘notes’ section of each ‘gene’ (cluster) entry in the JSON file which genomes are part of the cluster. ‘reaction’ and ‘metabolite’, respectively, record the genomes predicted to encode enzymes associated with reaction and metabolite entries. The arguments, ‘cluster’, ‘reaction’, and ‘metabolite’, are valid, and are all used in the following example.

anvi-get-metabolic-model-file -p /path/to/pan-db \ -g /path/to/genomes-storage-db \ --record-genomes cluster reaction metabolite

The use of --record-genomes as a flag without any arguments prevents genome membership from being recorded at all in the reaction-network-json file.

anvi-get-metabolic-model-file -p /path/to/pan-db \ -g /path/to/genomes-storage-db \ --record-genomes

Edit this file to update this information.

Additional Resources

Are you aware of resources that may help users better understand the utility of this program? Please feel free to edit this file on GitHub. If you are not sure how to do that, find the __resources__ tag in this file to see an example.