bio-svgenes 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. data/README.md +88 -0
  2. data/VERSION +1 -1
  3. data/bio-svgenes.gemspec +131 -8
  4. data/doc/classes/Bio.html +131 -0
  5. data/doc/classes/Bio/Graphics.html +142 -0
  6. data/doc/classes/Bio/Graphics/Glyph.html +987 -0
  7. data/doc/classes/Bio/Graphics/Glyph.src/M000001.html +26 -0
  8. data/doc/classes/Bio/Graphics/Glyph.src/M000002.html +27 -0
  9. data/doc/classes/Bio/Graphics/Glyph.src/M000003.html +32 -0
  10. data/doc/classes/Bio/Graphics/Glyph.src/M000004.html +27 -0
  11. data/doc/classes/Bio/Graphics/Glyph.src/M000005.html +25 -0
  12. data/doc/classes/Bio/Graphics/Glyph.src/M000006.html +29 -0
  13. data/doc/classes/Bio/Graphics/Glyph.src/M000007.html +107 -0
  14. data/doc/classes/Bio/Graphics/Glyph.src/M000008.html +51 -0
  15. data/doc/classes/Bio/Graphics/Glyph.src/M000009.html +23 -0
  16. data/doc/classes/Bio/Graphics/Glyph.src/M000010.html +18 -0
  17. data/doc/classes/Bio/Graphics/Glyph.src/M000011.html +75 -0
  18. data/doc/classes/Bio/Graphics/Glyph.src/M000012.html +51 -0
  19. data/doc/classes/Bio/Graphics/Glyph.src/M000013.html +23 -0
  20. data/doc/classes/Bio/Graphics/Glyph.src/M000014.html +26 -0
  21. data/doc/classes/Bio/Graphics/Glyph.src/M000015.html +27 -0
  22. data/doc/classes/Bio/Graphics/Glyph.src/M000016.html +32 -0
  23. data/doc/classes/Bio/Graphics/Glyph.src/M000017.html +27 -0
  24. data/doc/classes/Bio/Graphics/Glyph.src/M000018.html +25 -0
  25. data/doc/classes/Bio/Graphics/Glyph.src/M000019.html +29 -0
  26. data/doc/classes/Bio/Graphics/Glyph.src/M000020.html +107 -0
  27. data/doc/classes/Bio/Graphics/Glyph.src/M000021.html +51 -0
  28. data/doc/classes/Bio/Graphics/Glyph.src/M000022.html +23 -0
  29. data/doc/classes/Bio/Graphics/Glyph.src/M000023.html +18 -0
  30. data/doc/classes/Bio/Graphics/Glyph.src/M000024.html +75 -0
  31. data/doc/classes/Bio/Graphics/MiniFeature.html +243 -0
  32. data/doc/classes/Bio/Graphics/MiniFeature.src/M000001.html +25 -0
  33. data/doc/classes/Bio/Graphics/MiniFeature.src/M000003.html +25 -0
  34. data/doc/classes/Bio/Graphics/MiniFeature.src/M000024.html +25 -0
  35. data/doc/classes/Bio/Graphics/Page.html +705 -0
  36. data/doc/classes/Bio/Graphics/Page.src/M000010.html +35 -0
  37. data/doc/classes/Bio/Graphics/Page.src/M000011.html +83 -0
  38. data/doc/classes/Bio/Graphics/Page.src/M000012.html +24 -0
  39. data/doc/classes/Bio/Graphics/Page.src/M000013.html +29 -0
  40. data/doc/classes/Bio/Graphics/Page.src/M000014.html +24 -0
  41. data/doc/classes/Bio/Graphics/Page.src/M000015.html +20 -0
  42. data/doc/classes/Bio/Graphics/Page.src/M000016.html +20 -0
  43. data/doc/classes/Bio/Graphics/Page.src/M000017.html +18 -0
  44. data/doc/classes/Bio/Graphics/Page.src/M000018.html +18 -0
  45. data/doc/classes/Bio/Graphics/Page.src/M000019.html +18 -0
  46. data/doc/classes/Bio/Graphics/Page.src/M000020.html +18 -0
  47. data/doc/classes/Bio/Graphics/Page.src/M000021.html +18 -0
  48. data/doc/classes/Bio/Graphics/Page.src/M000022.html +18 -0
  49. data/doc/classes/Bio/Graphics/Page.src/M000023.html +18 -0
  50. data/doc/classes/Bio/Graphics/Page.src/M000024.html +18 -0
  51. data/doc/classes/Bio/Graphics/Page.src/M000025.html +35 -0
  52. data/doc/classes/Bio/Graphics/Page.src/M000026.html +83 -0
  53. data/doc/classes/Bio/Graphics/Page.src/M000027.html +24 -0
  54. data/doc/classes/Bio/Graphics/Page.src/M000028.html +29 -0
  55. data/doc/classes/Bio/Graphics/Page.src/M000029.html +24 -0
  56. data/doc/classes/Bio/Graphics/Page.src/M000030.html +20 -0
  57. data/doc/classes/Bio/Graphics/Page.src/M000031.html +20 -0
  58. data/doc/classes/Bio/Graphics/Page.src/M000032.html +18 -0
  59. data/doc/classes/Bio/Graphics/Page.src/M000033.html +18 -0
  60. data/doc/classes/Bio/Graphics/Page.src/M000034.html +18 -0
  61. data/doc/classes/Bio/Graphics/Page.src/M000035.html +18 -0
  62. data/doc/classes/Bio/Graphics/Page.src/M000036.html +18 -0
  63. data/doc/classes/Bio/Graphics/Page.src/M000037.html +18 -0
  64. data/doc/classes/Bio/Graphics/Page.src/M000038.html +18 -0
  65. data/doc/classes/Bio/Graphics/Page.src/M000039.html +18 -0
  66. data/doc/classes/Bio/Graphics/Page.src/M000040.html +107 -0
  67. data/doc/classes/Bio/Graphics/Page.src/M000041.html +18 -0
  68. data/doc/classes/Bio/Graphics/Page.src/M000042.html +23 -0
  69. data/doc/classes/Bio/Graphics/Page.src/M000043.html +18 -0
  70. data/doc/classes/Bio/Graphics/Page.src/M000044.html +18 -0
  71. data/doc/classes/Bio/Graphics/Primitive.html +204 -0
  72. data/doc/classes/Bio/Graphics/Primitive.src/M000001.html +21 -0
  73. data/doc/classes/Bio/Graphics/Primitive.src/M000002.html +20 -0
  74. data/doc/classes/Bio/Graphics/Primitive.src/M000008.html +21 -0
  75. data/doc/classes/Bio/Graphics/Primitive.src/M000009.html +20 -0
  76. data/doc/classes/Bio/Graphics/Primitive.src/M000022.html +21 -0
  77. data/doc/classes/Bio/Graphics/Primitive.src/M000023.html +20 -0
  78. data/doc/classes/Bio/Graphics/SVGEE.html +290 -0
  79. data/doc/classes/Bio/Graphics/SVGEE.src/M000002.html +24 -0
  80. data/doc/classes/Bio/Graphics/SVGEE.src/M000003.html +18 -0
  81. data/doc/classes/Bio/Graphics/SVGEE.src/M000004.html +24 -0
  82. data/doc/classes/Bio/Graphics/SVGEE.src/M000005.html +18 -0
  83. data/doc/classes/Bio/Graphics/SVGEE.src/M000006.html +18 -0
  84. data/doc/classes/Bio/Graphics/SVGEE.src/M000007.html +21 -0
  85. data/doc/classes/Bio/Graphics/SVGEE.src/M000008.html +27 -0
  86. data/doc/classes/Bio/Graphics/SVGEE.src/M000009.html +23 -0
  87. data/doc/classes/Bio/Graphics/SVGEE.src/M000016.html +24 -0
  88. data/doc/classes/Bio/Graphics/SVGEE.src/M000017.html +18 -0
  89. data/doc/classes/Bio/Graphics/SVGEE.src/M000018.html +18 -0
  90. data/doc/classes/Bio/Graphics/SVGEE.src/M000019.html +21 -0
  91. data/doc/classes/Bio/Graphics/SVGEE.src/M000020.html +27 -0
  92. data/doc/classes/Bio/Graphics/SVGEE.src/M000021.html +23 -0
  93. data/doc/classes/Bio/Graphics/Track.html +473 -0
  94. data/doc/classes/Bio/Graphics/Track.src/M000001.html +35 -0
  95. data/doc/classes/Bio/Graphics/Track.src/M000002.html +18 -0
  96. data/doc/classes/Bio/Graphics/Track.src/M000003.html +28 -0
  97. data/doc/classes/Bio/Graphics/Track.src/M000004.html +18 -0
  98. data/doc/classes/Bio/Graphics/Track.src/M000010.html +35 -0
  99. data/doc/classes/Bio/Graphics/Track.src/M000011.html +18 -0
  100. data/doc/classes/Bio/Graphics/Track.src/M000012.html +28 -0
  101. data/doc/classes/Bio/Graphics/Track.src/M000013.html +18 -0
  102. data/doc/created.rid +1 -9
  103. data/doc/files/lib/bio-svgenes_rb.html +131 -0
  104. data/doc/files/lib/bio/graphics/glyph_rb.html +101 -0
  105. data/doc/files/lib/bio/graphics/mini_feature_rb.html +101 -0
  106. data/doc/files/lib/bio/graphics/page_rb.html +111 -0
  107. data/doc/files/lib/bio/graphics/primitive_rb.html +101 -0
  108. data/doc/files/lib/bio/graphics/svgee_rb.html +101 -0
  109. data/doc/files/lib/bio/graphics/track_rb.html +101 -0
  110. data/doc/fr_class_index.html +34 -0
  111. data/doc/fr_file_index.html +33 -0
  112. data/doc/fr_method_index.html +70 -0
  113. data/doc/index.html +21 -91
  114. data/doc/manual/bootstrap/css/bootstrap-responsive.css +1109 -0
  115. data/doc/manual/bootstrap/css/bootstrap-responsive.min.css +9 -0
  116. data/doc/manual/bootstrap/css/bootstrap.css +6158 -0
  117. data/doc/manual/bootstrap/css/bootstrap.min.css +9 -0
  118. data/doc/manual/bootstrap/img/glyphicons-halflings-white.png +0 -0
  119. data/doc/manual/bootstrap/img/glyphicons-halflings.png +0 -0
  120. data/doc/manual/bootstrap/js/bootstrap.js +2276 -0
  121. data/doc/manual/bootstrap/js/bootstrap.min.js +6 -0
  122. data/doc/manual/img/circle.png +0 -0
  123. data/doc/manual/img/directed.png +0 -0
  124. data/doc/manual/img/down_triangle.png +0 -0
  125. data/doc/manual/img/histogram.png +0 -0
  126. data/doc/manual/img/span.png +0 -0
  127. data/doc/manual/img/transcript.png +0 -0
  128. data/doc/manual/img/up_triangle.png +0 -0
  129. data/doc/manual/manual.html +360 -0
  130. data/doc/manual/manual.md +307 -0
  131. data/doc/rdoc-style.css +208 -0
  132. data/examples/example.rb +12 -8
  133. data/examples/{make_example.rb → example2.rb} +5 -16
  134. data/lib/bio/graphics/glyph.rb +293 -126
  135. data/lib/bio/graphics/mini_feature.rb +24 -17
  136. data/lib/bio/graphics/page.rb +112 -54
  137. data/lib/bio/graphics/primitive.rb +12 -9
  138. data/lib/bio/graphics/svgee.rb +9 -11
  139. data/lib/bio/graphics/track.rb +92 -10
  140. metadata +132 -9
  141. data/README.rdoc +0 -19
  142. data/examples/annotate_snps.rb +0 -86
  143. data/examples/eg2.rb +0 -40
  144. data/examples/get_coverage_in_windows.rb +0 -176
