202: DNA

DNA: Read a File of 3-letter Codons and Generate DNA Information

1. Come to class as there may be corrections, changes and additions.
2. Code for READABILITY (significant reduction if not done)
3. Follow these directions to create a C# WINDOWS program.
4. Follow these directions to SUBMIT a folder called "DNA" to your class account

Includes the use of files, tab controls, listBoxes, loops, branches, bools and methods.


DNA is a "language" made up of four letters: A,G,C and T which represent the DNA-bases. DNA is organized into 3-letter sequences called "codons" which specify amino acids to be added during protein synthesis. Example codons: ATG, TAA, TGA, TAG, CCC, GGG. There are 64 possible codons - why 64 (use your math!)?? Your task is to analyse a file that contains an unspecified number of codons. (example file)

                                        Program (reduced) after Open and Print                                                                   Program (full) showing both sets of stats.


                                  Program (extra) at startup. Only "Open DNA File" enabled                         Buttons enabled after file opened after "Open DNA File" pressed (extra).


 
                                After file is read & printed to listbox in tab (extra).                                                 After all statistics have been generated (extra).


CONTROLS: 1 form: frmDNA (solution explorer) 4-6 buttons: btnOpen, btnPrint, btnCountCodon, btnClear btnCountStartStop btnCountValid 1 tabcontrol: tabOut 2 listboxes: lstOut, lstStats (both contained in tabOut)

REMEMBER: After opening the file, you can not assume any order of requests. A user could simply request, "Read and Count Vaid Frames", then open another file and request, "Read and Print DNA File". Each operation "should stand on its own two feet". MUST reset file pointer before each operation AFTER opening file. reader.DiscardBufferedData(); reader.BaseStream.Seek(0, SeekOrigin.Begin); reader.BaseStream.Position = 0;


90% . Use Tabs to organize into 2 "pages" - each tab will have a different listbox for output . Open File Button - always open "DNA.txt" - file "DNA.txt" MUST be located in your project directory - get DNA data file here -- file stats explained here CODE NOTES: using System.IO; StreamReader reader; // class-level reader = new StreamReader("../../DNA.txt"); // opens exactly that file at THAT location . Read and Print DNA File Button - reads file 1 line at a time and prints to a listBox, lstOut, 5 codons per line. - number each line. CODE NOTES: loop while reader.EndOfStream != true some string variable = reader.ReadLine(); . Read & Count Codons Button - reads file 1 line at a time, counting codons (1 per line) - prints codon count to a listBox, lstStats . Clear Button - clear both listboxes
95% . Read & Count Starts & Stops Button - reads file 1 line at a time - counts start & stop codons - prints counts to listBox, lstStats start: 'atg' stop: 'tag', 'taa', 'tga' . User-defined function called "ResetFile" - called multiple times throughout code - resets the streamreader file pointer to beginning of file reader.DiscardBufferedData(); reader.BaseStream.Seek(0, SeekOrigin.Begin); reader.BaseStream.Position = 0;
100% . Read & Count Frames & Codons in Frames (exons) Button - reads file 1 line at a time - counts # of reading frames can assume every frame is complete (start and a stop) - counts # of codons in frames (exons) - prints counts to a listBox, lstStats valid frame starts at 'atg' stops at 'tag' or 'taa' or 'tga' - get DNA data file here -- file stats explained here

A GOOD READ!: Hunting down my son's killer

A GOOD READ!: DNA for coders...