forked from opencobra/cobratoolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
analyzeRxns.m
54 lines (49 loc) · 1.59 KB
/
analyzeRxns.m
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
function [allRxns,rxnCount] = analyzeRxns(product,listProducts,listRxns)
%analyzeRxns determines which knockout reactions occur most often
% when a specified product is produced
%
% [allRxns, rxnCount] = analyzeRxns(product,listProducts,listRxns)
%
%INPUTS
% product the product to investigate
% listProducts the list of all products produced in a RandKnock
% listRxns the list of all rxns knocked out in a RandKnock
%
%OUTPUTS
% allRxns all of the rxns knocked out in strains producing the
% product
% rxnCount the number of times each rxn was knocked out
%
% Jeff Orth (6/20/07)
%find all product producers
makesProd = [];
h = waitbar(0,['finding ',product,' producing strains']);
for i = 1:length(listProducts)
waitbar(i/length(listProducts),h);
pos = strmatch(product,listProducts{i});
if pos ~= 0
makesProd = [makesProd,i];
end
end
if ( regexp( version, 'R20') )
close(h);
end
%determine which reactions are knocked out in each strain, return the
%frequency of each knockout reactions
allRxns = [];
rxnCount = [];
for i = 1:length(makesProd)
rxns = listRxns(makesProd(i));
rxns = rxns{1};
for j = 1:length(rxns)
rxn = rxns(j);
%if reaction has not been added to list yet, add it
match = strcmp(rxn,allRxns);
if length(find(match)) == 0
allRxns = [allRxns,rxn];
rxnCount = [rxnCount,1];
else
rxnCount(find(match)) = rxnCount(find(match))+1;
end
end
end