Skip to content

7. Helper scripts

Ben Vezina edited this page Dec 8, 2022 · 1 revision

Helper scripts

Several helper scripts have been written to aid in metabolic modelling tasks and data processing, located in helper_scripts directory.


Improving metabolic model annotations

This script will improve the annotations and metadata tagging of metabolic model reactions and metabolites using a reference model of high quality. For most cases, this is the universal.json. For an updated universal.json compatible with modern releases of COBRApy, see here

Overview and process

  1. The script takes input directory containing metabolic model file/s and reference model file (model file formats: .xml, .json, .sbml)
  2. Convert model file to the .xml SBML v3.1 format
  3. Use the reference model and the universal model to improve the annotations of the input model
  4. MEMOTE reports will be generated for the pre- and post-annotation model files for comparison.

Quick start

python improve_model_annotations.py --models model_directory --reference reference/iWFL1372_iML1515_iYS1720.json

Dependancies

  • cobra=0.20.0
  • memote=0.13.0
  • urllib3=1.26.3
  • python=3.6

Installation

The best way to install this is to access the script this directory and run the script directly in command line.

# Create conda environment
conda create -y --name metabolic_model_env python=3.6.12

# Activate environment
conda activate metabolic_model_env

# Install dependancies
conda install -y -c bioconda cobra=0.20.0
conda install -y -c conda-forge urllib3
pip install memote==0.13.0

# Test script
python improve_model_annotations.py -h

Usage

improve_model_annotations.py [-h] -m MODELS -r REFERENCE [-y YA_NAME]

required arguments:
  -m MODELS, --models MODELS
                        Directory of model files to be annotated
  -r REFERENCE, --reference REFERENCE
                        Reference model file annotations will be copied from. Reference model provided (iWFL1372_iML1515_iYS1720.json). Can also use BiGG Universal model found
                        here: https://zenodo.org/record/6713279

optional arguments:
  -y YA_NAME, --ya_name YA_NAME
                        What is ya name?

Tips

The better the reference model you use, the better your model annotations will likely be. The iWFL1372_iML1515_iYS1720.json model is a merged model of iWFL1372, iML1515 and iYS1720, all of which are well-curated and have good model annotations. The universal.json model is another great choice.

Additional contributions not recorded by GitHub


Merge multiple FBA profiles into longtable format

This script takes a directory containing .tsv files from the Bactabolize fba command and merges them together into a longtable format for analysis in a program like R.

Overview and process

  1. The script takes input directory of growth profile files (file format: .tsv)
  2. Merges together with column header
  3. Outputs new file fba_profiles_merged_longtable.tsv

Quick start

bash merge_fba_profiles_longtable.sh -f fba_profiles_directory

Dependencies

  • unix environment with basename, dirname and getopts

Installation

The best way to install this is to access the script this directory and run the script directly in command line.

Usage

# bash merge_fba_profiles_longtable.sh [-h] -f fba_profiles_directory

Command line options:
    Required:
        -f          Directory containing FBA profiles outputted from Bactabolize's fba command. Files in .tsv format.
		
    Optional:
        -h          Print this help menu

Example:
	bash merge_fba_profiles_longtable.sh -f fba_profiles_directory

Convert SEED ID to BiGG ID in metabolic model

This script will do a string replace from "cpd00007" (SEED ID) to "o2" (BiGG ID) for oxygen so models can be initialised and FBA, single gene knockout analysis etc performed. ModelSEED and KBase models will not effectively run in Bactabolize. This is because it utilises the BiGG ID for oxygen (o2_c, o2_p and o2_e).

Overview and process

  1. The script takes input metabolic model file/s (model file formats: .xml, .json)
  2. String replace for SEED IDs incompatible with Bactabolize
  3. Outputs new file which can be used with Bactabolize's main functions

Quick start

bash SEED_to_BiGG_model_convert.sh -m input.xml

Dependencies

  • unix environment with basename, dirname and getopts

Installation

The best way to install this is to access the script this directory and run the script directly in command line.

Usage

bash SEED_to_BiGG_model_convert.sh [-h] -m model.xml

Command line options:
    Required:
        -m          Model file to be converted. Takes .xml or .json
		
    Optional:
        -h          Print this help menu

Example:
	bash SEED_to_BiGG_model_convert.sh -m model.xml
	bash SEED_to_BiGG_model_convert.sh -m model.json