bio-graphics 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/doc/classes/Bio.html +135 -0
  2. data/doc/classes/Bio/Graphics.html +247 -0
  3. data/doc/classes/Bio/Graphics/Panel.html +344 -0
  4. data/doc/classes/Bio/Graphics/Panel.src/M000005.html +29 -0
  5. data/doc/classes/Bio/Graphics/Panel.src/M000006.html +19 -0
  6. data/doc/classes/Bio/Graphics/Panel.src/M000007.html +67 -0
  7. data/doc/classes/Bio/Graphics/Panel/Ruler.html +238 -0
  8. data/doc/classes/Bio/Graphics/Panel/Ruler.src/M000008.html +20 -0
  9. data/doc/classes/Bio/Graphics/Panel/Ruler.src/M000009.html +28 -0
  10. data/doc/classes/Bio/Graphics/Panel/Ruler.src/M000010.html +54 -0
  11. data/doc/classes/Bio/Graphics/Panel/Ruler.src/M000013.html +20 -0
  12. data/doc/classes/Bio/Graphics/Panel/Ruler.src/M000014.html +28 -0
  13. data/doc/classes/Bio/Graphics/Panel/Ruler.src/M000015.html +59 -0
  14. data/doc/classes/Bio/Graphics/Panel/Track.html +342 -0
  15. data/doc/classes/Bio/Graphics/Panel/Track.src/M000008.html +23 -0
  16. data/doc/classes/Bio/Graphics/Panel/Track.src/M000009.html +42 -0
  17. data/doc/classes/Bio/Graphics/Panel/Track.src/M000010.html +285 -0
  18. data/doc/classes/Bio/Graphics/Panel/Track.src/M000011.html +23 -0
  19. data/doc/classes/Bio/Graphics/Panel/Track.src/M000012.html +43 -0
  20. data/doc/classes/Bio/Graphics/Panel/Track.src/M000013.html +259 -0
  21. data/doc/classes/Bio/Graphics/Panel/Track/Feature.html +292 -0
  22. data/doc/classes/Bio/Graphics/Panel/Track/Feature.src/M000011.html +65 -0
  23. data/doc/classes/Bio/Graphics/Panel/Track/Feature.src/M000014.html +65 -0
  24. data/doc/classes/Bio/Graphics/Panel/Track/Feature/PixelRange.html +155 -0
  25. data/doc/classes/Bio/Graphics/Panel/Track/Feature/PixelRange.src/M000012.html +18 -0
  26. data/doc/classes/Bio/Graphics/Panel/Track/Feature/PixelRange.src/M000015.html +18 -0
  27. data/doc/classes/ImageMap.html +185 -0
  28. data/doc/classes/ImageMap.src/M000001.html +18 -0
  29. data/doc/classes/ImageMap.src/M000002.html +24 -0
  30. data/doc/classes/ImageMap/ImageMapElement.html +187 -0
  31. data/doc/classes/ImageMap/ImageMapElement.src/M000003.html +19 -0
  32. data/doc/classes/ImageMap/ImageMapElement.src/M000004.html +20 -0
  33. data/doc/created.rid +1 -0
  34. data/doc/files/README_DEV.html +432 -0
  35. data/doc/files/TUTORIAL.html +358 -0
  36. data/doc/files/lib/bio-graphics_rb.html +121 -0
  37. data/doc/files/lib/bio/graphics/feature_rb.html +113 -0
  38. data/doc/files/lib/bio/graphics/image_map_rb.html +113 -0
  39. data/doc/files/lib/bio/graphics/panel_rb.html +113 -0
  40. data/doc/files/lib/bio/graphics/ruler_rb.html +113 -0
  41. data/doc/files/lib/bio/graphics/track_rb.html +113 -0
  42. data/doc/fr_class_index.html +35 -0
  43. data/doc/fr_file_index.html +34 -0
  44. data/doc/fr_method_index.html +41 -0
  45. data/doc/images/example.png +0 -0
  46. data/doc/images/glyph_showcase.png +0 -0
  47. data/doc/images/terms.png +0 -0
  48. data/doc/images/terms.svg +166 -0
  49. data/doc/index.html +24 -0
  50. data/images/example.png +0 -0
  51. data/images/glyph_showcase.png +0 -0
  52. data/images/terms.png +0 -0
  53. data/images/terms.svg +166 -0
  54. data/lib/bio-graphics.rb +18 -0
  55. data/lib/bio/graphics/feature.rb +136 -0
  56. data/lib/bio/graphics/image_map.rb +37 -0
  57. data/lib/bio/graphics/panel.rb +205 -0
  58. data/lib/bio/graphics/ruler.rb +96 -0
  59. data/lib/bio/graphics/track.rb +387 -0
  60. data/samples/arkdb_features.rb +37 -0
  61. data/samples/data.txt +32 -0
  62. data/samples/glyph_showcase.rb +29 -0
  63. metadata +137 -0
