GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Bio::Graphics::Glyph::ternary_plot(3) User Contributed Perl Documentation Bio::Graphics::Glyph::ternary_plot(3)

Bio::Graphics::Glyph::ternary_plot - Draw ternary plot data

 #!/usr/bin/perl

 use strict;
 use warnings;

 use Bio::Graphics;
 use Bio::Graphics::Feature;

 my $segment  = Bio::Graphics::Feature->new(-start=>1,-end=>700);
 my $snp1     = Bio::Graphics::Feature->new(-start     => 500,
                                           -end       => 501,
                                           -name      => 'rs000001',
                                           -attributes=> {triples => [
                                                                      [0.01, 0.81, 0.18, 'red',  'CEPH'],
                                                                      [0.25, 0.25, 0.50, 'blue', 'JPT+CHB'],
                                                                      [0.81, 0.01, 0.18, 'green','YRI'],
                                                                     ]
                                                          }
                                          );
 my $snp2     = Bio::Graphics::Feature->new(-start     => 300,
                                           -end       => 301,
                                           -name      => 'rs12345',
                                           -attributes=> {triples => [
                                                                      [0.04, 0.64, 0.32, 'red',  'Controls'],
                                                                      [0.16, 0.36, 0.48, 'blue', 'Cases'],
                                                                     ]
                                                          }
                                          );

 my $panel = Bio::Graphics::Panel->new(-segment=>$segment,-width=>800);

 $panel->add_track($segment,-glyph=>'arrow',-double=>1,-tick=>2);
 $panel->add_track([$snp1,$snp2],
                  -glyph    => 'ternary_plot',
                  -height   => 80,
                  -fgcolor  => 'lightgrey',
                  -vertices => ['AA','GG','AG'],
                  -label    => 1,
                 );

 print $panel->png;

This glyph draws a light gray equilateral triangle with its base centered on the feature. The top of the equilateral triangle is equal to the specified height. To look good, please choose a height of >= 15.

Inside, the glyph will plot one or more data points using ternary plot conventions (see http://en.wikipedia.org/wiki/Ternary_plot). The data consists of a series of (A,B,C) triplets chosen such that the range of each component is [0.0,1.0] and A + B + C = 1.0. The left, right and apex of the triangle represent the proportions of A, B and C respectively. As a component approaches 1.0, it gets closer to its corresponding vertex.

The data can be represented as one or more feature tags called "triples" each in the format:

   A1,B1,C1,<color>,<label>   # (color and label are optional)

or as a callback specified by the option -triples, which should return a list of arrays, where each array is a triple, followed by an optional color. E.G.

 sub my_calback {
   my $feature = shift;
   return [[0.1,0.5,0.4,'red','pt1'],[0.2,0.2,0.6,'blue','pt2'],[0.8,0.2,0.0,'green','pt4']];
 }

The color, if it is missing, will be the same as the bgcolor.

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

  Option      Description 
  ------      -----------

  -triples    The callback to return triple data.
  -vertices   Labels for the left,right & top vertices

Please report them.

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::whiskerplot, Bio::DB::GFF, Bio::SeqI, Bio::SeqFeatureI, Bio::Das, GD

Lincoln Stein <lstein@cshl.org>.

Copyright (c) 2006 Cold Spring Harbor Laboratory

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty.

2022-05-14 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.