Due: Wednesday 3/27 10:00am

Submission name: w14_drawDNA

Background Genetics Information

DNA is made up of strands of nucleotides, of which there are 4 types: adenine, thymine, cytosine and guanine. Because of this, DNA sequences can be represented as strings like this:

tcgcagctcgaaccactatg

When two strands of DNA match, then adenine is paired with thymine, and cytosine is paired with guanine. So the following two DNA strands match:

 tcgcagctcgaaccactatg
 agcgtcgagcttggtgatac

Task at Hand

Using the information above, write the following processing functions:

  • void drawBase(char base, int x, int y, int sz)
    • Draws a single base in a square at (x, y) with side length sz.
    • The squares should have no stroke, and each type of nucleotide should be given a distinct color.
    • The letter for the nucleotide should be displayed within the square in a color that is easy to see.
  • void drawStrand(String dna, int x, int y, int sz)
    • Draws the entire dna strand starting at (x, y) using sz for the size of each square.
    • This method should call drawBase().

    a06_drawStrand

  • boolean strandMatch(String strand0, String strand1)
    • Returns true if strand0 and strand1 match as described above.
  • void strandCompare(String strand0, String strand1, int x, int y, int sz)
    • Draws strand0 directly above strand1.
    • If there is a nucleotide mismatch, draw a red border around the nucleotide.

    a06_strandCompare

  • Write a setup() method that tests these methods.