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

fix: ftINIT, importModel and default verbosity #519

Merged
merged 4 commits into from
Feb 12, 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
6 changes: 3 additions & 3 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ INSERT CODE HERE
#### System information
<!-- Please report the complete output from checkInstallation, for instance:
> Installing from location C:\Work\GitHub\RAVEN
> Checking RAVEN release 2.7.12
> Checking RAVEN release 2.8.6
> You are running the latest RAVEN release
> Checking MATLAB release 2022a
> Checking MATLAB release 2023b
> Checking system architecture win64
> Set RAVEN in MATLAB path Pass
> Save MATLAB path Pass
Expand All @@ -26,4 +26,4 @@ etc. etc.

**I hereby confirm that I have:**
<!-- Note: replace [ ] with [X] to check the box -->
- [ ] Checked that a similar issue does not [already exist](https://github.com/SysBioChalmers/RAVEN/issues?utf8=%E2%9C%93&q=is%3Aissue)
- [ ] Checked that a similar issue does not [already exist](https://github.com/SysBioChalmers/RAVEN/issues?q=is%3Aissue) or is already [discussed](https://github.com/SysBioChalmers/RAVEN/discussions).
16 changes: 11 additions & 5 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
### Main improvements in this PR:
<!-- Pointwise mention what changes were made in what function. Examples:
- fix bug where `functionName` failed to do function X
- updated all documentation -->
- Fixes:
- `functionName` failed to do action X
- Documentation:
- Updated all documentation
- Features:
- Introduced option to do function Y (issue #12345) -->

**I hereby confirm that I have:**
<!-- Note: replace [ ] with [X] to check the box -->
- [ ] Selected `develop` as a target branch
#### Instructions on merging this PR:
<!-- Chose ONE of the following two options
and replace [ ] with [X] to check the box.-->
- [ ] This PR has `develop` as target branch, and will be resolved with a *squash-merge*.
- [ ] This PR has `main` as target branch, and will be resolved with a *merge commit*.
8 changes: 4 additions & 4 deletions INIT/ftINIT.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
% is for the fitTasks step. For the INIT algorithm,
% see params (opt, default [])
% verbose if true, the MILP progression will be shown.
% (opt, default true)
% (opt, default false)
%
% model the resulting model structure
% metProduction array that indicates which of the
Expand Down Expand Up @@ -114,7 +114,7 @@
end

if nargin < 11
verbose = true;
verbose = false;
end
%Handle detected mets:
%Previously, this was handled by giving a bonus for secreting those metabolites,
Expand Down Expand Up @@ -351,9 +351,9 @@
%in the current formulation. Therefore, such reactions will have to be
%assigned a small negative score instead.
exchRxns = getExchangeRxns(prepData.refModel);
refModelNoExc = removeReactions(prepData.refModelWithBM,exchRxns,true,true);
refModelNoExc = removeReactions(prepData.refModelWithBM,exchRxns,false,true);
exchRxns = getExchangeRxns(initModel);
initModelNoExc = removeReactions(closeModel(initModel),exchRxns,true,true);
initModelNoExc = removeReactions(closeModel(initModel),exchRxns,false,true);

if useScoresForTasks == true
%map the rxn scores to the model without exchange rxns
Expand Down
5 changes: 1 addition & 4 deletions core/standardizeGrRules.m
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@

if ~isempty(indexes2check)

if embedded
EM = 'Potentially problematic ") AND (" in the grRules for reaction(s): ';
dispEM(EM,false,model.rxns(indexes2check),true)
else
if ~embedded
STR = 'Potentially problematic ") AND (", ") AND" or "AND ("relat';
STR = [STR,'ionships found in\n\n'];
for i=1:length(indexes2check)
Expand Down
10 changes: 5 additions & 5 deletions doc/INIT/ftINIT.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ <h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="
is for the fitTasks step. For the INIT algorithm,
see params (opt, default [])
verbose if true, the MILP progression will be shown.
(opt, default true)
(opt, default false)

model the resulting model structure
metProduction array that indicates which of the
Expand Down Expand Up @@ -195,7 +195,7 @@ <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" sr
0058 <span class="comment">% is for the fitTasks step. For the INIT algorithm,</span>
0059 <span class="comment">% see params (opt, default [])</span>
0060 <span class="comment">% verbose if true, the MILP progression will be shown.</span>
0061 <span class="comment">% (opt, default true)</span>
0061 <span class="comment">% (opt, default false)</span>
0062 <span class="comment">%</span>
0063 <span class="comment">% model the resulting model structure</span>
0064 <span class="comment">% metProduction array that indicates which of the</span>
Expand Down Expand Up @@ -251,7 +251,7 @@ <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" sr
0114 <span class="keyword">end</span>
0115
0116 <span class="keyword">if</span> nargin &lt; 11
0117 verbose = true;
0117 verbose = false;
0118 <span class="keyword">end</span>
0119 <span class="comment">%Handle detected mets:</span>
0120 <span class="comment">%Previously, this was handled by giving a bonus for secreting those metabolites,</span>
Expand Down Expand Up @@ -488,9 +488,9 @@ <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" sr
0351 <span class="comment">%in the current formulation. Therefore, such reactions will have to be</span>
0352 <span class="comment">%assigned a small negative score instead.</span>
0353 exchRxns = getExchangeRxns(prepData.refModel);
0354 refModelNoExc = removeReactions(prepData.refModelWithBM,exchRxns,true,true);
0354 refModelNoExc = removeReactions(prepData.refModelWithBM,exchRxns,false,true);
0355 exchRxns = getExchangeRxns(initModel);
0356 initModelNoExc = removeReactions(closeModel(initModel),exchRxns,true,true);
0356 initModelNoExc = removeReactions(closeModel(initModel),exchRxns,false,true);
0357
0358 <span class="keyword">if</span> useScoresForTasks == true
0359 <span class="comment">%map the rxn scores to the model without exchange rxns</span>
Expand Down
2 changes: 1 addition & 1 deletion doc/core/dispEM.html

Large diffs are not rendered by default.

75 changes: 36 additions & 39 deletions doc/core/standardizeGrRules.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="dispEM.html" class="code" title="function dispEM(string,throwErrors,toList,trimWarnings)">dispEM</a> dispEM</li></ul>
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
<li><a href="addRxns.html" class="code" title="function newModel=addRxns(model,rxnsToAdd,eqnType,compartment,allowNewMets,allowNewGenes)">addRxns</a> addRxns</li><li><a href="changeGrRules.html" class="code" title="function model = changeGrRules(model,rxns,grRules,replace)">changeGrRules</a> changeGrRules</li><li><a href="contractModel.html" class="code" title="function [reducedModel, removedRxns, indexedDuplicateRxns]=contractModel(model,distReverse,mets)">contractModel</a> contractModel</li><li><a href="expandModel.html" class="code" title="function [newModel, rxnToCheck]=expandModel(model)">expandModel</a> expandModel</li><li><a href="getModelFromHomology.html" class="code" title="function [draftModel, hitGenes]=getModelFromHomology(models,blastStructure,getModelFor,preferredOrder,strictness,onlyGenesInModels,maxE,minLen,minIde,mapNewGenesToOld)">getModelFromHomology</a> getModelFromHomology</li><li><a href="mergeModels.html" class="code" title="function model=mergeModels(models,metParam,supressWarnings)">mergeModels</a> mergeModels</li><li><a href="predictLocalization.html" class="code" title="function [outModel, geneLocalization, transportStruct, scores,removedRxns] = predictLocalization(model, GSS,defaultCompartment, transportCost, maxTime, plotResults)">predictLocalization</a> predictLocalization</li><li><a href="removeGenes.html" class="code" title="function reducedModel = removeGenes(model,genesToRemove,removeUnusedMets,removeBlockedRxns,standardizeRules)">removeGenes</a> removeGenes</li></ul>
Expand Down Expand Up @@ -196,44 +196,41 @@ <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" sr
0130
0131 <span class="keyword">if</span> ~isempty(indexes2check)
0132
0133 <span class="keyword">if</span> embedded
0134 EM = <span class="string">'Potentially problematic &quot;) AND (&quot; in the grRules for reaction(s): '</span>;
0135 <a href="dispEM.html" class="code" title="function dispEM(string,throwErrors,toList,trimWarnings)">dispEM</a>(EM,false,model.rxns(indexes2check),true)
0136 <span class="keyword">else</span>
0137 STR = <span class="string">'Potentially problematic &quot;) AND (&quot;, &quot;) AND&quot; or &quot;AND (&quot;relat'</span>;
0138 STR = [STR,<span class="string">'ionships found in\n\n'</span>];
0139 <span class="keyword">for</span> i=1:length(indexes2check)
0140 index = indexes2check(i);
0141 STR = [STR <span class="string">' - grRule #'</span> model.rxns{index} <span class="string">': '</span> grRules{index} <span class="string">'\n'</span>];
0142 <span class="keyword">end</span>
0143 STR = [STR,<span class="string">'\n This kind of relationships should only be present '</span>];
0144 STR = [STR,<span class="string">'in reactions catalysed by complexes of isoenzymes e'</span>];
0145 STR = [STR,<span class="string">'.g.\n\n - (G1 or G2) and (G3 or G4)\n\n For these c'</span>];
0146 STR = [STR,<span class="string">'ases modify the grRules manually, writing all the po'</span>];
0147 STR = [STR,<span class="string">'ssible combinations e.g.\n\n - (G1 and G3) or (G1 a'</span>];
0148 STR = [STR,<span class="string">'nd G4) or (G2 and G3) or (G2 and G4)\n\n For other c'</span>];
0149 STR = [STR,<span class="string">'ases modify the correspondent grRules avoiding:\n\n '</span>];
0150 STR = [STR,<span class="string">' 1) Overall container brackets, e.g.\n &quot;(G1 a'</span>];
0151 STR = [STR,<span class="string">'nd G2)&quot; should be &quot;G1 and G2&quot;\n\n 2) Single unit en'</span>];
0152 STR = [STR,<span class="string">'zymes enclosed into brackets, e.g.\n &quot;(G1)&quot; s'</span>];
0153 STR = [STR,<span class="string">'hould be &quot;G1&quot;\n\n 3) The use of uppercases for logi'</span>];
0154 STR = [STR,<span class="string">'cal operators, e.g.\n &quot;G1 OR G2&quot; should be &quot;G'</span>];
0155 STR = [STR,<span class="string">'1 or G2&quot;\n\n 4) Unbalanced brackets, e.g.\n '</span>];
0156 STR = [STR,<span class="string">'&quot;((G1 and G2) or G3&quot; should be &quot;(G1 and G2) or G3&quot;\n'</span>];
0157 warning(sprintf(STR))
0158 <span class="keyword">end</span>
0159 <span class="keyword">end</span>
0160 <span class="keyword">end</span>
0161
0162 <a name="_sub4" href="#_subfunctions" class="code">function grRules = grRulesPreparation(grRules)</a>
0163 <span class="comment">%Remove unnecessary blanks</span>
0164 grRules=strrep(grRules,<span class="string">' '</span>,<span class="string">' '</span>);
0165 grRules=strrep(grRules,<span class="string">'( '</span>,<span class="string">'('</span>);
0166 grRules=strrep(grRules,<span class="string">' )'</span>,<span class="string">')'</span>);
0167 <span class="comment">% Make sure that AND and OR strings are in lowercase</span>
0168 grRules=strrep(grRules,<span class="string">' AND '</span>,<span class="string">' and '</span>);
0169 grRules=strrep(grRules,<span class="string">' OR '</span>,<span class="string">' or '</span>);
0170 <span class="keyword">end</span></pre></div>
0133 <span class="keyword">if</span> ~embedded
0134 STR = <span class="string">'Potentially problematic &quot;) AND (&quot;, &quot;) AND&quot; or &quot;AND (&quot;relat'</span>;
0135 STR = [STR,<span class="string">'ionships found in\n\n'</span>];
0136 <span class="keyword">for</span> i=1:length(indexes2check)
0137 index = indexes2check(i);
0138 STR = [STR <span class="string">' - grRule #'</span> model.rxns{index} <span class="string">': '</span> grRules{index} <span class="string">'\n'</span>];
0139 <span class="keyword">end</span>
0140 STR = [STR,<span class="string">'\n This kind of relationships should only be present '</span>];
0141 STR = [STR,<span class="string">'in reactions catalysed by complexes of isoenzymes e'</span>];
0142 STR = [STR,<span class="string">'.g.\n\n - (G1 or G2) and (G3 or G4)\n\n For these c'</span>];
0143 STR = [STR,<span class="string">'ases modify the grRules manually, writing all the po'</span>];
0144 STR = [STR,<span class="string">'ssible combinations e.g.\n\n - (G1 and G3) or (G1 a'</span>];
0145 STR = [STR,<span class="string">'nd G4) or (G2 and G3) or (G2 and G4)\n\n For other c'</span>];
0146 STR = [STR,<span class="string">'ases modify the correspondent grRules avoiding:\n\n '</span>];
0147 STR = [STR,<span class="string">' 1) Overall container brackets, e.g.\n &quot;(G1 a'</span>];
0148 STR = [STR,<span class="string">'nd G2)&quot; should be &quot;G1 and G2&quot;\n\n 2) Single unit en'</span>];
0149 STR = [STR,<span class="string">'zymes enclosed into brackets, e.g.\n &quot;(G1)&quot; s'</span>];
0150 STR = [STR,<span class="string">'hould be &quot;G1&quot;\n\n 3) The use of uppercases for logi'</span>];
0151 STR = [STR,<span class="string">'cal operators, e.g.\n &quot;G1 OR G2&quot; should be &quot;G'</span>];
0152 STR = [STR,<span class="string">'1 or G2&quot;\n\n 4) Unbalanced brackets, e.g.\n '</span>];
0153 STR = [STR,<span class="string">'&quot;((G1 and G2) or G3&quot; should be &quot;(G1 and G2) or G3&quot;\n'</span>];
0154 warning(sprintf(STR))
0155 <span class="keyword">end</span>
0156 <span class="keyword">end</span>
0157 <span class="keyword">end</span>
0158
0159 <a name="_sub4" href="#_subfunctions" class="code">function grRules = grRulesPreparation(grRules)</a>
0160 <span class="comment">%Remove unnecessary blanks</span>
0161 grRules=strrep(grRules,<span class="string">' '</span>,<span class="string">' '</span>);
0162 grRules=strrep(grRules,<span class="string">'( '</span>,<span class="string">'('</span>);
0163 grRules=strrep(grRules,<span class="string">' )'</span>,<span class="string">')'</span>);
0164 <span class="comment">% Make sure that AND and OR strings are in lowercase</span>
0165 grRules=strrep(grRules,<span class="string">' AND '</span>,<span class="string">' and '</span>);
0166 grRules=strrep(grRules,<span class="string">' OR '</span>,<span class="string">' or '</span>);
0167 <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>
Loading
Loading