SysBioChalmers / RAVEN

The RAVEN Toolbox for genome scale model reconstruction, curation and analysis.
http://sysbiochalmers.github.io/RAVEN/
Other
101 stars 52 forks source link

In checkRxn, output arrays canMake and canConsume are mixed #572

Open dimwas opened 2 days ago

dimwas commented 2 days ago

Description of the issue:

The function checkRxn produces a struct as a report. In it, 4 arrays are included: reactants, products, canMake and canConsume. Therefore canMake must has the same dimension as products, but now it has the same dimension as reactants. canConsume has the same dimension as products instead. There are no error messages. One can fix it by simply switching canMake and canConsume names.

Reproducing this issue:

Can be reproduced using 'yeastGEM_v9.0.0'. 'r_4041' is the biomass production reaction.

matlab
load('yeast-GEM.mat');
report=checkRxn(model,'r_4041');

Here, reactants is a 9x1 array, but canConsume is a 4x1 array. In the same time, products is a 4x1 array, and canMake is a 9x1 array.

System information

Installation type Advanced (via git) Installing from location F:\RAVEN Checking RAVEN release 2.10.1 You are running the latest RAVEN release Checking MATLAB release 2023a Checking system architecture win64 Set RAVEN in MATLAB path Pass Save MATLAB path Pass

=== Model import and export ===

Add Java paths for Excel format Pass Checking libSBML version 5.20.2 Checking model import and export Import Excel format Pass Export Excel format Pass Import SBML format Pass Export SBML format Pass Import YAML format Pass Export YAML format Pass

=== Model solvers ===

Checking for LP solvers glpk Pass gurobi Pass scip Fail cobra Pass Set RAVEN solver gurobi

=== Essential binary executables ===

Checking BLAST+ Pass Checking DIAMOND Pass Checking HMMER Pass

=== Compatibility ===

Checking function uniqueness Pass

checkInstallation complete

ans =

'2.10.1'

I hereby confirm that I have:

edkerk commented 2 days ago

Thank you for reporting this. The code is actually correct, although the documentation is not clear enough:

%   report
%       reactants   array with reactant indexes
%       canMake     boolean array, true if the corresponding reactant can
%                   be synthesized
%       products    array with product indexes
%       canConsume  boolean array, true if the corresponding reactant can
%                   be consumed

As you see, canMake refers to the metabolites in reactants, while canConsume refers to the metabolites in products. The dimensions are therefore correct. The names of these fields might be somewhat misleading though.

Take reactants, this contains the metabolites that are specified as substrates in the selected reaction (r_4041 in your example). canMake then specifies if the rest of the metabolic network can make these metabolites.

You likely interpreted canMake as "can-this-be-made-by-r_4041"? This would then indeed refer to the products of this reaction.

I propose to clarify this in the documentation as follows:

%   report
%       reactants   array with reactant indexes
%       canMake     boolean array, true if the corresponding reactant can
%                   be synthesized by the rest of the metabolic network
%       products    array with product indexes
%       canConsume  boolean array, true if the corresponding reactant can
%                   be consumed by the rest of the metabolic network
dimwas commented 2 days ago

You likely interpreted canMake as "can-this-be-made-by-r_4041"? This would then indeed refer to the products of this reaction.

Yes, you are correct. I thought it is natural to think so, because 'reactants' and 'products' are the terms related to the reaction in question. I think your suggestions regarding the documentation will clear the misunderstanding up; to be precisely specific, I would write:

%   report
%       reactants   array with reactant indexes
%       canMake     boolean array, true if the corresponding reactant can
%                   be synthesized by the rest of the metabolic network
%       products    array with product indexes
%       canConsume  boolean array, true if the corresponding **product** can
%                   be consumed by the rest of the metabolic network
edkerk commented 2 days ago

Ah, I missed that reactant/product in the last definition.