@@ -0,0 +1,208 @@
1
+
2
+ body {
3
+ font-family: Verdana,Arial,Helvetica,sans-serif;
4
+ font-size: 90%;
5
+ margin: 0;
6
+ margin-left: 40px;
7
+ padding: 0;
8
+ background: white;
9
+ }
10
+
11
+ h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
12
+ h1 { font-size: 150%; }
13
+ h2,h3,h4 { margin-top: 1em; }
14
+
15
+ a { background: #eef; color: #039; text-decoration: none; }
16
+ a:hover { background: #039; color: #eef; }
17
+
18
+ /* Override the base stylesheet's Anchor inside a table cell */
19
+ td > a {
20
+ background: transparent;
21
+ color: #039;
22
+ text-decoration: none;
23
+ }
24
+
25
+ /* and inside a section title */
26
+ .section-title > a {
27
+ background: transparent;
28
+ color: #eee;
29
+ text-decoration: none;
30
+ }
31
+
32
+ /* === Structural elements =================================== */
33
+
34
+ div#index {
35
+ margin: 0;
36
+ margin-left: -40px;
37
+ padding: 0;
38
+ font-size: 90%;
39
+ }
40
+
41
+
42
+ div#index a {
43
+ margin-left: 0.7em;
44
+ }
45
+
46
+ div#index .section-bar {
47
+ margin-left: 0px;
48
+ padding-left: 0.7em;
49
+ background: #ccc;
50
+ font-size: small;
51
+ }
52
+
53
+
54
+ div#classHeader, div#fileHeader {
55
+ width: auto;
56
+ color: white;
57
+ padding: 0.5em 1.5em 0.5em 1.5em;
58
+ margin: 0;
59
+ margin-left: -40px;
60
+ border-bottom: 3px solid #006;
61
+ }
62
+
63
+ div#classHeader a, div#fileHeader a {
64
+ background: inherit;
65
+ color: white;
66
+ }
67
+
68
+ div#classHeader td, div#fileHeader td {
69
+ background: inherit;
70
+ color: white;
71
+ }
72
+
73
+
74
+ div#fileHeader {
75
+ background: #057;
76
+ }
77
+
78
+ div#classHeader {
79
+ background: #048;
80
+ }
81
+
82
+
83
+ .class-name-in-header {
84
+ font-size: 180%;
85
+ font-weight: bold;
86
+ }
87
+
88
+
89
+ div#bodyContent {
90
+ padding: 0 1.5em 0 1.5em;
91
+ }
92
+
93
+ div#description {
94
+ padding: 0.5em 1.5em;
95
+ background: #efefef;
96
+ border: 1px dotted #999;
97
+ }
98
+
99
+ div#description h1,h2,h3,h4,h5,h6 {
100
+ color: #125;;
101
+ background: transparent;
102
+ }
103
+
104
+ div#validator-badges {
105
+ text-align: center;
106
+ }
107
+ div#validator-badges img { border: 0; }
108
+
109
+ div#copyright {
110
+ color: #333;
111
+ background: #efefef;
112
+ font: 0.75em sans-serif;
113
+ margin-top: 5em;
114
+ margin-bottom: 0;
115
+ padding: 0.5em 2em;
116
+ }
117
+
118
+
119
+ /* === Classes =================================== */
120
+
121
+ table.header-table {
122
+ color: white;
123
+ font-size: small;
124
+ }
125
+
126
+ .type-note {
127
+ font-size: small;
128
+ color: #DEDEDE;
129
+ }
130
+
131
+ .xxsection-bar {
132
+ background: #eee;
133
+ color: #333;
134
+ padding: 3px;
135
+ }
136
+
137
+ .section-bar {
138
+ color: #333;
139
+ border-bottom: 1px solid #999;
140
+ margin-left: -20px;
141
+ }
142
+
143
+
144
+ .section-title {
145
+ background: #79a;
146
+ color: #eee;
147
+ padding: 3px;
148
+ margin-top: 2em;
149
+ margin-left: -30px;
150
+ border: 1px solid #999;
151
+ }
152
+
153
+ .top-aligned-row { vertical-align: top }
154
+ .bottom-aligned-row { vertical-align: bottom }
155
+
156
+ /* --- Context section classes ----------------------- */
157
+
158
+ .context-row { }
159
+ .context-item-name { font-family: monospace; font-weight: bold; color: black; }
160
+ .context-item-value { font-size: small; color: #448; }
161
+ .context-item-desc { color: #333; padding-left: 2em; }
162
+
163
+ /* --- Method classes -------------------------- */
164
+ .method-detail {
165
+ background: #efefef;
166
+ padding: 0;
167
+ margin-top: 0.5em;
168
+ margin-bottom: 1em;
169
+ border: 1px dotted #ccc;
170
+ }
171
+ .method-heading {
172
+ color: black;
173
+ background: #ccc;
174
+ border-bottom: 1px solid #666;
175
+ padding: 0.2em 0.5em 0 0.5em;
176
+ }
177
+ .method-signature { color: black; background: inherit; }
178
+ .method-name { font-weight: bold; }
179
+ .method-args { font-style: italic; }
180
+ .method-description { padding: 0 0.5em 0 0.5em; }
181
+
182
+ /* --- Source code sections -------------------- */
183
+
184
+ a.source-toggle { font-size: 90%; }
185
+ div.method-source-code {
186
+ background: #262626;
187
+ color: #ffdead;
188
+ margin: 1em;
189
+ padding: 0.5em;
190
+ border: 1px dashed #999;
191
+ overflow: hidden;
192
+ }
193
+
194
+ div.method-source-code pre { color: #ffdead; overflow: hidden; }
195
+
196
+ /* --- Ruby keyword styles --------------------- */
197
+
198
+ .standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
199
+
200
+ .ruby-constant { color: #7fffd4; background: transparent; }
201
+ .ruby-keyword { color: #00ffff; background: transparent; }
202
+ .ruby-ivar { color: #eedd82; background: transparent; }
203
+ .ruby-operator { color: #00ffee; background: transparent; }
204
+ .ruby-identifier { color: #ffdead; background: transparent; }
205
+ .ruby-node { color: #ffa07a; background: transparent; }
206
+ .ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
207
+ .ruby-regexp { color: #ffa07a; background: transparent; }
208
+ .ruby-value { color: #7fffd4; background: transparent; }
@@ -1,24 +1,28 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # untitled
3
+ # example.rb
4
4
  #
5
5
  # Created by Dan MacLean (TSL) on 2012-09-28.
6
6
  # Copyright (c) . All rights reserved.
7
7
  ###################################################
8
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
9
- $LOAD_PATH.unshift(File.dirname(__FILE__))
8
+
9
+ ##A very straightforward example that creates all the features and tracks explicitly.
10
+
10
11
 
11
12
  require 'bio-svgenes'
12
13
 
14
+ ##create the page
13
15
  p = Bio::Graphics::Page.new(:width => 800,
14
16
  :height => 200,
15
- :number_of_intervals => 10)
16
-
17
+ :number_of_intervals => 10
18
+ )
17
19
 
20
+ ##add a generic glyph track
18
21
  generic_track = p.add_track(:glyph => :generic,
19
22
  :name => 'generic_features',
20
23
  :label => true )
21
-
24
+
25
+ ##and some features
22
26
  feature1 = Bio::Graphics::MiniFeature.new(:start => 923, :end => 2212, :strand => '+', :id => "MyFeature")
23
27
  generic_track.add(feature1)
24
28
  feature2 = Bio::Graphics::MiniFeature.new(:start => 467, :end => 1234)
@@ -33,7 +37,7 @@ feature2 = Bio::Graphics::MiniFeature.new(:start => 12000, :end => 12030)
33
37
  generic_track.add(feature2)
34
38
 
35
39
 
36
-
40
+ ##another generic track
37
41
  generic_track = p.add_track(:glyph => :generic, :name => 'more_generic_features', :label => true, :fill_color => 'green' )
38
42
 
39
43
  feature1 = Bio::Graphics::MiniFeature.new(:start => 923, :end => 2212)
@@ -43,7 +47,7 @@ generic_track.add(feature1)
43
47
  feature1 = Bio::Graphics::MiniFeature.new(:start => 467, :end => 15000)
44
48
  generic_track.add(feature1)
45
49
 
46
-
50
+ ##another generic
47
51
  generic_track = p.add_track(:glyph => :generic,
48
52
  :name => 'yet_more_generic_features',
49
53
  :label => true,
@@ -1,18 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
- #
3
- # untitled
4
- #
5
- # Created by Dan MacLean (TSL) on 2013-01-18.
6
- # Copyright (c) . All rights reserved.
7
- ###################################################
2
+ #an example that loads data and renders different features from a gff
3
+ #will select any features in ['gene', 'mRNA','cDNA_match', 'microarray_probe', 'insertion','deletion','substitution','transposable_element_insertion_site'] and
4
+ #render these
8
5
 
9
- ##to do:
10
- ## background colour
11
- ## single nt features : minimum size on circles, squares, triangles, diamonds, span (t bar)
12
- ## label sizes
13
- ## label positions
14
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15
- $LOAD_PATH.unshift(File.dirname(__FILE__))
16
6
  require 'bio-svgenes'
17
7
 
18
8
 
@@ -129,10 +119,9 @@ end
129
119
 
130
120
 
131
121
  all_features = Bio::Graphics::Page.parse_gff( ARGV[0] )
132
- puts all_features.length
133
- #all_features.collect {|f| f.feature }.uniq.each do | feature_type |
122
+
134
123
  ['gene', 'mRNA','cDNA_match', 'microarray_probe', 'insertion','deletion','substitution','transposable_element_insertion_site'].each do |feature_type|
135
- #['gene', 'mRNA','cDNA_match', 'microarray_probe','transposable_element_insertion_site'].each do |feature_type|
124
+
136
125
  puts "rendering #{feature_type}"
137
126
  case feature_type
138
127
  when 'gene'
@@ -1,40 +1,62 @@
1
1
  module Bio
2
2
  class Graphics
3
- #A Glyph is an array of Primitive objects, holding information about the type of Glyph being created.
4
- #Each different type of Glyph has different arguments, pertaining to how the Glyph will be drawn and the parameters provided to SVGEE.
5
- #
6
3
 
4
+ #A glyph is a particular shape that represents a genomic feature. Bio::Graphics::Glyph objects represent glyphs. Bio::Graphics::Glyphs are created internally according to
5
+ #specification from the Bio::Graphics::Track and not instantiated directly by the user.
6
+ #Internally, these are constructed as an array of Bio::Graphics::Primitive objects, which are collections of simple shapes, combined appropriately to make a glyph
7
7
  class Glyph
8
8
 
9
9
  #The different type of Glyphs are:
10
- #* generic
11
- #* circle
12
- #* directed
13
- #* \down_triangle
14
- #* \up_triangle
15
- #* span
16
- #* transcript
17
- #* scale
18
- #* label
19
- #* histogram
10
+ #* :generic
11
+ #* :circle
12
+ #* :directed
13
+ #* :down_triangle
14
+ #* :up_triangle
15
+ #* :span
16
+ #* :transcript
17
+ #* :scale
18
+ #* :label
19
+ #* :histogram
20
20
 
21
21
  attr_reader :glyphs
22
- #holds a load of definitions for glyphs .. a glyph is an array of primitives...
22
+ #only glyphs defined here will be allowed
23
23
  @glyphs = [:generic, :directed, :transcript, :scale, :label, :histogram, :circle, :down_triangle, :up_triangle, :span]
24
- #Creates a generic glyph, which is a rectangle
24
+
25
+ #A generic glyph is a block of colour that displays no specific directional information attached.
25
26
  #
26
- #+args+
27
- #* height = the height of the Glyph (10)
28
- #* fill_color = the fill colour of the Glyph ('red')
29
- #* stroke = the outline colour of the Glyph ("black")
30
- #* stroke_width = The width of the outline stroke (1)
31
- #* x_round = x-axis radius of the ellipse used to round off the corners of the rectangle (1)
32
- #* y_round = y-axis radius of the ellipse used to round off the corners of the rectangle (1)
33
- #* style = the opacity of the fill color ("fill-opacity:0.4;")
34
- #* x = the co-ordinates of the Glyph for the x-axis
35
- #* y = the co-ordinates of the Glyph for the y-axis
36
-
37
- def self.generic(args) #:x, :y, :width :fill, :stroke :stroke_width, :style, :height,
27
+ #== args
28
+ #* :height = the height of the Glyph (default = 10)
29
+ #* :fill_color = the fill colour of the Glyph (default = 'red'), can be any SVG colour eg rgb(256,0,0) or #FF0000, or one of the built in gradient types Bio::Graphics::Glyph#gradients
30
+ # [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]
31
+ #or a custom definition of a gradient
32
+ # {:type => :radial,
33
+ # :id => :custom,
34
+ # :cx => 5,
35
+ # :cy => 5,
36
+ # :r => 50,
37
+ # :fx => 50,
38
+ # :fy => 50,
39
+ # :stops => [ {
40
+ # :offset => 0,
41
+ # :color => 'rgb(255,255,255)',
42
+ # :opacity => 0
43
+ # }, {
44
+ # :offset => 100,
45
+ # :color => 'rgb(0,127,200)',
46
+ # :opacity => 1
47
+ # }, ]
48
+ # } #* :stroke = the outline colour of the Glyph (default = "black"), can be any SVG colour eg rgb(256,0,0) or #FF0000
49
+ #* :stroke_width = The width of the outline stroke (default = 1), can be any SVG colour eg rgb(256,0,0) or #FF0000
50
+ #* :x_round = x-axis radius of the ellipse used to round off the corners of the rectangle (default = 1)
51
+ #* :y_round = y-axis radius of the ellipse used to round off the corners of the rectangle (default = 1)
52
+ #* :style = an arbitrary SVG compliant style string eg "fill-opacity:0.4;"
53
+ #* :x = x coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
54
+ #* :y = y coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
55
+ #
56
+ #=== returns
57
+ #
58
+ #* An Array[http://www.ruby-doc.org/core-2.0/Array.html] of Bio::Graphic::Primitive objects
59
+ def self.generic(args)
38
60
  args = {
39
61
  :height => 10,
40
62
  :fill_color => 'red',
@@ -46,17 +68,38 @@ attr_reader :glyphs
46
68
  [Bio::Graphics::Primitive.new(:rectangle, args)]
47
69
  end
48
70
 
49
- #Creates a circular Glyph
71
+ #A circular glyph centered on the start of the feature it represents
50
72
  #
51
- #+args+
52
- #* radius = the radius of the circle (10)
53
- #* fill_color = the fill colour of the Glyph ('red')
54
- #* stroke = the outline colour of the Glyph ("black")
55
- #* stroke_width = The width of the outline stroke (1)
56
- #* style = the opacity of the fill color
57
- #* x = x-axis centre of the circle
58
- #* y = y-axis centre of the circle
59
-
73
+ #== args
74
+ #* :radius = the radius of the circle (default = 10)
75
+ #* :fill_color = the fill colour of the Glyph (default = 'red'), can be any SVG colour eg rgb(256,0,0) or #FF0000, or one of the built in gradient types Bio::Graphics::Glyph#gradients
76
+ # [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]
77
+ #or a custom definition of a gradient
78
+ # {:type => :radial,
79
+ # :id => :custom,
80
+ # :cx => 5,
81
+ # :cy => 5,
82
+ # :r => 50,
83
+ # :fx => 50,
84
+ # :fy => 50,
85
+ # :stops => [ {
86
+ # :offset => 0,
87
+ # :color => 'rgb(255,255,255)',
88
+ # :opacity => 0
89
+ # }, {
90
+ # :offset => 100,
91
+ # :color => 'rgb(0,127,200)',
92
+ # :opacity => 1
93
+ # }, ]
94
+ # } #* :stroke = the outline colour of the Glyph (default = "black"), can be any SVG colour eg rgb(256,0,0) or #FF0000
95
+ #* :stroke_width = The width of the outline stroke (default = 1), can be any SVG colour eg rgb(256,0,0) or #FF0000
96
+ #* :style = an arbitrary SVG compliant style string eg "fill-opacity:0.4;"
97
+ #* :x = base x coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
98
+ #* :y = base y coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
99
+ #
100
+ #=== returns
101
+ #
102
+ #* An Array[http://www.ruby-doc.org/core-2.0/Array.html] of Bio::Graphic::Primitive objects
60
103
  def self.circle(args)
61
104
  args = {
62
105
  :radius => 10,
@@ -70,18 +113,41 @@ attr_reader :glyphs
70
113
  [Bio::Graphics::Primitive.new(:circle, args)]
71
114
  end
72
115
 
73
- #Creates a polygon Glyph to indicate the direction in which the Glyph is pointing
74
- #+args+
75
- #* width = the width of the feature
76
- #* fill_color = the fill colour of the Glyph ('red')
77
- #* stroke = the outline colour of the Glyph ("black")
78
- #* stroke_width = The width of the outline stroke (1)
79
- #* style = the opacity of the fill color
80
- #* strand = the strand on which the Glyph is located. May be '+' or '-'
81
- #* points = the x and y axis points used to calculate the shape of the polygon
82
- #* x = the co-ordinates of the Glyph for the x-axis
83
- #* y = the co-ordinates of the Glyph for the y-axis
84
- #The points of the polygon are calculated form the +x+ and +y+ co-ordinates
116
+ #A polygon glyph with a point on the end that represents the features strand and direction
117
+ #== args
118
+ #* :width = the width of the feature in px
119
+ #* :fill_color = the fill colour of the Glyph (default = 'red'), can be any SVG colour eg rgb(256,0,0) or #FF0000, or one of the built in gradient types Bio::Graphics::Glyph#gradients
120
+ # [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]
121
+ #or a custom definition of a gradient
122
+ # {:type => :radial,
123
+ # :id => :custom,
124
+ # :cx => 5,
125
+ # :cy => 5,
126
+ # :r => 50,
127
+ # :fx => 50,
128
+ # :fy => 50,
129
+ # :stops => [ {
130
+ # :offset => 0,
131
+ # :color => 'rgb(255,255,255)',
132
+ # :opacity => 0
133
+ # }, {
134
+ # :offset => 100,
135
+ # :color => 'rgb(0,127,200)',
136
+ # :opacity => 1
137
+ # }, ]
138
+ # }
139
+ #* :stroke = the outline colour of the Glyph (default = "black"), can be any SVG colour eg rgb(256,0,0) or #FF0000
140
+ #* :stroke_width = The width of the outline stroke (default = 1), can be any SVG colour eg rgb(256,0,0) or #FF0000
141
+ #* :style = an arbitrary SVG compliant style string eg "fill-opacity:0.4;"
142
+ #* :strand = the strand on which the feature is located. May be '+' or '-'
143
+ #* :points = the x and y axis coordinates that make up the corners of the polygon, calculated and added by the Bio::Graphics::Page object
144
+ #* :x = base x coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
145
+ #* :y = base y coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
146
+ #The points of the polygon are calculated form the +:x+ and +:y+ co-ordinates
147
+ #
148
+ #=== returns
149
+ #
150
+ #* An Array[http://www.ruby-doc.org/core-2.0/Array.html] of Bio::Graphic::Primitive objects
85
151
  def self.directed(args) #:x, :y, :width :fill, :stroke :stroke_width, :style, :height
86
152
  args = {
87
153
 
@@ -99,17 +165,38 @@ attr_reader :glyphs
99
165
  end
100
166
  [Bio::Graphics::Primitive.new(:polygon, args)]
101
167
  end
102
- #Creates a polygon Glyph for a downward-pointing triangle
103
- #+args+
104
- #* height = the height of the Glyph (10)
105
- #* fill_color = the fill colour of the Glyph ('red')
106
- #* stroke = the outline colour of the Glyph ("black")
107
- #* stroke_width = The width of the outline stroke (1)
108
- #* style = the opacity of the fill color ("fill-opacity:0.4;")
109
- #* x = the co-ordinates of the Glyph for the x-axis
110
- #* y = the co-ordinates of the Glyph for the y-axis
111
- #The points of the triangle are calculated form the +x+ and +y+ co-ordinates
112
-
168
+
169
+ #A downward-pointing triangle glyph
170
+ #== args
171
+ #* :height = the height of the Glyph (default = 10)
172
+ #* :fill_color = the fill colour of the Glyph (default = 'red'), can be any SVG colour eg rgb(256,0,0) or #FF0000, or one of the built in gradient types Bio::Graphics::Glyph#gradients
173
+ # [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]
174
+ #or a custom definition of a gradient
175
+ # {:type => :radial,
176
+ # :id => :custom,
177
+ # :cx => 5,
178
+ # :cy => 5,
179
+ # :r => 50,
180
+ # :fx => 50,
181
+ # :fy => 50,
182
+ # :stops => [ {
183
+ # :offset => 0,
184
+ # :color => 'rgb(255,255,255)',
185
+ # :opacity => 0
186
+ # }, {
187
+ # :offset => 100,
188
+ # :color => 'rgb(0,127,200)',
189
+ # :opacity => 1
190
+ # }, ]
191
+ # } #* :stroke = the outline colour of the Glyph (default = "black"), can be any SVG colour eg rgb(256,0,0) or #FF0000
192
+ #* :stroke_width = The width of the outline stroke (default = 1), can be any SVG colour eg rgb(256,0,0) or #FF0000
193
+ #* :style = an arbitrary SVG compliant style string eg "fill-opacity:0.4;"
194
+ #* :x = x coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
195
+ #* :y = y coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
196
+ #
197
+ #=== returns
198
+ #
199
+ #* An Array[http://www.ruby-doc.org/core-2.0/Array.html] of Bio::Graphic::Primitive objects
113
200
  def self.down_triangle(args) #:x, :y, :width :fill, :stroke :stroke_width, :style, :height
114
201
  args = {
115
202
 
@@ -122,17 +209,39 @@ attr_reader :glyphs
122
209
  args[:points] = "#{args[:x]},#{args[:y]} #{args[:x] + args[:width]},#{args[:y]} #{ args[:x] + (args[:width]/2) },#{(args[:y] + args[:height]) }"
123
210
  [Bio::Graphics::Primitive.new(:polygon, args)]
124
211
  end
125
- #Creates a polygon Glyph for an upward-pointing triangle
126
- #+args+
127
- #* height = the height of the Glyph (10)
128
- #* fill_color = the fill colour of the Glyph ('red')
129
- #* stroke = the outline colour of the Glyph ("black")
130
- #* stroke_width = The width of the outline stroke (1)
131
- #* style = the opacity of the fill color ("fill-opacity:0.4;")
132
- #* x = the co-ordinates of the Glyph for the x-axis
133
- #* y = the co-ordinates of the Glyph for the y-axis
134
- #The points of the triangle are calculated form the +x+ and +y+ co-ordinates
135
-
212
+
213
+ #An upward-pointing triangle glyph
214
+ #== args
215
+ #* :height = the height of the Glyph (default = 10)
216
+ #* :fill_color = the fill colour of the Glyph (default = 'red'), can be any SVG colour eg rgb(256,0,0) or #FF0000, or one of the built in gradient types Bio::Graphics::Glyph#gradients
217
+ # [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]
218
+ #or a custom definition of a gradient
219
+ # {:type => :radial,
220
+ # :id => :custom,
221
+ # :cx => 5,
222
+ # :cy => 5,
223
+ # :r => 50,
224
+ # :fx => 50,
225
+ # :fy => 50,
226
+ # :stops => [ {
227
+ # :offset => 0,
228
+ # :color => 'rgb(255,255,255)',
229
+ # :opacity => 0
230
+ # }, {
231
+ # :offset => 100,
232
+ # :color => 'rgb(0,127,200)',
233
+ # :opacity => 1
234
+ # }, ]
235
+ # }
236
+ #* :stroke = the outline colour of the Glyph (default = "black"), can be any SVG colour eg rgb(256,0,0) or #FF0000
237
+ #* :stroke_width = The width of the outline stroke (default = 1), can be any SVG colour eg rgb(256,0,0) or #FF0000
238
+ #* :style = an arbitrary SVG compliant style string eg "fill-opacity:0.4;"
239
+ #* :x = x coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
240
+ #* :y = y coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
241
+ #
242
+ #=== returns
243
+ #
244
+ #* An Array[http://www.ruby-doc.org/core-2.0/Array.html] of Bio::Graphic::Primitive objects
136
245
  def self.up_triangle(args) #:x, :y, :width :fill, :stroke :stroke_width, :style, :height
137
246
  args = {
138
247
  :height => 10,
@@ -143,16 +252,40 @@ attr_reader :glyphs
143
252
  args[:points] = "#{args[:x]},#{args[:y] + args[:height]} #{args[:x] + args[:width]},#{args[:y] + args[:height]} #{ args[:x] + (args[:width]/2) },#{args[:y] }"
144
253
  [Bio::Graphics::Primitive.new(:polygon, args)]
145
254
  end
146
- #Creates a span glyph, which is a line
255
+
256
+ #A line (span) glyph
147
257
  #
148
258
  #+args+
149
- #* height = the height of the Glyph (10)
150
- #* fill_color = the fill colour of the Glyph ('red')
151
- #* stroke = the outline colour of the Glyph ("black")
152
- #* stroke_width = The width of the outline stroke (1)
153
- #* style = the opacity of the fill color ("fill-opacity:0.4;")
154
- #* x = the co-ordinates of the Glyph for the x-axis
155
- #* y = the co-ordinates of the Glyph for the y-axis
259
+ #* :height = the height of the Glyph (default = 10)
260
+ #* :fill_color = the fill colour of the Glyph (default = 'red'), can be any SVG colour eg rgb(256,0,0) or #FF0000, or one of the built in gradient types Bio::Graphics::Glyph#gradients
261
+ # [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]
262
+ #or a custom definition of a gradient
263
+ # {:type => :radial,
264
+ # :id => :custom,
265
+ # :cx => 5,
266
+ # :cy => 5,
267
+ # :r => 50,
268
+ # :fx => 50,
269
+ # :fy => 50,
270
+ # :stops => [ {
271
+ # :offset => 0,
272
+ # :color => 'rgb(255,255,255)',
273
+ # :opacity => 0
274
+ # }, {
275
+ # :offset => 100,
276
+ # :color => 'rgb(0,127,200)',
277
+ # :opacity => 1
278
+ # }, ]
279
+ # }
280
+ #* :stroke = the outline colour of the Glyph (default = "black"), can be any SVG colour eg rgb(256,0,0) or #FF0000
281
+ #* :stroke_width = The width of the outline stroke (default = 1)
282
+ #* :style = an arbitrary SVG compliant style string eg "fill-opacity:0.4;"
283
+ #* :x = x coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
284
+ #* :y = y coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
285
+ #
286
+ #=== returns
287
+ #
288
+ #* An Array[http://www.ruby-doc.org/core-2.0/Array.html] of Bio::Graphic::Primitive objects
156
289
  def self.span(args)
157
290
  args = {
158
291
  :height => 10,
@@ -167,26 +300,69 @@ attr_reader :glyphs
167
300
  args[:y2] = args[:y]
168
301
  [Bio::Graphics::Primitive.new(:line, args)]
169
302
  end
170
- #Creates a transcript glyph, which is a number of different types of Glyph, depending on the features
171
- #within the transcript
303
+
304
+ #Creates a transcript glyph, which is a composite glyph containing generic glyphs for the exons/utrs and a directed glyph
305
+ #at the end. The glyphs are joined by lines.
172
306
  #
173
- #+args+
174
- #* height = the height of the Glyph (10)
175
- #* utr_fill_color = the fill colour of the Glyph ('black')
176
- #* utr_stroke = the outline colour of the Glyph ("black")
177
- #* utr_stroke_width = The width of the outline stroke (1)
178
- #* exon_fill_color = the fill colour of the Glyph ('red')
179
- #* exon_stroke = the outline colour of the Glyph ("black")
180
- #* exon_stroke_width = The width of the outline stroke (1)
181
- #* line_color = the colour for any line Glyphs
182
- #* line_width = the width for any line Glyphs
183
- #* exon_style = the opacity of the fill color for exons ("fill-opacity:0.4;")
184
- #* utr_style = the opacity of the fill color for utrs
185
- #* line_style = the opacity of the fill color for lines
186
- #* block_gaps = ****I'm not sure what these are****
187
- #* gap_marker = ****I'm not sure what these are****
188
- #* x = the co-ordinates of the Glyph for the x-axis
189
- #* y = the co-ordinates of the Glyph for the y-axis
307
+ #== args
308
+ #* :height = the height of the Glyph (default = 10)
309
+ #* :utr_fill_color = the fill colour of the utr part of the glyph (default = 'black'), can be any SVG colour eg rgb(256,0,0) or #FF0000, or one of the built in gradient types Bio::Graphics::Glyph#gradients
310
+ # [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]
311
+ #or a custom definition of a gradient
312
+ # {:type => :radial,
313
+ # :id => :custom,
314
+ # :cx => 5,
315
+ # :cy => 5,
316
+ # :r => 50,
317
+ # :fx => 50,
318
+ # :fy => 50,
319
+ # :stops => [ {
320
+ # :offset => 0,
321
+ # :color => 'rgb(255,255,255)',
322
+ # :opacity => 0
323
+ # }, {
324
+ # :offset => 100,
325
+ # :color => 'rgb(0,127,200)',
326
+ # :opacity => 1
327
+ # }, ]
328
+ # }
329
+ #* :utr_stroke = the outline colour of the utr part of the glyph (default = "black"), can be any SVG colour eg rgb(256,0,0) or #FF0000
330
+ #* :utr_stroke_width = The width of the outline stroke for the utr part of the glyph (default = 1)
331
+ #* :exon_fill_color = the fill colour of the utr part of the glyph (default = 'red'), can be any SVG colour eg rgb(256,0,0) or #FF0000, or one of the built in gradient types Bio::Graphics::Glyph#gradients or a custom definition of a gradient
332
+ # [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]
333
+ #or a custom definition of a gradient
334
+ # {:type => :radial,
335
+ # :id => :custom,
336
+ # :cx => 5,
337
+ # :cy => 5,
338
+ # :r => 50,
339
+ # :fx => 50,
340
+ # :fy => 50,
341
+ # :stops => [ {
342
+ # :offset => 0,
343
+ # :color => 'rgb(255,255,255)',
344
+ # :opacity => 0
345
+ # }, {
346
+ # :offset => 100,
347
+ # :color => 'rgb(0,127,200)',
348
+ # :opacity => 1
349
+ # }, ]
350
+ # }
351
+ #* :exon_stroke = the outline colour of the exon part of the glyph (default = "black") can be any SVG colour eg rgb(256,0,0) or #FF0000
352
+ #* :exon_stroke_width = The width of the outline stroke for the exon part of the glyph (default = 1)
353
+ #* :line_color = the colour for the line part that joins the blocks (default = 'black') can be any SVG colour eg rgb(256,0,0) or #FF0000
354
+ #* :line_width = the width ffor the line part that joins the blocks (default = 1)
355
+ #* :exon_style = an arbitrary SVG compliant style string eg "fill-opacity:0.4;"
356
+ #* :utr_style = an arbitrary SVG compliant style string eg "fill-opacity:0.4;"
357
+ #* :line_style = an arbitrary SVG compliant style string eg "fill-opacity:0.4;"
358
+ #* :block_gaps = gaps between the rendered blocks - calculated internally by Bio::Graphics::Page object
359
+ #* :gap_marker = style of the line between blocks - either angled or straight
360
+ #* :x = x coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
361
+ #* :y = y coordinate of the feature in pixels, usually added by the Bio::Graphics::Page object
362
+ #
363
+ #+returns+
364
+ #
365
+ #* An Array[http://www.ruby-doc.org/core-2.0/Array.html] of Bio::Graphic::Primitive objects
190
366
  def self.transcript(args)
191
367
  args = {
192
368
  :height => 10,
@@ -279,18 +455,18 @@ attr_reader :glyphs
279
455
  end
280
456
  composite
281
457
  end
282
- #Creates the scale across the top of the SVG page
458
+
459
+ #Glyph for the scale across the top of the rendered page
283
460
  #
284
- #+args+
285
- #* start = the start of the scale
286
- #* stop = the end of the scale
287
- #* \number_of_intervals = the number of tick-marks on the scale to show the current position
288
- #* page_width = the width of the page
461
+ #== args
462
+ #* :start = the start of the scale, usually added by the Bio::Graphics::Page object
463
+ #* :stop = the end of the scale, usually added by the Bio::Graphics::Page object
464
+ #* :number_of_intervals = the number of tick-marks the scale will marked with
465
+ #* :page_width = the minimum width of the page, usually updated by the Bio::Graphics::Page object
289
466
  #
290
467
  #+returns+
291
468
  #
292
- #* An Array[http://www.ruby-doc.org/core-2.0/Array.html] of Primitive objects (of type 'line', 'rectangle' and 'text')
293
-
469
+ #* An Array[http://www.ruby-doc.org/core-2.0/Array.html] of Bio::Graphic::Primitive objects (of type 'line', 'rectangle' and 'text')
294
470
  def self.scale(args)
295
471
  first_mark = args[:start]
296
472
  last_mark = args[:stop]
@@ -327,15 +503,15 @@ attr_reader :glyphs
327
503
  end
328
504
  return a
329
505
  end
506
+
330
507
  #Creates a label Glyph to write text
331
508
  #
332
509
  #+args+
333
- #* text = the text to write
334
- #* fill = the colour of the text ("black")
335
- #* style = the style of writing ("font-family:monospace;")
336
- #* x = the co-ordinates of the Glyph for the x-axis
337
- #* y = the co-ordinates of the Glyph for the y-axis
338
-
510
+ #* :text = the text to write
511
+ #* :fill = the colour of the text ("black")
512
+ #* :style = the style of writing ("font-family:monospace;")
513
+ #* :x = the co-ordinates of the Glyph for the x-axis
514
+ #* :y = the co-ordinates of the Glyph for the y-axis
339
515
  def self.label(args)
340
516
  [Bio::Graphics::Primitive.new(:text,
341
517
  :text => args[:text],
@@ -344,26 +520,17 @@ attr_reader :glyphs
344
520
  :fill => "black",
345
521
  :style => "font-family:monospace;")]
346
522
  end
523
+
347
524
  #The list of pre-defined gradients
348
525
  def self.gradients #needs to know which of its gradients are predefined
349
526
  [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]
350
527
  end
351
528
 
352
- #Sets the the type (linear or radial) and colour of gradient for a pre-defined gradient
353
- #along with the pertinent parameters for that type
529
+ #Sets the the type (linear or radial) and colours for a pre-defined gradient
354
530
  #
355
- #+args+
356
- #* gradient = a pre-defined gradient
357
- #The types of gradient are:
358
- #* red_white_h
359
- #* green_white_h
360
- #* blue_white_h
361
- #* yellow_white_h
362
- #* red_white_radial
363
- #* green_white_radial
364
- #* blue_white_radial
365
- #* yellow_white_radial
366
-
531
+ #== args
532
+ #* gradient = a pre-defined gradient type, one of
533
+ # [:red_white_h, :green_white_h, :blue_white_h, :yellow_white_h, :red_white_radial, :green_white_radial, :blue_white_radial, :yellow_white_radial ]
367
534
  def self.gradient(gradient)
368
535
  type, color = case gradient
369
536
  when :red_white_h