Sunday, October 7, 2007

DNA Painter is a small application that reads a nucleotide sequence and outputs an image. The logic behind it is pretty simple. I coded it while being influenced by ideas of cellular automata although it, technically, is not implementing those ideas.

The program works by reading a nucleotide string (A, T, C, or G) and applying logic to the current character. Each nucleotide gives the program a different and simple instruction.

  • A: Move one pixel down and add some red to the current color
  • T: Move one pixel right and add some green to the current color
  • C: Move one pixel up and add some blue to the current color
  • G: Move one pixel left and do something wacky (I think the current build right now just darkens the pixel)
In Actionscript 3.0 a pixel is a 32 bit number with 8 bits corresponding to the Alpha (transparency), Red, Green, and Blue values respectively. By mapping the RGB values to certain nucleotides I'll get at least 3 colors per image. Since chances are good that certain pixels will be painted on more than once the combination of two or more RGB values will result in a different color (red + blue = magenta, etc). This means that any image, given a long enough nucleotide sequence, will result in a multitude of color.


Although I created DNA Painter as an expression of art through computation and science one use of DNA Painter is the creation of visual representations of genes. The application can output an image based off of, say, the aldolase gene of three different mammalian species so the relative divergence of the gene can be seen. Yes, I realize that using some sort of bioinformatic statistical analysis on the actual DNA string will be much better. But it's not cool you see, and in this world we need cooo-oool.

Notes on usage

Some things to think about while playing around with the program:
  • A long red line in an image means the mapped gene has a long series of A (adenine) and a long green horizontal line means T (thymine) and so on.
  • A stair step in the image is a sequence of alternating nucleotides
  • Increasing the bitmap size will show a more accurate picture of the gene. This is because the drawing wraps when it reaches an edge of the bitmap. So a larger bitmap means less overlap so less "noise".
  • The five available genes that are embedded in the application are all human genes

More Info on the genes

Further Development

Although I would like to make the images prettier by applying filters and other effects I think I would like to focus more on the application of the program rather than the aesthetics. It would be nice to remove the wrap effect so each gene or sequence will be a consistent image no matter the bitmap size. This will allow the user to zoom in and out (and pan). It'll allow the visualization of repeating sections of nucleotides that can be shown to exist across related genes. Furthermore, by applying the application to mRNA we could break down each image to a series of codons.

Now that I think about it we could create a catalog of common DNA sequences. Whoa!


Post a Comment