<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Ace::Graphics::Track - PNG graphics of Ace::Sequence::Feature objects</title> <link rev="made" href="mailto:root@localhost" /> </head> <body style="background-color: white"> <p><a name="__index__"></a></p> <!-- INDEX BEGIN --> <!-- <ul> <li><a href="#name">NAME</a></li> <li><a href="#synopsis">SYNOPSIS</a></li> <li><a href="#description">DESCRIPTION</a></li> <li><a href="#methods">METHODS</a></li> <ul> <li><a href="#constructors">CONSTRUCTORS</a></li> <li><a href="#object_methods">OBJECT METHODS</a></li> <li><a href="#accessors">ACCESSORS</a></li> <li><a href="#internal_methods">INTERNAL METHODS</a></li> </ul> <li><a href="#bugs">BUGS</a></li> <li><a href="#see_also">SEE ALSO</a></li> <li><a href="#author">AUTHOR</a></li> </ul> --> <!-- INDEX END --> <p> </p> <h1><a name="name">NAME</a></h1> <p>Ace::Graphics::Track - PNG graphics of Ace::Sequence::Feature objects</p> <p> </p> <hr /> <h1><a name="synopsis">SYNOPSIS</a></h1> <pre> use Ace::Sequence; use Ace::Graphics::Panel;</pre> <pre> 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;</pre> <pre> my @transcripts = $cosmid->transcripts;</pre> <pre> my $panel = Ace::Graphics::Panel->new( -segment => $cosmid, -width => 800 );</pre> <pre> my $track = $panel->add_track('transcript' -fillcolor => 'wheat', -fgcolor => 'black', -bump => +1, -height => 10, -label => 1); foreach (@transcripts) { $track->add_feature($_); }</pre> <pre> my $boxes = $panel->boxes; print $panel->png;</pre> <p> </p> <hr /> <h1><a name="description">DESCRIPTION</a></h1> <p>The Ace::Graphics::Track class is used by Ace::Graphics::Panel to lay out a set of sequence features using a uniform glyph type. You will ordinarily work with panels rather than directly with tracks.</p> <p> </p> <hr /> <h1><a name="methods">METHODS</a></h1> <p>This section describes the class and object methods for Ace::Graphics::Panel.</p> <p> </p> <h2><a name="constructors">CONSTRUCTORS</a></h2> <p>There is only one constructor, the <a href="#item_new"><code>new()</code></a> method. It is ordinarily called by Ace::Graphics::Panel, and not in end-developer code.</p> <dl> <dt><strong><a name="item_new">$track = Ace::Graphics::Track-><code>new($glyph_name,$features,@options)</code></a></strong><br /> </dt> <dd> The <a href="#item_new"><code>new()</code></a> 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(). </dd> <dd> <p>If successful <a href="#item_new"><code>new()</code></a> will return a new Ace::Graphics::Track. Otherwise, it will return undef.</p> </dd> <dd> <p>If the specified glyph name is not a valid one, <a href="#item_new"><code>new()</code></a> will throw an exception.</p> </dd> <p></p></dl> <p> </p> <h2><a name="object_methods">OBJECT METHODS</a></h2> <p>Once a track is created, the following methods can be invoked.</p> <dl> <dt><strong><a name="item_add_feature">$track-><code>add_feature($feature)</code></a></strong><br /> </dt> <dd> 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 can be 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. </dd> <p></p> <dt><strong><a name="item_add_group">$track-><code>add_group($group)</code></a></strong><br /> </dt> <dd> This behaves the same as add_feature(), but requires that its argument be an array reference containing a list of grouped features. </dd> <p></p> <dt><strong><a name="item_draw">$track-><code>draw($gd,$left,$top)</code></a></strong><br /> </dt> <dd> Render the track on a previously-created GD::Image object. The $left and $top arguments indicate the position at which to start rendering. </dd> <p></p> <dt><strong><a name="item_boxes">$boxes = $track-><code>boxes($left,$top)</code></a></strong><br /> </dt> <dt><strong>@boxes = $track-><code>boxes($left,$top)</code></strong><br /> </dt> <dd> 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. </dd> <dd> <p>See Ace::Graphics::Panel-><a href="#item_boxes"><code>boxes()</code></a> for the format of the result.</p> </dd> <p></p></dl> <p> </p> <h2><a name="accessors">ACCESSORS</a></h2> <p>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.</p> <p>Note that in most cases you must change attributes before the track's <a href="#item_layout"><code>layout()</code></a> method is called.</p> <pre> Accessor Name Description ------------- -----------</pre> <pre> 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</pre> <p> </p> <h2><a name="internal_methods">INTERNAL METHODS</a></h2> <p>The following methods are used internally, but may be useful for those implementing new glyph types.</p> <dl> <dt><strong><a name="item_layout">$glyphs = $track->layout</a></strong><br /> </dt> <dd> Layout the features, and return an anonymous array of Ace::Graphics::Glyph objects that have been created and correctly positioned. </dd> <dd> <p>Because layout is an expensive operation, calling this method several times will return the previously-cached result, ignoring any changes to track attributes.</p> </dd> <p></p> <dt><strong><a name="item_height">$height = $track->height</a></strong><br /> </dt> <dd> Invokes <a href="#item_layout"><code>layout()</code></a> and returns the height of the track. </dd> <p></p> <dt><strong><a name="item_glyphs">$glyphs = $track->glyphs</a></strong><br /> </dt> <dd> Returns the glyph cache. Returns undef before <a href="#item_layout"><code>layout()</code></a> and a reference to an array of glyphs after layout(). </dd> <p></p> <dt><strong><a name="item_make_factory">$factory = $track-><code>make_factory(@options)</code></a></strong><br /> </dt> <dd> Given a set of options (argument/value pairs), returns a Ace::Graphics::GlyphFactory for use in creating the glyphs with the desired settings. </dd> <p></p></dl> <p> </p> <hr /> <h1><a name="bugs">BUGS</a></h1> <p>Please report them.</p> <p> </p> <hr /> <h1><a name="see_also">SEE ALSO</a></h1> <p><a href="/AcePerl/docs/./Ace/Sequence.html">the Ace::Sequence manpage</a>,<a href="/AcePerl/docs/./Ace/Sequence/Feature.html">the Ace::Sequence::Feature manpage</a>,<a href="/AcePerl/docs/./Ace/Graphics/Panel.html">the Ace::Graphics::Panel manpage</a>, <a href="/AcePerl/docs/./Ace/Graphics/GlyphFactory.html">the Ace::Graphics::GlyphFactory manpage</a>,<a href="/AcePerl/docs/./Ace/Graphics/Glyph.html">the Ace::Graphics::Glyph manpage</a></p> <p> </p> <hr /> <h1><a name="author">AUTHOR</a></h1> <p>Lincoln Stein <<a href="mailto:lstein@cshl.org">lstein@cshl.org</a>>.</p> <p>Copyright (c) 2001 Cold Spring Harbor Laboratory</p> <p>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.</p> </body> </html>