top of page

FBA with COBRA Toolbox

Flux Balance Analysis has a promising potential for systems biology studies. COBRA Toolbox has evolved as a strong tool for FBA and a lot of bugs and difficulties have been solved over the few years. I have listed below some of them that might prove useful to new users and save their time.

Installation

This site has quite nicely elaborated the steps of 'how to install COBRA Toolbox' for Matlab. Users with newer computers would probably look for the updated page, 'COBRA 2.0.5 on Matlab 64' to follow how to install newer versions of the toolbox on 64 bit architecture. I have personally followed the later one to successfully install the 2.0.6 version of the toolbox on Matlab 2014a on Windows 8.1. If you follow step-by-step instructions, it works perfectly well.

  • TranslateSBML might give some errors, if you are running the 'initCobraToolbox' command outside the COBRA installation directory. I got the follow error: Warning: 'TranslateSBML did not work with the test .xml file: Ecoli_core_ECOSAL.xml > In initCobraToolbox at 160'. Nothing to be worried about, since the 'initCobraToolbox' uses a current directory path. If you run the actual 'TranslateSBML' it should work perfectly.

Starting up

To avoid the need to run 'initCobraToolbox' each time you start Matlab, you may write a small script and save it as 'startup.m'. The file should be present in the Matlab start folder. To find this folder, just run 'pwd' when Matlab starts. This is 'C:\Users\Arnab\Documents\MATLAB' in my case. You may just include 'initCobraToolbox' in the 'startup.m' file and save it in that directory.

 

If you want to work in a different directory than the defualt Matlab directory, you can tell Matlab to automatically change to that working directory as soon as it starts. Just include 'cd('C:\Users\Arnab\Documents\working directory');' at the end of 'startup.m' file. Replace the full directory path with your working directory.

fastFVA

Recently I was using fluxVariability and I needed to run the program on a huge number of conditions. I realized it is taking a lot of time to execute. A nice alternative is the 'fastFVA' program published by Gudmundsson, et al. However, it is not that straight forward for dummies to just download the program and use it. I'll list the troubleshooting steps below.

If you just download the programa and navigate to the folder and run 'fastFVA(model,100,'max','glpk')' , you may get this error:

Invalid mex file ....\glpkFVAcc.mexw64: module not found

Or something similar. For this what you have to do is to generate the same glpkFVAcc.mexw64 file from the given glpkFVAcc.cpp file. How?

First, run the command that is given in the readme file:

mex -largeArrayDims -IC:\glpk-4.42\include\ glpkFVAcc.cpp C:\glpk-4.42\w64\glpk_4_42.lib

If you get error like, 'No compiler found' or something like that, then you have to install Windows SDK. Check in 'programs and features' if you already have installed copies of .NET 4.5 and/or Microsoft Visual Studio C++ 2010 SP1. If yes, then uninstall them first. If you have multiple copies of Visual studio C++ 2008, 2010, 2013, etc. Don't hesitate, uninstall all.

Then Install Windows SDK 7.1 (downloadable from here). Now also install Windows SDK 7.1 patch (downloadable from here). After that reinstall .NET framework 4.5 and Microsoft Visual Studio C++ 2010 SP1. These are freely available from Microsoft.

Second, install glpk for windows. Download winglpk-4.42 from here. Unzip the folder and put the resulting glpk-4.42 folder in C:\. Now navigate inside the glpk-4.42\w64 folder and copy the file glpk_4_42.dll. Paste it inside the fastFVA folder, wherever you have kept it.

Third, now run the same 'mex -...' command mentioned in first step. It should generate a fresh copy of glpkFVAcc.mexw64 and then the fastFVA command also should run as expected.

© 2015 by ARNAB ROY. Proudly created with Wix.com

    bottom of page