0001
0002 function [KCATcell, SAcell] = loadBRENDAdata(modelAdapter)
0003
0004 if nargin < 1 || isempty(modelAdapter)
0005 modelAdapter = ModelAdapterManager.getDefault();
0006 if isempty(modelAdapter)
0007 error('Either send in a modelAdapter or set the default model adapter in the ModelAdapterManager.')
0008 end
0009 end
0010
0011 basePath = modelAdapter.getBrendaDBFolder();
0012 KCAT_file = fullfile(basePath,'max_KCAT.txt');
0013 SA_file = fullfile(basePath,'max_SA.txt');
0014 MW_file = fullfile(basePath,'max_MW.txt');
0015
0016
0017 KCATcell = openDataFile(KCAT_file,1);
0018 scalingFactor = 1/60;
0019 SA = openDataFile(SA_file,scalingFactor);
0020 scalingFactor = 1/1000;
0021 MW = openDataFile(MW_file,scalingFactor);
0022
0023 for i=1:4
0024 SAcell{i} = [];
0025 end
0026 previousEC = []; EC_indexes = [];
0027
0028
0029
0030 MWECNum = upper(unique(MW{1}));
0031 MWECNumIndices = cell(length(MWECNum),1);
0032 MWECNumHashMap = containers.Map(MWECNum,1:length(MWECNum));
0033 for i = 1:length(MW{1})
0034 matchInd = cell2mat(values(MWECNumHashMap, MW{1}(i)));
0035 MWECNumIndices{matchInd} = [MWECNumIndices{matchInd};i];
0036 end
0037
0038
0039 for i=1:length(SA{1})
0040
0041
0042 if ~strcmpi(SA{1}(i), previousEC)
0043 key = upper(SA{1}(i));
0044 if isKey(MWECNumHashMap,key)
0045 matchInd = cell2mat(values(MWECNumHashMap,key));
0046 EC_indexes = MWECNumIndices{matchInd};
0047 else
0048 EC_indexes = [];
0049 end
0050 end
0051 mwEC{1} = MW{3}(EC_indexes); mwEC{2} = MW{4}(EC_indexes);
0052
0053
0054 org_index = find(strcmpi(SA{3}(i),mwEC{1}),1);
0055 if ~isempty(org_index)
0056 SAcell{1} = [SAcell{1};SA{1}(i)];
0057 SAcell{2} = [SAcell{2};SA{3}(i)];
0058 SAcell{3} = [SAcell{3}; SA{4}(i)*mwEC{2}(org_index)];
0059 SAcell{4} = [SAcell{4}; mwEC{2}(org_index)];
0060 end
0061 previousEC = SA{1}(i);
0062 end
0063
0064
0065 if ~isempty(KCATcell{1})
0066 KCATcell{1} = extractAfter(KCATcell{1},2);
0067 end
0068 if ~isempty(SAcell{1})
0069 SAcell{1} = extractAfter(SAcell{1},2);
0070 end
0071
0072 function data_cell = openDataFile(fileName,scalingFactor)
0073 fID = fopen(fileName);
0074 data_cell = textscan(fID,'%q %q %q %f %q','delimiter','\t');
0075 fclose(fID);
0076 data_cell{4} = data_cell{4}*scalingFactor;
0077
0078
0079 data_cell{3} = regexprep(data_cell{3},'\/\/.*','');
0080 end
0081 end