Skip to content

Commit

Permalink
fix: exportModel valid libSBML output
Browse files Browse the repository at this point in the history
  • Loading branch information
edkerk committed May 21, 2024
1 parent 191c89b commit d390475
Show file tree
Hide file tree
Showing 7 changed files with 804 additions and 810 deletions.
39 changes: 20 additions & 19 deletions doc/core/getAllowedBounds.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,28 +118,29 @@ <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" sr
0049 tmpModel = model;
0050 tmpModel.c = c;
0051
0052 <span class="comment">% Get minimal flux</span>
0053 tmpModel.c(rxns(i)) = -1;
0054 solMin = solveLP(tmpModel);
0055 <span class="keyword">if</span> ~isempty(solMin.f)
0056 minFluxes(i) = solMin.x(rxns(i));
0052 <span class="comment">% Get maximal flux</span>
0053 tmpModel.c(rxns(i)) = 1;
0054 [solMax,hsSol]=solveLP(tmpModel);
0055 <span class="keyword">if</span> ~isempty(solMax.f)
0056 maxFluxes(i) = solMax.x(rxns(i));
0057 <span class="keyword">else</span>
0058 minFluxes(i) = NaN;
0058 maxFluxes(i) = NaN;
0059 <span class="keyword">end</span>
0060
0061 <span class="comment">% Get maximal flux</span>
0062 tmpModel.c(rxns(i)) = 1;
0063 solMax=solveLP(tmpModel);
0064 exitFlags(i,:) = [solMin.stat solMax.stat];
0065 <span class="keyword">if</span> ~isempty(solMax.f)
0066 maxFluxes(i) = solMax.x(rxns(i));
0067 <span class="keyword">else</span>
0068 maxFluxes(i) = NaN;
0069 <span class="keyword">end</span>
0070 <span class="keyword">end</span>
0071 <span class="comment">% Reset original Parallel setting</span>
0072 ps.Pool.AutoCreate = oldPoolAutoCreateSetting;
0073 <span class="keyword">end</span></pre></div>
0061 <span class="comment">% Get minimal flux</span>
0062 tmpModel.c(rxns(i)) = -1;
0063 solMin = solveLP(tmpModel,[],[],hsSol);
0064 <span class="keyword">if</span> ~isempty(solMin.f)
0065 minFluxes(i) = solMin.x(rxns(i));
0066 <span class="keyword">else</span>
0067 minFluxes(i) = NaN;
0068 <span class="keyword">end</span>
0069 exitFlags(i,:) = [solMin.stat solMax.stat];
0070
0071 <span class="keyword">end</span>
0072 <span class="comment">% Reset original Parallel setting</span>
0073 ps.Pool.AutoCreate = oldPoolAutoCreateSetting;
0074 <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: 1 addition & 1 deletion doc/core/getGenesFromGrRules.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" sr
0054
0055 <span class="comment">% construct new gene list</span>
0056 nonEmpty = ~cellfun(@isempty,rxnGenes);
0057 genes = unique([rxnGenes{nonEmpty}]');
0057 genes = unique(transpose([rxnGenes{nonEmpty}]));
0058 genes(cellfun(@isempty,genes)) = [];
0059
0060 <span class="keyword">if</span> ~isempty(originalGenes)
Expand Down
41 changes: 22 additions & 19 deletions doc/core/haveFlux.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,25 +120,28 @@ <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" sr
0058 <span class="comment">%Loop through and maximize then minimize each rxn if it does not already</span>
0059 <span class="comment">%have a flux</span>
0060 Z=zeros(numel(smallModel.c),1);
0061 hsSolOut=[];
0062 <span class="keyword">for</span> i=[1 -1]
0063 <span class="keyword">for</span> j=1:numel(J)
0064 <span class="keyword">if</span> J(j)==false
0065 <span class="comment">%Only minimize for reversible reactions</span>
0066 <span class="keyword">if</span> i==1 || smallModel.rev(mixIndexes(j))~=0
0067 smallModel.c=Z;
0068 smallModel.c(mixIndexes(j))=i;
0069 [sol, hsSolOut]=solveLP(smallModel,0,[],hsSolOut);
0070 <span class="keyword">if</span> any(sol.x)
0071 J(abs(sol.x(mixIndexes))&gt;cutOff)=true;
0072 <span class="keyword">end</span>
0073 <span class="keyword">end</span>
0074 <span class="keyword">end</span>
0075 <span class="keyword">end</span>
0076 <span class="keyword">end</span>
0077
0078 I=ismember(rxns,smallModel.rxns(mixIndexes(J)));
0079 <span class="keyword">end</span></pre></div>
0061 tryMin = find(J == false);
0062 isRev = smallModel.rev
0063
0064 parfor
0065 <span class="keyword">for</span> i=[1 -1]
0066 <span class="keyword">for</span> j=1:numel(J)
0067 <span class="keyword">if</span> J(j)==false
0068 <span class="comment">%Only minimize for reversible reactions</span>
0069 <span class="keyword">if</span> i==1 || smallModel.rev(mixIndexes(j))~=0
0070 smallModel.c=Z;
0071 smallModel.c(mixIndexes(j))=i;
0072 sol=solveLP(smallModel,0);
0073 <span class="keyword">if</span> any(sol.x)
0074 J(abs(sol.x(mixIndexes))&gt;cutOff)=true;
0075 <span class="keyword">end</span>
0076 <span class="keyword">end</span>
0077 <span class="keyword">end</span>
0078 <span class="keyword">end</span>
0079 <span class="keyword">end</span>
0080
0081 I=ismember(rxns,smallModel.rxns(mixIndexes(J)));
0082 <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

0 comments on commit d390475

Please sign in to comment.