Bio::G...irplot(3pm)
π NAME π
Bio::Graphics::Glyph::pairplot β the pairwise plot glyph, bestie. It's the one that draws the little triangle dotplot thing. You're gonna love her.
β¨ SYNOPSIS β¨
Okay so first, the vibe-setting:
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);
}
Yes she's a lot of setup. No she's not sorry. π
πΈ DESCRIPTION πΈ
So this glyph draws a "triangle plot", like the ones people use to show linkage disequilibrium between a bunch of genetic markers. It's basically a dotplot but rotated to a 45 degree angle, and every little diamond-shaped region gets colored in with an intensity proportional to some arbitrary scoring value that relates one feature to another (in LD studies that's typically a D' value, iykyk).
Heads up bestie, this glyph needs more prep than the other glyphs. Here's the tea:
- First you gotta create a subclass of
Bio::SeqFeature::Generic(orBio::Graphics::Feature, whichever you prefer, no judgement) that has apair_score()method. Thatpair_score()method takes two features and returns a numeric value between 0.0 and 1.0, where higher values mean more intense. So like, 1.0 is giving main character energy, 0.0 is giving nothing. - Then you create a feature of this new type, and you use
add_SeqFeature()to add to it all the genomic features you wanna compare. - Then you add this feature to a track using the
pairplotglyph. When the glyph renders the feature, it will interrogate thepair_score()method for each pair of subfeatures. Obsessed honestly.
π OPTIONS π
On top of the common options (those are the baseline, the bare minimum), these glyph-specific options are recognized:
-pointβ If true, the plot will be drawn relative to the midpoint between each adjacent subfeature. This is appropriate for point-like subfeatures, such as SNPs. Default is0(so, false, off, not doing that).-angleβ Angle to draw the plot. Values between1degree and89degrees are valid. Higher angles give a more vertical plot. Default is45.-bgcolorβ The color of the plot. Default iscyan.
ngl the -angle one is lowkey the star of the show. 45 degrees? cute. 89 degrees? practically vertical, she's standing UP.
π BUGS π
Please report them. That's it. That's the whole section. fr fr, just report them. π«Ά
π¦ SEE ALSO π¦
Go read these, they're all iconic in their own way:
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.
π Okay so like, legally speaking: free software, GPL or Artistic License 2.0, your choice, go readLICENSEfor the full text, andDISCLAIMER.txtfor the disclaimers of warranty. Not me being a whole lawyer, but periodt.
And that's the whole page bestie!! π This was documented for perl v5.30.0, dated 2019-11-25, and it lives under Bio::G...irplot(3pm). Go draw some triangles. Slay. π
β¨
π¦ 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