|
1 | | -function model = scaleBioMass(model,component,new_value,balance_out,dispOutput) |
2 | | -% scaleBioMass |
3 | | -% Scales the biomass composition |
| 1 | +function model = scaleBioMass(model, component, new_value, balance_out, dispOutput) |
| 2 | +% scaleBioMass yeast-GEM shim — delegates to RAVEN's scaleBiomassFraction. |
4 | 3 | % |
5 | | -% Input: |
6 | | -% model (struct) yeast-GEM model |
7 | | -% component (string) biomass component to change (options are: |
8 | | -% 'carbohydrate', 'protein', 'lipid', 'RNA', 'DNA', |
9 | | -% 'ion', 'cofactor') |
10 | | -% new_value (num) new total fraction for the specified biomass |
11 | | -% component |
12 | | -% balance_out (string, optional) biomass component that will be used |
13 | | -% to balance out the biomass composition, so that the |
14 | | -% total mass adds up to 1 g/gDCW. This is highly |
15 | | -% recommended (default = empty, no scaling takes place) |
16 | | -% dispOutput (bool, optional) displayed outoupt (default = true) |
| 4 | +% Scales `component` to `new_value` g/gDW, optionally adjusting |
| 5 | +% `balance_out` so the biomass total stays at 1 g/gDW. yeast-GEM's |
| 6 | +% 'lipid' aggregation (rescale both backbone + chain in lock-step) |
| 7 | +% is preserved via the legacy rescalePseudoReaction shim, which |
| 8 | +% dispatches the lipid special case. |
17 | 9 | % |
18 | | -% Output: |
19 | | -% model (struct) modified yeast-GEM model |
20 | | -% |
21 | | -% Usage: model = scaleBioMass(model,component,new_value,balance_out,dispOutput) |
| 10 | +% Usage: model = scaleBioMass(model, component, new_value, balance_out, dispOutput) |
22 | 11 |
|
23 | 12 | if nargin < 5 |
24 | 13 | dispOutput = true; |
25 | 14 | end |
26 | 15 | if nargin < 4 |
27 | 16 | balance_out = ''; |
28 | 17 | end |
29 | | - |
30 | | -%Measure current composition and rescale: |
31 | | -[X,P,C,R,D,L,I,F] = sumBioMass(model,false); |
| 18 | + |
| 19 | +% Current fractions (uses the shared yeast biomass config). |
| 20 | +[X, P, C, R, D, L, I, F] = sumBioMass(model, false); |
32 | 21 | content_all = {'biomass','carbohydrate','protein','lipid','RNA','DNA','ion','cofactor'}; |
33 | 22 | content_Cap = {'X','C','P','L','R','D','I','F'}; |
34 | | -pos = strcmp(content_all,component); |
35 | | -old_value = eval(content_Cap{pos}); |
36 | | -f = new_value / old_value; |
37 | | -model = rescalePseudoReaction(model,component,f); |
| 23 | +pos = strcmp(content_all, component); |
| 24 | +old_value = eval(content_Cap{pos}); |
| 25 | +f = new_value / old_value; |
| 26 | +model = rescalePseudoReaction(model, component, f); |
38 | 27 |
|
39 | | -%Balance out (if desired): |
40 | 28 | if ~isempty(balance_out) |
41 | | - X = sumBioMass(model,false); |
42 | | - pos = strcmp(content_all,balance_out); |
| 29 | + X = sumBioMass(model, false); |
| 30 | + pos = strcmp(content_all, balance_out); |
43 | 31 | balance_value = eval(content_Cap{pos}); |
44 | | - f = (balance_value + (1-X)) / balance_value; |
45 | | - model = rescalePseudoReaction(model,balance_out,f); |
| 32 | + f = (balance_value + (1 - X)) / balance_value; |
| 33 | + model = rescalePseudoReaction(model, balance_out, f); |
46 | 34 | end |
47 | | -sumBioMass(model,dispOutput); |
| 35 | +sumBioMass(model, dispOutput); |
48 | 36 | end |
0 commit comments