Jump to content

Fun, little school project.

Hey guys, could I get some help? My class was learning about DNA and it reminded me how each nucleotide pairs with a complementary bond to form a hydrogen base. Most of you know how A goes with T, and C goes with G, and how when RNA is made, T is replaced by U. Can I make a program in C#.Net, where when you enter in a string such as AATGGCGA, it will convert it to TTACCGCT. Then, you can take that program and convert it to mRNA's code UUACCGCU. I think maybe I can get extra credit for making a simple program. I am a complete beginner to coding, just downloaded Visual Studio 2013. I am watching Barnecules' Codegasm video as I type this. I really want to get into this and all help is appreciated. You guys are awesome and this forum never fails me when it comes to stuff like this. Thanks!

 
Link to comment
https://linustechtips.com/topic/268437-fun-little-school-project/
Share on other sites

Link to post
Share on other sites

I made you a matlab code because i dont know c#.net

you may be able to use it as psuedo code if you decide to make it yourself:

clc;clear dnacode = input('what is the dna code  ','s');dnacode = lower(dnacode); for i = 1:length(dnacode)        if dnacode(i) == 'a'                dnacodeconjugate(i) = 't';            elseif dnacode(i) == 't'                dnacodeconjugate(i) = 'a';            elseif dnacode(i) == 'g'                dnacodeconjugate(i) = 'c';            elseif dnacode(i) == 'c'                 dnacodeconjugate(i) = 'g';             else                disp('invalid dna code')        break            end    enddnacodeconjugate = upper(dnacodeconjugate);disp(dnacodeconjugate)  
Link to post
Share on other sites

Hey in c# it would look very similar to @mansoor_ example. You could obviously make the dna string to string dna = console.readline();  

string Dna = "AATGGCGA";  //string i want to change to : TTACCGCT                          //TTACCGCT            char[] charDnaArray = Dna.ToCharArray();            int Length = Dna.Length;            Console.WriteLine(Length);            for (int i = 0; i < Length; i++)            {                if (charDnaArray[i] == 'A')                {                    charDnaArray[i] = 'T';                 }                else if(charDnaArray[i] == 'T')                {                    charDnaArray[i] = 'A';                }                else if(charDnaArray[i] == 'G')                {                    charDnaArray[i] = 'C';                }                else if(charDnaArray[i] == 'C')                {                    charDnaArray[i] = 'G';                }                         }            Console.WriteLine(charDnaArray);

CPU: Intel 3570 GPUs: Nvidia GTX 660Ti Case: Fractal design Define R4  Storage: 1TB WD Caviar Black & 240GB Hyper X 3k SSD Sound: Custom One Pros Keyboard: Ducky Shine 4 Mouse: Logitech G500

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×