Modified from colorSubsystemCD as distributed through COBRA Toolbox https://github.com/opencobra/cobratoolbox/blob/src/visualization/metabolicCartography/colorSubsystemCD.m Color every reaction in a specific subsystem USAGE: [newMap] = colorSubsystemCD(map, model, subsystem, color, areaWidth); INPUTS: map: File from CellDesigner parsed to MATLAB format model: COBRA model structure subsystem: Name of a subsystem as a String OPTIONAL INPUTS: color: Color desired for reactions in CAPITALS areaWidth: Width desired for reactions OUTPUT: newMap MATLAB structure of map with reaction modifications
0001 function newMap = colorSubsystem(map, model, subsystem, color) 0002 % Modified from colorSubsystemCD as distributed through COBRA Toolbox 0003 % https://github.com/opencobra/cobratoolbox/blob/src/visualization/metabolicCartography/colorSubsystemCD.m 0004 % 0005 % Color every reaction in a specific subsystem 0006 % 0007 % USAGE: 0008 % 0009 % [newMap] = colorSubsystemCD(map, model, subsystem, color, areaWidth); 0010 % 0011 % INPUTS: 0012 % map: File from CellDesigner parsed to MATLAB format 0013 % model: COBRA model structure 0014 % subsystem: Name of a subsystem as a String 0015 % 0016 % OPTIONAL INPUTS: 0017 % color: Color desired for reactions in CAPITALS 0018 % areaWidth: Width desired for reactions 0019 % 0020 % OUTPUT: 0021 % newMap MATLAB structure of map with reaction modifications 0022 if nargin < 4 0023 color = 'RED'; 0024 end 0025 0026 newMap = map; 0027 rxnList = model.rxns(ismember([model.subSystems{:}]', subsystem)); 0028 colors = createColorsMap; 0029 0030 index = find(ismember(newMap.rxnName, rxnList)); 0031 for j = index' 0032 newMap.rxnColor{j, 1} = colors(color); 0033 %newMap.rxnWidth{j, 1} = areaWidth; 0034 end 0035 0036 % Use the existence of reactant lines to check if the map has the 0037 % complete structure, and if so change also secondary lines. 0038 if any(strcmp('rxnReactantLineColor', fieldnames(newMap))) == 1 0039 for j = index' 0040 if ~isempty(newMap.rxnReactantLineColor{j}) 0041 for k = 1:length(newMap.rxnReactantLineColor{j}) 0042 newMap.rxnReactantLineColor{j, 1}{k, 1} = colors(color); 0043 %newMap.rxnReactantLineWidth{j, 1}{k, 1} = areaWidth; 0044 end 0045 end 0046 if ~isempty(newMap.rxnProductLineColor{j}) 0047 for m = 1:1:length(newMap.rxnProductLineColor{j}) 0048 newMap.rxnProductLineColor{j, 1}{m, 1} = colors(color); 0049 %newMap.rxnProductLineWidth{j, 1}{m, 1} = areaWidth; 0050 end 0051 end 0052 end 0053 end 0054 0055 end