Home > core > gapReport.m

gapReport

PURPOSE ^

gapReport

SYNOPSIS ^

function [noFluxRxns, noFluxRxnsRelaxed, subGraphs, notProducedMets, minToConnect,neededForProductionMat, canProduceWithoutInput, canConsumeWithoutOutput,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)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [noFluxRxns, noFluxRxnsRelaxed, subGraphs, notProducedMets, minToConnect,...
0002     neededForProductionMat, canProduceWithoutInput, canConsumeWithoutOutput, ...
0003     connectedFromTemplates, addedFromTemplates]=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 if nargin<2
0045     templateModels=[];
0046     connectedFromTemplates=[];
0047     addedFromTemplates=[];
0048 end
0049 
0050 fprintf(['Gap analysis for ' model.id ' - ' model.name '\n\n']);
0051 if isfield(model,'unconstrained')
0052     calculateINOUT=true;
0053     closedModel=model;
0054     model=simplifyModel(model);
0055 else
0056     canConsumeWithoutOutput={};
0057     canProduceWithoutInput={};
0058     calculateINOUT=false;
0059 end
0060 
0061 model2=model;
0062 model2.b=[model2.b inf(numel(model2.mets),1)];
0063 I=haveFlux(model);
0064 noFluxRxns=model.rxns(~I);
0065 J=haveFlux(model2);
0066 noFluxRxnsRelaxed=model2.rxns(~J);
0067 bModel=removeReactions(model,~I,true,true);
0068 cModel=removeReactions(model2,~J,true,true);
0069 fprintf('***Overview\n');
0070 fprintf([num2str(numel(model.rxns)-sum(I)) ' out of ' num2str(numel(model.rxns))...
0071     ' reactions cannot carry flux (' num2str(numel(model.rxns)-sum(J)) ' if net production of all metabolites is allowed)\n']);
0072 fprintf([num2str(numel(model.mets)-numel(bModel.mets)) ' out of ' num2str(numel(model.mets))...
0073     ' metabolites are unreachable (' num2str(numel(model.mets)-numel(cModel.mets)) ' if net production of all metabolites is allowed)\n']);
0074 
0075 fprintf('\n***Isolated subnetworks\n');
0076 subGraphs=getAllSubGraphs(model);
0077 fprintf(['A total of ' num2str(size(subGraphs,2)) ' isolated sub-networks are present in the model\n']);
0078 for i=1:size(subGraphs,2)
0079     fprintf(['\t' num2str(i) '. ' num2str(sum(subGraphs(:,i))) ' metabolites\n']);
0080 end
0081 
0082 fprintf('\n***Metabolite connectivity\n');
0083 [notProducedMets, ~, neededForProductionMat,minToConnect]=checkProduction(model,true,model.comps,false);
0084 fprintf(['To enable net production of all metabolites, a total of ' num2str(numel(minToConnect)) ' metabolites must be connected\n']);
0085 fprintf('Top 10 metabolites to connect:\n');
0086 for i=1:min(10,numel(minToConnect))
0087     fprintf(['\t' num2str(i) '. ' minToConnect{i} '\n']);
0088 end
0089 
0090 if calculateINOUT==true
0091     fprintf('\n***Mass balancing\n');
0092     produced=canProduce(closedModel);
0093     canProduceWithoutInput=closedModel.mets(produced);
0094     consumed=canConsume(closedModel);
0095     canConsumeWithoutOutput=closedModel.mets(consumed);
0096     fprintf([num2str(numel(canConsumeWithoutOutput)) ' metabolites could be consumed without any outputs\n' num2str(numel(canProduceWithoutInput)) ' metabolites could be produced without any inputs\n']);
0097 end
0098 
0099 if ~isempty(templateModels)
0100     fprintf('\n***Automated gap-filling\n');
0101     [connectedFromTemplates, ~, addedFromTemplates]=fillGaps(model,templateModels);
0102     t=templateModels{1}.id;
0103     for i=2:numel(templateModels)
0104         t=[t ', ' templateModels{i}.id];
0105     end
0106     fprintf([num2str(numel(connectedFromTemplates)) ' unconnected reactions can be connected by including ' num2str(numel(addedFromTemplates)) ' reactions from\n' t '\n']);
0107 end
0108 end

Generated by m2html © 2005