Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert #372 #380

Merged
merged 2 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 25 additions & 28 deletions doc/src/geckomat/utilities/enzymeUsage.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ <h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="
absUsage vector of absolute enzyme usages
UB vector of enzyme exchange reaction upper bounds
protID string array of matching protein IDs
fluxes vector of fluxes, copy of input fluxes

Usage:
usageData = enzymeUsage(ecModel,fluxes,zero)</pre></div>
Expand Down Expand Up @@ -100,33 +99,31 @@ <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" sr
0026 <span class="comment">% absUsage vector of absolute enzyme usages</span>
0027 <span class="comment">% UB vector of enzyme exchange reaction upper bounds</span>
0028 <span class="comment">% protID string array of matching protein IDs</span>
0029 <span class="comment">% fluxes vector of fluxes, copy of input fluxes</span>
0030 <span class="comment">%</span>
0031 <span class="comment">% Usage:</span>
0032 <span class="comment">% usageData = enzymeUsage(ecModel,fluxes,zero)</span>
0033
0034 <span class="keyword">if</span> nargin&lt;3
0035 zero=true;
0036 <span class="keyword">end</span>
0037 <span class="keyword">if</span> ecModel.ec.geckoLight
0038 error(<span class="string">'This function does not work on GECKO light models.'</span>)
0039 <span class="keyword">end</span>
0040 usageData.protID = ecModel.ec.enzymes;
0041 [~,rxnIdx] = ismember(strcat(<span class="string">'usage_prot_'</span>,ecModel.ec.enzymes),ecModel.rxns);
0042
0043 usageData.LB = ecModel.lb(rxnIdx);
0044 usageData.absUsage = abs(fluxes(rxnIdx));
0045 usageData.capUsage = abs(usageData.absUsage./usageData.LB);
0046 usageData.fluxes = fluxes;
0047
0048 <span class="keyword">if</span> ~zero
0049 nonzero = usageData.absUsage&lt;0;
0050 usageData.absUsage = usageData.absUsage(nonzero);
0051 usageData.capUsage = usageData.capUsage(nonzero);
0052 usageData.LB = usageData.LB(nonzero);
0053 usageData.protID = usageData.protID(nonzero);
0054 <span class="keyword">end</span>
0055 <span class="keyword">end</span></pre></div>
0029 <span class="comment">%</span>
0030 <span class="comment">% Usage:</span>
0031 <span class="comment">% usageData = enzymeUsage(ecModel,fluxes,zero)</span>
0032
0033 <span class="keyword">if</span> nargin&lt;3
0034 zero=true;
0035 <span class="keyword">end</span>
0036 <span class="keyword">if</span> ecModel.ec.geckoLight
0037 error(<span class="string">'This function does not work on GECKO light models.'</span>)
0038 <span class="keyword">end</span>
0039 usageData.protID = ecModel.ec.enzymes;
0040 [~,rxnIdx] = ismember(strcat(<span class="string">'usage_prot_'</span>,ecModel.ec.enzymes),ecModel.rxns);
0041
0042 usageData.LB = ecModel.lb(rxnIdx);
0043 usageData.absUsage = abs(fluxes(rxnIdx));
0044 usageData.capUsage = abs(usageData.absUsage./usageData.LB);
0045
0046 <span class="keyword">if</span> ~zero
0047 nonzero = usageData.absUsage&lt;0;
0048 usageData.absUsage = usageData.absUsage(nonzero);
0049 usageData.capUsage = usageData.capUsage(nonzero);
0050 usageData.LB = usageData.LB(nonzero);
0051 usageData.protID = usageData.protID(nonzero);
0052 <span class="keyword">end</span>
0053 <span class="keyword">end</span></pre></div>
<hr><address>Generated by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>
50 changes: 18 additions & 32 deletions doc/src/geckomat/utilities/reportEnzymeUsage.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,38 +123,24 @@ <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" sr
0061 topUsage.rxnNames = {};
0062 topUsage.grRules = {};
0063
0064 <span class="comment">% Calculate the protein pool flux from the 'prot_pool_exchange' reaction</span>
0065 protPoolExchangeFlux = -ecModel.lb(strcmp(ecModel.rxns,<span class="string">'prot_pool_exchange'</span>));
0066
0067 fluxValues = usageData.fluxes;
0068
0069 <span class="comment">% Sum fluxes for all 'usage_prot_' reactions, excluding the 'usage_prot_standard'</span>
0070 usageProtIndices = startsWith(ecModel.rxns, <span class="string">'usage_prot_'</span>) &amp; <span class="keyword">...</span>
0071 ~contains(ecModel.rxns, <span class="string">'standard'</span>);
0072
0073 <span class="comment">% Sum the absolute values of the usage fluxes</span>
0074 totalUsageProtFlux = sum(abs(fluxValues(usageProtIndices)));
0075
0076 <span class="comment">% Define the new protein pool as the sum of prot_pool_exchange flux and total usage_prot fluxes</span>
0077 protPool = (protPoolExchangeFlux + totalUsageProtFlux)/100;
0078
0079 <span class="keyword">for</span> i=1:numel(topEnzyme)
0080 [rxns, kcat, idx, rxnNames, grRules] = getReactionsFromEnzyme(ecModel,topEnzyme{i});
0081 rxnNumber = numel(rxns);
0082 topUsage.protID(end+1:end+rxnNumber,1) = topEnzyme(i);
0083 topUsage.geneID(end+1:end+rxnNumber,1) = geneIDs(i);
0084 topUsage.absUsage(end+1:end+rxnNumber,1) = usageData.absUsage(topUse(i));
0085 topUsage.percUsage(end+1:end+rxnNumber,1) = topUsage.absUsage(end-(rxnNumber-1):<span class="keyword">end</span>,1)/protPool;
0086 topUsage.kcat(end+1:end+rxnNumber,1) = kcat;
0087 topUsage.source(end+1:end+rxnNumber,1) = ecModel.ec.source(idx);
0088 topUsage.rxnID(end+1:end+rxnNumber,1) = rxns;
0089 topUsage.rxnNames(end+1:end+rxnNumber,1) = rxnNames;
0090 topUsage.grRules(end+1:end+rxnNumber,1) = grRules;
0091 <span class="keyword">end</span>
0092 usageReport.topAbsUsage = struct2table(topUsage);
0093 usageReport.totalProtPool = protPoolExchangeFlux;
0094 usageReport.totalUsageFlux = totalUsageProtFlux;
0095 <span class="keyword">end</span></pre></div>
0064 protPool = -ecModel.lb(strcmp(ecModel.rxns,<span class="string">'prot_pool_exchange'</span>))/100;
0065
0066 <span class="keyword">for</span> i=1:numel(topEnzyme)
0067 [rxns, kcat, idx, rxnNames, grRules] = getReactionsFromEnzyme(ecModel,topEnzyme{i});
0068 rxnNumber = numel(rxns);
0069 topUsage.protID(end+1:end+rxnNumber,1) = topEnzyme(i);
0070 topUsage.geneID(end+1:end+rxnNumber,1) = geneIDs(i);
0071 topUsage.absUsage(end+1:end+rxnNumber,1) = usageData.absUsage(topUse(i));
0072 topUsage.percUsage(end+1:end+rxnNumber,1) = topUsage.absUsage(end-(rxnNumber-1):<span class="keyword">end</span>,1)/protPool;
0073 topUsage.kcat(end+1:end+rxnNumber,1) = kcat;
0074 topUsage.source(end+1:end+rxnNumber,1) = ecModel.ec.source(idx);
0075 topUsage.rxnID(end+1:end+rxnNumber,1) = rxns;
0076 topUsage.rxnNames(end+1:end+rxnNumber,1) = rxnNames;
0077 topUsage.grRules(end+1:end+rxnNumber,1) = grRules;
0078 <span class="keyword">end</span>
0079 usageReport.topAbsUsage = struct2table(topUsage);
0080 usageReport.totalUsageFlux = protPool;
0081 <span class="keyword">end</span></pre></div>
<hr><address>Generated by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>
2 changes: 0 additions & 2 deletions src/geckomat/utilities/enzymeUsage.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
% absUsage vector of absolute enzyme usages
% UB vector of enzyme exchange reaction upper bounds
% protID string array of matching protein IDs
% fluxes vector of fluxes, copy of input fluxes
%
% Usage:
% usageData = enzymeUsage(ecModel,fluxes,zero)
Expand All @@ -43,7 +42,6 @@
usageData.LB = ecModel.lb(rxnIdx);
usageData.absUsage = abs(fluxes(rxnIdx));
usageData.capUsage = abs(usageData.absUsage./usageData.LB);
usageData.fluxes = fluxes;

