Bio::G...irplot(3pm)

πŸ“¦
version 2.40 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble

πŸ’– 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:

  1. First you gotta create a subclass of Bio::SeqFeature::Generic (or Bio::Graphics::Feature, whichever you prefer, no judgement) that has a pair_score() method. That pair_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.
  2. 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.
  3. Then you 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. 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 is 0 (so, false, off, not doing that).
  • -angle β€” Angle to draw the plot. Values between 1 degree and 89 degrees are valid. Higher angles give a more vertical plot. Default is 45.
  • -bgcolor β€” The color of the plot. Default is cyan.
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 read LICENSE for the full text, and DISCLAIMER.txt for 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