-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscangenes.m
More file actions
38 lines (31 loc) · 824 Bytes
/
Copy pathscangenes.m
File metadata and controls
38 lines (31 loc) · 824 Bytes
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
function xhits=scangenes(genes, numx)
%SCANGENES Utility function to scan a single multigene individual for all inputs
%and return a frequency vector.
%
% XHITS=SCANGENES(GENES, NUMX) scans the cell array GENES for NUMX
% input variables and returns the frequency vector XHITS.
%
% See also: GPMODELVARS
%
% (c) Dominic Searson 2009
%
% v1.0
numgenes=length(genes);
xhits=zeros(1,numx);
%loop through inputs
for i=1:numx
k1=[];
k2=[];
istr=int2str(i);
%loop through genes, look for current input
for j=1:numgenes
k1 = strfind(genes{j}, ['x' istr ',']);
k2 = strfind(genes{j},['x' istr ')']);
if ~isempty(k1)
xhits(i)=xhits(i)+length(k1);
end
if ~isempty(k2)
xhits(i)=xhits(i)+length(k2);
end
end
end