Home > src > geckomat > get_enzyme_data > copyECtoGEM.m

copyECtoGEM

PURPOSE ^

copyECtoGEM

SYNOPSIS ^

function ecModel = copyECtoGEM(ecModel, overwrite)

DESCRIPTION ^

 copyECtoGEM
   Copies EC numbers from ecModel.ec.eccodes to ecModel.eccodes.

 Input:
   ecModel     an ecModel in GECKO 3 format (with ecModel.ec structure)
   overwrite   logical that specifies if existing (non-empty) 
               ecModel.eccodes entries should be overwritten. Empty
               ecModel.eccodes entries are always overwritten if possible.
               default false.

 Output:
   ecModel     ecModel with populated model.eccodes

 Usage:
   ecModel = getECfromGEM(ecModel, overwrite)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ecModel = copyECtoGEM(ecModel, overwrite)
0002 % copyECtoGEM
0003 %   Copies EC numbers from ecModel.ec.eccodes to ecModel.eccodes.
0004 %
0005 % Input:
0006 %   ecModel     an ecModel in GECKO 3 format (with ecModel.ec structure)
0007 %   overwrite   logical that specifies if existing (non-empty)
0008 %               ecModel.eccodes entries should be overwritten. Empty
0009 %               ecModel.eccodes entries are always overwritten if possible.
0010 %               default false.
0011 %
0012 % Output:
0013 %   ecModel     ecModel with populated model.eccodes
0014 %
0015 % Usage:
0016 %   ecModel = getECfromGEM(ecModel, overwrite)
0017 
0018 if nargin < 2 || isempty(overwrite)
0019     overwrite = false;
0020 end
0021 if ~isfield(ecModel.ec,'eccodes')
0022     error('ecModel.ec.eccodes does not exist')
0023 end
0024 
0025 [a,b] = ismember(ecModel.rxns,ecModel.ec.rxns);
0026 if ~isfield(ecModel,'eccodes')
0027     ecModel.eccodes = cell(numel(ecModel.rxns),1);
0028 end
0029 
0030 if overwrite
0031     ecModel.eccodes(a) = ecModel.ec.eccodes(b(a));
0032 else % Only replace emptyEcCodes
0033     emptyEcCodes = cellfun(@isempty, ecModel.eccodes);
0034     a = a & emptyEcCodes;
0035     ecModel.eccodes(a) = ecModel.ec.eccodes(b(a));
0036 end
0037 end

Generated by m2html © 2005