Ace::G...:Track(3pm)

🌸 NAME

Ace::Graphics::Track β€” it's giving "PNG graphics of Ace::Sequence::Feature objects", and honestly? Iconic. ✨

(Also hi, this is the Ace::Graphics::Track(3pm) page from the User Contributed Perl Documentation, so you're in exactly the right place, babe 🫢)


πŸŽ€ SYNOPSIS

  use Ace::Sequence;
  use Ace::Graphics::Panel;

  my $db     = Ace->connect(-host=>'brie2.cshl.org',-port=>2005) or die;
  my $cosmid = Ace::Sequence->new(-seq=>'Y16B4A',
                                  -db=>$db,-start=>-15000,-end=>15000) or die;

  my @transcripts = $cosmid->transcripts;

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

  my $track = $panel->add_track('transcript'
                                -fillcolor =>  'wheat',
                                -fgcolor   =>  'black',
                                -bump      =>  +1,
                                -height    =>  10,
                                -label     =>  1);
  foreach (@transcripts) {
     $track->add_feature($_);
  }

  my $boxes = $panel->boxes;
  print $panel->png;

πŸ’– DESCRIPTION

okay so bestie, the Ace::Graphics::Track class is the one that Ace::Graphics::Panel uses to lay out a whole set of sequence features using a uniform glyph type. Think of it like: one track = one vibe = one glyph style, and everything on it matches. 🌈

Real talk though β€” you will ordinarily work with panels rather than directly with tracks. Tracks are the backstage crew; panels are the main character. πŸ‘‘


πŸ’… METHODS

This section describes the class and object methods for Ace::Graphics::Panel. (yes girl, that's what it says, and we respect it 😌)

🧚 CONSTRUCTORS

There is only one constructor, the new() method. It is ordinarily called by Ace::Graphics::Panel, and not in end-developer code. So like, you can call it yourself, but the panel is the one who normally does the asking. πŸ™ˆ

  • $track = Ace::Graphics::Track->new($glyph_name,$features,@options) β€” the new() method creates a new track object from the provided glyph name and list of features. The arguments are similar to those in Ace::Graphics::Panel->new().

If successful, new() will return a new Ace::Graphics::Track. Otherwise, it will return undef.

If the specified glyph name is not a valid one, new() will throw an exception. so like, don't just make up glyph names, she WILL clock it πŸ’€

πŸ¦‹ OBJECT METHODS

Once a track is created, the following methods can be invoked.

  • $track->add_feature($feature) β€” this adds a new feature to the track. The feature can either be:
    • a single object that implements the Bio::SeqFeatureI interface (such as an Ace::Sequence::Feature or Das::Segment::Feature), or
    • an anonymous array containing a set of related features.

In the latter case, the track will attempt to keep the features in the same horizontal band and will not allow any other features to overlap. she's protective like that 🫢

  • $track->add_group($group) β€” this behaves the same as add_feature(), but requires that its argument be an array reference containing a list of grouped features. no single objects allowed, periodt πŸ’…
  • $track->draw($gd,$left,$top) β€” render the track on a previously-created GD::Image object. The $left and $top arguments indicate the position at which to start rendering. πŸ“
  • $boxes = $track->boxes($left,$top)
  • @boxes = $track->boxes($left,$top) β€” return an array of array references indicating glyph coordinates for each of the render features. $left and $top indicate the offset for the track on the image plane.

In a scalar context, this method returns an array reference of glyph coordinates. In a list context, it returns the list itself. she contains multitudes ✨

See Ace::Graphics::Panel->boxes() for the format of the result.

🌸 ACCESSORS

The following accessor methods provide access to various attributes of the track object. Called with no arguments, they each return the current value of the attribute. Called with a single argument, they set the attribute and return its previous value. (yes, it gives you the old one back, it's very generous πŸ’–)

⚠️ Note that in most cases you must change attributes before the track's layout() method is called. Do not wait. Do not procrastinate. She will not re-check. 😭
  • scale() β€” get/set the track scale, measured in pixels/bp
  • lineheight() β€” get/set the height of each glyph, pixels
  • width() β€” get/set the width of the track
  • bump() β€” get/set the bump direction

πŸ”₯ INTERNAL METHODS

The following methods are used internally, but may be useful for those implementing new glyph types. iykyk 🧠

  • $glyphs = $track->layout β€” layout the features, and return an anonymous array of Ace::Graphics::Glyph objects that have been created and correctly positioned.

Because layout is an expensive operation, calling this method several times will return the previously-cached result, ignoring any changes to track attributes. (so if you changed stuff after the first call… she didn't hear you, bestie πŸ™ˆ)

  • $height = $track->height β€” invokes layout() and returns the height of the track.
  • $glyphs = $track->glyphs β€” returns the glyph cache. Returns undef before layout() and a reference to an array of glyphs after layout().
  • $factory = $track->make_factory(@options) β€” given a set of options (argument/value pairs), returns an Ace::Graphics::GlyphFactory for use in creating the glyphs with the desired settings. 🏭✨

πŸ› BUGS

Please report them. that's it, that's the whole section, she keeps it short and she keeps it real πŸ’€


πŸ‘€ SEE ALSO

Ace::Sequence, Ace::Sequence::Feature, Ace::Graphics::Panel, Ace::Graphics::GlyphFactory, Ace::Graphics::Glyph


πŸ‘‘ AUTHOR

Lincoln Stein <lstein@cshl.org>.

Copyright (c) 2001 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 β€” brought to you by perl v5.42.3, dated 2026-08-19, no cap πŸ’–βœ¨πŸŒΈ

πŸ“¦ where this page comes from