CS21 Lab 4: Graphics

Due 11:59pm Tuesday night, Feb 14

Run update21, if you haven't already, to create the cs21/labs/04 directory. Then cd into your cs21/labs/04 directory. You are responsible for creating the files needed to create the python programs for lab 4 in this directory (handin21 looks for your lab 4 assignments in your cs21/labs/04 directory):


$ update21
$ cd ~/cs21/labs/04
$ pwd
  /home/your_user_name/cs21/labs/04

Your programs are graded on both correctness and style. Please review the comments regarding programming style on the main page.

For this lab we will be using the Zelle graphics library.

1. Microarrays

Introduction

DNA allows biologists to identify the genes, or blueprints, of a specific organism. Usually, genes code for a protein which performs actions essential to cellular life. Genes, however, only identify what can be made, not if or how much of a protein is made. How much a gene is used, known as its expression level, varies based on conditions in the cellular environment. For example, the gene(s) for eye color are not heavily expressed in skin cells found on your arm, but are heavily expressed in the cells of the iris.

One way to understand the role of certain genes is to measure the expression levels of genes in different environments and compare the values. For example, to find genes related to heat-shock in bacteria, a biologist could sample the expression levels of a cell in a normal environment and compare it to expression levels of a cell in a heated environment. Presumably, large differences in expression levels indicate a certain gene is somehow involved in responding to heat shock.

One way to do this is to use DNA microarrays, a surface that measures the expression levels of a gene by collecting the mRNA strands present in a cell. See the link for more information. Essentially, the mRNA of one set of cells (e.g., normal bacteria) are tagged with green flourence markers while the mRNA of the other set (e.g., heated bacteria) are labeled with red. The more expression, the brighter the color appears. If one overlaps the two microarrays, you can detect the major differences in expression by noting which genes show up as green (down expression in heat), red (up expression in heat), or yellow (equal expression). The brightness indicates the magnitude of expression.

Assignment

Write a program called microArray.py that simulates a microarray experiment by drawing a pattern of circles in a graphics window, like the example at the end of this writeup.

Your program should ask the user for two things:

  1. the number of rows in the array
  2. the number of columns in the array
and then calculate the width and height to create a graphics window big enough to fit all of your rows and columns of wells (or circles). You can assume the width of each column and height of each row are both 30 pixels. You can add some extra space at the bottom to fit a Text message to the user.

To create your array, you will:

Here is a sample run of the program:
$ python microArray.py

This program uses graphics to display a mircroarray with
simulated expression levels

Enter number of rows in microarray: 7
Enter number of columns in microarray: 7



And another:
$ python microArray.py

This program uses graphics to display a mircroarray with
simulated expression levels

Enter number of rows in microarray: 10
Enter number of columns in microarray: 15



Notice in this second example how the window size is larger and the number of circles has increased, but the actual size of each circle is the same.


2. Artistic Creativity

Professor Soni is planning on writing an introductory biology textbook for computer scientists titled: "Biology: Like Computers but in Base 4". He needs to hire an artist to create the images and illustrations in his textbook and your all invited to apply! Audition for the non-paying job (welcome to the book-publishing world!) by illustrating some biological phenomena. Use your imagination and Zelle graphics library to accomplish your task. Obviously, you are limited to some basic shapes so don't try to model the structure of hemoglobin, but maybe you can come up with a simplified cartoon of a cell, or a DNA molecule, or your favorite animal. You can also feel free to appeal to Prof. Soni's emotional side and create an anatomically correct heart to send to your valentine.

Your program (mypicture.py) must:

Here are some examples:



Submit
Once you are satisfied with your programs, hand them in by typing handin21 at the unix prompt.

You may run handin21 as many times as you like, and only the most recent submission will be recorded. This is useful if you realize, after handing in some programs, that you'd like to make a few more changes to them.