Clear Filters
Clear Filters

How to reverse scrambled DNA?

1 view (last 30 days)
M.A.Fathy
M.A.Fathy on 29 Jan 2018
Answered: Asha D. on 7 Jul 2019
I have this function for scrambling DNA array in Matlab:
disp(x); disp(y);
figure,plot(x,y);
%%sorting
[lx,fx]=sort(x);
[ly,fy]=sort(y);
S=fx;
T=(fy)';
%%matrix generated for scrambling
[Tgrid, Sgrid] = meshgrid( T, S );
W = arrayfun( @(S,T) [S T], Sgrid, Tgrid, 'UniformOutput', false );
%%scrambled matrix
D=cellfun(@(x) C{x(1),x(2)},W,'un',0);
disp(D);
I can't figure out how I can reverse this scrambled function to get the decryption code. Would you please help me up?
Edit//
I am working on a gray scale image encryption(256*256), converted the values of this image into dna array(265*265), every pixel have 4 characters for an example ACGT TTCG AAGC ....etc. After that i scrambled this dna array by using two generated random chaotic sequences x,y which the length of each other is (1*256).
This is the code from beginning to make the above part be more clear, hope you can help me to get the inverse of scrambled function:
clc
clear all
close all
tic;
A=imread('C:\Users\Desktop\lena.jpg');
disp(A);
imshow(A);
for i=1:1:256
for j=1:1:256
B{i,j,1} = dec2bin(A(i,j),8); %%conversion of pixel values to 8 bit binary values from original image
end
end
disp(B);
codebook1 = containers.Map({'00','11','10','01'},{'G','C','T','A'}); %// Lookup-map values to key
%%DNA maping of binary values of original image
outputCell = cellfun(@(x) values(codebook1, {x(1:2),x(3:4),x(5:6),x(7:8)}),B, 'uni', 0);
C = cellfun(@cell2mat, outputCell, 'uni', 0);
disp(C);
%%Chaotic sequence generation
%the values of a, b, c, d, k here
a = 36;
b = 3;
c = 28;
d = 16;
k = 0.2;
%vector v0, which is a 4x1 vector of initial conditions
v0 = [0.3 -0.4 1.2 1];
fun = @(t,v) chenAssistentFun(t,v,a,b,c,d,k);
[t, v] = ode45(fun, [0 1.54], v0);
x = v(:,1);
x(257)=[];
y = v(:,2);

Answers (1)

Asha D.
Asha D. on 7 Jul 2019
I am eager to know that whether you got the reverse code.
If yes then kindly share.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!