bio-svgenes 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/bio-svgenes.gemspec +2 -2
- data/lib/bio/graphics/glyph.rb +14 -10
- data/lib/bio/graphics/mini_feature.rb +5 -0
- data/lib/bio/graphics/page.rb +4 -0
- data/lib/bio/graphics/primitive.rb +6 -0
- data/lib/bio/graphics/svgee.rb +6 -1
- data/lib/bio/graphics/track.rb +7 -0
- metadata +13 -13
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.2
|
data/bio-svgenes.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = "bio-svgenes"
|
|
8
|
-
s.version = "0.1.
|
|
8
|
+
s.version = "0.1.2"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Dan MacLean"]
|
|
12
|
-
s.date = "2012-11-
|
|
12
|
+
s.date = "2012-11-22"
|
|
13
13
|
s.description = "This bio-gem facilitates the creation of pretty, publication quality SVG images from feature data."
|
|
14
14
|
s.email = "maclean.daniel@gmail.com"
|
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/bio/graphics/glyph.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
module Bio
|
|
2
|
+
class Graphics
|
|
1
3
|
class Glyph
|
|
2
4
|
attr_reader :glyphs
|
|
3
5
|
#holds a load of definitions for glyphs .. a glyph is an array of primitives...
|
|
@@ -12,7 +14,7 @@ class Glyph
|
|
|
12
14
|
:x_round => 1,
|
|
13
15
|
:y_round => 1,
|
|
14
16
|
:style => "fill-opacity:0.4;"}.merge!(args)
|
|
15
|
-
[Primitive.new(:rectangle, args)]
|
|
17
|
+
[Bio::Graphics::Primitive.new(:rectangle, args)]
|
|
16
18
|
end
|
|
17
19
|
|
|
18
20
|
def self.directed(args) #:x, :y, :width :fill, :stroke :stroke_width, :style, :height
|
|
@@ -29,7 +31,7 @@ class Glyph
|
|
|
29
31
|
else
|
|
30
32
|
args[:points] = "#{args[:x]},#{args[:y]} #{args[:x] + args[:width] - (args[:height] * 0.2)},#{args[:y]} #{args[:x] + args[:width]},#{args[:y] + (args[:height]/2) } #{args[:x] + args[:width] - (args[:height] * 0.2)},#{args[:y] + args[:height]} #{args[:x]},#{args[:y] + args[:height]}"
|
|
31
33
|
end
|
|
32
|
-
[Primitive.new(:polygon, args)]
|
|
34
|
+
[Bio::Graphics::Primitive.new(:polygon, args)]
|
|
33
35
|
end
|
|
34
36
|
|
|
35
37
|
def self.transcript(args)
|
|
@@ -65,7 +67,7 @@ class Glyph
|
|
|
65
67
|
:style => args[:utr_style] )
|
|
66
68
|
##draw the other(s!)
|
|
67
69
|
args[:utrs].each do |utr|
|
|
68
|
-
composite << Primitive.new(:rectangle, {
|
|
70
|
+
composite << Bio::Graphics::Primitive.new(:rectangle, {
|
|
69
71
|
:x => utr.first,
|
|
70
72
|
:width => utr.last,
|
|
71
73
|
:y => args[:y],
|
|
@@ -90,7 +92,7 @@ class Glyph
|
|
|
90
92
|
end
|
|
91
93
|
#draw any remaining exons
|
|
92
94
|
args[:exons].each do |exon|
|
|
93
|
-
composite << Primitive.new(:rectangle, {
|
|
95
|
+
composite << Bio::Graphics::Primitive.new(:rectangle, {
|
|
94
96
|
:x => exon[0],
|
|
95
97
|
:width => exon[1],
|
|
96
98
|
:y => args[:y],
|
|
@@ -103,7 +105,7 @@ class Glyph
|
|
|
103
105
|
if args[:gap_marker] == "angled" and not args[:block_gaps].empty?
|
|
104
106
|
args[:block_gaps].each do |gap|
|
|
105
107
|
points = "#{gap.first},#{args[:y] + (args[:height]/2) } #{gap.first + (gap.last/2)},#{args[:y]} #{gap.first + gap.last},#{args[:y] + (args[:height]/2)}"
|
|
106
|
-
composite << Primitive.new(:polyline, {
|
|
108
|
+
composite << Bio::Graphics::Primitive.new(:polyline, {
|
|
107
109
|
:points => points,
|
|
108
110
|
:stroke => args[:line_color],
|
|
109
111
|
:stroke_width => args[:line_width],
|
|
@@ -112,7 +114,7 @@ class Glyph
|
|
|
112
114
|
end
|
|
113
115
|
else
|
|
114
116
|
#add line
|
|
115
|
-
composite << Primitive.new(:line, {
|
|
117
|
+
composite << Bio::Graphics::Primitive.new(:line, {
|
|
116
118
|
:x1 => args[:x],
|
|
117
119
|
:x2 => "#{args[:x] + args[:width]}",
|
|
118
120
|
:y1 => args[:y] + (args[:height]/2),
|
|
@@ -135,7 +137,7 @@ class Glyph
|
|
|
135
137
|
interval_width = full_dist / args[:number_of_intervals]
|
|
136
138
|
|
|
137
139
|
|
|
138
|
-
a = [Primitive.new(:line,
|
|
140
|
+
a = [Bio::Graphics::Primitive.new(:line,
|
|
139
141
|
:stroke => 'black',
|
|
140
142
|
:stroke_width => 1,
|
|
141
143
|
:x1 => 1, :x2 => args[:page_width] * 1.1,
|
|
@@ -146,7 +148,7 @@ class Glyph
|
|
|
146
148
|
px_per_nt = full_dist / args[:page_width]
|
|
147
149
|
marks.each do |mark|
|
|
148
150
|
x = (mark.to_f - first_mark )/ px_per_nt
|
|
149
|
-
a << Primitive.new(:rectangle,
|
|
151
|
+
a << Bio::Graphics::Primitive.new(:rectangle,
|
|
150
152
|
:x => x,
|
|
151
153
|
:y => 20,
|
|
152
154
|
:stroke => 'black',
|
|
@@ -154,7 +156,7 @@ class Glyph
|
|
|
154
156
|
:width => 1,
|
|
155
157
|
:height => 5 )
|
|
156
158
|
|
|
157
|
-
a << Primitive.new(:text,
|
|
159
|
+
a << Bio::Graphics::Primitive.new(:text,
|
|
158
160
|
:x => x,
|
|
159
161
|
:y => 40, :fill => 'black',
|
|
160
162
|
:text => mark,
|
|
@@ -164,7 +166,7 @@ class Glyph
|
|
|
164
166
|
end
|
|
165
167
|
|
|
166
168
|
def self.label(args)
|
|
167
|
-
[Primitive.new(:text,
|
|
169
|
+
[Bio::Graphics::Primitive.new(:text,
|
|
168
170
|
:text => args[:text],
|
|
169
171
|
:x => args[:x],
|
|
170
172
|
:y => args[:y],
|
|
@@ -239,3 +241,5 @@ class Glyph
|
|
|
239
241
|
|
|
240
242
|
|
|
241
243
|
end
|
|
244
|
+
end
|
|
245
|
+
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
module Bio
|
|
2
|
+
class Graphics
|
|
1
3
|
class MiniFeature
|
|
2
4
|
attr_accessor :start, :end, :strand, :exons, :utrs, :block_gaps, :segment_height, :id
|
|
3
5
|
def initialize(args)
|
|
@@ -11,3 +13,6 @@ class MiniFeature
|
|
|
11
13
|
@segment_height = args[:segment_height]
|
|
12
14
|
end
|
|
13
15
|
end
|
|
16
|
+
|
|
17
|
+
end
|
|
18
|
+
end
|
data/lib/bio/graphics/page.rb
CHANGED
data/lib/bio/graphics/svgee.rb
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
module Bio
|
|
2
|
+
class Graphics
|
|
3
|
+
|
|
1
4
|
class SVGEE
|
|
2
5
|
attr_reader :primitives, :defs, :supported_primitives
|
|
3
6
|
def initialize(args)
|
|
@@ -33,7 +36,7 @@ class SVGEE
|
|
|
33
36
|
else
|
|
34
37
|
add self.send("#{primitive}_tag", args)
|
|
35
38
|
end
|
|
36
|
-
return Primitive.new(primitive, args)
|
|
39
|
+
return Bio::Graphics::Primitive.new(primitive, args)
|
|
37
40
|
end
|
|
38
41
|
|
|
39
42
|
def link_and_tag(primitive, args)
|
|
@@ -109,6 +112,8 @@ class SVGEE
|
|
|
109
112
|
|
|
110
113
|
end
|
|
111
114
|
|
|
115
|
+
end
|
|
116
|
+
end
|
|
112
117
|
=begin How to use SVGEE
|
|
113
118
|
s = SVGEE.new
|
|
114
119
|
s.gradient(:radial => "grad1", :cx => 50, :cy => 50, :r => 50, :fx => 50, :fy => 50, :stops => [ {:offset => 0, :color => 'rgb(255,255,255)', :opacity => 0}, {:offset => 100, :color => 'rgb(0,0,255)', :opacity => 1},] )
|
data/lib/bio/graphics/track.rb
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
module Bio
|
|
2
|
+
class Graphics
|
|
3
|
+
|
|
1
4
|
class Track
|
|
2
5
|
attr_reader :glyph, :name, :label, :args, :track_height, :scale, :max_y
|
|
3
6
|
attr_accessor :features, :feature_rows, :name, :number_rows, :feature_height
|
|
@@ -47,3 +50,7 @@ class Track
|
|
|
47
50
|
end
|
|
48
51
|
|
|
49
52
|
end
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
end
|
|
56
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bio-svgenes
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.2
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,11 +9,11 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2012-11-
|
|
12
|
+
date: 2012-11-22 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: shoulda
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &70140177159960 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ! '>='
|
|
@@ -21,10 +21,10 @@ dependencies:
|
|
|
21
21
|
version: '0'
|
|
22
22
|
type: :development
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *70140177159960
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: bundler
|
|
27
|
-
requirement: &
|
|
27
|
+
requirement: &70140177159360 !ruby/object:Gem::Requirement
|
|
28
28
|
none: false
|
|
29
29
|
requirements:
|
|
30
30
|
- - ~>
|
|
@@ -32,10 +32,10 @@ dependencies:
|
|
|
32
32
|
version: 1.0.0
|
|
33
33
|
type: :development
|
|
34
34
|
prerelease: false
|
|
35
|
-
version_requirements: *
|
|
35
|
+
version_requirements: *70140177159360
|
|
36
36
|
- !ruby/object:Gem::Dependency
|
|
37
37
|
name: jeweler
|
|
38
|
-
requirement: &
|
|
38
|
+
requirement: &70140177175080 !ruby/object:Gem::Requirement
|
|
39
39
|
none: false
|
|
40
40
|
requirements:
|
|
41
41
|
- - ~>
|
|
@@ -43,10 +43,10 @@ dependencies:
|
|
|
43
43
|
version: 1.6.4
|
|
44
44
|
type: :development
|
|
45
45
|
prerelease: false
|
|
46
|
-
version_requirements: *
|
|
46
|
+
version_requirements: *70140177175080
|
|
47
47
|
- !ruby/object:Gem::Dependency
|
|
48
48
|
name: rcov
|
|
49
|
-
requirement: &
|
|
49
|
+
requirement: &70140177174420 !ruby/object:Gem::Requirement
|
|
50
50
|
none: false
|
|
51
51
|
requirements:
|
|
52
52
|
- - ! '>='
|
|
@@ -54,10 +54,10 @@ dependencies:
|
|
|
54
54
|
version: '0'
|
|
55
55
|
type: :development
|
|
56
56
|
prerelease: false
|
|
57
|
-
version_requirements: *
|
|
57
|
+
version_requirements: *70140177174420
|
|
58
58
|
- !ruby/object:Gem::Dependency
|
|
59
59
|
name: bio
|
|
60
|
-
requirement: &
|
|
60
|
+
requirement: &70140177173780 !ruby/object:Gem::Requirement
|
|
61
61
|
none: false
|
|
62
62
|
requirements:
|
|
63
63
|
- - ! '>='
|
|
@@ -65,7 +65,7 @@ dependencies:
|
|
|
65
65
|
version: 1.4.2
|
|
66
66
|
type: :development
|
|
67
67
|
prerelease: false
|
|
68
|
-
version_requirements: *
|
|
68
|
+
version_requirements: *70140177173780
|
|
69
69
|
description: This bio-gem facilitates the creation of pretty, publication quality
|
|
70
70
|
SVG images from feature data.
|
|
71
71
|
email: maclean.daniel@gmail.com
|
|
@@ -122,7 +122,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
122
122
|
version: '0'
|
|
123
123
|
segments:
|
|
124
124
|
- 0
|
|
125
|
-
hash:
|
|
125
|
+
hash: 90867079773197497
|
|
126
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
none: false
|
|
128
128
|
requirements:
|