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 lengthsz
. - 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.
- Draws a single base in a square at
void drawStrand(String dna, int x, int y, int sz)
- Draws the entire
dna
strand starting at(x, y)
usingsz
for the size of each square. - This method should call
drawBase()
.
- Draws the entire
boolean strandMatch(String strand0, String strand1)
- Returns
true
ifstrand0
andstrand1
match as described above.
- Returns
void strandCompare(String strand0, String strand1, int x, int y, int sz)
- Draws
strand0
directly abovestrand1
. - If there is a nucleotide mismatch, draw a red border around the nucleotide.
- Draws
- Write a
setup()
method that tests these methods.