Home > RAVEN > gapReport.m

gapReport

PURPOSE ^

gapReport

SYNOPSIS ^

function [noFluxRxns noFluxRxnsRelaxed subGraphs notProducedMets minToConnectneededForProductionMat connectedFromTemplates addedFromTemplates]=gapReport(model, templateModels)

DESCRIPTION ^

 gapReport
   Performs a gap analysis and summarizes the results 

   model                       a model structure
   templateModels              a cell array of template models to use for
                               gap filling (opt)

   noFluxRxns                  cell array with reactions that cannot carry
                               flux
   noFluxRxnsRelaxed           cell array with reactions that cannot carry
                               flux even if the mass balance constraint is 
                               relaxed so that it is allowed to have 
                               net production of all metabolites
   subGraphs                   structure with the metabolites in each of
                               the isolated sub networks
   notProducedMets             cell array with the metabolites that
                               couldn't have net production
   minToConnect                structure with the minimal number of
                               metabolites that need to be connected in 
                               order to be able to produce all other 
                               metabolites and which metabolites each of
                               them connects
   neededForProductionMat      matrix where n x m is true if metabolite n
                               allows for production of metabolite m
   canProduceWithoutInput      cell array with metabolites that could be
                               produced even when there is no input to the
                               model
   canConsumeWithoutOutput     cell array with metabolites that could be
                               consumed even when there is no output from
                               the model
   connectedFromTemplates      cell array with the reactions that could be
                               connected using the template models
   addedFromTemplates          structure with the reactions that were
                               added from the template models and which 
                               model they were added from

   Usage: [noFluxRxns noFluxRxnsRelaxed subGraphs notProducedMets minToConnect...
    neededForProductionMat connectedFromTemplates addedFromTemplates]=...
    gapReport(model, templateModels)

   Rasmus Agren, 2012-10-06

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [noFluxRxns noFluxRxnsRelaxed subGraphs notProducedMets minToConnect...
0002     neededForProductionMat connectedFromTemplates addedFromTemplates]=...
0003     gapReport(model, templateModels)
0004 % gapReport
0005 %   Performs a gap analysis and summarizes the results
0006 %
0007 %   model                       a model structure
0008 %   templateModels              a cell array of template models to use for
0009 %                               gap filling (opt)
0010 %
0011 %   noFluxRxns                  cell array with reactions that cannot carry
0012 %                               flux
0013 %   noFluxRxnsRelaxed           cell array with reactions that cannot carry
0014 %                               flux even if the mass balance constraint is
0015 %                               relaxed so that it is allowed to have
0016 %                               net production of all metabolites
0017 %   subGraphs                   structure with the metabolites in each of
0018 %                               the isolated sub networks
0019 %   notProducedMets             cell array with the metabolites that
0020 %                               couldn't have net production
0021 %   minToConnect                structure with the minimal number of
0022 %                               metabolites that need to be connected in
0023 %                               order to be able to produce all other
0024 %                               metabolites and which metabolites each of
0025 %                               them connects
0026 %   neededForProductionMat      matrix where n x m is true if metabolite n
0027 %                               allows for production of metabolite m
0028 %   canProduceWithoutInput      cell array with metabolites that could be
0029 %                               produced even when there is no input to the
0030 %                               model
0031 %   canConsumeWithoutOutput     cell array with metabolites that could be
0032 %                               consumed even when there is no output from
0033 %                               the model
0034 %   connectedFromTemplates      cell array with the reactions that could be
0035 %                               connected using the template models
0036 %   addedFromTemplates          structure with the reactions that were
0037 %                               added from the template models and which
0038 %                               model they were added from
0039 %
0040 %   Usage: [noFluxRxns noFluxRxnsRelaxed subGraphs notProducedMets minToConnect...
0041 %    neededForProductionMat connectedFromTemplates addedFromTemplates]=...
0042 %    gapReport(model, templateModels)
0043 %
0044 %   Rasmus Agren, 2012-10-06
0045 %
0046 
0047 if nargin<2
0048     templateModels=[];
0049     connectedFromTemplates=[];
0050     addedFromTemplates=[];
0051 end
0052 
0053 fprintf(['Gap analysis for ' model.id ' - ' model.description '\n\n']);
0054 if isfield(model,'unconstrained')
0055     calculateINOUT=true;
0056     closedModel=model;
0057     model=simplifyModel(model);
0058 else
0059     canConsumeWithoutOutput={};
0060     canProduceWithoutInput={};
0061     calculateINOUT=false;
0062 end
0063 
0064 model2=model;
0065 model2.b=[model2.b inf(numel(model2.mets),1)];
0066 I=haveFlux(model);
0067 noFluxRxns=model.rxns(~I);
0068 J=haveFlux(model2);
0069 noFluxRxnsRelaxed=model2.rxns(~J);
0070 bModel=removeRxns(model,~I,true,true);
0071 cModel=removeRxns(model2,~J,true,true);
0072 fprintf('***Overview\n');
0073 fprintf([num2str(numel(model.rxns)-sum(I)) ' out of ' num2str(numel(model.rxns))...
0074     ' reactions cannot carry flux (' num2str(numel(model.rxns)-sum(J)) ' if net production of all metabolites is allowed)\n']);
0075 fprintf([num2str(numel(model.mets)-numel(bModel.mets)) ' out of ' num2str(numel(model.mets))...
0076     ' metabolites are unreachable (' num2str(numel(model.mets)-numel(cModel.mets)) ' if net production of all metabolites is allowed)\n']);
0077 
0078 fprintf('\n***Isolated subnetworks\n');
0079 subGraphs=getAllSubGraphs(model);
0080 fprintf(['A total of ' num2str(numel(subGraphs)) ' isolated sub-networks are present in the model\n']);
0081 for i=1:numel(subGraphs)
0082    fprintf(['\t' num2str(i) '. ' num2str(numel(subGraphs{i})) ' metabolites\n']); 
0083 end
0084 
0085 fprintf('\n***Metabolite connectivity\n');
0086 [notProducedMets, crap, neededForProductionMat,minToConnect]=checkProduction(model,true,model.comps,false);
0087 fprintf(['To enable net production of all metabolites, a total of ' num2str(numel(minToConnect)) ' metabolites must be connected\n']);
0088 fprintf('Top 10 metabolites to connect:\n');
0089 for i=1:min(10,numel(minToConnect))
0090    fprintf(['\t' num2str(i) '. ' minToConnect{i} '\n']); 
0091 end
0092 
0093 if calculateINOUT==true
0094     fprintf('\n***Mass balancing\n');
0095     produced=canProduce(closedModel);
0096     canProduceWithoutInput=closedModel.mets(produced);
0097     consumed=canConsume(closedModel);
0098     canConsumeWithoutOutput=closedModel.mets(consumed);
0099     fprintf([num2str(numel(canConsumeWithoutOutput)) ' metabolites could be consumed without any outputs\n' num2str(numel(canProduceWithoutInput)) ' metabolites could be produced without any inputs\n']);
0100 end
0101 
0102 if ~isempty(templateModels)
0103     fprintf('\n***Automated gap-filling\n');
0104     [connectedFromTemplates crap addedFromTemplates]=fillGaps(model,templateModels);
0105     t=templateModels{1}.id;
0106     for i=2:numel(templateModels)
0107         t=[t ', ' templateModels{i}.id];
0108     end
0109     fprintf([num2str(numel(connectedFromTemplates)) ' unconnected reactions can be connected by including ' num2str(numel(addedFromTemplates)) ' reactions from\n' t '\n']);
0110 end
0111 end

Generated on Tue 23-Apr-2013 15:18:37 by m2html © 2005