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

RAVEN 2.10.3 #577

Merged
merged 2 commits into from
Dec 21, 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
12 changes: 6 additions & 6 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
### Main improvements in this PR:
<!-- Pointwise mention what changes were made in what function. Examples:
- Fixes:
- fix:
- `functionName` failed to do action X
- Documentation:
- Updated all documentation
- Features:
- Introduced option to do function Y (issue #12345) -->
- documentation:
- updated all documentation
- features:
- introduced option to do function Y (solves #12345) -->

#### 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*.
- [ ] This PR has `main` as target branch, and will be resolved as descriped [here](https://github.com/SysBioChalmers/RAVEN/wiki/Development-policy#make-a-new-release).
8 changes: 7 additions & 1 deletion core/generateNewIds.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
else
error('type should be either ''rxns'' or ''mets''.')
end
if nargin<4
quantity=1;
end
if nargin<5
numLength=4;
end
Expand All @@ -44,7 +47,10 @@
fprintf(['No ' type ' ids with prefix "' prefix ...
'" currently exist in the model. The first new id will be "' ...
[prefix,num2str(1,['%0' num2str(numLength) 'd'])] '"\n'],'%s')
lastId=0;
end

if isnan(lastId)
lastId = 0;
end

newIds=cell(quantity,1);
Expand Down
52 changes: 29 additions & 23 deletions doc/core/generateNewIds.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,33 +85,39 @@ <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" sr
0026 <span class="keyword">else</span>
0027 error(<span class="string">'type should be either ''rxns'' or ''mets''.'</span>)
0028 <span class="keyword">end</span>
0029 <span class="keyword">if</span> nargin&lt;5
0030 numLength=4;
0029 <span class="keyword">if</span> nargin&lt;4
0030 quantity=1;
0031 <span class="keyword">end</span>
0032
0033 <span class="comment">% Subset only existingIds that have the prefix</span>
0034 existingIds=existingIds(~cellfun(@isempty,regexp(existingIds,[<span class="string">'^'</span> prefix])));
0032 <span class="keyword">if</span> nargin&lt;5
0033 numLength=4;
0034 <span class="keyword">end</span>
0035
0036 <span class="keyword">if</span> ~isempty(existingIds)
0037 existingIds=regexprep(existingIds,[<span class="string">'^'</span> prefix],<span class="string">''</span>);
0038 existingIds=sort(existingIds);
0039 lastId=existingIds{end};
0040 numLength=length(lastId);
0041 lastId=str2double(lastId);
0042 <span class="keyword">else</span>
0043 lastId=0;
0044 fprintf([<span class="string">'No '</span> type <span class="string">' ids with prefix &quot;'</span> prefix <span class="keyword">...</span>
0045 <span class="string">'&quot; currently exist in the model. The first new id will be &quot;'</span> <span class="keyword">...</span>
0046 [prefix,num2str(1,[<span class="string">'%0'</span> num2str(numLength) <span class="string">'d'</span>])] <span class="string">'&quot;\n'</span>],<span class="string">'%s'</span>)
0047 lastId=0;
0048 <span class="keyword">end</span>
0049
0050 newIds=cell(quantity,1);
0036 <span class="comment">% Subset only existingIds that have the prefix</span>
0037 existingIds=existingIds(~cellfun(@isempty,regexp(existingIds,[<span class="string">'^'</span> prefix])));
0038
0039 <span class="keyword">if</span> ~isempty(existingIds)
0040 existingIds=regexprep(existingIds,[<span class="string">'^'</span> prefix],<span class="string">''</span>);
0041 existingIds=sort(existingIds);
0042 lastId=existingIds{end};
0043 numLength=length(lastId);
0044 lastId=str2double(lastId);
0045 <span class="keyword">else</span>
0046 lastId=0;
0047 fprintf([<span class="string">'No '</span> type <span class="string">' ids with prefix &quot;'</span> prefix <span class="keyword">...</span>
0048 <span class="string">'&quot; currently exist in the model. The first new id will be &quot;'</span> <span class="keyword">...</span>
0049 [prefix,num2str(1,[<span class="string">'%0'</span> num2str(numLength) <span class="string">'d'</span>])] <span class="string">'&quot;\n'</span>],<span class="string">'%s'</span>)
0050 <span class="keyword">end</span>
0051
0052 <span class="keyword">for</span> k=1:quantity
0053 newIds{k}=[prefix,num2str(k+lastId,[<span class="string">'%0'</span> num2str(numLength) <span class="string">'d'</span>])];
0052 <span class="keyword">if</span> isnan(lastId)
0053 lastId = 0;
0054 <span class="keyword">end</span>
0055 <span class="keyword">end</span></pre></div>
0055
0056 newIds=cell(quantity,1);
0057
0058 <span class="keyword">for</span> k=1:quantity
0059 newIds{k}=[prefix,num2str(k+lastId,[<span class="string">'%0'</span> num2str(numLength) <span class="string">'d'</span>])];
0060 <span class="keyword">end</span>
0061 <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>
30 changes: 15 additions & 15 deletions doc/io/closeModel.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,51 +63,51 @@ <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" sr
0011
0012 closedModel=model;
0013
0014 closedModel.comps{numel(closedModel.comps)+1}=<span class="string">'b'</span>;
0015 closedModel.compNames{numel(closedModel.compNames)+1}=<span class="string">'boundary'</span>;
0014 closedModel.comps{numel(closedModel.comps)+1,1}=<span class="string">'b'</span>;
0015 closedModel.compNames{numel(closedModel.compNames)+1,1}=<span class="string">'boundary'</span>;
0016 <span class="keyword">if</span> isfield(closedModel,<span class="string">'compMiriams'</span>)
0017 closedModel.compMiriams{numel(closedModel.compMiriams)+1}=[];
0018 <span class="keyword">end</span>;
0017 closedModel.compMiriams{numel(closedModel.compMiriams)+1,1}=[];
0018 <span class="keyword">end</span>
0019 closedModel.unconstrained=zeros(numel(closedModel.mets),1);
0020
0021 <span class="keyword">for</span> i=1:numel(closedModel.rxns)
0022 <span class="keyword">if</span> sum(abs(closedModel.S(:,i)))==1
0023 closedModel.mets{numel(closedModel.mets)+1}=strcat(closedModel.mets{find(closedModel.S(:,i))},<span class="string">'_b'</span>);
0024 <span class="keyword">if</span> isfield(closedModel,<span class="string">'metNames'</span>)
0025 closedModel.metNames{numel(closedModel.metNames)+1}=closedModel.metNames{find(closedModel.S(:,i))};
0026 <span class="keyword">end</span>;
0026 <span class="keyword">end</span>
0027 closedModel.metComps(numel(closedModel.metComps)+1)=numel(closedModel.comps);
0028 <span class="keyword">if</span> isfield(closedModel,<span class="string">'inchis'</span>)
0029 closedModel.inchis{numel(closedModel.inchis)+1}=closedModel.inchis{find(closedModel.S(:,i))};
0030 <span class="keyword">end</span>;
0030 <span class="keyword">end</span>
0031 <span class="keyword">if</span> isfield(closedModel,<span class="string">'metSmiles'</span>)
0032 closedModel.metSmiles{numel(closedModel.metSmiles)+1}=closedModel.metSmiles{find(closedModel.S(:,i))};
0033 <span class="keyword">end</span>;
0033 <span class="keyword">end</span>
0034 <span class="keyword">if</span> isfield(closedModel,<span class="string">'metFormulas'</span>)
0035 closedModel.metFormulas{numel(closedModel.metFormulas)+1}=closedModel.metFormulas{find(closedModel.S(:,i))};
0036 <span class="keyword">end</span>;
0036 <span class="keyword">end</span>
0037 <span class="keyword">if</span> isfield(closedModel,<span class="string">'metMiriams'</span>)
0038 closedModel.metMiriams{numel(closedModel.metMiriams)+1}=closedModel.metMiriams{find(closedModel.S(:,i))};
0039 <span class="keyword">end</span>;
0039 <span class="keyword">end</span>
0040 <span class="keyword">if</span> isfield(closedModel,<span class="string">'metFrom'</span>)
0041 closedModel.metFrom{numel(closedModel.metFrom)+1}=<span class="string">''</span>;
0042 <span class="keyword">end</span>;
0042 <span class="keyword">end</span>
0043 <span class="keyword">if</span> isfield(closedModel,<span class="string">'metCharges'</span>)
0044 closedModel.metCharges(numel(closedModel.metCharges)+1)=closedModel.metCharges(find(closedModel.S(:,i)));
0045 <span class="keyword">end</span>;
0045 <span class="keyword">end</span>
0046 <span class="keyword">if</span> isfield(closedModel,<span class="string">'metDeltaG'</span>)
0047 closedModel.metDeltaG(numel(closedModel.metDeltaG)+1)=closedModel.metDeltaG(find(closedModel.S(:,i)));
0048 <span class="keyword">end</span>;
0048 <span class="keyword">end</span>
0049 closedModel.unconstrained(numel(closedModel.unconstrained)+1)=1;
0050 closedModel.b(numel(closedModel.b)+1)=0;
0051 closedModel.S=[closedModel.S;sparse(1,size(closedModel.S,2))];
0052 <span class="keyword">if</span> sum(closedModel.S(:,i))==1
0053 closedModel.S(numel(closedModel.mets),i)=-1;
0054 <span class="keyword">else</span>
0055 closedModel.S(numel(closedModel.mets),i)=1;
0056 <span class="keyword">end</span>;
0057 <span class="keyword">end</span>;
0058 <span class="keyword">end</span>;
0056 <span class="keyword">end</span>
0057 <span class="keyword">end</span>
0058 <span class="keyword">end</span>
0059
0060 <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>
Expand Down
Loading