Binary to DNA sequence encoding - matlab
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
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
Star Strider
2015년 9월 20일
DNA has four bases (two complementary sets, A-T and C-G) and you have a binary sequence ...
Meghashree G
2015년 9월 20일
yeah..i know To use ATGC concept,but i don't know how to code..Like how do i extract only 2 digits from the binary vector and assign it to either A,T,G,C..
채택된 답변
Image Analyst
2015년 9월 20일
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
Meghashree G
2015년 9월 20일
Thank you so much :) it worked :)
Saurabh Kumar
2018년 2월 12일
I want to create a function in Matlab of above solution you have given. So that I don't need to describe different binary Everytime in .m blank file format. Please help Function []=binary()
function result = LabelBinaryArray(binaryArray)
% 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
Saurabh Kumar
2018년 2월 12일
Attempted to access binaryArray(2); index out of bounds because numel(binaryArray)=1.
Error in LabelBinaryArray (line 6) index = 2 * binaryArray(k) + binaryArray(k+1) + 1;
NOT WORKING
Image Analyst
2018년 2월 12일
It works if you pass in something like you said, like '01100011'. You can't pass in a single value like '1' like you did because that can't be mapped to a letter. How do I know you passed in only a single element? Because the error message says "because numel(binaryArray)=1" Are you sure you're passing in a binary array like you said? I'm assuming a binary array, which is class logical, though a double will work. You aren't passing in a string are you? Show me how you defined the array you passed in to the function.
LabelBinaryArray('011000110111001001111001011100000111010001101111')
Attempted to access bases(146); index out of bounds because numel(bases)=4.
Error in LabelBinaryArray (line 8) result((k+1)/2) = bases(index);
OK, you have a string, not a binary/logical array. To convert to a binary array you need to do this:
str = '011000110111001001111001011100000111010001101111'
binaryArray = logical(str - '0')
You can do that either inside the function, if you want to pass a string, or in your main program before you call the function, if you want to pass a binary array.
Saurabh Kumar
2018년 2월 13일
it worked. THANKS
How to decrypt it back to binary sequence
Decrypt what back to a binary sequence. You have the binary sequence both as a character array, str, and a logical/boolean array, binaryArray. What else do you want? What's missing? Just keep both things and you're all set.
Pls Can I get the decryption code
Shiva, I'm not sure who you're asking, but personally I don't have any to give you.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Cell Arrays에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
