Home > core > deleteUnusedGenes.m

deleteUnusedGenes

PURPOSE ^

deleteUnusedGenes

SYNOPSIS ^

function reducedModel=deleteUnusedGenes(model,verbose)

DESCRIPTION ^

 deleteUnusedGenes
   Deletes all genes that are not associated to any reaction

   model           a model structure
   verbose         0 for silent; 1 for printing number of deleted genes;
                   2 for printing the list of deleted genes (optional, default 1)

   reducedModel    an updated model structure

 Usage: reducedModel=deleteUnusedGenes(model)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function reducedModel=deleteUnusedGenes(model,verbose)
0002 % deleteUnusedGenes
0003 %   Deletes all genes that are not associated to any reaction
0004 %
0005 %   model           a model structure
0006 %   verbose         0 for silent; 1 for printing number of deleted genes;
0007 %                   2 for printing the list of deleted genes (optional, default 1)
0008 %
0009 %   reducedModel    an updated model structure
0010 %
0011 % Usage: reducedModel=deleteUnusedGenes(model)
0012 
0013 if nargin<2
0014     verbose=1;
0015 end
0016 reducedModel=model;
0017 
0018 %Find all genes that are not used
0019 [~, b]=find(reducedModel.rxnGeneMat);
0020 toKeep=false(numel(reducedModel.genes),1);
0021 toKeep(b)=true;
0022 
0023 switch verbose
0024     case 1
0025         disp('Number of unused genes removed from the model:')
0026         disp(numel(toKeep(~toKeep)))
0027     case 2
0028         disp('The following genes were removed from the model:')
0029         disp(reducedModel.genes(~toKeep))
0030     case 0
0031 end
0032         
0033 reducedModel.genes=reducedModel.genes(toKeep);
0034 reducedModel.rxnGeneMat=reducedModel.rxnGeneMat(:,toKeep);
0035 
0036 if isfield(reducedModel,'geneShortNames')
0037     reducedModel.geneShortNames=reducedModel.geneShortNames(toKeep);
0038 end
0039 
0040 if isfield(reducedModel,'proteins')
0041     reducedModel.proteins=reducedModel.proteins(toKeep);
0042 end
0043 
0044 if isfield(reducedModel,'geneMiriams')
0045     reducedModel.geneMiriams=reducedModel.geneMiriams(toKeep);
0046 end
0047 
0048 if isfield(reducedModel,'geneFrom')
0049     reducedModel.geneFrom=reducedModel.geneFrom(toKeep);
0050 end
0051 
0052 if isfield(reducedModel,'geneComps')
0053     reducedModel.geneComps=reducedModel.geneComps(toKeep);
0054 end
0055 end

Generated by m2html © 2005