1Ace::Graphics::Track(3)User Contributed Perl DocumentatioAnce::Graphics::Track(3)
2
3
4

NAME

6       Ace::Graphics::Track - PNG graphics of Ace::Sequence::Feature objects
7

SYNOPSIS

9         use Ace::Sequence;
10         use Ace::Graphics::Panel;
11
12         my $db     = Ace->connect(-host=>'brie2.cshl.org',-port=>2005) or die;
13         my $cosmid = Ace::Sequence->new(-seq=>'Y16B4A',
14                                         -db=>$db,-start=>-15000,-end=>15000) or die;
15
16         my @transcripts = $cosmid->transcripts;
17
18         my $panel = Ace::Graphics::Panel->new(
19                                             -segment => $cosmid,
20                                             -width  => 800
21                                            );
22
23         my $track = $panel->add_track('transcript'
24                                       -fillcolor =>  'wheat',
25                                       -fgcolor   =>  'black',
26                                       -bump      =>  +1,
27                                       -height    =>  10,
28                                       -label     =>  1);
29         foreach (@transcripts) {
30            $track->add_feature($_);
31         }
32
33         my $boxes = $panel->boxes;
34         print $panel->png;
35

DESCRIPTION

37       The Ace::Graphics::Track class is used by Ace::Graphics::Panel to lay
38       out a set of sequence features using a uniform glyph type. You will
39       ordinarily work with panels rather than directly with tracks.
40

METHODS

42       This section describes the class and object methods for Ace::Graph‐
43       ics::Panel.
44
45       CONSTRUCTORS
46
47       There is only one constructor, the new() method.  It is ordinarily
48       called by Ace::Graphics::Panel, and not in end-developer code.
49
50       $track = Ace::Graphics::Track->new($glyph_name,$features,@options)
51           The new() method creates a new track object from the provided glyph
52           name and list of features.  The arguments are similar to those in
53           Ace::Graphics::Panel->new().
54
55           If successful new() will return a new Ace::Graphics::Track.  Other‐
56           wise, it will return undef.
57
58           If the specified glyph name is not a valid one, new() will throw an
59           exception.
60
61       OBJECT METHODS
62
63       Once a track is created, the following methods can be invoked.
64
65       $track->add_feature($feature)
66           This adds a new feature to the track.  The feature can either be a
67           single object that implements the Bio::SeqFeatureI interface (such
68           as an Ace::Sequence::Feature or Das::Segment::Feature), or can be
69           an anonymous array containing a set of related features.  In the
70           latter case, the track will attempt to keep the features in the
71           same horizontal band and will not allow any other features to over‐
72           lap.
73
74       $track->add_group($group)
75           This behaves the same as add_feature(), but requires that its argu‐
76           ment be an array reference containing a list of grouped features.
77
78       $track->draw($gd,$left,$top)
79           Render the track on a previously-created GD::Image object.  The
80           $left and $top arguments indicate the position at which to start
81           rendering.
82
83       $boxes = $track->boxes($left,$top)
84       @boxes = $track->boxes($left,$top)
85           Return an array of array references indicating glyph coordinates
86           for each of the render features.  $left and $top indicate the off‐
87           set for the track on the image plane.  In a scalar context, this
88           method returns an array reference of glyph coordinates.  In a list
89           context, it returns the list itself.
90
91           See Ace::Graphics::Panel->boxes() for the format of the result.
92
93       ACCESSORS
94
95       The following accessor methods provide access to various attributes of
96       the track object.  Called with no arguments, they each return the cur‐
97       rent value of the attribute.  Called with a single argument, they set
98       the attribute and return its previous value.
99
100       Note that in most cases you must change attributes before the track's
101       layout() method is called.
102
103          Accessor Name      Description
104          -------------      -----------
105
106          scale()            Get/set the track scale, measured in pixels/bp
107          lineheight()       Get/set the height of each glyph, pixels
108          width()            Get/set the width of the track
109          bump()             Get/set the bump direction
110
111       INTERNAL METHODS
112
113       The following methods are used internally, but may be useful for those
114       implementing new glyph types.
115
116       $glyphs = $track->layout
117           Layout the features, and return an anonymous array of Ace::Graph‐
118           ics::Glyph objects that have been created and correctly positioned.
119
120           Because layout is an expensive operation, calling this method sev‐
121           eral times will return the previously-cached result, ignoring any
122           changes to track attributes.
123
124       $height = $track->height
125           Invokes layout() and returns the height of the track.
126
127       $glyphs = $track->glyphs
128           Returns the glyph cache.  Returns undef before layout() and a ref‐
129           erence to an array of glyphs after layout().
130
131       $factory = $track->make_factory(@options)
132           Given a set of options (argument/value pairs), returns a
133           Ace::Graphics::GlyphFactory for use in creating the glyphs with the
134           desired settings.
135

BUGS

137       Please report them.
138

SEE ALSO

140       Ace::Sequence,Ace::Sequence::Feature,Ace::Graphics::Panel, Ace::Graph‐
141       ics::GlyphFactory,Ace::Graphics::Glyph
142

AUTHOR

144       Lincoln Stein <lstein@cshl.org>.
145
146       Copyright (c) 2001 Cold Spring Harbor Laboratory
147
148       This library is free software; you can redistribute it and/or modify it
149       under the same terms as Perl itself.  See DISCLAIMER.txt for dis‐
150       claimers of warranty.
151
152
153
154perl v5.8.8                       2001-02-20           Ace::Graphics::Track(3)
Impressum