Binary to DNA sequence encoding - matlab
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Meghashree G
am 20 Sep. 2015
Kommentiert: Image Analyst
am 5 Feb. 2021
I am implementing DNA encryption algorithm.
For that, I have a vector containing binary values such as:
01100011 01110010 01111001 01110000 01110100 01101111.
Now, these values should be mapped to DNA sequence. How do I do that in MATLAB?
2 Kommentare
Star Strider
am 20 Sep. 2015
DNA has four bases (two complementary sets, A-T and C-G) and you have a binary sequence ...
Akzeptierte Antwort
Image Analyst
am 20 Sep. 2015
Perhaps this:
% Assign sample data.
binaryArray = [0,1,1,0,0,0,1,1, 0,1,1,1,0,0,1,0, 0,1,1,1,1,0,0,1, 0,1,1,1,0,0,0,0, 0,1,1,1,0,1,0,0, 0,1,1,0,1,1,1,1];
% Define base letters to choose from.
bases = 'ATGC';
for k = 1 : 2 : length(binaryArray)
% Convert these two digits into a number 1 - 4.
index = 2 * binaryArray(k) + binaryArray(k+1) + 1;
% Use that index to assign a letter to our result.
result((k+1)/2) = bases(index);
end
% Display in command window:
result
It shows:
result =
TGACTCAGTCGTTCAATCTATGCC
12 Kommentare
Image Analyst
am 5 Feb. 2021
Shiva, I'm not sure who you're asking, but personally I don't have any to give you.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Cell Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!