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
24         my $track = $panel->add_track('transcript'
25                                       -fillcolor =>  'wheat',
26                                       -fgcolor   =>  'black',
27                                       -bump      =>  +1,
28                                       -height    =>  10,
29                                       -label     =>  1);
30         foreach (@transcripts) {
31            $track->add_feature($_);
32         }
33
34         my $boxes = $panel->boxes;
35         print $panel->png;
36

DESCRIPTION

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

METHODS

43       This section describes the class and object methods for
44       Ace::Graphics::Panel.
45
46   CONSTRUCTORS
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.
56           Otherwise, 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       Once a track is created, the following methods can be invoked.
63
64       $track->add_feature($feature)
65           This adds a new feature to the track.  The feature can either be a
66           single object that implements the Bio::SeqFeatureI interface (such
67           as an Ace::Sequence::Feature or Das::Segment::Feature), or can be
68           an anonymous array containing a set of related features.  In the
69           latter case, the track will attempt to keep the features in the
70           same horizontal band and will not allow any other features to
71           overlap.
72
73       $track->add_group($group)
74           This behaves the same as add_feature(), but requires that its
75           argument be an array reference containing a list of grouped
76           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
87           offset 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       The following accessor methods provide access to various attributes of
95       the track object.  Called with no arguments, they each return the
96       current value of the attribute.  Called with a single argument, they
97       set the attribute and return its previous value.
98
99       Note that in most cases you must change attributes before the track's
100       layout() method is called.
101
102          Accessor Name      Description
103          -------------      -----------
104
105          scale()            Get/set the track scale, measured in pixels/bp
106          lineheight()       Get/set the height of each glyph, pixels
107          width()            Get/set the width of the track
108          bump()             Get/set the bump direction
109
110   INTERNAL METHODS
111       The following methods are used internally, but may be useful for those
112       implementing new glyph types.
113
114       $glyphs = $track->layout
115           Layout the features, and return an anonymous array of
116           Ace::Graphics::Glyph objects that have been created and correctly
117           positioned.
118
119           Because layout is an expensive operation, calling this method
120           several times will return the previously-cached result, ignoring
121           any changes to track attributes.
122
123       $height = $track->height
124           Invokes layout() and returns the height of the track.
125
126       $glyphs = $track->glyphs
127           Returns the glyph cache.  Returns undef before layout() and a
128           reference to an array of glyphs after layout().
129
130       $factory = $track->make_factory(@options)
131           Given a set of options (argument/value pairs), returns a
132           Ace::Graphics::GlyphFactory for use in creating the glyphs with the
133           desired settings.
134

BUGS

136       Please report them.
137

SEE ALSO

139       Ace::Sequence,Ace::Sequence::Feature,Ace::Graphics::Panel,
140       Ace::Graphics::GlyphFactory,Ace::Graphics::Glyph
141

AUTHOR

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