Skip to content
jandot edited this page Sep 13, 2010 · 1 revision

Here I’ll try to describe how the pARP application is set up and how different parts work together.

The parp.rb script is only used for initializing the application. All other classes are stored in the lib/ directory. The main class is MySketch in sketch.rb which contains the class that inherits from Processing::App. It has two methods: setup and draw. Setup is only run once and is responsible for setting defaults and loading data. It also generates the initial buffers that will be used in the draw method. All other methods of the MySketch class are contained in the lib/sketch_methods/ directory and grouped per functionality: loading, drawing, interaction and polar.

pARP doesn’t draw anything directly to the screen. Everything is drawn to a buffers first, which are then displayed on the screen. This makes it possible to only redraw (and therefore recalculate) those parts that actually change. pARP has 3 buffers:

  • zoomed: This is the main picture.
  • information_panel: The slice information and zoom scale on the right.
  • sequence_colour_scheme: The sequence colour scheme and help text at the bottom.

The circular picture is built up from one or more slices, each with its own resolution. New slices can be created by clicking on the circle which invokes Slice#add.

The system uses different coordinate systems. Basepairs, pixels and degrees. (I hope to get rid of the degree coordinate system in the future.) As the whole genome is always displayed and chromosomes are put one after the other, each chromosome gets a start_cumulative_bp which is just the sum of lengths of all previous chromosomes. Similarly, each slice has a start_cumulative_bp and stop_cumulative_bp. The pixel coordinate system is a linear scale representing the pixel around the circle; the maximum pixel value is 2*PI*radius. The first pixel contains the first basepair of chromosome 1. The fact that it’s displayed in a circle is irrelevant for any calculations; only for the actual drawing.

Clone this wiki locally