Home > src > geckomat > gather_kcats > readDLKcatOutput.m

readDLKcatOutput

PURPOSE ^

readDLKcatOutput

SYNOPSIS ^

function kcatList = readDLKcatOutput(model, outFile, modelAdapter)

DESCRIPTION ^

 readDLKcatOutput
   Reads the DLKcat output file and constructs a kcatList structure, that
   can be used by selectKcatValue() to populate the ecModel with kcat
   values.

 Input:
   model           an ecModel in GECKO 3 format (with ecModel.ec structure)
   outFile         name and path of the DLKcat output file. (Optional,
                   default is data/DLKcat.tsv from the obj.params.path
                   folder specified in the modelAdapter)
   modelAdapter    a loaded model adapter (Optional, will otherwise use the
                   default model adapter).

 Output:
   kcatList    structure array with list of DLKcat derived kcat values,
               with separate entries for each kcat value
               source      'DLKcat'           
               rxns        reaction identifiers
               genes       gene identifiers
               substrate   substrate names
               kcat        predicted kcat value in /sec

 Usage:
   kcatList = readDLKcatOutput(model, outFile, modelAdapter)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function kcatList = readDLKcatOutput(model, outFile, modelAdapter)
0002 % readDLKcatOutput
0003 %   Reads the DLKcat output file and constructs a kcatList structure, that
0004 %   can be used by selectKcatValue() to populate the ecModel with kcat
0005 %   values.
0006 %
0007 % Input:
0008 %   model           an ecModel in GECKO 3 format (with ecModel.ec structure)
0009 %   outFile         name and path of the DLKcat output file. (Optional,
0010 %                   default is data/DLKcat.tsv from the obj.params.path
0011 %                   folder specified in the modelAdapter)
0012 %   modelAdapter    a loaded model adapter (Optional, will otherwise use the
0013 %                   default model adapter).
0014 %
0015 % Output:
0016 %   kcatList    structure array with list of DLKcat derived kcat values,
0017 %               with separate entries for each kcat value
0018 %               source      'DLKcat'
0019 %               rxns        reaction identifiers
0020 %               genes       gene identifiers
0021 %               substrate   substrate names
0022 %               kcat        predicted kcat value in /sec
0023 %
0024 % Usage:
0025 %   kcatList = readDLKcatOutput(model, outFile, modelAdapter)
0026 
0027 if nargin < 3 || isempty(modelAdapter)
0028     modelAdapter = ModelAdapterManager.getDefault();
0029     if isempty(modelAdapter)
0030         error('Either send in a modelAdapter or set the default model adapter in the ModelAdapterManager.')
0031     end
0032 end
0033 params = modelAdapter.params;
0034 
0035 if nargin<2 || isempty(outFile)
0036     fID      = fopen(fullfile(params.path,'data','DLKcat.tsv'),'r');
0037 else
0038     fID      = fopen(outFile);
0039 end
0040 DLKcatOutput = textscan(fID,'%s %s %s %s %s %s','Delimiter','\t','HeaderLines',1);
0041 fclose(fID);
0042 
0043 % Check that DLKcat output file and model match (not fool proof, but good enough)
0044 [rxns, genes, subs, kcats] = deal(DLKcatOutput{[1,2,3,6]});
0045 
0046 % Check if it contains any kcat values
0047 if all(cellfun(@isempty,kcats)) || all(strcmpi(kcats,'NA'))
0048     error('DLKcat file does not contain any kcat values, please run runDLKcat() first.')
0049 end
0050 
0051 % Check that all substrates are in the model
0052 matchMets = ismember(subs,model.metNames);
0053 if ~all(matchMets)
0054     errorText = 'DLKcat was likely run with an input file that was generated from another ecModel, as the following substrates from DLKcat output cannot be found in model.metNames:';
0055     dispEM(errorText,true,subs(~matchMets),false)
0056 end
0057 
0058 % Check that all reactions are in model.ec.rxns
0059 matchRxns = ismember(rxns,model.ec.rxns);
0060 if ~all(matchRxns)
0061     errorText = 'DLKcat was likely run with an input file that was generated from another ecModel, as the following reactions from DLKcat output cannot be found in model.metNames:';
0062     dispEM(errorText,true,rxns(~matchRxns),false)
0063 end
0064 
0065 % Filter out entries with no numeric value
0066 noOutput        = cellfun(@isempty,regexpi(kcats,'[0-9]'));
0067 kcats           = str2double(kcats(~noOutput));
0068 rxns(noOutput)  = [];
0069 genes(noOutput) = [];
0070 subs(noOutput)  = [];
0071 
0072 % Make kcatList structure
0073 kcatList.source     = 'DLKcat';
0074 kcatList.rxns       = rxns;
0075 kcatList.genes      = genes;
0076 kcatList.substrates = subs;
0077 kcatList.kcats      = kcats;
0078 end

Generated by m2html © 2005