Bio::Graphics::Glyph::pairplot(3pm)

NAME
Bio::Graphics::Glyph::pairplot - The "pairwise plot" glyph

SYNOPSIS
 use Bio::Graphics;

 # create the panel, etc.  See Bio::Graphics::Panel
 # for the synopsis

 # Create one big feature using the PairFeature
 # glyph (see end of synopsis for an implementation)
 my $block = PairFeature->new(-start=>  2001,
                              -end  => 10000);

 # It will contain a series of subfeatures.
 my $start = 2001;
 while ($start < 10000) {
   my $end = $start+120;
   $block->add_SeqFeature($bsg->new(-start=>$start,
                                    -end  =>$end
                                   ),'EXPAND');
   $start += 200;
 }

 $panel->add_track($block,
                   -glyph => 'pairplot',
                   -angle => 45,
                   -bgcolor => 'red',
                   -point => 1,
                  );

 print $panel->png;

 package PairFeature;
 use base 'Bio::SeqFeature::Generic';

 sub pair_score {
   my $self = shift;
   my ($sf1,$sf2) = @_;
   # simple distance function
   my $dist  = $sf2->end    - $sf1->start;
   my $total = $self->end   - $self->start;
   return sprintf('%2.2f',1-$dist/$total);
 }

DESCRIPTION
This glyph draws a "triangle plot" similar to the ones used to show linkage disequilibrium between a series of genetic markers. It is basically a dotplot drawn at a 45 degree angle, with each diamond-shaped region colored with an intensity proportional to an arbitrary scoring value relating one feature to another (typically a D' value in LD studies).

This glyph requires more preparation than other glyphs. First, you must create a subclass of Bio::SeqFeature::Generic (or Bio::Graphics::Feature, if you prefer) that has a pair_score() method. The pair_score() method will take two features and return a numeric value between 0.0 and 1.0, where higher values mean more intense.

You should then create a feature of this new type and use add_SeqFeature() to add to it all the genomic features that you wish to compare.

Then add this feature to a track using the pairplot glyph. When the glyph renders the feature, it will interrogate the pair_score() method for each pair of subfeatures.

  OPTIONS
In addition to the common options, the following glyph-specific options are recognized:

  Option      Description                  Default
  ------      -----------                  -------

  -point      If true, the plot will be         0
              drawn relative to the
              midpoint between each adjacent
              subfeature.  This is appropriate
              for point-like subfeatures, such
              as SNPs.

  -angle      Angle to draw the plot.  Values   45
              between 1 degree and 89 degrees
              are valid.  Higher angles give
              a more vertical plot.

  -bgcolor    The color of the plot.            cyan

BUGS
Please report them.

SEE ALSO
Bio::Graphics::Panel, Bio::Graphics::Glyph, Bio::Graphics::Glyph::arrow, Bio::Graphics::Glyph::cds, Bio::Graphics::Glyph::crossbox, Bio::Graphics::Glyph::diamond, Bio::Graphics::Glyph::dna, Bio::Graphics::Glyph::dot, Bio::Graphics::Glyph::ellipse, Bio::Graphics::Glyph::extending_arrow, Bio::Graphics::Glyph::generic, Bio::Graphics::Glyph::graded_segments, Bio::Graphics::Glyph::heterogeneous_segments, Bio::Graphics::Glyph::line, Bio::Graphics::Glyph::pinsertion, Bio::Graphics::Glyph::primers, Bio::Graphics::Glyph::rndrect, Bio::Graphics::Glyph::segments, Bio::Graphics::Glyph::ruler_arrow, Bio::Graphics::Glyph::toomany, Bio::Graphics::Glyph::transcript, Bio::Graphics::Glyph::transcript2, Bio::Graphics::Glyph::translation, Bio::Graphics::Glyph::triangle, Bio::Graphics::Glyph::xyplot, Bio::DB::GFF, Bio::SeqI, Bio::SeqFeatureI, Bio::Das, GD

AUTHOR
Lincoln Stein <lstein@cshl.edu<gt>.

Copyright (c) 2004 Cold Spring Harbor Laboratory

This package and its accompanying libraries is free software; you can redistribute it and/or modify it under the terms of the GPL (either version 1, or at your option, any later version) or the Artistic License 2.0. Refer to LICENSE for the full license text. In addition, please see DISCLAIMER.txt for disclaimers of warranty.