Debian Codegraph @

README

raw
1 Bio::Graphics - Generate GD images of Bio::Seq objects
2
3
4 SYNOPSIS
5
6 This is a simple GD-based renderer (diagram drawer) for DNA and
7 protein sequences. It is used from Perl like this:
8
9 use Bio::Graphics;
10 use Bio::DB::BioFetch; # or some other Bio::SeqI generator
11 # get a Bio::SeqI object somehow
12 my $bf = Bio::DB::BioFetch->new;
13 my $cosmid = $bf->get_Seq_by_id('CEF58D5');
14
15 my @features = $cosmid->all_SeqFeatures;
16 my @CDS = grep {$_->primary_tag eq 'CDS'} @features;
17 my @gene = grep {$_->primary_tag eq 'gene'} @features;
18 my @tRNAs = grep {$_->primary_tag eq 'tRNA'} @features;
19 # let the drawing begin...
20 my $panel = Bio::Graphics::Panel->new(
21 -segment => $cosmid,
22 -width => 800
23 );
24
25 $panel->add_track(arrow => $cosmid,
26 -bump => 0,
27 -double=>1,
28 -tick => 2);
29
30 $panel->add_track(transcript => \@gene,
31 -bgcolor => 'blue',
32 -fgcolor => 'black',
33 -key => 'Genes',
34 -bump => +1,
35 -height => 10,
36 -label => 1,
37 -description=> 1
38 ) ;
39
40 $panel->add_track(transcript2 => \@CDS,
41 -bgcolor => 'cyan',
42 -fgcolor => 'black',
43 -key => 'CDS',
44 -bump => +1,
45 -height => 10,
46 -label => 1,
47 -description=> 1,
48 );
49
50 $panel->add_track(generic => \@tRNAs,
51 -bgcolor => 'red',
52 -fgcolor => 'black',
53 -key => 'tRNAs',
54 -bump => +1,
55 -height => 8,
56 -label => 1,
57 );
58
59 my $gd = $panel->gd;
60 print $gd->can('png') ? $gd->png : $gd->gif;
61
62 DESCRIPTION
63
64 The Bio::Graphics::Panel class provides drawing and formatting
65 services for any object that implements the Bio::SeqFeatureI
66 interface, including Ace::Sequence::Feature, Das::Segment::Feature and
67 Bio::DB::Graphics objects. It can be used to draw sequence
68 annotations, physical (contig) maps, protein domains, or any other
69 type of map in which a set of discrete ranges need to be laid out on
70 the number line.
71
72 The module supports a drawing style in which each type of feature
73 occupies a discrete "track" that spans the width of the display. Each
74 track will have its own distinctive "glyph", a configurable graphical
75 representation of the feature.
76
77 The module also supports a more flexible style in which several
78 different feature types and their associated glyphs can occupy the
79 same track. The choice of glyph is under run-time control.
80
81 Semantic zooming (for instance, changing the type of glyph depending
82 on the density of features) is supported by a callback system for
83 configuration variables. The module has built-in support for Bio::Das
84 stylesheets, and stylesheet-driven configuration can be intermixed
85 with semantic zooming, if desired.
86
87 You can add a key to the generated image using either of two key
88 styles. One style places the key captions at the top of each track.
89 The other style generates a graphical key at the bottom of the image.
90
91 Note that this modules depends on Bio::Perl, GD and the
92 Text::Parsewords module.
93
94 A good tutorial on this module can be found at
95 http://www.bioperl.org/wiki/HOWTO:Graphics.
96
97 BUILDING AND INSTALLING
98
99 From the directory in which this README file is located:
100
101 % perl ./Build.PL
102 % ./Build test
103 % ./Build install
104
105 The last step may need to be run as root.
106
107 You can test whether the module is working by running the testit.pl
108 script located in the eg subdirectory. It produces a PNG file, so you
109 should pipe the output to an image displayer, such as xv:
110
111 eg/testit.pl | xv -
112
113 THE FEATURE_DRAW.PL SCRIPT
114
115 This module contains a simple script named "feature_draw.pl" that
116 takes a file of annotations and generates an image. When first built,
117 the script lives in the "scripts" subdirectory. After installation,
118 the script will be moved into your system-wide scripts directory
119 (usually /usr/bin or something similar).
120
121 There is a sample features file in the "eg" subdirectory. After
122 building, but before installation, you can run the following command
123 from the directory in which this README file is located:
124
125 % scripts/feature_draw.pl eg/feature_data.txt | display -
126
127 This is piping the output directly to the "display" program, part of
128 the ImageMagick package. Replace with your favorite PNG-capable
129 display program.
130
131 After installation, feature_draw.pl will be available on your command
132 path. Run "man feature_draw.pl" to see the manual page, or use the -h
133 option to get a quick summary of usage.
134
135 THE GENERIC GENOME BROWSER
136
137 The gbrowse script, part of the Generic Genome Browser package, has
138 been moved into its own package. It creates a high-performance
139 web-based genome browser based on the Bio::Graphics package. You can
140 get it by anonymous CVS to SourceForge:
141
142 cvs -d:pserver:[email protected]:/cvsroot/gmod \
143 co Generic-Genome-Browser
144
145 Lincoln Stein <[email protected]>
146 12 December 2008