Bio::G...y_plot(3pm)
β¨ NAME β¨
Bio::Graphics::Glyph::ternary_plot β the glyph that draws ternary plot data π
(also this page is Bio::G...y_plot(3pm) from the User Contributed Perl Documentation, since the title got cutely truncated by the man renderer, love that for it π)
π SYNOPSIS π
#!/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;
π¦ DESCRIPTION π¦
okay so bestie, picture this: this glyph draws a light gray equilateral triangle, and its base is centered on the feature. π«Ά The top of that equilateral triangle is equal to the height you specify. And like, if you want it to look good β and we do want it to look good β please choose a height of >= 15. no cap. π
Inside, the glyph will plot one or more data points using ternary plot conventions (see http://en.wikipedia.org/wiki/Ternary_plot). The data is 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. So the way that this works: as a component approaches 1.0, it gets closer to its corresponding vertex. iconic behavior honestly π
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. π¨ (yes it just vibes with the background, we love a low-effort queen)
π OPTIONS π
In addition to the common options, the following glyph-specific options are recognized:
-triplesβ The callback to return triple data. πβ¨-verticesβ Labels for the left,right & top vertices. π·οΈ
π BUGS π
Please report them. (yes that's the whole thing, they really said "your problem now" π but fr fr, 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::whiskerplot, Bio::DB::GFF, Bio::SeqI, Bio::SeqFeatureI, Bio::Das, GD
πΈ AUTHOR πΈ
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.
and that's the whole page bestie!! this one was shipped as part of perl v5.30.0, dated 2019-11-25, in the User Contributed Perl Documentation section β so like, it's been serving looks since 2006 and still ate. periodt. πβ¨
π¦ where this page comes from
- debian bookworm: libbio-graphics-perl 2.40-6 Β· Perl
- debian trixie: libbio-graphics-perl 2.40-6 Β· Perl
- ubuntu jammy: libbio-graphics-perl 2.40-6 Β· Perl
- ubuntu noble: libbio-graphics-perl 2.40-6 Β· Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms