I have a DNA sequence, its length for example is m*4n:
B = 'GATTAACTACACTTGAGGCT...';
I have also a vector of real numbers X = {xi, i = 1..m*4n}, and use mod(X,1)
to keep them in the range [0,1]. For example:
X = [0.223 0.33 0.71 0.44 0.91 0.32 0.11 ....... m*4n];
I then need to transform X
into a binary vector by applying the function:
f(x)={0 ,0 < X(i,j) ≤ 0.5; 1 ,0.5 < X(i,j) ≤ 1;)
The output according the previous values will be like X = [0010100 ....]
. If X(i,j)==1
, then B(i,j)
is complemented, otherwise it is unchanged. In this context, the complement is the matching base-pair (i.e. A->T, C->G, G->C, and T->A).
This is the code I've tried so far, with no success:
%%maping X chaotic sequence from real numbers to binary sequence using threshold function
X = v(:,3);
X(257)=[];
disp (X);
mode (X,1);
for i=1
for j=1:256
if ((X(i,j)> 0) && (X(i,j)<= .5))
X(i,j) = 0;
elseif ((X(i,j)> .5) && (X(i,j)<= 1))
X(i,j) = 1;
end
end
end
disp(X);
How can I properly perform the indexing and complement?