-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildFluxDistLayoutDiff.m
More file actions
65 lines (60 loc) · 2.35 KB
/
buildFluxDistLayoutDiff.m
File metadata and controls
65 lines (60 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
function [messageOut] = buildFluxDistLayoutDiff(model, solution1, solution2, identifier)
% Builds a layout for MINERVA from the difference in flux distribution
% between two COBRA solutions.
%
% USAGE:
%
% [messageOut] = buildFluxDistLayout(model, solution1, solution2, identifier)
%
% INPUTS:
% model: COBRA model structure
% solution1: optimizeCb solution structure with a flux vector
% solution2: optimizeCb solution structure with a flux vector
% identifier: Name for the layout in MINERVA
%
% OUTPUT:
% messageOut: message!
%
% .. Author: Michiel Adriaens (14-06-2018)
content = 'name\treactionIdentifier\tlineWidth\tcolor\n';
for i=1:length(solution1.v)
mapReactionId = model.rxns{i};
% Both negative
if solution1.v(i) < 0 && solution2.v(i) < 0
if solution1.v(i) < solution2.v(i) % stronger negative flux
line = strcat('\t', mapReactionId, '\t', 5, '\t', '#FFD700', '\n'); % gold
content = strcat(content, line);
end
if solution1.v(i) > solution2.v(i) % weaker negative flux
line = strcat('\t', mapReactionId, '\t', 5, '\t', '#1E90FF', '\n'); % blue
content = strcat(content, line);
end
end
% Both positive
if solution1.v(i) > 0 && solution2.v(i) > 0
if solution1.v(i) > solution2.v(i) % stronger positive flux
line = strcat('\t', mapReactionId, '\t', 5, '\t', '#FFD700', '\n'); % gold
content = strcat(content, line);
end
if solution1.v(i) < solution2.v(i) % weaker positive flux
line = strcat('\t', mapReactionId, '\t', 5, '\t', '#1E90FF', '\n'); % blue
content = strcat(content, line);
end
end
% Positive versus negative
if solution1.v(i) > 0 && solution2.v(i) < 0
line = strcat('\t', mapReactionId, '\t', 5, '\t', '#7c6c5a', '\n'); % taupe
content = strcat(content, line);
end
% Negative versus positive
if solution1.v(i) < 0 && solution2.v(i) > 0
line = strcat('\t', mapReactionId, '\t', 5, '\t', '#7c6c5a', '\n'); % taupe
content = strcat(content, line);
end
end
% Modified code of buildFluxDistLayout to export overlay to upload manually:
fileID = fopen(strcat(identifier, '_diff_overlay.txt'), 'w');
fprintf(fileID, content);
fclose(fileID);
serverResponse = 'done';
end