diff --git a/doc/src/geckomat/gather_kcats/fuzzyKcatMatching.html b/doc/src/geckomat/gather_kcats/fuzzyKcatMatching.html
index 12670628..86e8db83 100644
--- a/doc/src/geckomat/gather_kcats/fuzzyKcatMatching.html
+++ b/doc/src/geckomat/gather_kcats/fuzzyKcatMatching.html
@@ -197,430 +197,415 @@
SOURCE CODE find_inKEGG(org_name,phylDistStruct.names);
0103
0104
-0105 phylDistStruct.genus = cell(length(phylDistStruct.names),1);
-0106 for i = 1:length(phylDistStruct.genus)
-0107 name = phylDistStruct.names{i};
-0108 phylDistStruct.genus{i} = lower(name(1:(strfind(name,' ')-1)));
-0109 end
-0110
-0111 phylDistStruct.uniqueGenusList = unique(phylDistStruct.genus);
-0112 phylDistStruct.genusHashMap = containers.Map(phylDistStruct.uniqueGenusList,1:length(phylDistStruct.uniqueGenusList));
-0113 phylDistStruct.uniqueGenusIndices = cell(length(phylDistStruct.uniqueGenusList),1);
-0114
-0115
-0116 for i = 1:length(phylDistStruct.genus)
-0117 matchInd = cell2mat(values(phylDistStruct.genusHashMap,phylDistStruct.genus(i)));
-0118 phylDistStruct.uniqueGenusIndices{matchInd} = [phylDistStruct.uniqueGenusIndices{matchInd};i];
-0119 end
+0105 phylDistStruct.genus = lower(regexprep(phylDistStruct.names,'\s.*',''));
+0106
+0107 phylDistStruct.uniqueGenusList = unique(phylDistStruct.genus);
+0108 phylDistStruct.genusHashMap = containers.Map(phylDistStruct.uniqueGenusList,1:length(phylDistStruct.uniqueGenusList));
+0109 phylDistStruct.uniqueGenusIndices = cell(length(phylDistStruct.uniqueGenusList),1);
+0110
+0111
+0112 for i = 1:length(phylDistStruct.genus)
+0113 matchInd = cell2mat(values(phylDistStruct.genusHashMap,phylDistStruct.genus(i)));
+0114 phylDistStruct.uniqueGenusIndices{matchInd} = [phylDistStruct.uniqueGenusIndices{matchInd};i];
+0115 end
+0116
+0117
+0118 kcats = zeros(length(eccodes),1);
+0119 mM = length(eccodes);
0120
-0121
-0122 kcats = zeros(length(eccodes),1);
-0123 mM = length(eccodes);
-0124
-0125
-0126
-0127
-0128 kcatInfo.info.org_s = zeros(mM,1);
-0129 kcatInfo.info.rest_s = zeros(mM,1);
-0130 kcatInfo.info.org_ns = zeros(mM,1);
-0131 kcatInfo.info.rest_ns = zeros(mM,1);
-0132 kcatInfo.info.org_sa = zeros(mM,1);
-0133 kcatInfo.info.rest_sa = zeros(mM,1);
-0134 kcatInfo.info.wcLevel = NaN(mM,1);
-0135 kcatInfo.stats.queries = 0;
-0136 kcatInfo.stats.org_s = 0;
-0137 kcatInfo.stats.rest_s = 0;
-0138 kcatInfo.stats.org_ns = 0;
-0139 kcatInfo.stats.rest_ns = 0;
-0140 kcatInfo.stats.org_sa = 0;
-0141 kcatInfo.stats.rest_sa = 0;
-0142 kcatInfo.stats.wc0 = 0;
-0143 kcatInfo.stats.wc1 = 0;
-0144 kcatInfo.stats.wc2 = 0;
-0145 kcatInfo.stats.wc3 = 0;
-0146 kcatInfo.stats.wc4 = 0;
-0147 kcatInfo.stats.matrix = zeros(6,5);
-0148
-0149
-0150
-0151
-0152
-0153 [ECIndexIds,~,ic] = unique(KCATcell{1});
-0154 EcIndexIndices = cell(length(ECIndexIds),1);
-0155 for i = 1:length(EcIndexIndices)
-0156 EcIndexIndices{i} = find(ic == i).';
-0157 end
-0158
-0159
-0160 while forceWClvl > 0
-0161 eccodes=regexprep(eccodes,'(.)*(\.\d+)(\.-)*$','$1\.-$3');
-0162 forceWClvl = forceWClvl - 1;
-0163 end
-0164 if forceWClvl == 1
-0165 eccodes = regexprep(eccodes,'.*','-\.-\.-\.-');
-0166 end
-0167
-0168 progressbar('Gathering kcat values by fuzzy matching to BRENDA database')
-0169
-0170 for i = 1:mM
-0171
-0172 EC = eccodes{i};
-0173 if ~isempty(EC)
-0174 EC = strsplit(EC,';');
-0175
-0176 if ~isempty(substrates{i})
-0177 [kcats(i), kcatInfo.info,kcatInfo.stats] = iterativeMatch(EC,substrates{i},substrCoeffs{i},i,KCATcell,...
-0178 kcatInfo.info,kcatInfo.stats,org_name,...
-0179 phylDistStruct,org_index,SAcell,ECIndexIds,EcIndexIndices);
-0180 end
-0181 end
-0182 progressbar(i/mM)
-0183 end
-0184
-0185 kcatList.source = 'brenda';
-0186 kcatList.rxns = model.ec.rxns(ecRxns);
-0187 kcatList.substrates = substrates;
-0188 kcatList.kcats = kcats;
-0189 kcatList.eccodes = eccodes;
-0190 kcatList.wildcardLvl = kcatInfo.info.wcLevel;
-0191 kcatList.origin = NaN(numel(model.ec.rxns(ecRxns)),1);
-0192
-0193
-0194 origin = [kcatInfo.info.org_s kcatInfo.info.rest_s kcatInfo.info.org_ns kcatInfo.info.rest_ns kcatInfo.info.org_sa kcatInfo.info.rest_sa];
-0195 for i=1:6
-0196 kcatList.origin(find(origin(:,i))) = i;
-0197 end
-0198 end
-0199
-0200 function [kcat,dir,tot] =iterativeMatch(EC,subs,substrCoeff,i,KCATcell,dir,tot,...
-0201 name,phylDist,org_index,SAcell,ECIndexIds,EcIndexIndices)
-0202
-0203
-0204
-0205 kcat = zeros(size(EC));
-0206 origin = zeros(size(EC));
-0207 matches = zeros(size(EC));
-0208 wc_num = ones(size(EC)).*1000;
-0209 for k = 1:length(EC)
-0210 success = false;
-0211 while ~success
-0212
-0213 [kcat(k),origin(k),matches(k)] = mainMatch(EC{k},subs,substrCoeff,KCATcell,...
-0214 name,phylDist,...
-0215 org_index,SAcell,ECIndexIds,EcIndexIndices);
-0216
-0217
-0218 if origin(k) > 0
-0219 success = true;
-0220 wc_num(k) = sum(EC{k}=='-');
-0221 else
-0222 dot_pos = [2 strfind(EC{k},'.')];
-0223 wild_num = sum(EC{k}=='-');
-0224 wc_text = '-.-.-.-';
-0225 EC{k} = [EC{k}(1:dot_pos(4-wild_num)) wc_text(1:2*wild_num+1)];
-0226 end
-0227 end
-0228 end
-0229
-0230 if sum(origin) > 0
-0231
-0232
-0233 best_pos = (wc_num == min(wc_num));
-0234 new_origin = origin(best_pos);
-0235 best_pos = (origin == min(new_origin(new_origin~=0)));
-0236 max_pos = find(kcat == max(kcat(best_pos)));
-0237 wc_num = wc_num(max_pos(1));
-0238 origin = origin(max_pos(1));
-0239 matches = matches(max_pos(1));
-0240 kcat = kcat(max_pos(1));
-0241
-0242
-0243 dir.org_s(i) = matches*(origin == 1);
-0244 dir.rest_s(i) = matches*(origin == 2);
-0245 dir.org_ns(i) = matches*(origin == 3);
-0246 dir.org_sa(i) = matches*(origin == 4);
-0247 dir.rest_ns(i) = matches*(origin == 5);
-0248 dir.rest_sa(i) = matches*(origin == 6);
-0249 dir.wcLevel(i) = wc_num;
-0250 tot.org_s = tot.org_s + (origin == 1);
-0251 tot.rest_s = tot.rest_s + (origin == 2);
-0252 tot.org_ns = tot.org_ns + (origin == 3);
-0253 tot.org_sa = tot.org_sa + (origin == 4);
-0254 tot.rest_ns = tot.rest_ns + (origin == 5);
-0255 tot.rest_sa = tot.rest_sa + (origin == 6);
-0256 tot.wc0 = tot.wc0 + (wc_num == 0);
-0257 tot.wc1 = tot.wc1 + (wc_num == 1);
-0258 tot.wc2 = tot.wc2 + (wc_num == 2);
-0259 tot.wc3 = tot.wc3 + (wc_num == 3);
-0260 tot.wc4 = tot.wc4 + (wc_num == 4);
-0261 tot.queries = tot.queries + 1;
-0262 tot.matrix(origin,wc_num+1) = tot.matrix(origin,wc_num+1) + 1;
-0263 end
-0264
-0265 end
-0266
-0267
-0268 function [kcat,origin,matches] = mainMatch(EC,subs,substrCoeff,KCATcell,...
-0269 name,phylDist,org_index,SAcell,ECIndexIds,EcIndexIndices)
-0270
-0271
-0272
-0273
-0274 wild = false;
-0275 wild_pos = strfind(EC,'-');
-0276 if ~isempty(wild_pos)
-0277 EC = EC(1:wild_pos(1)-1);
-0278 wild = true;
-0279 end
-0280 stringMatchesEC_cell = extract_string_matches(EC,KCATcell{1},wild,ECIndexIds,EcIndexIndices);
-0281
-0282
-0283
-0284
-0285 origin = 0;
-0286
-0287 [kcat,matches] = matchKcat(EC,subs,substrCoeff,KCATcell,name,true,false,...
-0288 phylDist,org_index,SAcell,stringMatchesEC_cell,[]);
-0289 if matches > 0 && ~wild
-0290 origin = 1;
-0291
-0292 else
-0293 [kcat,matches] = matchKcat(EC,subs,substrCoeff,KCATcell,'',true,false,...
-0294 phylDist,org_index,SAcell,stringMatchesEC_cell,[]);
-0295 if matches > 0 && ~wild
-0296 origin = 2;
-0297
-0298 else
-0299 [kcat,matches] = matchKcat(EC,subs,substrCoeff,KCATcell,name,false,false,...
-0300 phylDist,org_index,SAcell,stringMatchesEC_cell,[]);
-0301 if matches > 0
-0302 origin = 3;
-0303
-0304 else
-0305
-0306 stringMatchesSA = extract_string_matches(EC,SAcell{1},wild,[],[]);
-0307
-0308 [kcat,matches] = matchKcat(EC,subs,substrCoeff,KCATcell,name,false,...
-0309 true,phylDist,org_index,...
-0310 SAcell,stringMatchesEC_cell,stringMatchesSA);
-0311 if matches > 0
-0312 origin = 4;
-0313
-0314 else
-0315 [kcat,matches] = matchKcat(EC,subs,substrCoeff,KCATcell,'',false,...
-0316 false,phylDist,...
-0317 org_index,SAcell,stringMatchesEC_cell,stringMatchesSA);
-0318 if matches > 0
-0319 origin = 5;
-0320
-0321 else
-0322 [kcat,matches] = matchKcat(EC,subs,substrCoeff,KCATcell,'',...
-0323 false,true,phylDist,...
-0324 org_index,SAcell,stringMatchesEC_cell,stringMatchesSA);
-0325 if matches > 0
-0326 origin = 6;
-0327 end
-0328 end
-0329
-0330 end
-0331 end
-0332 end
-0333 end
-0334 end
-0335
-0336 function [kcat,matches] = matchKcat(EC,subs,substrCoeff,KCATcell,organism,...
-0337 substrate,SA,phylDist,...
-0338 org_index,SAcell,KCATcellMatches,SAcellMatches)
-0339
-0340
-0341
-0342 kcat = [];
-0343 matches = 0;
-0344
-0345 if SA
-0346
-0347 EC_indexes = extract_indexes(SAcellMatches,[],SAcell{2},subs,substrate,...
-0348 organism,org_index,phylDist);
+0121
+0122
+0123
+0124 kcatInfo.info.org_s = zeros(mM,1);
+0125 kcatInfo.info.rest_s = zeros(mM,1);
+0126 kcatInfo.info.org_ns = zeros(mM,1);
+0127 kcatInfo.info.rest_ns = zeros(mM,1);
+0128 kcatInfo.info.org_sa = zeros(mM,1);
+0129 kcatInfo.info.rest_sa = zeros(mM,1);
+0130 kcatInfo.info.wcLevel = NaN(mM,1);
+0131 kcatInfo.stats.queries = 0;
+0132 kcatInfo.stats.org_s = 0;
+0133 kcatInfo.stats.rest_s = 0;
+0134 kcatInfo.stats.org_ns = 0;
+0135 kcatInfo.stats.rest_ns = 0;
+0136 kcatInfo.stats.org_sa = 0;
+0137 kcatInfo.stats.rest_sa = 0;
+0138 kcatInfo.stats.wc0 = 0;
+0139 kcatInfo.stats.wc1 = 0;
+0140 kcatInfo.stats.wc2 = 0;
+0141 kcatInfo.stats.wc3 = 0;
+0142 kcatInfo.stats.wc4 = 0;
+0143 kcatInfo.stats.matrix = zeros(6,5);
+0144
+0145
+0146
+0147
+0148
+0149 [ECIndexIds,~,ic] = unique(KCATcell{1});
+0150 EcIndexIndices = cell(length(ECIndexIds),1);
+0151 for i = 1:length(EcIndexIndices)
+0152 EcIndexIndices{i} = find(ic == i).';
+0153 end
+0154
+0155
+0156 while forceWClvl > 0
+0157 eccodes=regexprep(eccodes,'(.)*(\.\d+)(\.-)*$','$1\.-$3');
+0158 forceWClvl = forceWClvl - 1;
+0159 end
+0160 if forceWClvl == 1
+0161 eccodes = regexprep(eccodes,'.*','-\.-\.-\.-');
+0162 end
+0163
+0164 progressbar('Gathering kcat values by fuzzy matching to BRENDA database')
+0165
+0166 for i = 1:mM
+0167
+0168 EC = eccodes{i};
+0169 if ~isempty(EC)
+0170 EC = strsplit(EC,';');
+0171
+0172 if ~isempty(substrates{i})
+0173 [kcats(i), kcatInfo.info,kcatInfo.stats] = iterativeMatch(EC,substrates{i},substrCoeffs{i},i,KCATcell,...
+0174 kcatInfo.info,kcatInfo.stats,org_name,...
+0175 phylDistStruct,org_index,SAcell,ECIndexIds,EcIndexIndices);
+0176 end
+0177 end
+0178 progressbar(i/mM)
+0179 end
+0180
+0181 kcatList.source = 'brenda';
+0182 kcatList.rxns = model.ec.rxns(ecRxns);
+0183 kcatList.substrates = substrates;
+0184 kcatList.kcats = kcats;
+0185 kcatList.eccodes = eccodes;
+0186 kcatList.wildcardLvl = kcatInfo.info.wcLevel;
+0187 kcatList.origin = NaN(numel(model.ec.rxns(ecRxns)),1);
+0188
+0189
+0190 origin = [kcatInfo.info.org_s kcatInfo.info.rest_s kcatInfo.info.org_ns kcatInfo.info.rest_ns kcatInfo.info.org_sa kcatInfo.info.rest_sa];
+0191 for i=1:6
+0192 kcatList.origin(find(origin(:,i))) = i;
+0193 end
+0194 end
+0195
+0196 function [kcat,dir,tot] =iterativeMatch(EC,subs,substrCoeff,i,KCATcell,dir,tot,...
+0197 name,phylDist,org_index,SAcell,ECIndexIds,EcIndexIndices)
+0198
+0199
+0200
+0201 kcat = zeros(size(EC));
+0202 origin = zeros(size(EC));
+0203 matches = zeros(size(EC));
+0204 wc_num = ones(size(EC)).*1000;
+0205 for k = 1:length(EC)
+0206 success = false;
+0207 while ~success
+0208
+0209 [kcat(k),origin(k),matches(k)] = mainMatch(EC{k},subs,substrCoeff,KCATcell,...
+0210 name,phylDist,...
+0211 org_index,SAcell,ECIndexIds,EcIndexIndices);
+0212
+0213
+0214 if origin(k) > 0
+0215 success = true;
+0216 wc_num(k) = sum(EC{k}=='-');
+0217 else
+0218 dot_pos = [2 strfind(EC{k},'.')];
+0219 wild_num = sum(EC{k}=='-');
+0220 wc_text = '-.-.-.-';
+0221 EC{k} = [EC{k}(1:dot_pos(4-wild_num)) wc_text(1:2*wild_num+1)];
+0222 end
+0223 end
+0224 end
+0225
+0226 if sum(origin) > 0
+0227
+0228
+0229 best_pos = (wc_num == min(wc_num));
+0230 new_origin = origin(best_pos);
+0231 best_pos = (origin == min(new_origin(new_origin~=0)));
+0232 max_pos = find(kcat == max(kcat(best_pos)));
+0233 wc_num = wc_num(max_pos(1));
+0234 origin = origin(max_pos(1));
+0235 matches = matches(max_pos(1));
+0236 kcat = kcat(max_pos(1));
+0237
+0238
+0239 dir.org_s(i) = matches*(origin == 1);
+0240 dir.rest_s(i) = matches*(origin == 2);
+0241 dir.org_ns(i) = matches*(origin == 3);
+0242 dir.org_sa(i) = matches*(origin == 4);
+0243 dir.rest_ns(i) = matches*(origin == 5);
+0244 dir.rest_sa(i) = matches*(origin == 6);
+0245 dir.wcLevel(i) = wc_num;
+0246 tot.org_s = tot.org_s + (origin == 1);
+0247 tot.rest_s = tot.rest_s + (origin == 2);
+0248 tot.org_ns = tot.org_ns + (origin == 3);
+0249 tot.org_sa = tot.org_sa + (origin == 4);
+0250 tot.rest_ns = tot.rest_ns + (origin == 5);
+0251 tot.rest_sa = tot.rest_sa + (origin == 6);
+0252 tot.wc0 = tot.wc0 + (wc_num == 0);
+0253 tot.wc1 = tot.wc1 + (wc_num == 1);
+0254 tot.wc2 = tot.wc2 + (wc_num == 2);
+0255 tot.wc3 = tot.wc3 + (wc_num == 3);
+0256 tot.wc4 = tot.wc4 + (wc_num == 4);
+0257 tot.queries = tot.queries + 1;
+0258 tot.matrix(origin,wc_num+1) = tot.matrix(origin,wc_num+1) + 1;
+0259 end
+0260
+0261 end
+0262
+0263
+0264 function [kcat,origin,matches] = mainMatch(EC,subs,substrCoeff,KCATcell,...
+0265 name,phylDist,org_index,SAcell,ECIndexIds,EcIndexIndices)
+0266
+0267
+0268
+0269
+0270 wild = false;
+0271 wild_pos = strfind(EC,'-');
+0272 if ~isempty(wild_pos)
+0273 EC = EC(1:wild_pos(1)-1);
+0274 wild = true;
+0275 end
+0276 stringMatchesEC_cell = extract_string_matches(EC,KCATcell{1},wild,ECIndexIds,EcIndexIndices);
+0277
+0278
+0279
+0280
+0281 origin = 0;
+0282
+0283 [kcat,matches] = matchKcat(EC,subs,substrCoeff,KCATcell,name,true,false,...
+0284 phylDist,org_index,SAcell,stringMatchesEC_cell,[]);
+0285 if matches > 0 && ~wild
+0286 origin = 1;
+0287
+0288 else
+0289 [kcat,matches] = matchKcat(EC,subs,substrCoeff,KCATcell,'',true,false,...
+0290 phylDist,org_index,SAcell,stringMatchesEC_cell,[]);
+0291 if matches > 0 && ~wild
+0292 origin = 2;
+0293
+0294 else
+0295 [kcat,matches] = matchKcat(EC,subs,substrCoeff,KCATcell,name,false,false,...
+0296 phylDist,org_index,SAcell,stringMatchesEC_cell,[]);
+0297 if matches > 0
+0298 origin = 3;
+0299
+0300 else
+0301
+0302 stringMatchesSA = extract_string_matches(EC,SAcell{1},wild,[],[]);
+0303
+0304 [kcat,matches] = matchKcat(EC,subs,substrCoeff,KCATcell,name,false,...
+0305 true,phylDist,org_index,...
+0306 SAcell,stringMatchesEC_cell,stringMatchesSA);
+0307 if matches > 0
+0308 origin = 4;
+0309
+0310 else
+0311 [kcat,matches] = matchKcat(EC,subs,substrCoeff,KCATcell,'',false,...
+0312 false,phylDist,...
+0313 org_index,SAcell,stringMatchesEC_cell,stringMatchesSA);
+0314 if matches > 0
+0315 origin = 5;
+0316
+0317 else
+0318 [kcat,matches] = matchKcat(EC,subs,substrCoeff,KCATcell,'',...
+0319 false,true,phylDist,...
+0320 org_index,SAcell,stringMatchesEC_cell,stringMatchesSA);
+0321 if matches > 0
+0322 origin = 6;
+0323 end
+0324 end
+0325
+0326 end
+0327 end
+0328 end
+0329 end
+0330 end
+0331
+0332 function [kcat,matches] = matchKcat(EC,subs,substrCoeff,KCATcell,organism,...
+0333 substrate,SA,phylDist,...
+0334 org_index,SAcell,KCATcellMatches,SAcellMatches)
+0335
+0336
+0337
+0338 kcat = [];
+0339 matches = 0;
+0340
+0341 if SA
+0342
+0343 EC_indexes = extract_indexes(SAcellMatches,[],SAcell{2},subs,substrate,...
+0344 organism,org_index,phylDist);
+0345
+0346 kcat = SAcell{3}(EC_indexes);
+0347 org_cell = SAcell{2}(EC_indexes);
+0348 MW_BRENDA = SAcell{4}(EC_indexes);
0349
-0350 kcat = SAcell{3}(EC_indexes);
-0351 org_cell = SAcell{2}(EC_indexes);
-0352 MW_BRENDA = SAcell{4}(EC_indexes);
-0353
-0354 else
-0355
-0356 EC_indexes = extract_indexes(KCATcellMatches,KCATcell{2},KCATcell{3},...
-0357 subs,substrate,organism,org_index,...
-0358 phylDist);
-0359 if substrate
-0360 for j = 1:length(EC_indexes)
-0361 indx = EC_indexes(j);
-0362 for k = 1:length(subs)
-0363 if (isempty(subs{k}))
-0364 break;
-0365 end
-0366
-0367 if ~isempty(subs{k}) && strcmpi(subs{k},KCATcell{2}(indx))
-0368 if KCATcell{4}(indx) > 0
-0369 coeff = min(substrCoeff);
-0370 kCatTmp = KCATcell{4}(indx);
-0371 kcat = [kcat;kCatTmp/coeff];
-0372 end
-0373 end
-0374 end
-0375 end
-0376 else
-0377 kcat = KCATcell{4}(EC_indexes);
-0378 end
-0379 end
-0380
-0381 if isempty(kcat)
-0382 kcat = 0;
-0383 else
-0384 matches = length(kcat);
-0385 [kcat,MaxIndx] = max(kcat);
+0350 else
+0351
+0352 EC_indexes = extract_indexes(KCATcellMatches,KCATcell{2},KCATcell{3},...
+0353 subs,substrate,organism,org_index,...
+0354 phylDist);
+0355 if substrate
+0356 for j = 1:length(EC_indexes)
+0357 indx = EC_indexes(j);
+0358 for k = 1:length(subs)
+0359 if (isempty(subs{k}))
+0360 break;
+0361 end
+0362
+0363 if ~isempty(subs{k}) && strcmpi(subs{k},KCATcell{2}(indx))
+0364 if KCATcell{4}(indx) > 0
+0365 coeff = min(substrCoeff);
+0366 kCatTmp = KCATcell{4}(indx);
+0367 kcat = [kcat;kCatTmp/coeff];
+0368 end
+0369 end
+0370 end
+0371 end
+0372 else
+0373 kcat = KCATcell{4}(EC_indexes);
+0374 end
+0375 end
+0376
+0377 if isempty(kcat)
+0378 kcat = 0;
+0379 else
+0380 matches = length(kcat);
+0381 [kcat,MaxIndx] = max(kcat);
+0382 end
+0383
+0384 if kcat>(1E7)
+0385 kcat = 1E7;
0386 end
-0387
-0388 if kcat>(1E7)
-0389 kcat = 1E7;
-0390 end
-0391 end
-0392
-0393
-0394
-0395
-0396 function EC_indexes = extract_string_matches(EC,EC_cell,wild,ECIndexIds,EcIndexIndices)
-0397 EC_indexes = [];
-0398 EC_indexesOld = [];
-0399 if wild
-0400 if (~isempty(ECIndexIds))
-0401 X = find(contains(ECIndexIds, EC));
-0402 for j = 1:length(X)
-0403 EC_indexes = [EC_indexes,EcIndexIndices{X(j)}];
-0404 end
-0405 else
-0406 for j=1:length(EC_cell)
-0407 if strfind(EC_cell{j},EC)==1
-0408 EC_indexes = [EC_indexes,j];
-0409 end
-0410 end
-0411 end
-0412 else
-0413 if (~isempty(ECIndexIds))
-0414 mtch = find(strcmpi(EC,ECIndexIds));
-0415 if (~isempty(mtch))
-0416 EC_indexes = EcIndexIndices{mtch};
+0387 end
+0388
+0389
+0390
+0391
+0392 function EC_indexes = extract_string_matches(EC,EC_cell,wild,ECIndexIds,EcIndexIndices)
+0393 EC_indexes = [];
+0394 EC_indexesOld = [];
+0395 if wild
+0396 if (~isempty(ECIndexIds))
+0397 X = find(contains(ECIndexIds, EC));
+0398 for j = 1:length(X)
+0399 EC_indexes = [EC_indexes,EcIndexIndices{X(j)}];
+0400 end
+0401 else
+0402 for j=1:length(EC_cell)
+0403 if strfind(EC_cell{j},EC)==1
+0404 EC_indexes = [EC_indexes,j];
+0405 end
+0406 end
+0407 end
+0408 else
+0409 if (~isempty(ECIndexIds))
+0410 mtch = find(strcmpi(EC,ECIndexIds));
+0411 if (~isempty(mtch))
+0412 EC_indexes = EcIndexIndices{mtch};
+0413 end
+0414 else
+0415 if ~isempty(EC_cell)
+0416 EC_indexes = transpose(find(strcmpi(EC,EC_cell)));
0417 end
-0418 else
-0419 if ~isempty(EC_cell)
-0420 EC_indexes = transpose(find(strcmpi(EC,EC_cell)));
-0421 end
-0422 end
-0423 end
-0424
-0425 end
-0426
-0427
-0428
-0429 function EC_indexes = extract_indexes(EC_indCellStringMatches,subs_cell,orgs_cell,subs,...
-0430 substrate,organism, org_index,...
-0431 phylDist)
-0432
-0433 EC_indexes = EC_indCellStringMatches;
-0434
-0435
-0436
-0437
-0438 if substrate
-0439 if (~isempty(EC_indexes))
-0440 Subs_indexes = [];
-0441 for l = 1:length(subs)
-0442 if (isempty(subs{l}))
-0443 break;
-0444 end
-0445 Subs_indexes = horzcat(Subs_indexes,EC_indexes(strcmpi(subs(l),...
-0446 subs_cell(EC_indexes))));
-0447 end
-0448 EC_indexes = Subs_indexes;
-0449 end
-0450 end
-0451
-0452 EC_orgs = orgs_cell(EC_indexes);
-0453
-0454
-0455 if string(organism) ~= ''
-0456 EC_indexes = EC_indexes(strcmpi(string(organism),EC_orgs));
-0457
-0458
-0459
-0460 elseif org_index~='*'
-0461 KEGG_indexes = [];temp = [];
-0462
-0463
-0464
-0465
-0466 for j=1:length(EC_indexes)
-0467
-0468 orgs_index = find(strcmpi(orgs_cell(EC_indexes(j)),phylDist.names),1);
-0469 if ~isempty(orgs_index)
-0470 KEGG_indexes = [KEGG_indexes; orgs_index];
-0471 temp = [temp;EC_indexes(j)];
-0472
-0473
-0474 else
-0475 org = orgs_cell{EC_indexes(j)};
-0476 orgGenus = lower(org(1:(strfind(org,' ')-1)));
-0477 if isKey(phylDist.genusHashMap,orgGenus)
-0478 matchInd = cell2mat(values(phylDist.genusHashMap,{orgGenus}));
-0479 matches = phylDist.uniqueGenusIndices{matchInd};
-0480 k = matches(1);
-0481 KEGG_indexes = [KEGG_indexes;k];
-0482 temp = [temp;EC_indexes(j)];
-0483 end
-0484 end
-0485 end
-0486
-0487 EC_indexes = temp;
-0488
-0489
-0490 if ~isempty(EC_indexes)
-0491 distances = phylDist.distMat(org_index,KEGG_indexes);
-0492 EC_indexes = EC_indexes(distances == min(distances));
-0493 end
-0494 end
-0495 end
-0496
-0497 function org_index = find_inKEGG(org_name,names)
-0498 org_index = find(strcmpi(org_name,names));
-0499 if numel(org_index)>1
-0500 org_index = org_index(1);
-0501 elseif isempty(org_index)
-0502 i=1;
-0503 while isempty(org_index) && i<length(names)
-0504
-0505 str = names{i};
-0506 if strcmpi(org_name(1:strfind(org_name,' ')-1),...
-0507 str(1:strfind(str,' ')-1))
-0508 org_index = i;
-0509 end
-0510 i = i+1;
-0511 end
-0512 if isempty(org_index);org_index = '*';end
-0513 end
-0514 end
-0515
-0516 function phylDistStruct = KEGG_struct(phylpath)
-0517 load(phylpath)
-0518 phylDistStruct.ids = transpose(phylDistStruct.ids);
-0519 phylDistStruct.names = transpose(phylDistStruct.names);
-0520
-0521
-0522 for i=1:length(phylDistStruct.names)
-0523 pos = strfind(phylDistStruct.names{i}, ' (');
-0524 if ~isempty(pos)
-0525 phylDistStruct.names{i} = phylDistStruct.names{i}(1:pos-1);
-0526 end
-0527 end
-0528 end
+0418 end
+0419 end
+0420
+0421 end
+0422
+0423
+0424
+0425 function EC_indexes = extract_indexes(EC_indCellStringMatches,subs_cell,orgs_cell,subs,...
+0426 substrate,organism, org_index,...
+0427 phylDist)
+0428
+0429 EC_indexes = EC_indCellStringMatches;
+0430
+0431
+0432
+0433
+0434 if substrate
+0435 if (~isempty(EC_indexes))
+0436 Subs_indexes = [];
+0437 for l = 1:length(subs)
+0438 if (isempty(subs{l}))
+0439 break;
+0440 end
+0441 Subs_indexes = horzcat(Subs_indexes,EC_indexes(strcmpi(subs(l),...
+0442 subs_cell(EC_indexes))));
+0443 end
+0444 EC_indexes = Subs_indexes;
+0445 end
+0446 end
+0447
+0448 EC_orgs = orgs_cell(EC_indexes);
+0449
+0450
+0451 if string(organism) ~= ''
+0452 EC_indexes = EC_indexes(strcmpi(string(organism),EC_orgs));
+0453
+0454
+0455
+0456 elseif org_index~='*'
+0457 KEGG_indexes = [];temp = [];
+0458
+0459
+0460
+0461
+0462 for j=1:length(EC_indexes)
+0463
+0464 orgs_index = find(strcmpi(orgs_cell(EC_indexes(j)),phylDist.names),1);
+0465 if ~isempty(orgs_index)
+0466 KEGG_indexes = [KEGG_indexes; orgs_index];
+0467 temp = [temp;EC_indexes(j)];
+0468
+0469
+0470 else
+0471 org = orgs_cell{EC_indexes(j)};
+0472 orgGenus = lower(regexprep(org,'\s.*',''));
+0473 if isKey(phylDist.genusHashMap,orgGenus)
+0474 matchInd = cell2mat(values(phylDist.genusHashMap,{orgGenus}));
+0475 matches = phylDist.uniqueGenusIndices{matchInd};
+0476 k = matches(1);
+0477 KEGG_indexes = [KEGG_indexes;k];
+0478 temp = [temp;EC_indexes(j)];
+0479 end
+0480 end
+0481 end
+0482
+0483 EC_indexes = temp;
+0484
+0485
+0486 if ~isempty(EC_indexes)
+0487 distances = phylDist.distMat(org_index,KEGG_indexes);
+0488 EC_indexes = EC_indexes(distances == min(distances));
+0489 end
+0490 end
+0491 end
+0492
+0493 function org_index = find_inKEGG(org_name,names)
+0494 org_index = find(strcmpi(org_name,names));
+0495 if numel(org_index)>1
+0496 org_index = org_index(1);
+0497 elseif isempty(org_index)
+0498 org_name = regexprep(org_name,'\s.*','');
+0499 org_index = find(strcmpi(org_name,names));
+0500 if numel(org_index)>1
+0501 org_index = org_index(1);
+0502 elseif isempty(org_index)
+0503 org_index = '*';
+0504 end
+0505 end
+0506 end
+0507
+0508 function phylDistStruct = KEGG_struct(phylpath)
+0509 load(phylpath)
+0510 phylDistStruct.ids = transpose(phylDistStruct.ids);
+0511 phylDistStruct.names = transpose(phylDistStruct.names);
+0512 phylDistStruct.names = regexprep(phylDistStruct.names,'\s*\(.*','');
+0513 end
Generated by m2html © 2005