File Exchange

image thumbnail


version (2.1 MB) by Joram Posma
A toolbox to interactively create, customize and explore multi-systemic metabolic reaction networks


Updated 05 Sep 2017

View Version History

View License

A Matlab-based tool to create custom sub-networks using main substrate-product pairs as defined by the Kyoto Encyclopaedia of Genes and Genomes (KEGG). It can be used to explore transgenomic interactions, for example mammalian and bacterial associations. It calculates the shortest path between a set of metabolites (e.g. biomarkers from a metabonomic study) and plots the connectivity between metabolites as links in a network graph. The resulting graph can be changed and explored interactively. Furthermore, nodes in the graph are linked to the KEGG compound webpage.
A multi-systemic example data set is provided of a supra-organism, this includes reactions that can occur in compartments of homo sapiens, firmicutes and/or bacretoidetes species. The MetaboGetworks function can be used to generate custom multi-organism databases to use in the MetaboNetworks function. (See the READ ME file)

Cite As

Joram Posma (2021). MetaboNetworks (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (11)


Hi!Is there a way to add a organism non included in the actual list?


Hi, this is a helpful tool, but the KEGG reactions are typically directed. The adjacency matrix your tool creates is symmetric. is there a way to get directed edges?

Joram Posma

Hi Arman,

K is a list of KEGG IDs corresponding to each row/column in A.
You can find the names (there can be multiple per KEGG ID) by looking into N, C and I.

Hope this helps.

Arman MK

Thanks a lot for your help. For E.Coli I found a large matrix of approximately 18000 by 18000. How the rows and columns are labeled by metabolites?

Thanks again

Joram Posma

Hi Arman,

Use MetaboGetworks to get the database for the organism you are interested in, then look in the saved database file for the variable 'A' to get the metabolite-metabolite adjacency matrix.

If you are specifically looking for 'static pathways' that are connected to other 'static pathways' (e.g. glycolysis/glucogenesis and sucrose/starch) MetaboNetworks/MetaboGetworks will not give you that as it does not use 'pathways' but looks at the whole metabolic network. If this IS what you want to do, I recommend you to look at the KEGG REST-API help pages, it will show you how to get entries for a pathway, in this you will also find the 'pathways' that are linked to it. Good luck!

Arman MK

Thanks a lot for this great toolbox.
I have a question. I need to access the adjacency matrix for all the KEGG pathways for an organism. I need the matrix itself, so I can perform some other functions on it. How can I extract the adjacency matrix from your code.

Thank You,

Joram Posma

Hi Xiaoqiang,

I believe we have solved your problem via email exchange. So this is for any other people encountering the same problem:

This issue has to do with the number of metabolites in KEGG, this is different in the example data (generated in Feb 2014) compared to data now. All metabolites are always included in the database/adjacency matrix (currently >17000 total). Thus creating a distance matrix results in a matrix the same size as the adjacency matrix (with a lot of metabolites at infinite distance to each other as they are unconnected). One solution is to remove all metabolites that are unconnected, e.g. using:

>> ii=full(sum(A)==0);
>> jj=ismember(C,K(ii));
>> A(ii,:)=[];
>> A(:,ii)=[];
>> K(ii)=[];
>> C(jj)=[];
>> I(jj)=[];
>> N(jj)=[];
>> [~,~,I]=unique(I);
>> save('database_new.mat','A','K','C','E','I','N');

xu xiaoqiang

it's a great work about the MetaboNetworks; but I have problems with MetaboNetworks function in matlab2014a;after I creat an database using MetaboGetworks(so far is good),I always have the same problem using the MetaboNetworks: out of memorry(I just use the human species database(616KB) and run in 4G memorry PC with 2 metabolite);however when I use example database(14505KB),it's ok!; Is any bugs in creating database using MetaboGetworks(I follow the guide line step by step)?

Joram Posma

Hi Marco,

I have updated the code that should resolve the error you got. It is caused by a naming ambiguity in KEGG of a newly added species.

I ran some checks and it works here in 2014a, hope it does for you as well.


It's a very good tool, but I have some problems with the MetaboGetworks function.I get an error message when I run MetaboGetworks. I would be very thankful if you could consider my problem.
The rest of tool run good. I'm using the Matlab version 2014a.
Below the error message:

EDU>> MetaboGetworks

Index exceeds matrix dimensions.

Error in OrganismFindGUI>OrganismFindGUI_OpeningFcn (line 48)

Error in gui_mainfcn (line 220)
feval(gui_State.gui_OpeningFcn, gui_hFigure, [], guidata(gui_hFigure), varargin{:});

Error in OrganismFindGUI (line 15)
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});

Error in MetaboGetworks (line 9)



MATLAB Release Compatibility
Created with R2014a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired by: MatlabBGL

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!