Skip to content

Commit cded846

Browse files
committed
RAVEN 2.10.5
2 parents 6f27c36 + 820cc5c commit cded846

17 files changed

+1336
-1329
lines changed

core/checkModelStruct.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ function checkModelStruct(model,throwErrors,trimWarnings)
124124
EM='If "grRules" field exists, the model should also contain a "genes" field';
125125
dispEM(EM,throwErrors);
126126
else
127+
%Erroneous grRules that start/end with OR/AND
128+
EM='The following reaction(s) have grRules that start or end with ''OR'' or ''AND'':';
129+
dispEM(EM,throwErrors,model.rxns(startsWith(model.grRules,{'or ','and '}) | endsWith(model.grRules,{' or',' and'})),trimWarnings);
130+
%grRules that are not in genes field
127131
geneList = getGenesFromGrRules(model.grRules);
128132
geneList = setdiff(unique(geneList),model.genes);
129133
if ~isempty(geneList)

core/getExchangeRxns.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
% positive flux value would imply uptake,
2727
% but reaction bounds are not considered
2828
% 'out' reactions where the boundary metabolite
29-
% is the substrate of the reaction, a
30-
% positive flux value would imply uptake,
29+
% is the product of the reaction, a
30+
% negative flux value would imply uptake,
3131
% but reaction bounds are not considered.
3232
%
3333
% Output:

core/setParam.m

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
else
4040
rxnList=convertCharArray(rxnList);
4141
end
42+
if isempty(rxnList)
43+
return;
44+
end
4245

4346
%Allow to set several parameters to the same value
4447
if numel(rxnList)~=numel(params) && numel(params)~=1
@@ -59,23 +62,16 @@
5962
%as we do not want to throw errors if matches fail
6063
indexes=zeros(numel(rxnList),1);
6164

62-
for i=1:numel(rxnList)
63-
index=find(strcmp(rxnList{i},model.rxns),1);
64-
if ~isempty(index)
65-
indexes(i)=index;
66-
else
67-
indexes(i)=-1;
68-
EM=['Reaction ' rxnList{i} ' is not present in the reaction list'];
69-
dispEM(EM,false);
70-
end
65+
[Lia,Locb] = ismember(rxnList,model.rxns);
66+
indexes(Lia) = Locb;
67+
if any(~Lia)
68+
params(~Lia)=[];
69+
indexes(~Lia)=[];
70+
paramType(~Lia)=[];
71+
dispEM('Reactions not present in model, will be ignored:',false,rxnLise(~Lia));
7172
end
7273

73-
%Remove the reactions that were not found
74-
params(indexes==-1)=[];
75-
indexes(indexes==-1)=[];
76-
paramType(indexes==-1)=[];
7774
%Change the parameters
78-
7975
if ~isempty(indexes)
8076
if contains(paramType,'obj')
8177
model.c=zeros(numel(model.c),1); % parameter is changed, not added

doc/core/checkModelStruct.html

Lines changed: 323 additions & 319 deletions
Large diffs are not rendered by default.

doc/core/getExchangeRxns.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ <h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="
5454
positive flux value would imply uptake,
5555
but reaction bounds are not considered
5656
'out' reactions where the boundary metabolite
57-
is the substrate of the reaction, a
58-
positive flux value would imply uptake,
57+
is the product of the reaction, a
58+
negative flux value would imply uptake,
5959
but reaction bounds are not considered.
6060

6161
Output:
@@ -109,8 +109,8 @@ <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" sr
109109
0026 <span class="comment">% positive flux value would imply uptake,</span>
110110
0027 <span class="comment">% but reaction bounds are not considered</span>
111111
0028 <span class="comment">% 'out' reactions where the boundary metabolite</span>
112-
0029 <span class="comment">% is the substrate of the reaction, a</span>
113-
0030 <span class="comment">% positive flux value would imply uptake,</span>
112+
0029 <span class="comment">% is the product of the reaction, a</span>
113+
0030 <span class="comment">% negative flux value would imply uptake,</span>
114114
0031 <span class="comment">% but reaction bounds are not considered.</span>
115115
0032 <span class="comment">%</span>
116116
0033 <span class="comment">% Output:</span>

doc/core/setParam.html