@@ -0,0 +1,358 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: TUTORIAL</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>TUTORIAL</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>TUTORIAL
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Sat Sep 29 18:23:07 +0100 2007</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <p>
73
+ <img src="../images/example.png" />
74
+ </p>
75
+ <h1><a href="../classes/Bio/Graphics.html">Bio::Graphics</a> tutorial</h1>
76
+ <p>
77
+ Copyright (C) 2007 Jan Aerts &lt;jan.aerts@bbsrc.ac.uk&gt;
78
+ </p>
79
+ <p>
80
+ License: The Ruby License
81
+ </p>
82
+ <p>
83
+ Homepage: <a
84
+ href="http://bio-graphics.rubyforge.org">bio-graphics.rubyforge.org</a>
85
+ </p>
86
+ <p>
87
+ (If you&#8216;d like to know how the code itself works, please see the
88
+ README.DEV)
89
+ </p>
90
+ <h2>Overview and terms used</h2>
91
+ <p>
92
+ This <a href="../classes/Bio/Graphics.html">Bio::Graphics</a> library
93
+ allows for drawing overviews of genomic regions, similar to the pictures
94
+ drawn by <a href="http://www.gmod.org/wiki/index.php/Gbrowse">gbrowse</a>.
95
+ Basically, it allows creating simple images that display features on a
96
+ linear map. The code is based on the equivalent code in the <a
97
+ href="http://www.bioperl.org/wiki/Main_Page">bioperl</a> project.
98
+ </p>
99
+ <p>
100
+ Any <a href="../classes/Bio/Graphics.html">Bio::Graphics</a> image consists
101
+ of the following parts (nomenclature identical to that from bioperl):
102
+ </p>
103
+ <ul>
104
+ <li>one panel: container of all tracks
105
+
106
+ </li>
107
+ <li>one or more tracks: container of the features. Multiple tracks can exist in
108
+ the same graphic to allow for differential visualization of different
109
+ feature types (e.g. genes as blue rectangles and polymorphisms as red
110
+ triangles)
111
+
112
+ </li>
113
+ <li>one or more features in each track: these are the actual features that you
114
+ want to display (e.g. &#8216;gene 1&#8217;, &#8216;SNP 123445&#8217;)
115
+
116
+ </li>
117
+ <li>a ruler on top of the panel: is added automatically
118
+
119
+ </li>
120
+ </ul>
121
+ <p>
122
+ Schematically:
123
+ </p>
124
+ <pre>
125
+ panel
126
+ +-&gt; track 1
127
+ | +-&gt; feature 1
128
+ | +-&gt; feature 2
129
+ | +-&gt; feature 3
130
+ +-&gt; track 2
131
+ | +-&gt; feature 4
132
+ | +-&gt; feature 5
133
+ +-&gt; ruler
134
+ </pre>
135
+ <p>
136
+ Below is an annotated version of the picture at the top of the page. The
137
+ whole picture makes up the panel, which contains one ruler and 3 tracks
138
+ (&#8216;scaffolds&#8217;, &#8216;markers&#8217; and &#8216;clones&#8217;).
139
+ Each of these tracks has zero or more features.
140
+ </p>
141
+ <p>
142
+ <img src="../images/terms.png" />
143
+ </p>
144
+ <p>
145
+ As a feature can only exist within the confines of a track and a track can
146
+ only exist within the confines of a panel, these classes are encapsuled.
147
+ This means that the Track class is not Bio::Graphics::Track, but <a
148
+ href="../classes/Bio/Graphics/Panel/Track.html">Bio::Graphics::Panel::Track</a>;
149
+ the same goes for <a
150
+ href="../classes/Bio/Graphics/Panel/Track/Feature.html">Bio::Graphics::Panel::Track::Feature</a>.
151
+ </p>
152
+ <h2>Glyphs</h2>
153
+ <p>
154
+ According to Wikipedia, a <em>glyph</em> is &quot;the shape given in a
155
+ particular typeface to a specific grapheme or symbol&quot;. In the context
156
+ of <a href="../classes/Bio/Graphics.html">Bio::Graphics</a>, a glyph is
157
+ just the thing that represents one single feature. Several kinds of glyph
158
+ exist to allow for features that are on a particular strand as well as for
159
+ spliced features. See the picture below for an overview.
160
+ </p>
161
+ <p>
162
+ <img src="../images/glyph_showcase.png" />
163
+ </p>
164
+ <p>
165
+ If the view is really zoomed out, arrow on the directed glyphs are not
166
+ shown, as they would be bigger than the glyph itself.
167
+ </p>
168
+ <h2>Use</h2>
169
+ <p>
170
+ The code below was used to create the picture showing all the different
171
+ glyphs mentioned above. This is not the nicest piece of code, but it is the
172
+ simplest. It is straightforward to parse a GFF file and create a picture
173
+ based on that. See my <a
174
+ href="http://saaientist.blogspot.com/2007/09/graphics-genomics-and-ruby.html">blog</a>
175
+ for an nicer example.
176
+ </p>
177
+ <p>
178
+ For an explanation of the arguments with each method for this example, see
179
+ the <a href="../classes/Bio/Graphics/Panel.html">Bio::Graphics::Panel</a>
180
+ and <a
181
+ href="../classes/Bio/Graphics/Panel/Track.html">Bio::Graphics::Panel::Track</a>
182
+ object documentation.
183
+ </p>
184
+ <pre>
185
+ 1 # Load the library
186
+ 2 require 'bio-graphics' # or require_gem 'bio-graphics'
187
+ 3
188
+ 4 # Create the panel
189
+ 5 my_panel = Bio::Graphics::Panel.new(500, 600, true, 1, 500)
190
+ 6
191
+ 7 # Create the tracks
192
+ 8 generic_track = my_panel.add_track('generic')
193
+ 9 directed_track = my_panel.add_track('directed',[0,1,0],'directed_generic')
194
+ 10 triangle_track = my_panel.add_track('triangle',[1,0,0],'triangle')
195
+ 11 spliced_track = my_panel.add_track('spliced',[1,0,0],'spliced')
196
+ 12 directed_spliced_track = my_panel.add_track('directed_spliced',[1,0,1],'directed_spliced')
197
+ 13
198
+ 14 # Add features to each track
199
+ 15 generic_track.add_feature('clone1','250..375', 'http://www.newsforge.com')
200
+ 16 generic_track.add_feature('clone2','54..124', 'http://www.thearkdb.org')
201
+ 17 generic_track.add_feature('clone3','100..449', 'http://www.google.com')
202
+ 18
203
+ 19 directed_track.add_feature('marker1','50..60', 'http://www.google.com')
204
+ 20 directed_track.add_feature('marker2','complement(80..120)', 'http://www.sourceforge.net')
205
+ 21
206
+ 22 triangle_track.add_feature('snp1','56')
207
+ 23 triangle_track.add_feature('snp2','103','http://digg.com')
208
+ 24
209
+ 25 spliced_track.add_feature('gene1','join(34..52,109..183)','http://news.bbc.co.uk')
210
+ 26 spliced_track.add_feature('gene2','complement(join(170..231,264..299,350..360,409..445))')
211
+ 27 spliced_track.add_feature('gene3','join(134..152,209..283)')
212
+ 28
213
+ 29 directed_spliced_track.add_feature('gene4','join(34..52,109..183)', 'http://www.vrtnieuws.net')
214
+ 30 directed_spliced_track.add_feature('gene5','complement(join(170..231,264..299,350..360,409..445))')
215
+ 31 directed_spliced_track.add_feature('gene6','join(134..152,209..283)')
216
+ 32
217
+ 33 # Draw the thing
218
+ 34 my_panel.draw('glyph_showcase.png')
219
+ </pre>
220
+ <p>
221
+ Let&#8216;s walk through this:
222
+ </p>
223
+ <ul>
224
+ <li>Line 2: load the actual library code. Make sure that the library is in your
225
+ RUBYLIB path.
226
+
227
+ </li>
228
+ <li>Line 5: Create the panel, which is nothing more than the canvas
229
+ you&#8216;ll be working on. The following parameters were used:
230
+
231
+ <ul>
232
+ <li>The sequence is 500 bp long.
233
+
234
+ </li>
235
+ <li>The width of the picture will be 600 points.
236
+
237
+ </li>
238
+ <li>A HTML page will be created to make hyperlinks possible (the <em>true</em>)
239
+
240
+ </li>
241
+ <li>The picture will be zoomed in from bp 1 to 500 (i.e. completely zoomed
242
+ out).
243
+
244
+ </li>
245
+ </ul>
246
+ </li>
247
+ <li>Lines 8-12: Create the different tracks. Parameters are:
248
+
249
+ <ul>
250
+ <li>name.
251
+
252
+ </li>
253
+ <li>colour. At the moment in RGB. (This will probably change to colour names in
254
+ the future).
255
+
256
+ </li>
257
+ <li>type. See the picture above and Bio::Graphics::Panel::Track#new for allowed
258
+ values.
259
+
260
+ </li>
261
+ </ul>
262
+ </li>
263
+ <li>Lines 15-31: Add features to each track. Parameters are:
264
+
265
+ <ul>
266
+ <li>name.
267
+
268
+ </li>
269
+ <li>location. This should be a location parsable by <a
270
+ href="http://www.bioruby.org">bioruby's</a> Bio::Locations object.
271
+
272
+ </li>
273
+ <li>link.
274
+
275
+ </li>
276
+ </ul>
277
+ </li>
278
+ <li>Line 34: Create the actual picture. If the third parameter to the initial
279
+ Panel#new call (in line 5) is &#8216;true&#8217;, a HTML file is created as
280
+ well.
281
+
282
+ </li>
283
+ </ul>
284
+ <h3>Hyperlinks</h3>
285
+ <p>
286
+ There are no graphic formats that are inherently clickable (SVG is a
287
+ special case and the <em>display</em> of it is not the SVG itself).
288
+ Therefore, in case the user wants a clickable graphic, an accompanying HTML
289
+ file is created with the same name as the picture but obviously the .html
290
+ extension. This file contains the map and will display a clickable picture
291
+ when loaded in a webbrowser.
292
+ </p>
293
+ <h2>Download and installation</h2>
294
+ <p>
295
+ Development of the library is at <a
296
+ href="http://rubyforge.org/projects/bio-graphics">rubyforge.org/projects/bio-graphics</a>/
297
+ </p>
298
+ <p>
299
+ There are different ways to install the library.
300
+ </p>
301
+ <ul>
302
+ <li>Export for SVN (for the latest development version): &quot;svn checkout
303
+ svn+ssh://jandot@rubyforge.org//var/svn/bio-graphics&quot;
304
+
305
+ </li>
306
+ <li>As a rubygem: download the bio-graphics-1.0.gem from the website, and do
307
+ &quot;gem install bio-graphics-1.0.gem&quot;
308
+
309
+ </li>
310
+ </ul>
311
+ <h2>Prerequisites</h2>
312
+ <p>
313
+ You&#8216;ll need to have the following installed to use this library:
314
+ </p>
315
+ <ul>
316
+ <li>bioruby (<a href="http://www.bioruby.org">www.bioruby.org</a>), to parse
317
+ the feature locations. On linux systems, type &quot;gem install bio&quot;.
318
+
319
+ </li>
320
+ <li>cairo (<a href="http://cairographics.org">cairographics.org</a>), to do the
321
+ actual drawing. On Ubuntu, type &quot;sudo apt-get install
322
+ libcairo-ruby&quot;.
323
+
324
+ </li>
325
+ </ul>
326
+
327
+ </div>
328
+
329
+
330
+ </div>
331
+
332
+
333
+ </div>
334
+
335
+
336
+ <!-- if includes -->
337
+
338
+ <div id="section">
339
+
340
+
341
+
342
+
343
+
344
+
345
+
346
+
347
+ <!-- if method_list -->
348
+
349
+
350
+ </div>
351
+
352
+
353
+ <div id="validator-badges">
354
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
355
+ </div>
356
+
357
+ </body>
358
+ </html>
@@ -0,0 +1,121 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: bio-graphics.rb</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>bio-graphics.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/bio-graphics.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Fri Sep 28 20:03:31 +0100 2007</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <h1>bio-graphics.rb - Loading all <a href="../../classes/Bio/Graphics.html">Bio::Graphics</a> modules</h1>
73
+ <table>
74
+ <tr><td valign="top">Copyright:</td><td>Copyright (C) 2007 Jan Aerts &lt;jan.aerts@bbsrc.ac.uk&gt;
75
+
76
+ </td></tr>
77
+ <tr><td valign="top">License:</td><td>The Ruby License
78
+
79
+ </td></tr>
80
+ </table>
81
+
82
+ </div>
83
+
84
+ <div id="requires-list">
85
+ <h3 class="section-bar">Required files</h3>
86
+
87
+ <div class="name-list">
88
+ bio&nbsp;&nbsp;
89
+ cairo&nbsp;&nbsp;
90
+ </div>
91
+ </div>
92
+
93
+ </div>
94
+
95
+
96
+ </div>
97
+
98
+
99
+ <!-- if includes -->
100
+
101
+ <div id="section">
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+ <!-- if method_list -->
111
+
112
+
113
+ </div>
114
+
115
+
116
+ <div id="validator-badges">
117
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
118
+ </div>
119
+
120
+ </body>
121
+ </html>