Click here to Skip to main content
15,887,434 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
1.input is a large sequence of DNA bases (i,e) sequence of any length of 4 alphabets (a,t,g,c) in random fashion. eg, atgcccctgggaagtgaaaatgcccc........
2.convert a=00
t=01
g=10
c=11
3.then,partition the sequence into 8 bits
4.convert each 8bit value into corresponding decimal value
5.convert each decimal value into corresponding ASCII value.
6.now,consider first 16 ASCII characters of the sequence,compare it with every next 16 characters.
7.for each comparison, print only the position and change in symbol.
ie. 1@ which mean 1st position is replaced by @. dont change the common terms.

What I have tried:

i tried only the logic manually
Posted
Updated 17-Aug-17 23:25pm
Comments
Jochen Arndt 18-Aug-17 4:32am    
This looks like homework for which you will not get code here.

Try it yourself. If you got stuck somewhere, show what you have tried and explain your problems. Then we will try to help you.
Richard MacCutchan 18-Aug-17 4:44am    
"i tried only the logic manually"
Then turning that into code should not be too difficult.

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
 
Share this answer
 
So you must only write the code. Take some tutorial to leverage for codind skills.

Consider to use classes to give your code a better architecture. It is best to split every task in a single function or class, than sum up all results in some array. This array should be typedef array of your results.

You will need to do some bit shifting and type casting somewhere in your code:
C++
unsigned char byte = (dna1<<6) | (dna2<<4) | (dna3<<2) | (dna4<<0);
int value = (int) byte;
char c = (char) value;
Dont rely that the code is suitable for you!!!

Tip: write some test snippets to verify your code.
 
Share this answer
 
You didn't state any question or problem, you just pasted an assignment.
Your statement look weird to me:
- 4 and 5 are about converting a 8 bits value to a 8 bits value ???
- 6 this step is only looking for repeats of blocks of 16 and with distance multiples of 16 too, this means that repeats with distances different of 16 do not interest you.
- 7 is weird too since @ in ascii, it is also the encoding for taaa, how do you know what is what ?
-----
We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.

As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.
When you just ask for the solution, it is like trying to learn to drive a car by having someone else training.
Creating an algorithm is basically finding the maths and make necessary adaptation to fit your actual problem.

The idea of "development" is as the word suggests: "The systematic use of scientific and technical knowledge to meet specific objectives or requirements." BusinessDictionary.com[^]
That's not the same thing as "have a quick google and give up if I can't find exactly the right code".
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900