Exercises, answers and checks
Exercise 1 · GC percentage
Calculate GC% for GGCCAT.
Answer
There are four G/C bases among six total: 66.67%.
Exercise 2 · Complement
Write the reverse complement of AAGC.
Answer
Complement is TTCG; reverse it to get GCTT.
Exercise 3 · Codons
Translate ATG GCT TAA in frame 0 with the standard code.
Answer
MA*: methionine, alanine, stop.
Exercise 4 · Reproducibility
Why pass the same seed when you are debugging mutation code?
Answer
A fixed seed reproduces the same pseudo-random sequence, so changes in the output are attributable to code/input changes rather than a different random stream.
Exercise 5 · Input validation
Why reject ACNT in the beginner GC/translation functions?
Answer
These functions are deliberately defined only for unambiguous A/C/G/T. Silently ignoring N would make the result depend on an unstated denominator. A more advanced implementation can support IUPAC ambiguity symbols with an explicit rule.
Run the test suite
In the downloads folder run:
python -m unittest -v
Passing tests show that the listed examples behave as expected; they do not prove a program has no bugs or that the chosen analysis is biologically appropriate.