.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Ace::Graphics::Track 3pm" .TH Ace::Graphics::Track 3pm 2024-01-10 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Ace::Graphics::Track \- PNG graphics of Ace::Sequence::Feature objects .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 2 \& use Ace::Sequence; \& use Ace::Graphics::Panel; \& \& my $db = Ace\->connect(\-host=>\*(Aqbrie2.cshl.org\*(Aq,\-port=>2005) or die; \& my $cosmid = Ace::Sequence\->new(\-seq=>\*(AqY16B4A\*(Aq, \& \-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(\*(Aqtranscript\*(Aq \& \-fillcolor => \*(Aqwheat\*(Aq, \& \-fgcolor => \*(Aqblack\*(Aq, \& \-bump => +1, \& \-height => 10, \& \-label => 1); \& foreach (@transcripts) { \& $track\->add_feature($_); \& } \& \& my $boxes = $panel\->boxes; \& print $panel\->png; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" 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. .SH METHODS .IX Header "METHODS" This section describes the class and object methods for Ace::Graphics::Panel. .SS CONSTRUCTORS .IX Subsection "CONSTRUCTORS" There is only one constructor, the \fBnew()\fR method. It is ordinarily called by Ace::Graphics::Panel, and not in end-developer code. .ie n .IP "$track = Ace::Graphics::Track\->new($glyph_name,$features,@options)" 4 .el .IP "\f(CW$track\fR = Ace::Graphics::Track\->new($glyph_name,$features,@options)" 4 .IX Item "$track = Ace::Graphics::Track->new($glyph_name,$features,@options)" The \fBnew()\fR 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\->\fBnew()\fR. .Sp If successful \fBnew()\fR will return a new Ace::Graphics::Track. Otherwise, it will return undef. .Sp If the specified glyph name is not a valid one, \fBnew()\fR will throw an exception. .SS "OBJECT METHODS" .IX Subsection "OBJECT METHODS" Once a track is created, the following methods can be invoked. .ie n .IP $track\->add_feature($feature) 4 .el .IP \f(CW$track\fR\->add_feature($feature) 4 .IX Item "$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 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. .ie n .IP $track\->add_group($group) 4 .el .IP \f(CW$track\fR\->add_group($group) 4 .IX Item "$track->add_group($group)" This behaves the same as \fBadd_feature()\fR, but requires that its argument be an array reference containing a list of grouped features. .ie n .IP $track\->draw($gd,$left,$top) 4 .el .IP \f(CW$track\fR\->draw($gd,$left,$top) 4 .IX Item "$track->draw($gd,$left,$top)" Render the track on a previously-created GD::Image object. The \f(CW$left\fR and \f(CW$top\fR arguments indicate the position at which to start rendering. .ie n .IP "$boxes = $track\->boxes($left,$top)" 4 .el .IP "\f(CW$boxes\fR = \f(CW$track\fR\->boxes($left,$top)" 4 .IX Item "$boxes = $track->boxes($left,$top)" .PD 0 .ie n .IP "@boxes = $track\->boxes($left,$top)" 4 .el .IP "\f(CW@boxes\fR = \f(CW$track\fR\->boxes($left,$top)" 4 .IX Item "@boxes = $track->boxes($left,$top)" .PD Return an array of array references indicating glyph coordinates for each of the render features. \f(CW$left\fR and \f(CW$top\fR 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. .Sp See Ace::Graphics::Panel\->\fBboxes()\fR for the format of the result. .SS ACCESSORS .IX Subsection "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. .PP Note that in most cases you must change attributes before the track's \&\fBlayout()\fR method is called. .PP .Vb 2 \& Accessor Name Description \& \-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\- \& \& 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 .Ve .SS "INTERNAL METHODS" .IX Subsection "INTERNAL METHODS" The following methods are used internally, but may be useful for those implementing new glyph types. .ie n .IP "$glyphs = $track\->layout" 4 .el .IP "\f(CW$glyphs\fR = \f(CW$track\fR\->layout" 4 .IX Item "$glyphs = $track->layout" Layout the features, and return an anonymous array of Ace::Graphics::Glyph objects that have been created and correctly positioned. .Sp Because layout is an expensive operation, calling this method several times will return the previously-cached result, ignoring any changes to track attributes. .ie n .IP "$height = $track\->height" 4 .el .IP "\f(CW$height\fR = \f(CW$track\fR\->height" 4 .IX Item "$height = $track->height" Invokes \fBlayout()\fR and returns the height of the track. .ie n .IP "$glyphs = $track\->glyphs" 4 .el .IP "\f(CW$glyphs\fR = \f(CW$track\fR\->glyphs" 4 .IX Item "$glyphs = $track->glyphs" Returns the glyph cache. Returns undef before \fBlayout()\fR and a reference to an array of glyphs after \fBlayout()\fR. .ie n .IP "$factory = $track\->make_factory(@options)" 4 .el .IP "\f(CW$factory\fR = \f(CW$track\fR\->make_factory(@options)" 4 .IX Item "$factory = $track->make_factory(@options)" Given a set of options (argument/value pairs), returns a Ace::Graphics::GlyphFactory for use in creating the glyphs with the desired settings. .SH BUGS .IX Header "BUGS" Please report them. .SH "SEE ALSO" .IX Header "SEE ALSO" Ace::Sequence,Ace::Sequence::Feature,Ace::Graphics::Panel, Ace::Graphics::GlyphFactory,Ace::Graphics::Glyph .SH AUTHOR .IX Header "AUTHOR" Lincoln Stein . .PP Copyright (c) 2001 Cold Spring Harbor Laboratory .PP 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.