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,29 @@
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>
7
+ <head>
8
+ <title>new (Bio::Graphics::Panel)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/bio/graphics/panel.rb, line 101</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">length</span>, <span class="ruby-identifier">width</span> = <span class="ruby-constant">DEFAULT_PANEL_WIDTH</span>, <span class="ruby-identifier">clickable</span> = <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">display_start</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">display_stop</span> = <span class="ruby-keyword kw">nil</span>)
15
+ <span class="ruby-ivar">@length</span> = <span class="ruby-identifier">length</span>.<span class="ruby-identifier">to_i</span>
16
+ <span class="ruby-ivar">@width</span> = <span class="ruby-identifier">width</span>.<span class="ruby-identifier">to_i</span>
17
+ <span class="ruby-ivar">@tracks</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
18
+ <span class="ruby-ivar">@number_of_times_bumped</span> = <span class="ruby-value">0</span>
19
+ <span class="ruby-ivar">@clickable</span> = <span class="ruby-identifier">clickable</span>
20
+ <span class="ruby-ivar">@image_map</span> = ( <span class="ruby-identifier">clickable</span> ) <span class="ruby-operator">?</span> <span class="ruby-constant">ImageMap</span>.<span class="ruby-identifier">new</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
21
+ <span class="ruby-ivar">@display_start</span> = ( <span class="ruby-identifier">display_start</span>.<span class="ruby-identifier">nil?</span> ) <span class="ruby-operator">?</span> <span class="ruby-value">0</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">display_start</span>
22
+ <span class="ruby-ivar">@display_stop</span> = ( <span class="ruby-identifier">display_stop</span>.<span class="ruby-identifier">nil?</span> ) <span class="ruby-operator">?</span> <span class="ruby-ivar">@length</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">display_stop</span>
23
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@display_stop</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-ivar">@display_start</span>
24
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;[ERROR] Start coordinate to be displayed has to be smaller than stop coordinate.&quot;</span>
25
+ <span class="ruby-keyword kw">end</span>
26
+ <span class="ruby-ivar">@rescale_factor</span> = (<span class="ruby-ivar">@display_stop</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@display_start</span>).<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-ivar">@width</span>
27
+ <span class="ruby-keyword kw">end</span></pre>
28
+ </body>
29
+ </html>
@@ -0,0 +1,19 @@
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>
7
+ <head>
8
+ <title>add_track (Bio::Graphics::Panel)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/bio/graphics/panel.rb, line 136</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_track</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">feature_colour</span> = [<span class="ruby-value">0</span>,<span class="ruby-value">0</span>,<span class="ruby-value">1</span>], <span class="ruby-identifier">feature_glyph</span> = <span class="ruby-value str">'generic'</span>)
15
+ <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">push</span>(<span class="ruby-constant">Bio</span><span class="ruby-operator">::</span><span class="ruby-constant">Graphics</span><span class="ruby-operator">::</span><span class="ruby-constant">Panel</span><span class="ruby-operator">::</span><span class="ruby-constant">Track</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">feature_colour</span>, <span class="ruby-identifier">feature_glyph</span>))
16
+ <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@tracks</span>[<span class="ruby-value">-1</span>]
17
+ <span class="ruby-keyword kw">end</span></pre>
18
+ </body>
19
+ </html>
@@ -0,0 +1,67 @@
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>
7
+ <head>
8
+ <title>draw (Bio::Graphics::Panel)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/bio/graphics/panel.rb, line 148</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw</span>(<span class="ruby-identifier">file_name</span>)
15
+ <span class="ruby-comment cmt"># Create a panel that is huge vertically
16
+ <span class="ruby-identifier">huge_height</span> = <span class="ruby-value">2000</span>
17
+
18
+ <span class="ruby-identifier">huge_panel_drawing</span> = <span class="ruby-keyword kw">nil</span>
19
+ <span class="ruby-identifier">huge_panel_drawing</span> = <span class="ruby-constant">Cairo</span><span class="ruby-operator">::</span><span class="ruby-constant">ImageSurface</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">1</span>, <span class="ruby-ivar">@width</span>, <span class="ruby-identifier">huge_height</span>)
20
+
21
+ <span class="ruby-identifier">background</span> = <span class="ruby-constant">Cairo</span><span class="ruby-operator">::</span><span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">huge_panel_drawing</span>)
22
+ <span class="ruby-identifier">background</span>.<span class="ruby-identifier">set_source_rgb</span>(<span class="ruby-value">1</span>,<span class="ruby-value">1</span>,<span class="ruby-value">1</span>)
23
+ <span class="ruby-identifier">background</span>.<span class="ruby-identifier">rectangle</span>(<span class="ruby-value">0</span>,<span class="ruby-value">0</span>,<span class="ruby-ivar">@width</span>,<span class="ruby-identifier">huge_height</span>).<span class="ruby-identifier">fill</span>
24
+
25
+ <span class="ruby-comment cmt"># Add ruler
26
+ <span class="ruby-identifier">vertical_offset</span> = <span class="ruby-value">0</span>
27
+ <span class="ruby-identifier">ruler</span> = <span class="ruby-constant">Bio</span><span class="ruby-operator">::</span><span class="ruby-constant">Graphics</span><span class="ruby-operator">::</span><span class="ruby-constant">Panel</span><span class="ruby-operator">::</span><span class="ruby-constant">Ruler</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>)
28
+ <span class="ruby-identifier">ruler</span>.<span class="ruby-identifier">draw</span>(<span class="ruby-identifier">huge_panel_drawing</span>, <span class="ruby-identifier">vertical_offset</span>)
29
+ <span class="ruby-identifier">vertical_offset</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">ruler</span>.<span class="ruby-identifier">height</span>
30
+
31
+ <span class="ruby-comment cmt"># Add tracks
32
+ <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">track</span><span class="ruby-operator">|</span>
33
+ <span class="ruby-identifier">track</span>.<span class="ruby-identifier">draw</span>(<span class="ruby-identifier">huge_panel_drawing</span>, <span class="ruby-identifier">vertical_offset</span>)
34
+ <span class="ruby-ivar">@number_of_times_bumped</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">track</span>.<span class="ruby-identifier">number_of_times_bumped</span>
35
+ <span class="ruby-identifier">vertical_offset</span> <span class="ruby-operator">+=</span> ( <span class="ruby-identifier">track</span>.<span class="ruby-identifier">number_of_times_bumped</span><span class="ruby-operator">*</span>(<span class="ruby-constant">FEATURE_HEIGHT</span><span class="ruby-operator">+</span><span class="ruby-constant">FEATURE_V_DISTANCE</span><span class="ruby-operator">+</span><span class="ruby-value">5</span>)) <span class="ruby-operator">+</span> <span class="ruby-value">10</span> <span class="ruby-comment cmt"># '10' is for the header
36
+ <span class="ruby-keyword kw">end</span>
37
+
38
+ <span class="ruby-comment cmt"># And create a smaller version of the panel
39
+ <span class="ruby-identifier">height</span> = <span class="ruby-identifier">ruler</span>.<span class="ruby-identifier">height</span>
40
+ <span class="ruby-ivar">@number_of_times_bumped</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span>
41
+ <span class="ruby-identifier">height</span> <span class="ruby-operator">+=</span> <span class="ruby-value">20</span>
42
+ <span class="ruby-keyword kw">end</span>
43
+ <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">length</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-comment cmt">#To correct for the track headers
44
+ <span class="ruby-identifier">height</span> <span class="ruby-operator">+=</span> <span class="ruby-value">10</span>
45
+ <span class="ruby-keyword kw">end</span>
46
+
47
+ <span class="ruby-identifier">resized_panel_drawing</span> = <span class="ruby-keyword kw">nil</span>
48
+ <span class="ruby-identifier">resized_panel_drawing</span> = <span class="ruby-constant">Cairo</span><span class="ruby-operator">::</span><span class="ruby-constant">ImageSurface</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">1</span>, <span class="ruby-ivar">@width</span>, <span class="ruby-identifier">height</span>)
49
+ <span class="ruby-identifier">resizing_context</span> = <span class="ruby-constant">Cairo</span><span class="ruby-operator">::</span><span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">resized_panel_drawing</span>)
50
+ <span class="ruby-identifier">resizing_context</span>.<span class="ruby-identifier">set_source</span>(<span class="ruby-identifier">huge_panel_drawing</span>, <span class="ruby-value">0</span>,<span class="ruby-value">0</span>)
51
+ <span class="ruby-identifier">resizing_context</span>.<span class="ruby-identifier">rectangle</span>(<span class="ruby-value">0</span>,<span class="ruby-value">0</span>,<span class="ruby-ivar">@width</span>, <span class="ruby-identifier">height</span>).<span class="ruby-identifier">fill</span>
52
+
53
+ <span class="ruby-comment cmt"># And print to file
54
+ <span class="ruby-identifier">resized_panel_drawing</span>.<span class="ruby-identifier">write_to_png</span>(<span class="ruby-identifier">file_name</span>)
55
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@clickable</span> <span class="ruby-comment cmt"># create png and map
56
+ <span class="ruby-identifier">html_filename</span> = <span class="ruby-identifier">file_name</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp re">/\.[^.]+$/</span>, <span class="ruby-value str">'.html'</span>)
57
+ <span class="ruby-identifier">html</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">html_filename</span>,<span class="ruby-value str">'w'</span>)
58
+ <span class="ruby-identifier">html</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;&lt;html&gt;&quot;</span>
59
+ <span class="ruby-identifier">html</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;&lt;body&gt;&quot;</span>
60
+ <span class="ruby-identifier">html</span>.<span class="ruby-identifier">puts</span> <span class="ruby-ivar">@image_map</span>.<span class="ruby-identifier">to_s</span>
61
+ <span class="ruby-identifier">html</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;&lt;img border='1' src='&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">file_name</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;' usemap='#image_map' /&gt;&quot;</span>
62
+ <span class="ruby-identifier">html</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;&lt;/body&gt;&quot;</span>
63
+ <span class="ruby-identifier">html</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value str">&quot;&lt;/html&gt;&quot;</span>
64
+ <span class="ruby-keyword kw">end</span>
65
+ <span class="ruby-keyword kw">end</span></pre>
66
+ </body>
67
+ </html>
@@ -0,0 +1,238 @@
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>Class: Bio::Graphics::Panel::Ruler</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="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Bio::Graphics::Panel::Ruler</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../../files/lib/bio/graphics/ruler_rb.html">
59
+ lib/bio/graphics/ruler.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+ <div id="description">
82
+ <p>
83
+ The Bio::Graphics::Ruler class describes the ruler to be drawn on the
84
+ graph. This is created automatically when creating the picture by using
85
+ Bio::Graphics::Panel.to_svg. See BioExt::Graphics documentation for
86
+ explanation of interplay between different classes.
87
+ </p>
88
+
89
+ </div>
90
+
91
+
92
+ </div>
93
+
94
+ <div id="method-list">
95
+ <h3 class="section-bar">Methods</h3>
96
+
97
+ <div class="name-list">
98
+ <a href="#M000014">calculate_tick_distance</a>&nbsp;&nbsp;
99
+ <a href="#M000015">draw</a>&nbsp;&nbsp;
100
+ <a href="#M000013">new</a>&nbsp;&nbsp;
101
+ </div>
102
+ </div>
103
+
104
+ </div>
105
+
106
+
107
+ <!-- if includes -->
108
+
109
+ <div id="section">
110
+
111
+
112
+
113
+
114
+
115
+ <div id="attribute-list">
116
+ <h3 class="section-bar">Attributes</h3>
117
+
118
+ <div class="name-list">
119
+ <table>
120
+ <tr class="top-aligned-row context-row">
121
+ <td class="context-item-name">colour</td>
122
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
123
+ <td class="context-item-desc"></td>
124
+ </tr>
125
+ <tr class="top-aligned-row context-row">
126
+ <td class="context-item-name">height</td>
127
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
128
+ <td class="context-item-desc"></td>
129
+ </tr>
130
+ <tr class="top-aligned-row context-row">
131
+ <td class="context-item-name">major_tick_distance</td>
132
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
133
+ <td class="context-item-desc"></td>
134
+ </tr>
135
+ <tr class="top-aligned-row context-row">
136
+ <td class="context-item-name">minor_tick_distance</td>
137
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
138
+ <td class="context-item-desc"></td>
139
+ </tr>
140
+ <tr class="top-aligned-row context-row">
141
+ <td class="context-item-name">name</td>
142
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
143
+ <td class="context-item-desc"></td>
144
+ </tr>
145
+ <tr class="top-aligned-row context-row">
146
+ <td class="context-item-name">panel</td>
147
+ <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
148
+ <td class="context-item-desc"></td>
149
+ </tr>
150
+ </table>
151
+ </div>
152
+ </div>
153
+
154
+
155
+
156
+ <!-- if method_list -->
157
+ <div id="methods">
158
+ <h3 class="section-bar">Public Class methods</h3>
159
+
160
+ <div id="method-M000013" class="method-detail">
161
+ <a name="M000013"></a>
162
+
163
+ <div class="method-heading">
164
+ <a href="Ruler.src/M000013.html" target="Code" class="method-signature"
165
+ onclick="popupCode('Ruler.src/M000013.html');return false;">
166
+ <span class="method-name">new</span><span class="method-args">(panel, colour = [0,0,0])</span>
167
+ </a>
168
+ </div>
169
+
170
+ <div class="method-description">
171
+ <p>
172
+ Creates a <a href="Ruler.html#M000013">new</a> <a
173
+ href="Ruler.html">Bio::Graphics::Panel::Ruler</a> object.
174
+ </p>
175
+ <hr size="1"></hr><p>
176
+ <b>Arguments</b>:
177
+ </p>
178
+ <ul>
179
+ <li><em>panel</em> (required) :: <a
180
+ href="../Panel.html">Bio::Graphics::Panel</a> object that this ruler
181
+ belongs to
182
+
183
+ </li>
184
+ <li><em>colour</em> :: colour of the ruler. Default = &#8216;black&#8216;
185
+
186
+ </li>
187
+ </ul>
188
+ <table>
189
+ <tr><td valign="top"><b>Returns</b>:</td><td>Bio::Graphics::Ruler object
190
+
191
+ </td></tr>
192
+ </table>
193
+ </div>
194
+ </div>
195
+
196
+ <h3 class="section-bar">Public Instance methods</h3>
197
+
198
+ <div id="method-M000014" class="method-detail">
199
+ <a name="M000014"></a>
200
+
201
+ <div class="method-heading">
202
+ <a href="Ruler.src/M000014.html" target="Code" class="method-signature"
203
+ onclick="popupCode('Ruler.src/M000014.html');return false;">
204
+ <span class="method-name">calculate_tick_distance</span><span class="method-args">()</span>
205
+ </a>
206
+ </div>
207
+
208
+ <div class="method-description">
209
+ </div>
210
+ </div>
211
+
212
+ <div id="method-M000015" class="method-detail">
213
+ <a name="M000015"></a>
214
+
215
+ <div class="method-heading">
216
+ <a href="Ruler.src/M000015.html" target="Code" class="method-signature"
217
+ onclick="popupCode('Ruler.src/M000015.html');return false;">
218
+ <span class="method-name">draw</span><span class="method-args">(panel_drawing, vertical_offset)</span>
219
+ </a>
220
+ </div>
221
+
222
+ <div class="method-description">
223
+ </div>
224
+ </div>
225
+
226
+
227
+ </div>
228
+
229
+
230
+ </div>
231
+
232
+
233
+ <div id="validator-badges">
234
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
235
+ </div>
236
+
237
+ </body>
238
+ </html>
@@ -0,0 +1,20 @@
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>
7
+ <head>
8
+ <title>new (Bio::Graphics::Panel::Ruler)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/bio/graphics/ruler.rb, line 28</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">panel</span>, <span class="ruby-identifier">colour</span> = [<span class="ruby-value">0</span>,<span class="ruby-value">0</span>,<span class="ruby-value">0</span>])
15
+ <span class="ruby-ivar">@panel</span> = <span class="ruby-identifier">panel</span>
16
+ <span class="ruby-ivar">@name</span> = <span class="ruby-value str">'ruler'</span>
17
+ <span class="ruby-ivar">@colour</span> = <span class="ruby-identifier">colour</span>
18
+ <span class="ruby-keyword kw">end</span></pre>
19
+ </body>
20
+ </html>
@@ -0,0 +1,28 @@
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>
7
+ <head>
8
+ <title>calculate_tick_distance (Bio::Graphics::Panel::Ruler)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/bio/graphics/ruler.rb, line 35</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">calculate_tick_distance</span>
15
+ <span class="ruby-identifier">min_tick_distance_requirement_met</span> = <span class="ruby-keyword kw">false</span>
16
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">minor_tick_distance</span> = <span class="ruby-value">1</span> <span class="ruby-comment cmt"># in basepairs. Start with at least 10 bp distance
17
+ <span class="ruby-keyword kw">while</span> <span class="ruby-operator">!</span> <span class="ruby-identifier">min_tick_distance_requirement_met</span>
18
+ <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">minor_tick_distance</span><span class="ruby-operator">/</span><span class="ruby-identifier">panel</span>.<span class="ruby-identifier">rescale_factor</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-constant">RULER_MIN_DISTANCE_TICKS_PIXEL</span>
19
+ <span class="ruby-identifier">min_tick_distance_requirement_met</span> = <span class="ruby-keyword kw">true</span>
20
+ <span class="ruby-keyword kw">else</span>
21
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">minor_tick_distance</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">minor_tick_distance</span><span class="ruby-operator">*</span><span class="ruby-value">5</span>
22
+ <span class="ruby-keyword kw">end</span>
23
+ <span class="ruby-keyword kw">end</span>
24
+
25
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">major_tick_distance</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">minor_tick_distance</span> <span class="ruby-operator">*</span> <span class="ruby-value">10</span>
26
+ <span class="ruby-keyword kw">end</span></pre>
27
+ </body>
28
+ </html>
@@ -0,0 +1,54 @@
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>
7
+ <head>
8
+ <title>draw (Bio::Graphics::Panel::Ruler)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/bio/graphics/ruler.rb, line 49</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw</span>(<span class="ruby-identifier">panel_drawing</span>, <span class="ruby-identifier">vertical_offset</span>)
15
+ <span class="ruby-identifier">ruler_drawing</span> = <span class="ruby-constant">Cairo</span><span class="ruby-operator">::</span><span class="ruby-constant">Context</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">panel_drawing</span>)
16
+
17
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">calculate_tick_distance</span>
18
+
19
+ <span class="ruby-comment cmt"># Draw line
20
+ <span class="ruby-identifier">ruler_drawing</span>.<span class="ruby-identifier">move_to</span>(<span class="ruby-value">0</span>,<span class="ruby-value">10</span>)
21
+ <span class="ruby-identifier">ruler_drawing</span>.<span class="ruby-identifier">line_to</span>(<span class="ruby-identifier">panel</span>.<span class="ruby-identifier">width</span>, <span class="ruby-value">10</span>)
22
+ <span class="ruby-identifier">ruler_drawing</span>.<span class="ruby-identifier">stroke</span>
23
+
24
+ <span class="ruby-comment cmt"># Draw ticks
25
+ <span class="ruby-comment cmt"># * Find position of first tick.
26
+ <span class="ruby-identifier">first_tick_position</span> = <span class="ruby-identifier">panel</span>.<span class="ruby-identifier">display_start</span>
27
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">first_tick_position</span>.<span class="ruby-identifier">modulo</span>(<span class="ruby-identifier">minor_tick_distance</span>) <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
28
+ <span class="ruby-identifier">first_tick_position</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
29
+ <span class="ruby-keyword kw">end</span>
30
+
31
+ <span class="ruby-comment cmt"># * And start drawing the rest.
32
+ <span class="ruby-identifier">first_tick_position</span>.<span class="ruby-identifier">step</span>(<span class="ruby-identifier">panel</span>.<span class="ruby-identifier">display_stop</span>, <span class="ruby-identifier">minor_tick_distance</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">tick</span><span class="ruby-operator">|</span>
33
+ <span class="ruby-identifier">tick_pixel_position</span> = (<span class="ruby-identifier">tick</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">panel</span>.<span class="ruby-identifier">display_start</span>) <span class="ruby-operator">/</span> <span class="ruby-identifier">panel</span>.<span class="ruby-identifier">rescale_factor</span>
34
+ <span class="ruby-identifier">ruler_drawing</span>.<span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">tick_pixel_position</span>.<span class="ruby-identifier">floor</span>, <span class="ruby-value">5</span>)
35
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tick</span>.<span class="ruby-identifier">modulo</span>(<span class="ruby-identifier">major_tick_distance</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
36
+ <span class="ruby-identifier">ruler_drawing</span>.<span class="ruby-identifier">rel_line_to</span>(<span class="ruby-value">0</span>, <span class="ruby-value">15</span>)
37
+
38
+ <span class="ruby-comment cmt"># Draw tick number
39
+ <span class="ruby-identifier">ruler_drawing</span>.<span class="ruby-identifier">select_font_face</span>(<span class="ruby-value str">'Georgia'</span>, <span class="ruby-value">1</span>, <span class="ruby-value">1</span>)
40
+ <span class="ruby-identifier">ruler_drawing</span>.<span class="ruby-identifier">set_font_size</span>(<span class="ruby-constant">RULER_TEXT_HEIGHT</span>)
41
+ <span class="ruby-identifier">ruler_drawing</span>.<span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">tick_pixel_position</span>.<span class="ruby-identifier">floor</span>, <span class="ruby-value">20</span> <span class="ruby-operator">+</span> <span class="ruby-constant">RULER_TEXT_HEIGHT</span>)
42
+ <span class="ruby-identifier">ruler_drawing</span>.<span class="ruby-identifier">show_text</span>(<span class="ruby-identifier">tick</span>.<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">to_s</span>)
43
+ <span class="ruby-keyword kw">else</span>
44
+ <span class="ruby-identifier">ruler_drawing</span>.<span class="ruby-identifier">rel_line_to</span>(<span class="ruby-value">0</span>, <span class="ruby-value">5</span>)
45
+
46
+ <span class="ruby-keyword kw">end</span>
47
+ <span class="ruby-identifier">ruler_drawing</span>.<span class="ruby-identifier">stroke</span>
48
+ <span class="ruby-keyword kw">end</span>
49
+
50
+
51
+ <span class="ruby-ivar">@height</span> = <span class="ruby-value">25</span> <span class="ruby-operator">+</span> <span class="ruby-constant">RULER_TEXT_HEIGHT</span>
52
+ <span class="ruby-keyword kw">end</span></pre>
53
+ </body>
54
+ </html>