0001 function kcatList = readDLKcatOutput(model, outFile, modelAdapter)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
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
0044 [rxns, genes, subs, kcats] = deal(DLKcatOutput{[1,2,3,6]});
0045
0046
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
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
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
0066 noOutput = cellfun(@isempty,regexpi(kcats,'[0-9]'));
0067 kcats = str2double(kcats(~noOutput));
0068 rxns(noOutput) = [];
0069 genes(noOutput) = [];
0070 subs(noOutput) = [];
0071
0072
0073 kcatList.source = 'DLKcat';
0074 kcatList.rxns = rxns;
0075 kcatList.genes = genes;
0076 kcatList.substrates = subs;
0077 kcatList.kcats = kcats;
0078 end