1Ace::Graphics::Track(3)User Contributed Perl DocumentatioAnce::Graphics::Track(3)
2
3
4
6 Ace::Graphics::Track - PNG graphics of Ace::Sequence::Feature objects
7
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
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
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 co