next up previous contents
Next: Drawing Trees Up: Basic Visualization Functions Previous: Creating Dot Plots

Creating Histograms

The function
DrawHistogram(y : list(real) {,lbl : list(string)} )
Given a list of real numbers, Darwin creates a histogram scaled appropriately. The list of labels lbl is optional. As an example, we calculate the frequency of each of the twenty amino acids in our small version of Swiss-Prot Sample/SH2.

  DB := ReadDb('Sample/SH2');                   # load the SH2 database
  labels := CreateArray(1..20);                      # create an array of labels
  for i from 1 to 20 do labels[i] := IntToAAA(i) od:  #  and assign each a name
  counts := GetAaCount(DB);                          # count the bases 
  DrawHistogram(counts, labels);                      # create the histogram
Figure [*] contains the results of our experiment.

Figure: Amino acid frequencies in the Sample/SH2 database.

Gaston Gonnet