Last edited 11nov09 by
Find this document at

iilliVirus: T4 Bacteriophage Animation

By; Ryan Young


My project, as outlined in my proposal submitted earlier, will be to models a T4 bacteriophage infecting and lysing a bacterial cell. This cell will be an E. coli cell. Also, I intend to demonstrate schooling algorithms as the mathematical portion of my project. I will be programming this project in Python. I wish to have the program run in two modes. Swarm model, very similar to the shark, and another in which the virus will destroy the bacteria.



The design of my project is quite straight-forward. Using the pre-defined shapes of Visual, it was quite easy to put together the shapes that make a T4 phage come into existance. For example, the head was created using the convex() function, the tails using ring(), the tail fibers using curve(), and the DNA using helix(). These functions are quite easy to construct, and all come with the ability to be customized any way that the programmer desires. The only ability that is missing in this program is to change the opacity of the convex() function. This would allow the view to see cells DNA.

The tail and base plate of the virus are made up of 70 tori, with a radius of .65 and placed in .1 increments. This makes a very seamless tail and looks very similar to how the viruses actually look. There are six tail fibers that are included in the RTICA. These are what allow the virus to attach to the cell and stabilize it while it injects it's DNA. The tail fibers were created in such a way as to look like they are not simply a rotation of the same figure.



The math in this project was to incorporate the swarming algorithm. However, due to time constraints, this did not happen. However, sensing that this portion of the project was lacking, I took a slightly deeper look into the mathematics that created the icosahedral head.

The code that creates the head is quite simple in this case and revolves around the number phi:

(0, ±1, ±φ)
(±1, ±φ, 0)
(±φ, 0, ±1)

This relatively simple set of points creates the 20 sided icosahedron. Phi also occurs in the set of points for the dodecahedron:

(±1, ±1, ±1)
(0, ±1/φ, ±φ)
(±1/φ, ±φ, 0)
(±φ, 0, ±1/φ)

This dependance on phi for the icosahedron and dodecahedron is due to the shaped being formed by orthogonal golden rectangles. A golden rectangle is a rectangle in the proportions 1:φ. These are the reasons that the points that create the complex looking shapes look so deceptively simple.

The picture to the left is that of a golden rectangle with a Fibonacci spiral inscribed. This shows how both are made. The golden rectangle has a square taken out and a circular arc inscribed. This is repeated with the leftover piece, that is also a golden rectangle. This the Fibonacci spiral is graphically produced.



This past week, I made much progress on my project. Currently, I have the the code that creates the virus in another program defined as a function. This program is called and the function is defined as virus(). This will randomly create a virus at a position between -50 and 50 on all three vertices.

The program that currenty runs my project is still This is a very short program right now, only three lines. This sets up a while function that allows you to input how many viruses you want created. The news that VPython will not be supported in Cube comes as a dissapointment. However, today it was decided that an attempt would be to translate illiVirus into OpenGL. This would give a direct path to the Cube. This is a very exciting development.

Also, this may require a complete rewrite of the entire program. The use of texture mapping and coded, non-random motion, are the next pieces of programming that will incorporated to the program.

The project is going quite well. I still have a lot of work to do, but it is coming much quicker than it could. If I keep my pace up, I will have no problem finishing my project for the end of the semester.


Many setbacks have popped up that have drastically slowed the progress of illiVirus. The while() in the looop() command that is currently operating the program is not letting multiple to viruses spin independently of one another. the first solution to try and fix this was to simultaneously spin another frame, this unfortunately was also unsucessful.

The next possible solution was to insert multiple copies of the virus into the virus() definition, thus making multiple viruses. The next issue that arises is the fact that these multiple viruses must spin around the same axis. This is very visually displeasing as the speeds of the further from this axis are much too high.

Due to these setbacks, the program is running with two viruses, spinning close together, and resembling Whirling Dervishes. While this is a moderate success, it is my opinion that the scope of my project may need to be drawn back.

At this point, it was decided to switch gears and work on the animation of the phage lysing the cell. This will be the center piece of my presentation. The goal is to randomly generate a virus, have it find the E. coli cell, attach, insert its DNA, replicate and destroy the cell. This should not be extremely difficult and I will hopefully have it done soon.

I have accomplished everything that I have intedend to do appart from the swarming algorithms. It was decided that the work I have accomplished to this point will sufficiently complete my contracted obligations. I have succeeded in creating a model of the T4 phage, texture mapping a model of an E. coli, animating the attack of the phage on the E. coli and the lysing of the cell. The hopes are that someone will apply the swarming to this program in the future and further the model.


These links were very helpful in this project and would be to anyone interested on these topics:
Asthetics and Mathematics: Univ. of Oregon
Wikipedia-Icosahedron and Dodecahedron
Centers for Disease Control and Prevention
United States Army Medical Research Institute of Infections Diseases
HTML Code Tutorial