0001 function [noFluxRxns, noFluxRxnsRelaxed, subGraphs, notProducedMets, minToConnect,...
0002 neededForProductionMat, canProduceWithoutInput, canConsumeWithoutOutput, ...
0003 connectedFromTemplates, addedFromTemplates]=gapReport(model, templateModels)
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
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