cobratoolbox icon indicating copy to clipboard operation
cobratoolbox copied to clipboard

A possible bug in selectGeneFromGPR function

Open Ojami opened this issue 5 years ago • 0 comments

Summary

mapExpressionToReactions.m uses selectGeneFromGPR to map expression values to reaction levels. It uses processed gene expression values from findUsedGenesLevels and assigns -1 for genes missing from the model.

Problem

Missing values (-1) interfere with mapping with minSum flag for AND rules:

if minSum
                    % This is an or rule, so we sum up all options.
                    curExpr = [curExpr, sum(gene_exp(geneID))];
                    gene_potential=[gene_potential, gene_names(geneID)'];
                    if geneSigFlag ~= 0 
                        curSig = [curSig, sum(gene_sig(geneID))]; 
                    end
                else

For instance if gene_exp(geneID) is a vector of [-1 -1 -1 3], -1 values cancell out 3.

Also, seems minSum flag doesn't take care of OR rules properly:

if minSum
            % in case of min sum these are and clauses that are combined, so its the minimum.
            [expressionCol(i), ID_min] = min(curExpr);
            gene_used{i}=gene_potential(ID_min);
            if ~isempty(curSig)
                signifCol(i) = curSig(ID_min); 
            end
        else
...

curExpr would be a vector in case of only OR rules for a reaction; therefore [expressionCol(i), ID_min] = min(curExpr); takes min among them (acting like an AND rule). I guess this was written for more complex situations (e.g. mixture of AND and ORs).

I hereby confirm that I have:

  • [X] Tried to solve the issue on my own
  • [X] Retried to run my code with the latest version of The COBRA Toolbox
  • [X] Checked that a similar issue has not already been opened

Ojami avatar Oct 09 '20 17:10 Ojami