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.
- data/README.md +88 -0
- data/VERSION +1 -1
- data/bio-svgenes.gemspec +131 -8
- data/doc/classes/Bio.html +131 -0
- data/doc/classes/Bio/Graphics.html +142 -0
- data/doc/classes/Bio/Graphics/Glyph.html +987 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000001.html +26 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000002.html +27 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000003.html +32 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000004.html +27 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000005.html +25 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000006.html +29 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000007.html +107 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000008.html +51 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000009.html +23 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000010.html +18 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000011.html +75 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000012.html +51 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000013.html +23 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000014.html +26 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000015.html +27 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000016.html +32 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000017.html +27 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000018.html +25 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000019.html +29 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000020.html +107 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000021.html +51 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000022.html +23 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000023.html +18 -0
- data/doc/classes/Bio/Graphics/Glyph.src/M000024.html +75 -0
- data/doc/classes/Bio/Graphics/MiniFeature.html +243 -0
- data/doc/classes/Bio/Graphics/MiniFeature.src/M000001.html +25 -0
- data/doc/classes/Bio/Graphics/MiniFeature.src/M000003.html +25 -0
- data/doc/classes/Bio/Graphics/MiniFeature.src/M000024.html +25 -0
- data/doc/classes/Bio/Graphics/Page.html +705 -0
- data/doc/classes/Bio/Graphics/Page.src/M000010.html +35 -0
- data/doc/classes/Bio/Graphics/Page.src/M000011.html +83 -0
- data/doc/classes/Bio/Graphics/Page.src/M000012.html +24 -0
- data/doc/classes/Bio/Graphics/Page.src/M000013.html +29 -0
- data/doc/classes/Bio/Graphics/Page.src/M000014.html +24 -0
- data/doc/classes/Bio/Graphics/Page.src/M000015.html +20 -0
- data/doc/classes/Bio/Graphics/Page.src/M000016.html +20 -0
- data/doc/classes/Bio/Graphics/Page.src/M000017.html +18 -0
- data/doc/classes/Bio/Graphics/Page.src/M000018.html +18 -0
- data/doc/classes/Bio/Graphics/Page.src/M000019.html +18 -0
- data/doc/classes/Bio/Graphics/Page.src/M000020.html +18 -0
- data/doc/classes/Bio/Graphics/Page.src/M000021.html +18 -0
- data/doc/classes/Bio/Graphics/Page.src/M000022.html +18 -0
- data/doc/classes/Bio/Graphics/Page.src/M000023.html +18 -0
- data/doc/classes/Bio/Graphics/Page.src/M000024.html +18 -0
- data/doc/classes/Bio/Graphics/Page.src/M000025.html +35 -0
- data/doc/classes/Bio/Graphics/Page.src/M000026.html +83 -0
- data/doc/classes/Bio/Graphics/Page.src/M000027.html +24 -0
- data/doc/classes/Bio/Graphics/Page.src/M000028.html +29 -0
- data/doc/classes/Bio/Graphics/Page.src/M000029.html +24 -0
- data/doc/classes/Bio/Graphics/Page.src/M000030.html +20 -0
- data/doc/classes/Bio/Graphics/Page.src/M000031.html +20 -0
- data/doc/classes/Bio/Graphics/Page.src/M000032.html +18 -0
- data/doc/classes/Bio/Graphics/Page.src/M000033.html +18 -0
- data/doc/classes/Bio/Graphics/Page.src/M000034.html +18 -0
- data/doc/classes/Bio/Graphics/Page.src/M000035.html +18 -0
- data/doc/classes/Bio/Graphics/Page.src/M000036.html +18 -0
- data/doc/classes/Bio/Graphics/Page.src/M000037.html +18 -0
- data/doc/classes/Bio/Graphics/Page.src/M000038.html +18 -0
- data/doc/classes/Bio/Graphics/Page.src/M000039.html +18 -0
- data/doc/classes/Bio/Graphics/Page.src/M000040.html +107 -0
- data/doc/classes/Bio/Graphics/Page.src/M000041.html +18 -0
- data/doc/classes/Bio/Graphics/Page.src/M000042.html +23 -0
- data/doc/classes/Bio/Graphics/Page.src/M000043.html +18 -0
- data/doc/classes/Bio/Graphics/Page.src/M000044.html +18 -0
- data/doc/classes/Bio/Graphics/Primitive.html +204 -0
- data/doc/classes/Bio/Graphics/Primitive.src/M000001.html +21 -0
- data/doc/classes/Bio/Graphics/Primitive.src/M000002.html +20 -0
- data/doc/classes/Bio/Graphics/Primitive.src/M000008.html +21 -0
- data/doc/classes/Bio/Graphics/Primitive.src/M000009.html +20 -0
- data/doc/classes/Bio/Graphics/Primitive.src/M000022.html +21 -0
- data/doc/classes/Bio/Graphics/Primitive.src/M000023.html +20 -0
- data/doc/classes/Bio/Graphics/SVGEE.html +290 -0
- data/doc/classes/Bio/Graphics/SVGEE.src/M000002.html +24 -0
- data/doc/classes/Bio/Graphics/SVGEE.src/M000003.html +18 -0
- data/doc/classes/Bio/Graphics/SVGEE.src/M000004.html +24 -0
- data/doc/classes/Bio/Graphics/SVGEE.src/M000005.html +18 -0
- data/doc/classes/Bio/Graphics/SVGEE.src/M000006.html +18 -0
- data/doc/classes/Bio/Graphics/SVGEE.src/M000007.html +21 -0
- data/doc/classes/Bio/Graphics/SVGEE.src/M000008.html +27 -0
- data/doc/classes/Bio/Graphics/SVGEE.src/M000009.html +23 -0
- data/doc/classes/Bio/Graphics/SVGEE.src/M000016.html +24 -0
- data/doc/classes/Bio/Graphics/SVGEE.src/M000017.html +18 -0
- data/doc/classes/Bio/Graphics/SVGEE.src/M000018.html +18 -0
- data/doc/classes/Bio/Graphics/SVGEE.src/M000019.html +21 -0
- data/doc/classes/Bio/Graphics/SVGEE.src/M000020.html +27 -0
- data/doc/classes/Bio/Graphics/SVGEE.src/M000021.html +23 -0
- data/doc/classes/Bio/Graphics/Track.html +473 -0
- data/doc/classes/Bio/Graphics/Track.src/M000001.html +35 -0
- data/doc/classes/Bio/Graphics/Track.src/M000002.html +18 -0
- data/doc/classes/Bio/Graphics/Track.src/M000003.html +28 -0
- data/doc/classes/Bio/Graphics/Track.src/M000004.html +18 -0
- data/doc/classes/Bio/Graphics/Track.src/M000010.html +35 -0
- data/doc/classes/Bio/Graphics/Track.src/M000011.html +18 -0
- data/doc/classes/Bio/Graphics/Track.src/M000012.html +28 -0
- data/doc/classes/Bio/Graphics/Track.src/M000013.html +18 -0
- data/doc/created.rid +1 -9
- data/doc/files/lib/bio-svgenes_rb.html +131 -0
- data/doc/files/lib/bio/graphics/glyph_rb.html +101 -0
- data/doc/files/lib/bio/graphics/mini_feature_rb.html +101 -0
- data/doc/files/lib/bio/graphics/page_rb.html +111 -0
- data/doc/files/lib/bio/graphics/primitive_rb.html +101 -0
- data/doc/files/lib/bio/graphics/svgee_rb.html +101 -0
- data/doc/files/lib/bio/graphics/track_rb.html +101 -0
- data/doc/fr_class_index.html +34 -0
- data/doc/fr_file_index.html +33 -0
- data/doc/fr_method_index.html +70 -0
- data/doc/index.html +21 -91
- data/doc/manual/bootstrap/css/bootstrap-responsive.css +1109 -0
- data/doc/manual/bootstrap/css/bootstrap-responsive.min.css +9 -0
- data/doc/manual/bootstrap/css/bootstrap.css +6158 -0
- data/doc/manual/bootstrap/css/bootstrap.min.css +9 -0
- data/doc/manual/bootstrap/img/glyphicons-halflings-white.png +0 -0
- data/doc/manual/bootstrap/img/glyphicons-halflings.png +0 -0
- data/doc/manual/bootstrap/js/bootstrap.js +2276 -0
- data/doc/manual/bootstrap/js/bootstrap.min.js +6 -0
- data/doc/manual/img/circle.png +0 -0
- data/doc/manual/img/directed.png +0 -0
- data/doc/manual/img/down_triangle.png +0 -0
- data/doc/manual/img/histogram.png +0 -0
- data/doc/manual/img/span.png +0 -0
- data/doc/manual/img/transcript.png +0 -0
- data/doc/manual/img/up_triangle.png +0 -0
- data/doc/manual/manual.html +360 -0
- data/doc/manual/manual.md +307 -0
- data/doc/rdoc-style.css +208 -0
- data/examples/example.rb +12 -8
- data/examples/{make_example.rb → example2.rb} +5 -16
- data/lib/bio/graphics/glyph.rb +293 -126
- data/lib/bio/graphics/mini_feature.rb +24 -17
- data/lib/bio/graphics/page.rb +112 -54
- data/lib/bio/graphics/primitive.rb +12 -9
- data/lib/bio/graphics/svgee.rb +9 -11
- data/lib/bio/graphics/track.rb +92 -10
- metadata +132 -9
- data/README.rdoc +0 -19
- data/examples/annotate_snps.rb +0 -86
- data/examples/eg2.rb +0 -40
- data/examples/get_coverage_in_windows.rb +0 -176
@@ -0,0 +1,35 @@
|
|
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::Page)</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/page.rb, line 16</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-ivar">@height</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:height</span>]
|
16
|
+
<span class="ruby-ivar">@width</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:width</span>]
|
17
|
+
<span class="ruby-identifier">args</span>[<span class="ruby-identifier">:style</span>] = <span class="ruby-node">"background-color:#{args[:background_color]};"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:background_color</span>]
|
18
|
+
<span class="ruby-ivar">@svg</span> = <span class="ruby-constant">SVGEE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">args</span>)
|
19
|
+
<span class="ruby-ivar">@scale_start</span> = <span class="ruby-value">1.0</span><span class="ruby-operator">/</span><span class="ruby-value">0</span><span class="ruby-value">.0</span>
|
20
|
+
<span class="ruby-ivar">@scale_stop</span> = <span class="ruby-value">-1.0</span><span class="ruby-operator">/</span><span class="ruby-value">0</span><span class="ruby-value">.0</span>
|
21
|
+
<span class="ruby-ivar">@tracks</span> = [] <span class="ruby-comment cmt">#array of track objects with loads of features in it...</span>
|
22
|
+
<span class="ruby-ivar">@nt_per_percent</span> = <span class="ruby-value">1</span>;
|
23
|
+
<span class="ruby-ivar">@num_intervals</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:number_of_intervals</span>]
|
24
|
+
<span class="ruby-ivar">@track_top</span> = <span class="ruby-value">30</span>
|
25
|
+
|
26
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-ivar">@svg</span>.<span class="ruby-identifier">update_height</span>(<span class="ruby-identifier">height</span>)
|
27
|
+
<span class="ruby-ivar">@height</span> = <span class="ruby-identifier">height</span>
|
28
|
+
<span class="ruby-keyword kw">end</span>
|
29
|
+
|
30
|
+
<span class="ruby-comment cmt">#def @svg.update_width(width)</span>
|
31
|
+
<span class="ruby-comment cmt"># @width = width</span>
|
32
|
+
<span class="ruby-comment cmt">#end</span>
|
33
|
+
<span class="ruby-keyword kw">end</span></pre>
|
34
|
+
</body>
|
35
|
+
</html>
|
@@ -0,0 +1,83 @@
|
|
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>from_json (Bio::Graphics::Page)</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/page.rb, line 39</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span><span class="ruby-keyword kw">self</span>..<span class="ruby-identifier">from_json</span><span class="ruby-identifier">from_json</span>(<span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-identifier">require</span> <span class="ruby-value str">'rubygems'</span>
|
16
|
+
<span class="ruby-identifier">require</span> <span class="ruby-value str">'json'</span>
|
17
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">args</span>[<span class="ruby-identifier">:json</span>], <span class="ruby-value str">'r'</span>).<span class="ruby-identifier">read</span>)
|
18
|
+
<span class="ruby-identifier">p</span> = <span class="ruby-constant">Page</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:width</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">data</span>[<span class="ruby-value str">"Page"</span>][<span class="ruby-value str">"width"</span>],
|
19
|
+
<span class="ruby-identifier">:height</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">data</span>[<span class="ruby-value str">"Page"</span>][<span class="ruby-value str">"height"</span>],
|
20
|
+
<span class="ruby-identifier">:number_of_intervals</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">data</span>[<span class="ruby-value str">"Page"</span>][<span class="ruby-value str">"intervals"</span>])
|
21
|
+
<span class="ruby-identifier">data</span>[<span class="ruby-value str">"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>
|
22
|
+
<span class="ruby-comment cmt">#prep the track args</span>
|
23
|
+
<span class="ruby-identifier">track_args</span> = <span class="ruby-identifier">track</span>.<span class="ruby-identifier">dup</span>
|
24
|
+
<span class="ruby-identifier">track_args</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">"file"</span>)
|
25
|
+
<span class="ruby-identifier">track_args</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">"file_type"</span>)
|
26
|
+
<span class="ruby-identifier">track_args</span> = <span class="ruby-identifier">track_args</span>.<span class="ruby-identifier">inject</span>({}) { <span class="ruby-operator">|</span><span class="ruby-identifier">memo</span>, (<span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>)<span class="ruby-operator">|</span> <span class="ruby-identifier">memo</span>[<span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">v</span>; <span class="ruby-identifier">memo</span> }
|
27
|
+
<span class="ruby-comment cmt">##convert any of the pre-made gradient strings in the keys to symbol</span>
|
28
|
+
<span class="ruby-identifier">track_args</span>.<span class="ruby-identifier">each_key</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span>
|
29
|
+
<span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">track_args</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_sym</span>)
|
30
|
+
<span class="ruby-identifier">track_args</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">track_args</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">to_sym</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Glyph</span>.<span class="ruby-identifier">gradients</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">track_args</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">to_sym</span>)
|
31
|
+
<span class="ruby-keyword kw">end</span>
|
32
|
+
|
33
|
+
<span class="ruby-identifier">svg_track</span> = <span class="ruby-identifier">p</span>.<span class="ruby-identifier">add_track</span>(<span class="ruby-identifier">track_args</span>)
|
34
|
+
<span class="ruby-identifier">features</span> = [] <span class="ruby-comment cmt">##set up the features...</span>
|
35
|
+
|
36
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">track</span>[<span class="ruby-value str">"file_type"</span>] <span class="ruby-comment cmt">##deal with the gff and data files</span>
|
37
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">"gff"</span>
|
38
|
+
<span class="ruby-identifier">groups</span> = {}
|
39
|
+
<span class="ruby-identifier">parentless_features</span> = []
|
40
|
+
<span class="ruby-constant">Page</span>.<span class="ruby-identifier">parse_gff</span>(<span class="ruby-identifier">track</span>[<span class="ruby-value str">"file"</span>]).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">gff</span><span class="ruby-operator">|</span> <span class="ruby-comment cmt">#gets features in a list and links their children to them as members of the array at the key</span>
|
41
|
+
<span class="ruby-identifier">parent_id</span> = <span class="ruby-identifier">gff</span>.<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'Parent'</span> }
|
42
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parent_id</span>.<span class="ruby-identifier">empty?</span>
|
43
|
+
<span class="ruby-identifier">parentless_features</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">gff</span>
|
44
|
+
<span class="ruby-keyword kw">else</span>
|
45
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">groups</span>[<span class="ruby-identifier">parent_id</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">last</span>].<span class="ruby-identifier">nil?</span>
|
46
|
+
<span class="ruby-identifier">groups</span>[<span class="ruby-identifier">parent_id</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">last</span>] = []
|
47
|
+
<span class="ruby-identifier">groups</span>[<span class="ruby-identifier">parent_id</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">last</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">gff</span>
|
48
|
+
<span class="ruby-keyword kw">else</span>
|
49
|
+
<span class="ruby-identifier">groups</span>[<span class="ruby-identifier">parent_id</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">last</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">gff</span>
|
50
|
+
<span class="ruby-keyword kw">end</span>
|
51
|
+
<span class="ruby-keyword kw">end</span>
|
52
|
+
<span class="ruby-keyword kw">end</span>
|
53
|
+
<span class="ruby-comment cmt">#now flick through the parentless features and add any exons / UTRs</span>
|
54
|
+
<span class="ruby-identifier">parentless_features</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">plf</span><span class="ruby-operator">|</span>
|
55
|
+
<span class="ruby-identifier">require</span> <span class="ruby-value str">'pp'</span>
|
56
|
+
<span class="ruby-comment cmt">#pp parentless_features</span>
|
57
|
+
<span class="ruby-identifier">gff_id</span> = <span class="ruby-identifier">plf</span>.<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'ID'</span> }
|
58
|
+
<span class="ruby-identifier">gff_id</span> = <span class="ruby-identifier">gff_id</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">last</span>
|
59
|
+
<span class="ruby-identifier">exons</span> = []
|
60
|
+
<span class="ruby-identifier">utrs</span> = []
|
61
|
+
<span class="ruby-identifier">children</span> = <span class="ruby-identifier">groups</span>[<span class="ruby-identifier">gff_id</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">children</span> = []
|
62
|
+
<span class="ruby-identifier">children</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span>
|
63
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">child</span>.<span class="ruby-identifier">feature</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'exon'</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">child</span>.<span class="ruby-identifier">feature</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'CDS'</span>
|
64
|
+
<span class="ruby-identifier">exons</span> <span class="ruby-operator">+=</span> [<span class="ruby-identifier">child</span>.<span class="ruby-identifier">start</span>, <span class="ruby-identifier">child</span>.<span class="ruby-identifier">end</span>]
|
65
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">child</span>.<span class="ruby-identifier">feature</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/utr/i</span>
|
66
|
+
<span class="ruby-identifier">utrs</span> <span class="ruby-operator">+=</span> [<span class="ruby-identifier">child</span>.<span class="ruby-identifier">start</span>, <span class="ruby-identifier">child</span>.<span class="ruby-identifier">end</span>]
|
67
|
+
<span class="ruby-keyword kw">end</span>
|
68
|
+
<span class="ruby-keyword kw">end</span>
|
69
|
+
<span class="ruby-identifier">features</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">MiniFeature</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:start</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">plf</span>.<span class="ruby-identifier">start</span>, <span class="ruby-identifier">:end</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">plf</span>.<span class="ruby-identifier">end</span>, <span class="ruby-identifier">:exons</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">exons</span>, <span class="ruby-identifier">:utrs</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">utrs</span>, <span class="ruby-identifier">:strand</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">plf</span>.<span class="ruby-identifier">strand</span>, <span class="ruby-identifier">:id</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">gff_id</span>)
|
70
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt">#parentless features end</span>
|
71
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">"data"</span>
|
72
|
+
<span class="ruby-comment cmt">##each line is a data feature</span>
|
73
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">track</span>[<span class="ruby-value str">"file"</span>], <span class="ruby-value str">"r"</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
74
|
+
<span class="ruby-identifier">start</span>, <span class="ruby-identifier">stop</span>, <span class="ruby-identifier">value</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\t/</span>)
|
75
|
+
<span class="ruby-identifier">features</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">MiniFeature</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:start</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">start</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">:end</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">stop</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">:segment_height</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_f</span>)
|
76
|
+
<span class="ruby-keyword kw">end</span>
|
77
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt">#data end</span>
|
78
|
+
<span class="ruby-identifier">features</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">svg_track</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">f</span>) }
|
79
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt">#track end</span>
|
80
|
+
<span class="ruby-identifier">p</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">args</span>[<span class="ruby-identifier">:outfile</span>])
|
81
|
+
<span class="ruby-keyword kw">end</span></pre>
|
82
|
+
</body>
|
83
|
+
</html>
|
@@ -0,0 +1,24 @@
|
|
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>parse_gff (Bio::Graphics::Page)</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/page.rb, line 111</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">parse_gff</span>(<span class="ruby-identifier">gff_file</span>)
|
15
|
+
<span class="ruby-identifier">require</span> <span class="ruby-value str">'bio'</span>
|
16
|
+
<span class="ruby-identifier">a</span> = []
|
17
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">gff_file</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
18
|
+
<span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^#/</span>
|
19
|
+
<span class="ruby-identifier">a</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Bio</span><span class="ruby-operator">::</span><span class="ruby-constant">GFF</span><span class="ruby-operator">::</span><span class="ruby-constant">GFF3</span><span class="ruby-operator">::</span><span class="ruby-constant">Record</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">line</span>)
|
20
|
+
<span class="ruby-keyword kw">end</span>
|
21
|
+
<span class="ruby-identifier">a</span>
|
22
|
+
<span class="ruby-keyword kw">end</span></pre>
|
23
|
+
</body>
|
24
|
+
</html>
|
@@ -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>add_track (Bio::Graphics::Page)</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/page.rb, line 206</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_track</span>(<span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-comment cmt">#sort out the colour/gradient options</span>
|
16
|
+
[<span class="ruby-identifier">:fill_color</span>, <span class="ruby-identifier">:exon_fill_color</span>, <span class="ruby-identifier">:utr_fill_color</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">colour_tag</span><span class="ruby-operator">|</span>
|
17
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-constant">Glyph</span>.<span class="ruby-identifier">gradients</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">args</span>[<span class="ruby-identifier">colour_tag</span>])
|
18
|
+
<span class="ruby-ivar">@svg</span>.<span class="ruby-identifier">gradient</span>(<span class="ruby-constant">Glyph</span>.<span class="ruby-identifier">gradient</span>(<span class="ruby-identifier">args</span>[<span class="ruby-identifier">colour_tag</span>]))
|
19
|
+
<span class="ruby-identifier">args</span>[<span class="ruby-identifier">colour_tag</span>] = <span class="ruby-node">"url(##{args[colour_tag]})"</span>
|
20
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">colour_tag</span>].<span class="ruby-identifier">instance_of?</span>(<span class="ruby-constant">Hash</span>)
|
21
|
+
<span class="ruby-ivar">@svg</span>.<span class="ruby-identifier">gradient</span>(<span class="ruby-identifier">args</span>[<span class="ruby-identifier">colour_tag</span>])
|
22
|
+
<span class="ruby-identifier">args</span>[<span class="ruby-identifier">colour_tag</span>] = <span class="ruby-node">"url(##{args[colour_tag][:id]})"</span>
|
23
|
+
<span class="ruby-keyword kw">end</span>
|
24
|
+
<span class="ruby-keyword kw">end</span>
|
25
|
+
<span class="ruby-ivar">@tracks</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Track</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">args</span>)
|
26
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@tracks</span>.<span class="ruby-identifier">last</span>
|
27
|
+
<span class="ruby-keyword kw">end</span></pre>
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,24 @@
|
|
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>get_limits (Bio::Graphics::Page)</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/page.rb, line 222</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_limits</span>
|
15
|
+
<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>
|
16
|
+
<span class="ruby-identifier">lowest</span> = <span class="ruby-identifier">track</span>.<span class="ruby-identifier">features</span>.<span class="ruby-identifier">sort</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">start</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">y</span>.<span class="ruby-identifier">start</span> }.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">start</span>
|
17
|
+
<span class="ruby-identifier">highest</span> = <span class="ruby-identifier">track</span>.<span class="ruby-identifier">features</span>.<span class="ruby-identifier">sort</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span><span class="ruby-operator">|</span> <span class="ruby-identifier">y</span>.<span class="ruby-identifier">end</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">x</span>.<span class="ruby-identifier">end</span> }.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">end</span>
|
18
|
+
<span class="ruby-ivar">@scale_start</span> = <span class="ruby-identifier">lowest</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">lowest</span> <span class="ruby-operator"><</span> <span class="ruby-ivar">@scale_start</span>
|
19
|
+
<span class="ruby-ivar">@scale_stop</span> = <span class="ruby-identifier">highest</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">highest</span> <span class="ruby-operator">></span> <span class="ruby-ivar">@scale_stop</span>
|
20
|
+
<span class="ruby-ivar">@nt_per_px_x</span> = (<span class="ruby-ivar">@scale_stop</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@scale_start</span>).<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-ivar">@width</span>.<span class="ruby-identifier">to_f</span>
|
21
|
+
<span class="ruby-keyword kw">end</span>
|
22
|
+
<span class="ruby-keyword kw">end</span></pre>
|
23
|
+
</body>
|
24
|
+
</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>draw_scale (Bio::Graphics::Page)</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/page.rb, line 233</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_scale</span>
|
15
|
+
<span class="ruby-constant">Glyph</span>.<span class="ruby-identifier">scale</span>(<span class="ruby-identifier">:start</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@scale_start</span>,
|
16
|
+
<span class="ruby-identifier">:stop</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@scale_stop</span>,
|
17
|
+
<span class="ruby-identifier">:number_of_intervals</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@num_intervals</span>, <span class="ruby-identifier">:page_width</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@width</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@svg</span>.<span class="ruby-identifier">add_primitive</span>(<span class="ruby-identifier">g</span>) }
|
18
|
+
<span class="ruby-keyword kw">end</span></pre>
|
19
|
+
</body>
|
20
|
+
</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>draw_label (Bio::Graphics::Page)</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/page.rb, line 241</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_label</span>(<span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-constant">Glyph</span>.<span class="ruby-identifier">label</span>(<span class="ruby-identifier">:text</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:text</span>],
|
16
|
+
<span class="ruby-identifier">:x</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:x</span>],
|
17
|
+
<span class="ruby-identifier">:y</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:y</span>]).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@svg</span>.<span class="ruby-identifier">add_primitive</span>(<span class="ruby-identifier">g</span>) }
|
18
|
+
<span class="ruby-keyword kw">end</span></pre>
|
19
|
+
</body>
|
20
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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_generic (Bio::Graphics::Page)</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/page.rb, line 248</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_generic</span>(<span class="ruby-identifier">args</span>) <span class="ruby-comment cmt">#remember presentation info comes from track@args when the track is defined</span>
|
15
|
+
<span class="ruby-constant">Glyph</span>.<span class="ruby-identifier">generic</span>(<span class="ruby-identifier">args</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@svg</span>.<span class="ruby-identifier">add_primitive</span>(<span class="ruby-identifier">g</span>) }
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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_directed (Bio::Graphics::Page)</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/page.rb, line 252</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_directed</span>(<span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-constant">Glyph</span>.<span class="ruby-identifier">directed</span>(<span class="ruby-identifier">args</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@svg</span>.<span class="ruby-identifier">add_primitive</span>(<span class="ruby-identifier">g</span>) }
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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_circle (Bio::Graphics::Page)</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/page.rb, line 256</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_circle</span>(<span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-constant">Glyph</span>.<span class="ruby-identifier">circle</span>(<span class="ruby-identifier">args</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@svg</span>.<span class="ruby-identifier">add_primitive</span>(<span class="ruby-identifier">g</span>) }
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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_transcript (Bio::Graphics::Page)</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/page.rb, line 260</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_transcript</span>(<span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-constant">Glyph</span>.<span class="ruby-identifier">transcript</span>(<span class="ruby-identifier">args</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@svg</span>.<span class="ruby-identifier">add_primitive</span>(<span class="ruby-identifier">g</span>) }
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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_histogram (Bio::Graphics::Page)</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/page.rb, line 264</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_histogram</span>(<span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-constant">Glyph</span>.<span class="ruby-identifier">generic</span>(<span class="ruby-identifier">args</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@svg</span>.<span class="ruby-identifier">add_primitive</span>(<span class="ruby-identifier">g</span>) }
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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_up_triangle (Bio::Graphics::Page)</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/page.rb, line 268</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_up_triangle</span>(<span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-constant">Glyph</span>.<span class="ruby-identifier">up_triangle</span>(<span class="ruby-identifier">args</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@svg</span>.<span class="ruby-identifier">add_primitive</span>(<span class="ruby-identifier">g</span>) }
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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_down_triangle (Bio::Graphics::Page)</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/page.rb, line 272</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_down_triangle</span>(<span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-constant">Glyph</span>.<span class="ruby-identifier">down_triangle</span>(<span class="ruby-identifier">args</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@svg</span>.<span class="ruby-identifier">add_primitive</span>(<span class="ruby-identifier">g</span>) }
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
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_span (Bio::Graphics::Page)</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/page.rb, line 276</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_span</span>(<span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-constant">Glyph</span>.<span class="ruby-identifier">span</span>(<span class="ruby-identifier">args</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">g</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@svg</span>.<span class="ruby-identifier">add_primitive</span>(<span class="ruby-identifier">g</span>) }
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,35 @@
|
|
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::Page)</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/page.rb, line 16</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-ivar">@height</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:height</span>]
|
16
|
+
<span class="ruby-ivar">@width</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:width</span>]
|
17
|
+
<span class="ruby-identifier">args</span>[<span class="ruby-identifier">:style</span>] = <span class="ruby-node">"background-color:#{args[:background_color]};"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:background_color</span>]
|
18
|
+
<span class="ruby-ivar">@svg</span> = <span class="ruby-constant">SVGEE</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">args</span>)
|
19
|
+
<span class="ruby-ivar">@scale_start</span> = <span class="ruby-value">1.0</span><span class="ruby-operator">/</span><span class="ruby-value">0</span><span class="ruby-value">.0</span>
|
20
|
+
<span class="ruby-ivar">@scale_stop</span> = <span class="ruby-value">-1.0</span><span class="ruby-operator">/</span><span class="ruby-value">0</span><span class="ruby-value">.0</span>
|
21
|
+
<span class="ruby-ivar">@tracks</span> = [] <span class="ruby-comment cmt">#array of track objects with loads of features in it...</span>
|
22
|
+
<span class="ruby-ivar">@nt_per_percent</span> = <span class="ruby-value">1</span>;
|
23
|
+
<span class="ruby-ivar">@num_intervals</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:number_of_intervals</span>]
|
24
|
+
<span class="ruby-ivar">@track_top</span> = <span class="ruby-value">30</span>
|
25
|
+
|
26
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-ivar">@svg</span>.<span class="ruby-identifier">update_height</span>(<span class="ruby-identifier">height</span>)
|
27
|
+
<span class="ruby-ivar">@height</span> = <span class="ruby-identifier">height</span>
|
28
|
+
<span class="ruby-keyword kw">end</span>
|
29
|
+
|
30
|
+
<span class="ruby-comment cmt">#def @svg.update_width(width)</span>
|
31
|
+
<span class="ruby-comment cmt"># @width = width</span>
|
32
|
+
<span class="ruby-comment cmt">#end</span>
|
33
|
+
<span class="ruby-keyword kw">end</span></pre>
|
34
|
+
</body>
|
35
|
+
</html>
|
@@ -0,0 +1,83 @@
|
|
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>from_json (Bio::Graphics::Page)</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/page.rb, line 39</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span><span class="ruby-keyword kw">self</span>..<span class="ruby-identifier">from_json</span><span class="ruby-identifier">from_json</span>(<span class="ruby-identifier">args</span>)
|
15
|
+
<span class="ruby-identifier">require</span> <span class="ruby-value str">'rubygems'</span>
|
16
|
+
<span class="ruby-identifier">require</span> <span class="ruby-value str">'json'</span>
|
17
|
+
<span class="ruby-identifier">data</span> = <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">args</span>[<span class="ruby-identifier">:json</span>], <span class="ruby-value str">'r'</span>).<span class="ruby-identifier">read</span>)
|
18
|
+
<span class="ruby-identifier">p</span> = <span class="ruby-constant">Page</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:width</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">data</span>[<span class="ruby-value str">"Page"</span>][<span class="ruby-value str">"width"</span>],
|
19
|
+
<span class="ruby-identifier">:height</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">data</span>[<span class="ruby-value str">"Page"</span>][<span class="ruby-value str">"height"</span>],
|
20
|
+
<span class="ruby-identifier">:number_of_intervals</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">data</span>[<span class="ruby-value str">"Page"</span>][<span class="ruby-value str">"intervals"</span>])
|
21
|
+
<span class="ruby-identifier">data</span>[<span class="ruby-value str">"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>
|
22
|
+
<span class="ruby-comment cmt">#prep the track args</span>
|
23
|
+
<span class="ruby-identifier">track_args</span> = <span class="ruby-identifier">track</span>.<span class="ruby-identifier">dup</span>
|
24
|
+
<span class="ruby-identifier">track_args</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">"file"</span>)
|
25
|
+
<span class="ruby-identifier">track_args</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">"file_type"</span>)
|
26
|
+
<span class="ruby-identifier">track_args</span> = <span class="ruby-identifier">track_args</span>.<span class="ruby-identifier">inject</span>({}) { <span class="ruby-operator">|</span><span class="ruby-identifier">memo</span>, (<span class="ruby-identifier">k</span>, <span class="ruby-identifier">v</span>)<span class="ruby-operator">|</span> <span class="ruby-identifier">memo</span>[<span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_sym</span>] = <span class="ruby-identifier">v</span>; <span class="ruby-identifier">memo</span> }
|
27
|
+
<span class="ruby-comment cmt">##convert any of the pre-made gradient strings in the keys to symbol</span>
|
28
|
+
<span class="ruby-identifier">track_args</span>.<span class="ruby-identifier">each_key</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span>
|
29
|
+
<span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">track_args</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_sym</span>)
|
30
|
+
<span class="ruby-identifier">track_args</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">track_args</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">to_sym</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Glyph</span>.<span class="ruby-identifier">gradients</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">track_args</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">to_sym</span>)
|
31
|
+
<span class="ruby-keyword kw">end</span>
|
32
|
+
|
33
|
+
<span class="ruby-identifier">svg_track</span> = <span class="ruby-identifier">p</span>.<span class="ruby-identifier">add_track</span>(<span class="ruby-identifier">track_args</span>)
|
34
|
+
<span class="ruby-identifier">features</span> = [] <span class="ruby-comment cmt">##set up the features...</span>
|
35
|
+
|
36
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">track</span>[<span class="ruby-value str">"file_type"</span>] <span class="ruby-comment cmt">##deal with the gff and data files</span>
|
37
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">"gff"</span>
|
38
|
+
<span class="ruby-identifier">groups</span> = {}
|
39
|
+
<span class="ruby-identifier">parentless_features</span> = []
|
40
|
+
<span class="ruby-constant">Page</span>.<span class="ruby-identifier">parse_gff</span>(<span class="ruby-identifier">track</span>[<span class="ruby-value str">"file"</span>]).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">gff</span><span class="ruby-operator">|</span> <span class="ruby-comment cmt">#gets features in a list and links their children to them as members of the array at the key</span>
|
41
|
+
<span class="ruby-identifier">parent_id</span> = <span class="ruby-identifier">gff</span>.<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'Parent'</span> }
|
42
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parent_id</span>.<span class="ruby-identifier">empty?</span>
|
43
|
+
<span class="ruby-identifier">parentless_features</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">gff</span>
|
44
|
+
<span class="ruby-keyword kw">else</span>
|
45
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">groups</span>[<span class="ruby-identifier">parent_id</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">last</span>].<span class="ruby-identifier">nil?</span>
|
46
|
+
<span class="ruby-identifier">groups</span>[<span class="ruby-identifier">parent_id</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">last</span>] = []
|
47
|
+
<span class="ruby-identifier">groups</span>[<span class="ruby-identifier">parent_id</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">last</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">gff</span>
|
48
|
+
<span class="ruby-keyword kw">else</span>
|
49
|
+
<span class="ruby-identifier">groups</span>[<span class="ruby-identifier">parent_id</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">last</span>] <span class="ruby-operator"><<</span> <span class="ruby-identifier">gff</span>
|
50
|
+
<span class="ruby-keyword kw">end</span>
|
51
|
+
<span class="ruby-keyword kw">end</span>
|
52
|
+
<span class="ruby-keyword kw">end</span>
|
53
|
+
<span class="ruby-comment cmt">#now flick through the parentless features and add any exons / UTRs</span>
|
54
|
+
<span class="ruby-identifier">parentless_features</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">plf</span><span class="ruby-operator">|</span>
|
55
|
+
<span class="ruby-identifier">require</span> <span class="ruby-value str">'pp'</span>
|
56
|
+
<span class="ruby-comment cmt">#pp parentless_features</span>
|
57
|
+
<span class="ruby-identifier">gff_id</span> = <span class="ruby-identifier">plf</span>.<span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'ID'</span> }
|
58
|
+
<span class="ruby-identifier">gff_id</span> = <span class="ruby-identifier">gff_id</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">last</span>
|
59
|
+
<span class="ruby-identifier">exons</span> = []
|
60
|
+
<span class="ruby-identifier">utrs</span> = []
|
61
|
+
<span class="ruby-identifier">children</span> = <span class="ruby-identifier">groups</span>[<span class="ruby-identifier">gff_id</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">children</span> = []
|
62
|
+
<span class="ruby-identifier">children</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">child</span><span class="ruby-operator">|</span>
|
63
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">child</span>.<span class="ruby-identifier">feature</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'exon'</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">child</span>.<span class="ruby-identifier">feature</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'CDS'</span>
|
64
|
+
<span class="ruby-identifier">exons</span> <span class="ruby-operator">+=</span> [<span class="ruby-identifier">child</span>.<span class="ruby-identifier">start</span>, <span class="ruby-identifier">child</span>.<span class="ruby-identifier">end</span>]
|
65
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">child</span>.<span class="ruby-identifier">feature</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/utr/i</span>
|
66
|
+
<span class="ruby-identifier">utrs</span> <span class="ruby-operator">+=</span> [<span class="ruby-identifier">child</span>.<span class="ruby-identifier">start</span>, <span class="ruby-identifier">child</span>.<span class="ruby-identifier">end</span>]
|
67
|
+
<span class="ruby-keyword kw">end</span>
|
68
|
+
<span class="ruby-keyword kw">end</span>
|
69
|
+
<span class="ruby-identifier">features</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">MiniFeature</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:start</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">plf</span>.<span class="ruby-identifier">start</span>, <span class="ruby-identifier">:end</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">plf</span>.<span class="ruby-identifier">end</span>, <span class="ruby-identifier">:exons</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">exons</span>, <span class="ruby-identifier">:utrs</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">utrs</span>, <span class="ruby-identifier">:strand</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">plf</span>.<span class="ruby-identifier">strand</span>, <span class="ruby-identifier">:id</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">gff_id</span>)
|
70
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt">#parentless features end</span>
|
71
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">"data"</span>
|
72
|
+
<span class="ruby-comment cmt">##each line is a data feature</span>
|
73
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">track</span>[<span class="ruby-value str">"file"</span>], <span class="ruby-value str">"r"</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
74
|
+
<span class="ruby-identifier">start</span>, <span class="ruby-identifier">stop</span>, <span class="ruby-identifier">value</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/\t/</span>)
|
75
|
+
<span class="ruby-identifier">features</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">MiniFeature</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:start</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">start</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">:end</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">stop</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">:segment_height</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_f</span>)
|
76
|
+
<span class="ruby-keyword kw">end</span>
|
77
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt">#data end</span>
|
78
|
+
<span class="ruby-identifier">features</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">svg_track</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">f</span>) }
|
79
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt">#track end</span>
|
80
|
+
<span class="ruby-identifier">p</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">args</span>[<span class="ruby-identifier">:outfile</span>])
|
81
|
+
<span class="ruby-keyword kw">end</span></pre>
|
82
|
+
</body>
|
83
|
+
</html>
|