Lines changed: 83 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -111,96 +111,92 @@ <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" sr
111111
0039 <span class="keyword">else</span>
112112
0040 rxnList=<a href="convertCharArray.html" class="code" title="function inputConverted = convertCharArray(funcInput)">convertCharArray</a>(rxnList);
113113
0041 <span class="keyword">end</span>
114-
0042
115-
0043 <span class="comment">%Allow to set several parameters to the same value</span>
116-
0044 <span class="keyword">if</span> numel(rxnList)~=numel(params) &amp;&amp; numel(params)~=1
117-
0045 EM=<span class="string">'The number of parameter values and the number of reactions must be the same'</span>;
118-
0046 <a href="dispEM.html" class="code" title="function dispEM(string,throwErrors,toList,trimWarnings)">dispEM</a>(EM);
119-
0047 <span class="keyword">end</span>
120-
0048
121-
0049 <span class="keyword">if</span> length(rxnList)&gt;1
122-
0050 <span class="keyword">if</span> length(paramType)==1
123-
0051 paramType(1:length(rxnList))=paramType;
124-
0052 <span class="keyword">end</span>
125-
0053 <span class="keyword">if</span> length(params)==1
126-
0054 params(1:length(rxnList))=params;
114+
0042 <span class="keyword">if</span> isempty(rxnList)
115+
0043 <span class="keyword">return</span>;
116+
0044 <span class="keyword">end</span>
117+
0045
118+
0046 <span class="comment">%Allow to set several parameters to the same value</span>
119+
0047 <span class="keyword">if</span> numel(rxnList)~=numel(params) &amp;&amp; numel(params)~=1
120+
0048 EM=<span class="string">'The number of parameter values and the number of reactions must be the same'</span>;
121+
0049 <a href="dispEM.html" class="code" title="function dispEM(string,throwErrors,toList,trimWarnings)">dispEM</a>(EM);
122+
0050 <span class="keyword">end</span>
123+
0051
124+
0052 <span class="keyword">if</span> length(rxnList)&gt;1
125+
0053 <span class="keyword">if</span> length(paramType)==1
126+
0054 paramType(1:length(rxnList))=paramType;
127127
0055 <span class="keyword">end</span>
128-
0056 <span class="keyword">end</span>
129-
0057
130-
0058 <span class="comment">%Find the indexes for the reactions in rxnList. Do not use getIndexes</span>
131-
0059 <span class="comment">%as we do not want to throw errors if matches fail</span>
132-
0060 indexes=zeros(numel(rxnList),1);
133-
0061
134-
0062 <span class="keyword">for</span> i=1:numel(rxnList)
135-
0063 index=find(strcmp(rxnList{i},model.rxns),1);
136-
0064 <span class="keyword">if</span> ~isempty(index)
137-
0065 indexes(i)=index;
138-
0066 <span class="keyword">else</span>
139-
0067 indexes(i)=-1;
140-
0068 EM=[<span class="string">'Reaction '</span> rxnList{i} <span class="string">' is not present in the reaction list'</span>];
141-
0069 <a href="dispEM.html" class="code" title="function dispEM(string,throwErrors,toList,trimWarnings)">dispEM</a>(EM,false);
142-
0070 <span class="keyword">end</span>
143-
0071 <span class="keyword">end</span>
144-
0072
145-
0073 <span class="comment">%Remove the reactions that were not found</span>
146-
0074 params(indexes==-1)=[];
147-
0075 indexes(indexes==-1)=[];
148-
0076 paramType(indexes==-1)=[];
149-
0077 <span class="comment">%Change the parameters</span>
150-
0078
151-
0079 <span class="keyword">if</span> ~isempty(indexes)
152-
0080 <span class="keyword">if</span> contains(paramType,<span class="string">'obj'</span>)
153-
0081 model.c=zeros(numel(model.c),1); <span class="comment">% parameter is changed, not added</span>
154-
0082 <span class="keyword">end</span>
155-
0083 <span class="keyword">for</span> j=1:length(paramType)
156-
0084 <span class="keyword">if</span> strcmpi(paramType{j},<span class="string">'eq'</span>)
128+
0056 <span class="keyword">if</span> length(params)==1
129+
0057 params(1:length(rxnList))=params;
130+
0058 <span class="keyword">end</span>
131+
0059 <span class="keyword">end</span>
132+
0060
133+
0061 <span class="comment">%Find the indexes for the reactions in rxnList. Do not use getIndexes</span>
134+
0062 <span class="comment">%as we do not want to throw errors if matches fail</span>
135+
0063 indexes=zeros(numel(rxnList),1);
136+
0064
137+
0065 [Lia,Locb] = ismember(rxnList,model.rxns);
138+
0066 indexes(Lia) = Locb;
139+
0067 <span class="keyword">if</span> any(~Lia)
140+
0068 params(~Lia)=[];
141+
0069 indexes(~Lia)=[];
142+
0070 paramType(~Lia)=[];
143+
0071 <a href="dispEM.html" class="code" title="function dispEM(string,throwErrors,toList,trimWarnings)">dispEM</a>(<span class="string">'Reactions not present in model, will be ignored:'</span>,false,rxnLise(~Lia));
144+
0072 <span class="keyword">end</span>
145+
0073
146+
0074 <span class="comment">%Change the parameters</span>
147+
0075 <span class="keyword">if</span> ~isempty(indexes)
148+
0076 <span class="keyword">if</span> contains(paramType,<span class="string">'obj'</span>)
149+
0077 model.c=zeros(numel(model.c),1); <span class="comment">% parameter is changed, not added</span>
150+
0078 <span class="keyword">end</span>
151+
0079 <span class="keyword">for</span> j=1:length(paramType)
152+
0080 <span class="keyword">if</span> strcmpi(paramType{j},<span class="string">'eq'</span>)
153+
0081 model.lb(indexes(j))=params(j);
154+
0082 model.ub(indexes(j))=params(j);
155+
0083 <span class="keyword">end</span>
156+
0084 <span class="keyword">if</span> strcmpi(paramType{j},<span class="string">'lb'</span>)
157157
0085 model.lb(indexes(j))=params(j);
158-
0086 model.ub(indexes(j))=params(j);
159-
0087 <span class="keyword">end</span>
160-
0088 <span class="keyword">if</span> strcmpi(paramType{j},<span class="string">'lb'</span>)
161-
0089 model.lb(indexes(j))=params(j);
162-
0090 <span class="keyword">end</span>
163-
0091 <span class="keyword">if</span> strcmpi(paramType{j},<span class="string">'ub'</span>)
164-
0092 model.ub(indexes(j))=params(j);
165-
0093 <span class="keyword">end</span>
166-
0094 <span class="keyword">if</span> strcmpi(paramType{j},<span class="string">'obj'</span>)
167-
0095 model.c(indexes(j))=params(j);
158+
0086 <span class="keyword">end</span>
159+
0087 <span class="keyword">if</span> strcmpi(paramType{j},<span class="string">'ub'</span>)
160+
0088 model.ub(indexes(j))=params(j);
161+
0089 <span class="keyword">end</span>
162+
0090 <span class="keyword">if</span> strcmpi(paramType{j},<span class="string">'obj'</span>)
163+
0091 model.c(indexes(j))=params(j);
164+
0092 <span class="keyword">end</span>
165+
0093 <span class="keyword">if</span> strcmpi(paramType{j},<span class="string">'rev'</span>)
166+
0094 <span class="comment">%Non-zero values are interpreted as reversible</span>
167+
0095 model.rev(indexes(j))=params(j)~=0;
168168
0096 <span class="keyword">end</span>
169-
0097 <span class="keyword">if</span> strcmpi(paramType{j},<span class="string">'rev'</span>)
170-
0098 <span class="comment">%Non-zero values are interpreted as reversible</span>
171-
0099 model.rev(indexes(j))=params(j)~=0;
172-
0100 <span class="keyword">end</span>
173-
0101 <span class="keyword">if</span> strcmpi(paramType{j},<span class="string">'var'</span>)
174-
0102 <span class="keyword">if</span> params(j) &lt; 0
175-
0103 model.lb(indexes(j)) = params(j) * (1+var/200);
176-
0104 model.ub(indexes(j)) = params(j) * (1-var/200);
177-
0105 <span class="keyword">else</span>
178-
0106 model.lb(indexes(j)) = params(j) * (1-var/200);
179-
0107 model.ub(indexes(j)) = params(j) * (1+var/200);
180-
0108 <span class="keyword">end</span>
181-
0109 <span class="keyword">end</span>
182-
0110 <span class="keyword">if</span> strcmpi(paramType{j},<span class="string">'unc'</span>)
183-
0111 <span class="keyword">if</span> isfield(model.annotation,<span class="string">'defaultLB'</span>)
184-
0112 lb = model.annotation.defaultLB;
185-
0113 <span class="keyword">else</span>
186-
0114 lb = -1000;
187-
0115 <span class="keyword">end</span>
188-
0116 <span class="keyword">if</span> isfield(model.annotation,<span class="string">'defaultUB'</span>)
189-
0117 ub = model.annotation.defaultUB;
190-
0118 <span class="keyword">else</span>
191-
0119 ub = 1000;
192-
0120 <span class="keyword">end</span>
193-
0121 model.lb(indexes(j)) = lb;
194-
0122 model.ub(indexes(j)) = ub;
195-
0123 <span class="keyword">end</span>
196-
0124 <span class="keyword">end</span>
197-
0125 <span class="keyword">end</span>
198-
0126 <span class="keyword">if</span> any(ismember(paramType,{<span class="string">'lb'</span>,<span class="string">'ub'</span>,<span class="string">'unc'</span>}))
199-
0127 invalidBound = model.lb(indexes) &gt; model.ub(indexes);
200-
0128 <span class="keyword">if</span> any(invalidBound)
201-
0129 error([<span class="string">'Invalid set of bounds for reaction(s): '</span>, strjoin(model.rxns(indexes(invalidBound)),<span class="string">', '</span>), <span class="string">'.'</span>])
202-
0130 <span class="keyword">end</span>
203-
0131 <span class="keyword">end</span></pre></div>
169+
0097 <span class="keyword">if</span> strcmpi(paramType{j},<span class="string">'var'</span>)
170+
0098 <span class="keyword">if</span> params(j) &lt; 0
171+
0099 model.lb(indexes(j)) = params(j) * (1+var/200);
172+
0100 model.ub(indexes(j)) = params(j) * (1-var/200);
173+
0101 <span class="keyword">else</span>
174+
0102 model.lb(indexes(j)) = params(j) * (1-var/200);
175+
0103 model.ub(indexes(j)) = params(j) * (1+var/200);
176+
0104 <span class="keyword">end</span>
177+
0105 <span class="keyword">end</span>
178+
0106 <span class="keyword">if</span> strcmpi(paramType{j},<span class="string">'unc'</span>)
179+
0107 <span class="keyword">if</span> isfield(model.annotation,<span class="string">'defaultLB'</span>)
180+
0108 lb = model.annotation.defaultLB;
181+
0109 <span class="keyword">else</span>
182+
0110 lb = -1000;
183+
0111 <span class="keyword">end</span>
184+
0112 <span class="keyword">if</span> isfield(model.annotation,<span class="string">'defaultUB'</span>)
185+
0113 ub = model.annotation.defaultUB;
186+
0114 <span class="keyword">else</span>
187+
0115 ub = 1000;
188+
0116 <span class="keyword">end</span>
189+
0117 model.lb(indexes(j)) = lb;
190+
0118 model.ub(indexes(j)) = ub;
191+
0119 <span class="keyword">end</span>
192+
0120 <span class="keyword">end</span>
193+
0121 <span class="keyword">end</span>
194+
0122 <span class="keyword">if</span> any(ismember(paramType,{<span class="string">'lb'</span>,<span class="string">'ub'</span>,<span class="string">'unc'</span>}))
195+
0123 invalidBound = model.lb(indexes) &gt; model.ub(indexes);
196+
0124 <span class="keyword">if</span> any(invalidBound)
197+
0125 error([<span class="string">'Invalid set of bounds for reaction(s): '</span>, strjoin(model.rxns(indexes(invalidBound)),<span class="string">', '</span>), <span class="string">'.'</span>])
198+
0126 <span class="keyword">end</span>
199+
0127 <span class="keyword">end</span></pre></div>
204200
<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>
205201
</body>
206202
</html>

0 commit comments

Comments
 (0)