if ~zero
nonzero = usageData.absUsage<0;
Expand Down
18 changes: 2 additions & 16 deletions src/geckomat/utilities/reportEnzymeUsage.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,7 @@
topUsage.rxnNames = {};
topUsage.grRules = {};

% Calculate the protein pool flux from the 'prot_pool_exchange' reaction
protPoolExchangeFlux = -ecModel.lb(strcmp(ecModel.rxns,'prot_pool_exchange'));

fluxValues = usageData.fluxes;

% Sum fluxes for all 'usage_prot_' reactions, excluding the 'usage_prot_standard'
usageProtIndices = startsWith(ecModel.rxns, 'usage_prot_') & ...
~contains(ecModel.rxns, 'standard');

% Sum the absolute values of the usage fluxes
totalUsageProtFlux = sum(abs(fluxValues(usageProtIndices)));

% Define the new protein pool as the sum of prot_pool_exchange flux and total usage_prot fluxes
protPool = (protPoolExchangeFlux + totalUsageProtFlux)/100;
protPool = -ecModel.lb(strcmp(ecModel.rxns,'prot_pool_exchange'))/100;

for i=1:numel(topEnzyme)
[rxns, kcat, idx, rxnNames, grRules] = getReactionsFromEnzyme(ecModel,topEnzyme{i});
Expand All @@ -90,6 +77,5 @@
topUsage.grRules(end+1:end+rxnNumber,1) = grRules;
end
usageReport.topAbsUsage = struct2table(topUsage);
usageReport.totalProtPool = protPoolExchangeFlux;
usageReport.totalUsageFlux = totalUsageProtFlux;
usageReport.totalUsageFlux = protPool;
end
Loading