Finding repeats in DNA sequences
In this lab you will work with a Proce55ing sketchbook to create a graphical representation of repeating sequences in DNA sequences. Finding repeating patterns, either adjacent to each other, as in tandom repeats, or long interspersed repeats yield important genetic information about a DNA sequence.
Repeats can also be found comparing the sequence to its reverse. Biologists are interested in repeats because they are often indicative of genome rearrangements.
- Copy and paste the program DNA_Repeats_start.pde in a new sketchbook which you should call DNA_Repeats.pde.
- Create the font needed for the program. Click on Tools, Create Font, and select Monaco, with a size of 12 points.
This will create the file Monaco-12.vlw in the data folder of your Processing sketchbook. If you cannot find the font Monaco on your computer, select a monospace font such as Prestige Elite, or Courier.
- Run the program. Verify that you get a empty square and a listing of the DNA sequence
Step 1: Finding repeats
This part involves the whole class to discover the algorithm that can be used to find repeat patterns longer than some predefined length.
- come up with an algorithm (this will take some time!)
- code it, and test it. Use a minimum length of 1 or 2 at first, and increase it slowly to see the longest pattern founds.
- verify that you get an image similar to the one above.
Step 2: finding the longest repeat
- Make your program print in the console the locations of the longest repeats it finds, in the following form:
longest repeat: 123, 255 length 7 CGGTAAC
This means that a sequence of length 7 was found at Index 123 and at Index 255, and reads CGGTAAC
Step 3: Marking the longest repeat
- Once your program works, make it display a circle around the longest repeat (or repeats) found. Use the drawPoints( int i, int j, int n ) function as an example for a new function putCircleAround( int i, int j, int radius ) that could be used to highlight the longest segment.
Note that to draw a circle that is not filled with color, you use the noFill() function and call ellipse().
noFill(); ellipse( x, y, radius, radius );
Back to CSC334 Lab Page
© D. Thiebaut 2008