how can i complement a DNA matrix using a binary vector?
이전 댓글 표시
I have a DNA matrix, its length for example is m*4n.
for example:
B = 'GATT' 'AACT' 'ACAC' 'TTGA' 'GGCT'
'GCAC' 'TCAT' 'GTTC' 'GCCT' 'TTTA'
'AACG' 'GTTA' 'ACGT' 'CGTC' 'TGGA'
'CTAC' 'AAAA' 'GGGC' 'CCCT' 'TCGT'
'GTGT' 'GCGG' 'GTTT' 'TTGC' 'ATTA'
i have also a vector of real numbers X = {xi, i = 1..m*4n}.
Taking mod(X,1) to keep the real numbers in the range [o,1] .
the output will be like X = [0.223 0.33 0.71 0.44 0.91 0.32 0.11 ....... m*4n];
then need to transform the obtained result into a binary vector by applying the
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 A(i,j) is complemented otherwise it is unchanged.
i tried to code this part as following but it didn't work:
%%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);
and suppose i can get the binary vector ,how to complement the DNa matrix A using the sequence X ??
%%P.S. the complement of A - T, T - A, C - G, G - C
To be more specific i need the following:
1- Apply mode (X,1) on the vector to get the values in tha rang of 0,1.
2- Mapping the real number vector into a binary vector by applying this function f(x)={0 ,0 < X(i,j) ≤ 0.5; 1 ,0.5 < X(i,j) ≤ 1;).
3- Using this binary vector X(i,j) to complement the DNA matrix A(i,j) by applying the condition, if X(i,j)=1 then A(i,j) is complemented , otherwise it is unchanged.
채택된 답변
추가 답변 (2개)
James Tursa
2016년 12월 21일
편집: James Tursa
2016년 12월 21일
Not quite sure I fully understand, but maybe something like this?
mask = mod(X,1) > 0.5; % logical indexes of the characters to flip
Bmask = B(mask); % get the characters to flip
Bmask(Bmask=='T') = 'a'; % flip T to a
Bmask(Bmask=='A') = 't'; % flip A to t
Bmask(Bmask=='C') = 'g'; % flip C to g
Bmask(Bmask=='G') = 'c'; % flip G to c
B(mask) = upper(Bmask); % replace the original characters with their flipped versions
or using ismember:
mask = mod(X,1) > 0.5; % logical indexes of the characters to flip
Bmask = B(mask); % get the characters to flip
[~,loc] = ismember(Bmask,'ATCG'); % identify the characters to flip
S = 'TAGC'; % the flipped reference string
B(mask) = S(loc); % replace the masked characters with their flipped versions
David Barry
2016년 12월 21일
X = [0.223 0.33 0.71 0.44 0.91 0.32 0.11];
X(X<= 0.5 & X >0) = 0;
X(X>0.5 & X<=1) = 1;
댓글 수: 1
카테고리
도움말 센터 및 File Exchange에서 Large Files and Big Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!