genevalidator 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/.travis.yml +2 -0
- data/README.md +78 -30
- data/Rakefile +11 -8
- data/aux/app_template_footer.erb +1 -6
- data/aux/app_template_header.erb +12 -32
- data/aux/files/css/style.css +2 -8
- data/aux/files/js/plots.js +564 -576
- data/aux/files/js/script.js +10 -0
- data/aux/json_footer.erb +8 -0
- data/aux/json_header.erb +19 -0
- data/aux/json_query.erb +14 -0
- data/aux/template_footer.erb +9 -58
- data/aux/template_header.erb +18 -58
- data/aux/template_query.erb +8 -36
- data/bin/genevalidator +45 -32
- data/genevalidator.gemspec +11 -7
- data/lib/genevalidator.rb +75 -455
- data/lib/genevalidator/arg_validation.rb +78 -107
- data/lib/genevalidator/blast.rb +57 -60
- data/lib/genevalidator/clusterization.rb +15 -15
- data/lib/genevalidator/exceptions.rb +32 -5
- data/lib/genevalidator/get_raw_sequences.rb +70 -33
- data/lib/genevalidator/hsp.rb +1 -4
- data/lib/genevalidator/json_to_gv_results.rb +109 -0
- data/lib/genevalidator/output.rb +177 -185
- data/lib/genevalidator/pool.rb +2 -1
- data/lib/genevalidator/sequences.rb +3 -3
- data/lib/genevalidator/tabular_parser.rb +24 -18
- data/lib/genevalidator/validation.rb +279 -0
- data/lib/genevalidator/validation_alignment.rb +31 -47
- data/lib/genevalidator/validation_blast_reading_frame.rb +19 -18
- data/lib/genevalidator/validation_duplication.rb +23 -19
- data/lib/genevalidator/validation_gene_merge.rb +30 -65
- data/lib/genevalidator/validation_length_cluster.rb +14 -53
- data/lib/genevalidator/validation_length_rank.rb +10 -11
- data/lib/genevalidator/validation_open_reading_frame.rb +18 -19
- data/lib/genevalidator/validation_report.rb +2 -5
- data/lib/genevalidator/validation_test.rb +8 -4
- data/lib/genevalidator/version.rb +1 -1
- data/test/test_all_validations.rb +51 -66
- data/test/test_blast.rb +68 -51
- data/test/test_clusterization.rb +1 -1
- data/test/test_clusterization_2d.rb +19 -13
- data/test/test_extended_array_methods.rb +1 -1
- data/test/test_files/all_validations_mrna/mrna.blast_tab6 +1806 -0
- data/test/test_files/all_validations_mrna/mrna.blast_tab7 +1865 -0
- data/test/test_files/all_validations_mrna/{all_validations_mrna.fasta.blast_xml → mrna.blast_xml} +18642 -1
- data/test/test_files/all_validations_mrna/{all_validations_mrna.fasta.blast_xml.index → mrna.blast_xml.index} +300 -0
- data/test/test_files/all_validations_mrna/{all_validations_mrna.fasta → mrna.fa} +0 -0
- data/test/test_files/all_validations_mrna/mrna.raw_seq +3970 -0
- data/test/test_files/all_validations_mrna/{all_validations_mrna.fasta.blast_xml.raw_seq.idx → mrna.raw_seq.idx} +901 -1
- data/test/test_files/all_validations_prot/{all_validations_prot.fasta.blast_tab → prot.blast_tab6} +416 -0
- data/test/test_files/all_validations_prot/prot.blast_tab7 +2400 -0
- data/test/test_files/all_validations_prot/{all_validations_prot.fasta.blast_xml → prot.blast_xml} +18299 -6723
- data/test/test_files/all_validations_prot/{all_validations_prot.fasta.blast_xml.index → prot.blast_xml.index} +408 -0
- data/test/test_files/all_validations_prot/{all_validations_prot.fasta → prot.fa} +0 -0
- data/test/test_files/all_validations_prot/{all_validations_prot.fasta.blast_xml.raw_seq → prot.raw_seq} +2735 -0
- data/test/test_files/all_validations_prot/{all_validations_prot.fasta.blast_xml.raw_seq.idx → prot.raw_seq.idx} +3032 -1808
- data/test/test_sequences.rb +46 -41
- data/test/test_validation_open_reading_frame.rb +318 -202
- data/test/test_validations.rb +48 -32
- metadata +76 -102
- data/doc/AliasDuplicationError.html +0 -134
- data/doc/AlignmentValidation.html +0 -1687
- data/doc/AlignmentValidationOutput.html +0 -659
- data/doc/Blast.html +0 -1905
- data/doc/BlastRFValidationOutput.html +0 -545
- data/doc/BlastReadingFrameValidation.html +0 -370
- data/doc/BlastUtils.html +0 -875
- data/doc/ClasspathError.html +0 -134
- data/doc/Cluster.html +0 -1316
- data/doc/DuplciationValidationOutput.html +0 -564
- data/doc/DuplicationValidation.html +0 -920
- data/doc/DuplicationValidationOutput.html +0 -564
- data/doc/FileNotFoundException.html +0 -134
- data/doc/GeneMergeValidation.html +0 -935
- data/doc/GeneMergeValidationOutput.html +0 -652
- data/doc/HierarchicalClusterization.html +0 -994
- data/doc/Hsp.html +0 -1485
- data/doc/InconsistentTabularFormat.html +0 -135
- data/doc/LengthClusterValidation.html +0 -982
- data/doc/LengthClusterValidationOutput.html +0 -515
- data/doc/LengthRankValidation.html +0 -496
- data/doc/LengthRankValidationOutput.html +0 -517
- data/doc/NoInternetError.html +0 -135
- data/doc/NoMafftInstallationError.html +0 -134
- data/doc/NoPIdentError.html +0 -134
- data/doc/NoValidationError.html +0 -134
- data/doc/NotEnoughHitsError.html +0 -135
- data/doc/ORFValidationOutput.html +0 -593
- data/doc/OpenReadingFrameValidation.html +0 -1107
- data/doc/OtherError.html +0 -123
- data/doc/Output.html +0 -1540
- data/doc/Pair.html +0 -309
- data/doc/PairCluster.html +0 -767
- data/doc/Plot.html +0 -837
- data/doc/QueryError.html +0 -134
- data/doc/ReportClassError.html +0 -135
- data/doc/Sequence.html +0 -1299
- data/doc/SequenceTypeError.html +0 -135
- data/doc/TabularEntry.html +0 -837
- data/doc/TabularParser.html +0 -1104
- data/doc/Validation.html +0 -2147
- data/doc/ValidationClassError.html +0 -134
- data/doc/ValidationOutput.html +0 -460
- data/doc/ValidationReport.html +0 -940
- data/doc/ValidationTest.html +0 -939
- data/doc/_index.html +0 -449
- data/doc/class_list.html +0 -54
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -57
- data/doc/css/style.css +0 -338
- data/doc/file.README.html +0 -151
- data/doc/file_list.html +0 -56
- data/doc/frames.html +0 -26
- data/doc/index.html +0 -151
- data/doc/js/app.js +0 -214
- data/doc/js/full_list.js +0 -178
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -1505
- data/doc/top-level-namespace.html +0 -112
- data/test/test_files/all_validations_mrna/all_validations_mrna.fasta.blast_tab +0 -967
- data/test/test_files/all_validations_mrna/all_validations_mrna.fasta.blast_tab.index +0 -967
- data/test/test_files/all_validations_mrna/all_validations_mrna.fasta.blast_tab.raw_seq +0 -4929
- data/test/test_files/all_validations_mrna/all_validations_mrna.fasta.blast_tab.raw_seq.idx +0 -1006
- data/test/test_files/all_validations_mrna/all_validations_mrna.fasta.blast_xml.raw_seq +0 -2075
- data/test/test_files/all_validations_prot/all_validations_prot.fasta.blast_tab.index +0 -1864
- data/test/test_files/all_validations_prot/all_validations_prot.fasta.blast_tab.raw_seq +0 -42411
- data/test/test_files/all_validations_prot/all_validations_prot.fasta.blast_tab.raw_seq.idx +0 -3751
@@ -1,134 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
-
<title>
|
7
|
-
Exception: FileNotFoundException
|
8
|
-
|
9
|
-
— Documentation by YARD 0.8.7.2
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
hasFrames = window.top.frames.main ? true : false;
|
19
|
-
relpath = '';
|
20
|
-
framesUrl = "frames.html#!" + escape(window.location.href);
|
21
|
-
</script>
|
22
|
-
|
23
|
-
|
24
|
-
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
-
|
26
|
-
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
-
|
28
|
-
|
29
|
-
</head>
|
30
|
-
<body>
|
31
|
-
<div id="header">
|
32
|
-
<div id="menu">
|
33
|
-
|
34
|
-
<a href="_index.html">Index (F)</a> »
|
35
|
-
|
36
|
-
|
37
|
-
<span class="title">FileNotFoundException</span>
|
38
|
-
|
39
|
-
|
40
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
-
</div>
|
42
|
-
|
43
|
-
<div id="search">
|
44
|
-
|
45
|
-
<a class="full_list_link" id="class_list_link"
|
46
|
-
href="class_list.html">
|
47
|
-
Class List
|
48
|
-
</a>
|
49
|
-
|
50
|
-
<a class="full_list_link" id="method_list_link"
|
51
|
-
href="method_list.html">
|
52
|
-
Method List
|
53
|
-
</a>
|
54
|
-
|
55
|
-
<a class="full_list_link" id="file_list_link"
|
56
|
-
href="file_list.html">
|
57
|
-
File List
|
58
|
-
</a>
|
59
|
-
|
60
|
-
</div>
|
61
|
-
<div class="clear"></div>
|
62
|
-
</div>
|
63
|
-
|
64
|
-
<iframe id="search_frame"></iframe>
|
65
|
-
|
66
|
-
<div id="content"><h1>Exception: FileNotFoundException
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
</h1>
|
71
|
-
|
72
|
-
<dl class="box">
|
73
|
-
|
74
|
-
<dt class="r1">Inherits:</dt>
|
75
|
-
<dd class="r1">
|
76
|
-
<span class="inheritName">Exception</span>
|
77
|
-
|
78
|
-
<ul class="fullTree">
|
79
|
-
<li>Object</li>
|
80
|
-
|
81
|
-
<li class="next">Exception</li>
|
82
|
-
|
83
|
-
<li class="next">FileNotFoundException</li>
|
84
|
-
|
85
|
-
</ul>
|
86
|
-
<a href="#" class="inheritanceTree">show all</a>
|
87
|
-
|
88
|
-
</dd>
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
<dt class="r2 last">Defined in:</dt>
|
99
|
-
<dd class="r2 last">lib/genevalidator/exceptions.rb</dd>
|
100
|
-
|
101
|
-
</dl>
|
102
|
-
<div class="clear"></div>
|
103
|
-
|
104
|
-
<h2>Overview</h2><div class="docstring">
|
105
|
-
<div class="discussion">
|
106
|
-
|
107
|
-
<p>Exception raised when an unexisting file is accessed</p>
|
108
|
-
|
109
|
-
|
110
|
-
</div>
|
111
|
-
</div>
|
112
|
-
<div class="tags">
|
113
|
-
|
114
|
-
|
115
|
-
</div>
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
</div>
|
126
|
-
|
127
|
-
<div id="footer">
|
128
|
-
Generated on Sat Sep 28 07:01:32 2013 by
|
129
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
130
|
-
0.8.7.2 (ruby-1.9.3).
|
131
|
-
</div>
|
132
|
-
|
133
|
-
</body>
|
134
|
-
</html>
|
@@ -1,935 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
-
<head>
|
5
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
-
<title>
|
7
|
-
Class: GeneMergeValidation
|
8
|
-
|
9
|
-
— Documentation by YARD 0.8.7.2
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
-
|
17
|
-
<script type="text/javascript" charset="utf-8">
|
18
|
-
hasFrames = window.top.frames.main ? true : false;
|
19
|
-
relpath = '';
|
20
|
-
framesUrl = "frames.html#!" + escape(window.location.href);
|
21
|
-
</script>
|
22
|
-
|
23
|
-
|
24
|
-
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
-
|
26
|
-
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
-
|
28
|
-
|
29
|
-
</head>
|
30
|
-
<body>
|
31
|
-
<div id="header">
|
32
|
-
<div id="menu">
|
33
|
-
|
34
|
-
<a href="_index.html">Index (G)</a> »
|
35
|
-
|
36
|
-
|
37
|
-
<span class="title">GeneMergeValidation</span>
|
38
|
-
|
39
|
-
|
40
|
-
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
-
</div>
|
42
|
-
|
43
|
-
<div id="search">
|
44
|
-
|
45
|
-
<a class="full_list_link" id="class_list_link"
|
46
|
-
href="class_list.html">
|
47
|
-
Class List
|
48
|
-
</a>
|
49
|
-
|
50
|
-
<a class="full_list_link" id="method_list_link"
|
51
|
-
href="method_list.html">
|
52
|
-
Method List
|
53
|
-
</a>
|
54
|
-
|
55
|
-
<a class="full_list_link" id="file_list_link"
|
56
|
-
href="file_list.html">
|
57
|
-
File List
|
58
|
-
</a>
|
59
|
-
|
60
|
-
</div>
|
61
|
-
<div class="clear"></div>
|
62
|
-
</div>
|
63
|
-
|
64
|
-
<iframe id="search_frame"></iframe>
|
65
|
-
|
66
|
-
<div id="content"><h1>Class: GeneMergeValidation
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
</h1>
|
71
|
-
|
72
|
-
<dl class="box">
|
73
|
-
|
74
|
-
<dt class="r1">Inherits:</dt>
|
75
|
-
<dd class="r1">
|
76
|
-
<span class="inheritName"><span class='object_link'><a href="ValidationTest.html" title="ValidationTest (class)">ValidationTest</a></span></span>
|
77
|
-
|
78
|
-
<ul class="fullTree">
|
79
|
-
<li>Object</li>
|
80
|
-
|
81
|
-
<li class="next"><span class='object_link'><a href="ValidationTest.html" title="ValidationTest (class)">ValidationTest</a></span></li>
|
82
|
-
|
83
|
-
<li class="next">GeneMergeValidation</li>
|
84
|
-
|
85
|
-
</ul>
|
86
|
-
<a href="#" class="inheritanceTree">show all</a>
|
87
|
-
|
88
|
-
</dd>
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
<dt class="r2 last">Defined in:</dt>
|
99
|
-
<dd class="r2 last">lib/genevalidator/validation_gene_merge.rb</dd>
|
100
|
-
|
101
|
-
</dl>
|
102
|
-
<div class="clear"></div>
|
103
|
-
|
104
|
-
<h2>Overview</h2><div class="docstring">
|
105
|
-
<div class="discussion">
|
106
|
-
|
107
|
-
<p>This class contains the methods necessary for checking whether there is
|
108
|
-
evidence that the prediction is a merge of multiple genes</p>
|
109
|
-
|
110
|
-
|
111
|
-
</div>
|
112
|
-
</div>
|
113
|
-
<div class="tags">
|
114
|
-
|
115
|
-
|
116
|
-
</div>
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
<h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
|
121
|
-
<ul class="summary">
|
122
|
-
|
123
|
-
<li class="public ">
|
124
|
-
<span class="summary_signature">
|
125
|
-
|
126
|
-
<a href="#filename-instance_method" title="#filename (instance method)">- (Object) <strong>filename</strong> </a>
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
</span>
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
<span class="note title readonly">readonly</span>
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
<span class="summary_desc"><div class='inline'>
|
146
|
-
<p>Returns the value of attribute filename.</p>
|
147
|
-
</div></span>
|
148
|
-
|
149
|
-
</li>
|
150
|
-
|
151
|
-
|
152
|
-
<li class="public ">
|
153
|
-
<span class="summary_signature">
|
154
|
-
|
155
|
-
<a href="#hits-instance_method" title="#hits (instance method)">- (Object) <strong>hits</strong> </a>
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
</span>
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
<span class="note title readonly">readonly</span>
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
<span class="summary_desc"><div class='inline'>
|
175
|
-
<p>Returns the value of attribute hits.</p>
|
176
|
-
</div></span>
|
177
|
-
|
178
|
-
</li>
|
179
|
-
|
180
|
-
|
181
|
-
<li class="public ">
|
182
|
-
<span class="summary_signature">
|
183
|
-
|
184
|
-
<a href="#prediction-instance_method" title="#prediction (instance method)">- (Object) <strong>prediction</strong> </a>
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
</span>
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
<span class="note title readonly">readonly</span>
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
<span class="summary_desc"><div class='inline'>
|
204
|
-
<p>Returns the value of attribute prediction.</p>
|
205
|
-
</div></span>
|
206
|
-
|
207
|
-
</li>
|
208
|
-
|
209
|
-
|
210
|
-
</ul>
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
<h3 class="inherited">Attributes inherited from <span class='object_link'><a href="ValidationTest.html" title="ValidationTest (class)">ValidationTest</a></span></h3>
|
217
|
-
<p class="inherited"><span class='object_link'><a href="ValidationTest.html#cli_name-instance_method" title="ValidationTest#cli_name (method)">#cli_name</a></span>, <span class='object_link'><a href="ValidationTest.html#description-instance_method" title="ValidationTest#description (method)">#description</a></span>, <span class='object_link'><a href="ValidationTest.html#header-instance_method" title="ValidationTest#header (method)">#header</a></span>, <span class='object_link'><a href="ValidationTest.html#running_time-instance_method" title="ValidationTest#running_time (method)">#running_time</a></span>, <span class='object_link'><a href="ValidationTest.html#short_header-instance_method" title="ValidationTest#short_header (method)">#short_header</a></span>, <span class='object_link'><a href="ValidationTest.html#type-instance_method" title="ValidationTest#type (method)">#type</a></span>, <span class='object_link'><a href="ValidationTest.html#validation_report-instance_method" title="ValidationTest#validation_report (method)">#validation_report</a></span></p>
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
<h2>
|
222
|
-
Instance Method Summary
|
223
|
-
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
224
|
-
</h2>
|
225
|
-
|
226
|
-
<ul class="summary">
|
227
|
-
|
228
|
-
<li class="public ">
|
229
|
-
<span class="summary_signature">
|
230
|
-
|
231
|
-
<a href="#initialize-instance_method" title="#initialize (instance method)">- (GeneMergeValidation) <strong>initialize</strong>(type, prediction, hits, filename) </a>
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
</span>
|
236
|
-
|
237
|
-
|
238
|
-
<span class="note title constructor">constructor</span>
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
<span class="summary_desc"><div class='inline'>
|
248
|
-
<p>Initilizes the object Params: <tt>type</tt>: type of the predicted sequence
|
249
|
-
(:nucleotide or :protein) <tt>prediction</tt>: a <tt>Sequence</tt> object
|
250
|
-
representing the blast query <tt>hits</tt>: a vector of <tt>Sequence</tt>
|
251
|
-
objects (usually representig the blast hits) <tt>filename</tt>: name of the
|
252
|
-
input file, used when generatig the plot files.</p>
|
253
|
-
</div></span>
|
254
|
-
|
255
|
-
</li>
|
256
|
-
|
257
|
-
|
258
|
-
<li class="public ">
|
259
|
-
<span class="summary_signature">
|
260
|
-
|
261
|
-
<a href="#plot_2d_start_from-instance_method" title="#plot_2d_start_from (instance method)">- (Object) <strong>plot_2d_start_from</strong>(slope, y_intercept, output = "#{filename}_match_2d.json", hits = @hits) </a>
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
</span>
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
<span class="summary_desc"><div class='inline'>
|
276
|
-
<p>Generates a json file containing data used for plotting the start/end of
|
277
|
-
the matched region offsets in the prediction Param <tt>slope</tt>: slope of
|
278
|
-
the linear regression line <tt>y_intercept</tt>: the ecuation of the line
|
279
|
-
is y= slope*x + y_intercept <tt>output</tt>: location where the plot will
|
280
|
-
be saved in jped file format <tt>hits</tt>: array of Sequence objects.</p>
|
281
|
-
</div></span>
|
282
|
-
|
283
|
-
</li>
|
284
|
-
|
285
|
-
|
286
|
-
<li class="public ">
|
287
|
-
<span class="summary_signature">
|
288
|
-
|
289
|
-
<a href="#plot_matched_regions-instance_method" title="#plot_matched_regions (instance method)">- (Object) <strong>plot_matched_regions</strong>(output = "#{filename}_match.json", hits = @hits, prediction = @prediction) </a>
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
</span>
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
<span class="summary_desc"><div class='inline'>
|
304
|
-
<p>Generates a json file containing data used for plotting the matched region
|
305
|
-
of the prediction for each hit Param <tt>output</tt>: location where the
|
306
|
-
plot will be saved in jped file format <tt>hits</tt>: array of Sequence
|
307
|
-
objects <tt>prediction</tt>: Sequence objects.</p>
|
308
|
-
</div></span>
|
309
|
-
|
310
|
-
</li>
|
311
|
-
|
312
|
-
|
313
|
-
<li class="public ">
|
314
|
-
<span class="summary_signature">
|
315
|
-
|
316
|
-
<a href="#run-instance_method" title="#run (instance method)">- (Object) <strong>run</strong> </a>
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
</span>
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
<span class="summary_desc"><div class='inline'>
|
331
|
-
<p>Validation test for gene merge Output: <tt>GeneMergeValidationOutput</tt>
|
332
|
-
object.</p>
|
333
|
-
</div></span>
|
334
|
-
|
335
|
-
</li>
|
336
|
-
|
337
|
-
|
338
|
-
<li class="public ">
|
339
|
-
<span class="summary_signature">
|
340
|
-
|
341
|
-
<a href="#slope-instance_method" title="#slope (instance method)">- (Object) <strong>slope</strong>(hits = @hits) </a>
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
</span>
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
<span class="summary_desc"><div class='inline'>
|
356
|
-
<p>Caclulates the slope of the regression line give a set of 2d coordonates of
|
357
|
-
the start/stop offests of the hits Param <tt>hits</tt>: array of Sequence
|
358
|
-
objects Code inspired from: <a
|
359
|
-
href="http://engineering.sharethrough.com/blog/2012/09/12/simple-linear-regression-using-ruby">engineering.sharethrough.com/blog/2012/09/12/simple-linear-regression-using-ruby</a>/
|
360
|
-
Output: The ecuation of the regression line: [y slope].</p>
|
361
|
-
</div></span>
|
362
|
-
|
363
|
-
</li>
|
364
|
-
|
365
|
-
|
366
|
-
</ul>
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
<div id="constructor_details" class="method_details_list">
|
376
|
-
<h2>Constructor Details</h2>
|
377
|
-
|
378
|
-
<div class="method_details first">
|
379
|
-
<h3 class="signature first" id="initialize-instance_method">
|
380
|
-
|
381
|
-
- (<tt><span class='object_link'><a href="" title="GeneMergeValidation (class)">GeneMergeValidation</a></span></tt>) <strong>initialize</strong>(type, prediction, hits, filename)
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
</h3><div class="docstring">
|
388
|
-
<div class="discussion">
|
389
|
-
|
390
|
-
<p>Initilizes the object Params: <tt>type</tt>: type of the predicted sequence
|
391
|
-
(:nucleotide or :protein) <tt>prediction</tt>: a <tt>Sequence</tt> object
|
392
|
-
representing the blast query <tt>hits</tt>: a vector of <tt>Sequence</tt>
|
393
|
-
objects (usually representig the blast hits) <tt>filename</tt>: name of the
|
394
|
-
input file, used when generatig the plot files</p>
|
395
|
-
|
396
|
-
|
397
|
-
</div>
|
398
|
-
</div>
|
399
|
-
<div class="tags">
|
400
|
-
|
401
|
-
|
402
|
-
</div><table class="source_code">
|
403
|
-
<tr>
|
404
|
-
<td>
|
405
|
-
<pre class="lines">
|
406
|
-
|
407
|
-
|
408
|
-
66
|
409
|
-
67
|
410
|
-
68
|
411
|
-
69
|
412
|
-
70
|
413
|
-
71
|
414
|
-
72
|
415
|
-
73
|
416
|
-
74
|
417
|
-
75
|
418
|
-
76</pre>
|
419
|
-
</td>
|
420
|
-
<td>
|
421
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/validation_gene_merge.rb', line 66</span>
|
422
|
-
|
423
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_prediction'>prediction</span><span class='comma'>,</span> <span class='id identifier rubyid_hits'>hits</span><span class='comma'>,</span> <span class='id identifier rubyid_filename'>filename</span><span class='rparen'>)</span>
|
424
|
-
<span class='kw'>super</span>
|
425
|
-
<span class='ivar'>@filename</span> <span class='op'>=</span> <span class='id identifier rubyid_filename'>filename</span>
|
426
|
-
<span class='ivar'>@short_header</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Gene_Merge(slope)</span><span class='tstring_end'>"</span></span>
|
427
|
-
<span class='ivar'>@header</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Gene Merge</span><span class='tstring_end'>"</span></span>
|
428
|
-
<span class='ivar'>@description</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Check whether BLAST hits make evidence about a merge of two</span><span class='tstring_end'>"</span></span><span class='op'><<</span>
|
429
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> genes that match the predicted gene. Meaning of the output displayed:</span><span class='tstring_end'>"</span></span><span class='op'><<</span>
|
430
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> slope of the linear regression of the relationship between the start and</span><span class='tstring_end'>"</span></span><span class='op'><<</span>
|
431
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> stop offsets of the hsps (see the plot). Invalid slopes are around 45 degrees.</span><span class='tstring_end'>"</span></span>
|
432
|
-
<span class='ivar'>@cli_name</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>merge</span><span class='tstring_end'>"</span></span>
|
433
|
-
<span class='kw'>end</span></pre>
|
434
|
-
</td>
|
435
|
-
</tr>
|
436
|
-
</table>
|
437
|
-
</div>
|
438
|
-
|
439
|
-
</div>
|
440
|
-
|
441
|
-
<div id="instance_attr_details" class="attr_details">
|
442
|
-
<h2>Instance Attribute Details</h2>
|
443
|
-
|
444
|
-
|
445
|
-
<span id=""></span>
|
446
|
-
<div class="method_details first">
|
447
|
-
<h3 class="signature first" id="filename-instance_method">
|
448
|
-
|
449
|
-
- (<tt>Object</tt>) <strong>filename</strong> <span class="extras">(readonly)</span>
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
</h3><div class="docstring">
|
456
|
-
<div class="discussion">
|
457
|
-
|
458
|
-
<p>Returns the value of attribute filename</p>
|
459
|
-
|
460
|
-
|
461
|
-
</div>
|
462
|
-
</div>
|
463
|
-
<div class="tags">
|
464
|
-
|
465
|
-
|
466
|
-
</div><table class="source_code">
|
467
|
-
<tr>
|
468
|
-
<td>
|
469
|
-
<pre class="lines">
|
470
|
-
|
471
|
-
|
472
|
-
57
|
473
|
-
58
|
474
|
-
59</pre>
|
475
|
-
</td>
|
476
|
-
<td>
|
477
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/validation_gene_merge.rb', line 57</span>
|
478
|
-
|
479
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_filename'>filename</span>
|
480
|
-
<span class='ivar'>@filename</span>
|
481
|
-
<span class='kw'>end</span></pre>
|
482
|
-
</td>
|
483
|
-
</tr>
|
484
|
-
</table>
|
485
|
-
</div>
|
486
|
-
|
487
|
-
|
488
|
-
<span id=""></span>
|
489
|
-
<div class="method_details ">
|
490
|
-
<h3 class="signature " id="hits-instance_method">
|
491
|
-
|
492
|
-
- (<tt>Object</tt>) <strong>hits</strong> <span class="extras">(readonly)</span>
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
</h3><div class="docstring">
|
499
|
-
<div class="discussion">
|
500
|
-
|
501
|
-
<p>Returns the value of attribute hits</p>
|
502
|
-
|
503
|
-
|
504
|
-
</div>
|
505
|
-
</div>
|
506
|
-
<div class="tags">
|
507
|
-
|
508
|
-
|
509
|
-
</div><table class="source_code">
|
510
|
-
<tr>
|
511
|
-
<td>
|
512
|
-
<pre class="lines">
|
513
|
-
|
514
|
-
|
515
|
-
55
|
516
|
-
56
|
517
|
-
57</pre>
|
518
|
-
</td>
|
519
|
-
<td>
|
520
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/validation_gene_merge.rb', line 55</span>
|
521
|
-
|
522
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_hits'>hits</span>
|
523
|
-
<span class='ivar'>@hits</span>
|
524
|
-
<span class='kw'>end</span></pre>
|
525
|
-
</td>
|
526
|
-
</tr>
|
527
|
-
</table>
|
528
|
-
</div>
|
529
|
-
|
530
|
-
|
531
|
-
<span id=""></span>
|
532
|
-
<div class="method_details ">
|
533
|
-
<h3 class="signature " id="prediction-instance_method">
|
534
|
-
|
535
|
-
- (<tt>Object</tt>) <strong>prediction</strong> <span class="extras">(readonly)</span>
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
</h3><div class="docstring">
|
542
|
-
<div class="discussion">
|
543
|
-
|
544
|
-
<p>Returns the value of attribute prediction</p>
|
545
|
-
|
546
|
-
|
547
|
-
</div>
|
548
|
-
</div>
|
549
|
-
<div class="tags">
|
550
|
-
|
551
|
-
|
552
|
-
</div><table class="source_code">
|
553
|
-
<tr>
|
554
|
-
<td>
|
555
|
-
<pre class="lines">
|
556
|
-
|
557
|
-
|
558
|
-
56
|
559
|
-
57
|
560
|
-
58</pre>
|
561
|
-
</td>
|
562
|
-
<td>
|
563
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/validation_gene_merge.rb', line 56</span>
|
564
|
-
|
565
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_prediction'>prediction</span>
|
566
|
-
<span class='ivar'>@prediction</span>
|
567
|
-
<span class='kw'>end</span></pre>
|
568
|
-
</td>
|
569
|
-
</tr>
|
570
|
-
</table>
|
571
|
-
</div>
|
572
|
-
|
573
|
-
</div>
|
574
|
-
|
575
|
-
|
576
|
-
<div id="instance_method_details" class="method_details_list">
|
577
|
-
<h2>Instance Method Details</h2>
|
578
|
-
|
579
|
-
|
580
|
-
<div class="method_details first">
|
581
|
-
<h3 class="signature first" id="plot_2d_start_from-instance_method">
|
582
|
-
|
583
|
-
- (<tt>Object</tt>) <strong>plot_2d_start_from</strong>(slope, y_intercept, output = "#{filename}_match_2d.json", hits = @hits)
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
</h3><div class="docstring">
|
590
|
-
<div class="discussion">
|
591
|
-
|
592
|
-
<p>Generates a json file containing data used for plotting the start/end of
|
593
|
-
the matched region offsets in the prediction Param <tt>slope</tt>: slope of
|
594
|
-
the linear regression line <tt>y_intercept</tt>: the ecuation of the line
|
595
|
-
is y= slope*x + y_intercept <tt>output</tt>: location where the plot will
|
596
|
-
be saved in jped file format <tt>hits</tt>: array of Sequence objects</p>
|
597
|
-
|
598
|
-
|
599
|
-
</div>
|
600
|
-
</div>
|
601
|
-
<div class="tags">
|
602
|
-
|
603
|
-
|
604
|
-
</div><table class="source_code">
|
605
|
-
<tr>
|
606
|
-
<td>
|
607
|
-
<pre class="lines">
|
608
|
-
|
609
|
-
|
610
|
-
155
|
611
|
-
156
|
612
|
-
157
|
613
|
-
158
|
614
|
-
159
|
615
|
-
160
|
616
|
-
161
|
617
|
-
162
|
618
|
-
163
|
619
|
-
164
|
620
|
-
165
|
621
|
-
166
|
622
|
-
167
|
623
|
-
168
|
624
|
-
169</pre>
|
625
|
-
</td>
|
626
|
-
<td>
|
627
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/validation_gene_merge.rb', line 155</span>
|
628
|
-
|
629
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_plot_2d_start_from'>plot_2d_start_from</span><span class='lparen'>(</span><span class='id identifier rubyid_slope'>slope</span><span class='comma'>,</span> <span class='id identifier rubyid_y_intercept'>y_intercept</span><span class='comma'>,</span> <span class='id identifier rubyid_output'>output</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_filename'>filename</span><span class='rbrace'>}</span><span class='tstring_content'>_match_2d.json</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_hits'>hits</span> <span class='op'>=</span> <span class='ivar'>@hits</span><span class='rparen'>)</span>
|
630
|
-
<span class='id identifier rubyid_f'>f</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_output'>output</span> <span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>w</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
631
|
-
<span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='id identifier rubyid_hits'>hits</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hit'>hit</span><span class='op'>|</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>x</span><span class='tstring_end'>"</span></span><span class='op'>=></span><span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_hsp_list'>hsp_list</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hsp'>hsp</span><span class='op'>|</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_match_query_from'>match_query_from</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span><span class='comma'>,</span>
|
632
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>y</span><span class='tstring_end'>"</span></span><span class='op'>=></span><span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_hsp_list'>hsp_list</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hsp'>hsp</span><span class='op'>|</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_match_query_to'>match_query_to</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span><span class='rbrace'>}</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span><span class='rparen'>)</span>
|
633
|
-
<span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
|
634
|
-
<span class='kw'>return</span> <span class='const'>Plot</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_output'>output</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\/([^\/]+)$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
635
|
-
<span class='symbol'>:scatter</span><span class='comma'>,</span>
|
636
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Start vs end hsp match</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
637
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
638
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>from</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
639
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>to</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
640
|
-
<span class='id identifier rubyid_y_intercept'>y_intercept</span><span class='comma'>,</span>
|
641
|
-
<span class='id identifier rubyid_slope'>slope</span><span class='rparen'>)</span>
|
642
|
-
|
643
|
-
<span class='kw'>end</span></pre>
|
644
|
-
</td>
|
645
|
-
</tr>
|
646
|
-
</table>
|
647
|
-
</div>
|
648
|
-
|
649
|
-
<div class="method_details ">
|
650
|
-
<h3 class="signature " id="plot_matched_regions-instance_method">
|
651
|
-
|
652
|
-
- (<tt>Object</tt>) <strong>plot_matched_regions</strong>(output = "#{filename}_match.json", hits = @hits, prediction = @prediction)
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
</h3><div class="docstring">
|
659
|
-
<div class="discussion">
|
660
|
-
|
661
|
-
<p>Generates a json file containing data used for plotting the matched region
|
662
|
-
of the prediction for each hit Param <tt>output</tt>: location where the
|
663
|
-
plot will be saved in jped file format <tt>hits</tt>: array of Sequence
|
664
|
-
objects <tt>prediction</tt>: Sequence objects</p>
|
665
|
-
|
666
|
-
|
667
|
-
</div>
|
668
|
-
</div>
|
669
|
-
<div class="tags">
|
670
|
-
|
671
|
-
|
672
|
-
</div><table class="source_code">
|
673
|
-
<tr>
|
674
|
-
<td>
|
675
|
-
<pre class="lines">
|
676
|
-
|
677
|
-
|
678
|
-
120
|
679
|
-
121
|
680
|
-
122
|
681
|
-
123
|
682
|
-
124
|
683
|
-
125
|
684
|
-
126
|
685
|
-
127
|
686
|
-
128
|
687
|
-
129
|
688
|
-
130
|
689
|
-
131
|
690
|
-
132
|
691
|
-
133
|
692
|
-
134
|
693
|
-
135
|
694
|
-
136
|
695
|
-
137
|
696
|
-
138
|
697
|
-
139
|
698
|
-
140
|
699
|
-
141
|
700
|
-
142
|
701
|
-
143
|
702
|
-
144
|
703
|
-
145</pre>
|
704
|
-
</td>
|
705
|
-
<td>
|
706
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/validation_gene_merge.rb', line 120</span>
|
707
|
-
|
708
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_plot_matched_regions'>plot_matched_regions</span><span class='lparen'>(</span><span class='id identifier rubyid_output'>output</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_filename'>filename</span><span class='rbrace'>}</span><span class='tstring_content'>_match.json</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='id identifier rubyid_hits'>hits</span> <span class='op'>=</span> <span class='ivar'>@hits</span><span class='comma'>,</span> <span class='id identifier rubyid_prediction'>prediction</span> <span class='op'>=</span> <span class='ivar'>@prediction</span><span class='rparen'>)</span>
|
709
|
-
|
710
|
-
<span class='id identifier rubyid_colors'>colors</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>yellow</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>red</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
711
|
-
<span class='id identifier rubyid_f'>f</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_output'>output</span> <span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>w</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
712
|
-
<span class='id identifier rubyid_no_lines'>no_lines</span> <span class='op'>=</span> <span class='int'>100</span>
|
713
|
-
<span class='id identifier rubyid_ratio'>ratio</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_hits'>hits</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='op'>/</span><span class='id identifier rubyid_no_lines'>no_lines</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span>
|
714
|
-
|
715
|
-
<span class='kw'>if</span> <span class='id identifier rubyid_ratio'>ratio</span> <span class='op'>==</span> <span class='int'>0</span>
|
716
|
-
<span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_hits'>hits</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hit'>hit</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>y</span><span class='tstring_end'>"</span></span><span class='op'>=></span><span class='id identifier rubyid_i'>i</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>start</span><span class='tstring_end'>"</span></span><span class='op'>=></span><span class='int'>0</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>stop</span><span class='tstring_end'>"</span></span><span class='op'>=></span><span class='id identifier rubyid_prediction'>prediction</span><span class='period'>.</span><span class='id identifier rubyid_length_protein'>length_protein</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>color</span><span class='tstring_end'>"</span></span><span class='op'>=></span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>gray</span><span class='tstring_end'>"</span></span><span class='rbrace'>}</span><span class='rbrace'>}</span> <span class='op'>+</span>
|
717
|
-
<span class='id identifier rubyid_hits'>hits</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hit'>hit</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_hsp_list'>hsp_list</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hsp'>hsp</span><span class='op'>|</span>
|
718
|
-
<span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>y</span><span class='tstring_end'>"</span></span><span class='op'>=></span><span class='id identifier rubyid_i'>i</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>start</span><span class='tstring_end'>"</span></span><span class='op'>=></span><span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_match_query_from'>match_query_from</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>stop</span><span class='tstring_end'>"</span></span><span class='op'>=></span><span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_match_query_to'>match_query_to</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>color</span><span class='tstring_end'>"</span></span><span class='op'>=></span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_colors'>colors</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='op'>%</span><span class='int'>2</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rbrace'>}</span><span class='rbrace'>}</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span><span class='rparen'>)</span>
|
719
|
-
<span class='kw'>else</span>
|
720
|
-
<span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_write'>write</span><span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_hits'>hits</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hit'>hit</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_i'>i</span><span class='op'>%</span><span class='id identifier rubyid_ratio'>ratio</span><span class='op'>==</span><span class='int'>0</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hit'>hit</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>y</span><span class='tstring_end'>"</span></span><span class='op'>=></span><span class='id identifier rubyid_i'>i</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>start</span><span class='tstring_end'>"</span></span><span class='op'>=></span><span class='int'>0</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>stop</span><span class='tstring_end'>"</span></span><span class='op'>=></span><span class='id identifier rubyid_prediction'>prediction</span><span class='period'>.</span><span class='id identifier rubyid_length_protein'>length_protein</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>color</span><span class='tstring_end'>"</span></span><span class='op'>=></span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>gray</span><span class='tstring_end'>"</span></span><span class='rbrace'>}</span><span class='rbrace'>}</span> <span class='op'>+</span>
|
721
|
-
<span class='id identifier rubyid_hits'>hits</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hit'>hit</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_i'>i</span><span class='op'>%</span><span class='id identifier rubyid_ratio'>ratio</span><span class='op'>==</span><span class='int'>0</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_each_with_index'>each_with_index</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hit'>hit</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_hsp_list'>hsp_list</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hsp'>hsp</span><span class='op'>|</span>
|
722
|
-
<span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>y</span><span class='tstring_end'>"</span></span><span class='op'>=></span><span class='id identifier rubyid_i'>i</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>start</span><span class='tstring_end'>"</span></span><span class='op'>=></span><span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_match_query_from'>match_query_from</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>stop</span><span class='tstring_end'>"</span></span><span class='op'>=></span><span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_match_query_to'>match_query_to</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>color</span><span class='tstring_end'>"</span></span><span class='op'>=></span><span class='tstring'><span class='tstring_beg'>"</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_colors'>colors</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='op'>%</span><span class='int'>2</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_end'>"</span></span><span class='rbrace'>}</span><span class='rbrace'>}</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span><span class='rparen'>)</span>
|
723
|
-
<span class='kw'>end</span>
|
724
|
-
<span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_close'>close</span>
|
725
|
-
<span class='kw'>return</span> <span class='const'>Plot</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_output'>output</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\/([^\/]+)$</span><span class='regexp_end'>/</span></span><span class='rparen'>)</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='comma'>,</span>
|
726
|
-
<span class='symbol'>:lines</span><span class='comma'>,</span>
|
727
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Prediction vs hit match</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
728
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>prediction, gray; prediction high-scoring alignmet seq, red; prediction high-scoring alignmet seq, yellow</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
729
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>length</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
730
|
-
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>idx</span><span class='tstring_end'>"</span></span><span class='comma'>,</span>
|
731
|
-
<span class='id identifier rubyid_hits'>hits</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='rparen'>)</span>
|
732
|
-
|
733
|
-
<span class='kw'>end</span></pre>
|
734
|
-
</td>
|
735
|
-
</tr>
|
736
|
-
</table>
|
737
|
-
</div>
|
738
|
-
|
739
|
-
<div class="method_details ">
|
740
|
-
<h3 class="signature " id="run-instance_method">
|
741
|
-
|
742
|
-
- (<tt>Object</tt>) <strong>run</strong>
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
</h3><div class="docstring">
|
749
|
-
<div class="discussion">
|
750
|
-
|
751
|
-
<p>Validation test for gene merge Output: <tt>GeneMergeValidationOutput</tt>
|
752
|
-
object</p>
|
753
|
-
|
754
|
-
|
755
|
-
</div>
|
756
|
-
</div>
|
757
|
-
<div class="tags">
|
758
|
-
|
759
|
-
|
760
|
-
</div><table class="source_code">
|
761
|
-
<tr>
|
762
|
-
<td>
|
763
|
-
<pre class="lines">
|
764
|
-
|
765
|
-
|
766
|
-
82
|
767
|
-
83
|
768
|
-
84
|
769
|
-
85
|
770
|
-
86
|
771
|
-
87
|
772
|
-
88
|
773
|
-
89
|
774
|
-
90
|
775
|
-
91
|
776
|
-
92
|
777
|
-
93
|
778
|
-
94
|
779
|
-
95
|
780
|
-
96
|
781
|
-
97
|
782
|
-
98
|
783
|
-
99
|
784
|
-
100
|
785
|
-
101
|
786
|
-
102
|
787
|
-
103
|
788
|
-
104
|
789
|
-
105
|
790
|
-
106
|
791
|
-
107
|
792
|
-
108
|
793
|
-
109
|
794
|
-
110
|
795
|
-
111</pre>
|
796
|
-
</td>
|
797
|
-
<td>
|
798
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/validation_gene_merge.rb', line 82</span>
|
799
|
-
|
800
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_run'>run</span>
|
801
|
-
<span class='kw'>begin</span>
|
802
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>NotEnoughHitsError</span> <span class='kw'>unless</span> <span class='id identifier rubyid_hits'>hits</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>>=</span> <span class='int'>5</span>
|
803
|
-
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>Exception</span> <span class='kw'>unless</span> <span class='id identifier rubyid_prediction'>prediction</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Sequence</span> <span class='kw'>and</span> <span class='id identifier rubyid_hits'>hits</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span> <span class='const'>Sequence</span>
|
804
|
-
|
805
|
-
<span class='id identifier rubyid_start'>start</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
|
806
|
-
|
807
|
-
<span class='id identifier rubyid_lm_slope'>lm_slope</span> <span class='op'>=</span> <span class='id identifier rubyid_slope'>slope</span><span class='lbracket'>[</span><span class='int'>1</span><span class='rbracket'>]</span>
|
808
|
-
<span class='id identifier rubyid_y_intercept'>y_intercept</span> <span class='op'>=</span> <span class='id identifier rubyid_slope'>slope</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
|
809
|
-
|
810
|
-
<span class='ivar'>@validation_report</span> <span class='op'>=</span> <span class='const'>GeneMergeValidationOutput</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_lm_slope'>lm_slope</span><span class='rparen'>)</span>
|
811
|
-
|
812
|
-
<span class='id identifier rubyid_plot1'>plot1</span> <span class='op'>=</span> <span class='id identifier rubyid_plot_2d_start_from'>plot_2d_start_from</span><span class='lparen'>(</span><span class='id identifier rubyid_lm_slope'>lm_slope</span><span class='comma'>,</span> <span class='id identifier rubyid_y_intercept'>y_intercept</span><span class='rparen'>)</span>
|
813
|
-
<span class='ivar'>@validation_report</span><span class='period'>.</span><span class='id identifier rubyid_plot_files'>plot_files</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_plot1'>plot1</span><span class='rparen'>)</span>
|
814
|
-
<span class='id identifier rubyid_plot2'>plot2</span> <span class='op'>=</span> <span class='id identifier rubyid_plot_matched_regions'>plot_matched_regions</span>
|
815
|
-
<span class='ivar'>@validation_report</span><span class='period'>.</span><span class='id identifier rubyid_plot_files'>plot_files</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_plot2'>plot2</span><span class='rparen'>)</span>
|
816
|
-
<span class='ivar'>@running_time</span> <span class='op'>=</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span> <span class='op'>-</span> <span class='id identifier rubyid_start'>start</span>
|
817
|
-
<span class='kw'>return</span> <span class='ivar'>@validation_report</span>
|
818
|
-
|
819
|
-
<span class='comment'># Exception is raised when blast founds no hits
|
820
|
-
</span> <span class='kw'>rescue</span> <span class='const'>NotEnoughHitsError</span> <span class='op'>=></span> <span class='id identifier rubyid_error'>error</span>
|
821
|
-
<span class='ivar'>@validation_report</span> <span class='op'>=</span> <span class='const'>ValidationReport</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Not enough evidence</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:warning</span><span class='rparen'>)</span>
|
822
|
-
<span class='kw'>return</span> <span class='ivar'>@validation_report</span>
|
823
|
-
<span class='kw'>rescue</span> <span class='const'>Exception</span> <span class='op'>=></span> <span class='id identifier rubyid_error'>error</span>
|
824
|
-
<span class='ivar'>@validation_report</span><span class='period'>.</span><span class='id identifier rubyid_errors'>errors</span><span class='period'>.</span><span class='id identifier rubyid_push'>push</span> <span class='const'>OtherError</span>
|
825
|
-
<span class='ivar'>@validation_report</span> <span class='op'>=</span> <span class='const'>ValidationReport</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Unexpected error</span><span class='tstring_end'>"</span></span><span class='comma'>,</span> <span class='symbol'>:error</span><span class='rparen'>)</span>
|
826
|
-
<span class='kw'>return</span> <span class='ivar'>@validation_report</span>
|
827
|
-
<span class='kw'>end</span>
|
828
|
-
|
829
|
-
<span class='kw'>end</span></pre>
|
830
|
-
</td>
|
831
|
-
</tr>
|
832
|
-
</table>
|
833
|
-
</div>
|
834
|
-
|
835
|
-
<div class="method_details ">
|
836
|
-
<h3 class="signature " id="slope-instance_method">
|
837
|
-
|
838
|
-
- (<tt>Object</tt>) <strong>slope</strong>(hits = @hits)
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
</h3><div class="docstring">
|
845
|
-
<div class="discussion">
|
846
|
-
|
847
|
-
<p>Caclulates the slope of the regression line give a set of 2d coordonates of
|
848
|
-
the start/stop offests of the hits Param <tt>hits</tt>: array of Sequence
|
849
|
-
objects Code inspired from: <a
|
850
|
-
href="http://engineering.sharethrough.com/blog/2012/09/12/simple-linear-regression-using-ruby">engineering.sharethrough.com/blog/2012/09/12/simple-linear-regression-using-ruby</a>/
|
851
|
-
Output: The ecuation of the regression line: [y slope]</p>
|
852
|
-
|
853
|
-
|
854
|
-
</div>
|
855
|
-
</div>
|
856
|
-
<div class="tags">
|
857
|
-
|
858
|
-
|
859
|
-
</div><table class="source_code">
|
860
|
-
<tr>
|
861
|
-
<td>
|
862
|
-
<pre class="lines">
|
863
|
-
|
864
|
-
|
865
|
-
179
|
866
|
-
180
|
867
|
-
181
|
868
|
-
182
|
869
|
-
183
|
870
|
-
184
|
871
|
-
185
|
872
|
-
186
|
873
|
-
187
|
874
|
-
188
|
875
|
-
189
|
876
|
-
190
|
877
|
-
191
|
878
|
-
192
|
879
|
-
193
|
880
|
-
194
|
881
|
-
195
|
882
|
-
196
|
883
|
-
197
|
884
|
-
198
|
885
|
-
199
|
886
|
-
200
|
887
|
-
201
|
888
|
-
202
|
889
|
-
203</pre>
|
890
|
-
</td>
|
891
|
-
<td>
|
892
|
-
<pre class="code"><span class="info file"># File 'lib/genevalidator/validation_gene_merge.rb', line 179</span>
|
893
|
-
|
894
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_slope'>slope</span><span class='lparen'>(</span><span class='id identifier rubyid_hits'>hits</span> <span class='op'>=</span> <span class='ivar'>@hits</span><span class='rparen'>)</span>
|
895
|
-
|
896
|
-
<span class='id identifier rubyid_pairs'>pairs</span> <span class='op'>=</span> <span class='ivar'>@hits</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hit'>hit</span><span class='op'>|</span> <span class='const'>Pair</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_hsp_list'>hsp_list</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hsp'>hsp</span><span class='op'>|</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_match_query_from'>match_query_from</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_min'>min</span><span class='comma'>,</span> <span class='id identifier rubyid_hit'>hit</span><span class='period'>.</span><span class='id identifier rubyid_hsp_list'>hsp_list</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_hsp'>hsp</span><span class='op'>|</span> <span class='id identifier rubyid_hsp'>hsp</span><span class='period'>.</span><span class='id identifier rubyid_match_query_to'>match_query_to</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_max'>max</span><span class='rparen'>)</span><span class='rbrace'>}</span>
|
897
|
-
|
898
|
-
<span class='id identifier rubyid_xx'>xx</span> <span class='op'>=</span> <span class='id identifier rubyid_pairs'>pairs</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_pair'>pair</span><span class='op'>|</span> <span class='id identifier rubyid_pair'>pair</span><span class='period'>.</span><span class='id identifier rubyid_x'>x</span><span class='rbrace'>}</span>
|
899
|
-
<span class='id identifier rubyid_yy'>yy</span> <span class='op'>=</span> <span class='id identifier rubyid_pairs'>pairs</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span><span class='op'>|</span><span class='id identifier rubyid_pair'>pair</span><span class='op'>|</span> <span class='id identifier rubyid_pair'>pair</span><span class='period'>.</span><span class='id identifier rubyid_y'>y</span><span class='rbrace'>}</span>
|
900
|
-
|
901
|
-
<span class='comment'># calculate the slope
|
902
|
-
</span> <span class='id identifier rubyid_x_mean'>x_mean</span> <span class='op'>=</span> <span class='id identifier rubyid_xx'>xx</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_sum'>sum</span><span class='comma'>,</span> <span class='id identifier rubyid_x'>x</span><span class='op'>|</span> <span class='id identifier rubyid_x'>x</span> <span class='op'>+</span> <span class='id identifier rubyid_sum'>sum</span> <span class='rbrace'>}</span> <span class='op'>/</span> <span class='lparen'>(</span><span class='id identifier rubyid_xx'>xx</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>+</span> <span class='float'>0.0</span><span class='rparen'>)</span>
|
903
|
-
<span class='id identifier rubyid_y_mean'>y_mean</span> <span class='op'>=</span> <span class='id identifier rubyid_yy'>yy</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_sum'>sum</span><span class='comma'>,</span> <span class='id identifier rubyid_x'>x</span><span class='op'>|</span> <span class='id identifier rubyid_x'>x</span> <span class='op'>+</span> <span class='id identifier rubyid_sum'>sum</span> <span class='rbrace'>}</span> <span class='op'>/</span> <span class='lparen'>(</span><span class='id identifier rubyid_yy'>yy</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>+</span> <span class='float'>0.0</span><span class='rparen'>)</span>
|
904
|
-
|
905
|
-
<span class='id identifier rubyid_numerator'>numerator</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='int'>0</span><span class='op'>...</span><span class='id identifier rubyid_xx'>xx</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_sum'>sum</span><span class='comma'>,</span> <span class='id identifier rubyid_i'>i</span><span class='op'>|</span>
|
906
|
-
<span class='id identifier rubyid_sum'>sum</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_xx'>xx</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span> <span class='op'>-</span> <span class='id identifier rubyid_x_mean'>x_mean</span><span class='rparen'>)</span> <span class='op'>*</span> <span class='lparen'>(</span><span class='id identifier rubyid_yy'>yy</span><span class='lbracket'>[</span><span class='id identifier rubyid_i'>i</span><span class='rbracket'>]</span> <span class='op'>-</span> <span class='id identifier rubyid_y_mean'>y_mean</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
907
|
-
<span class='kw'>end</span>
|
908
|
-
|
909
|
-
<span class='id identifier rubyid_denominator'>denominator</span> <span class='op'>=</span> <span class='id identifier rubyid_xx'>xx</span><span class='period'>.</span><span class='id identifier rubyid_reduce'>reduce</span><span class='lparen'>(</span><span class='int'>0</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_sum'>sum</span><span class='comma'>,</span> <span class='id identifier rubyid_x'>x</span><span class='op'>|</span>
|
910
|
-
<span class='id identifier rubyid_sum'>sum</span> <span class='op'>+</span> <span class='lparen'>(</span><span class='lparen'>(</span><span class='id identifier rubyid_x'>x</span> <span class='op'>-</span> <span class='id identifier rubyid_x_mean'>x_mean</span><span class='rparen'>)</span> <span class='op'>**</span> <span class='int'>2</span><span class='rparen'>)</span>
|
911
|
-
<span class='kw'>end</span>
|
912
|
-
|
913
|
-
<span class='id identifier rubyid_slope'>slope</span> <span class='op'>=</span> <span class='id identifier rubyid_numerator'>numerator</span> <span class='op'>/</span> <span class='lparen'>(</span><span class='id identifier rubyid_denominator'>denominator</span> <span class='op'>+</span> <span class='float'>0.0</span><span class='rparen'>)</span>
|
914
|
-
<span class='id identifier rubyid_y_intercept'>y_intercept</span> <span class='op'>=</span> <span class='id identifier rubyid_y_mean'>y_mean</span> <span class='op'>-</span> <span class='lparen'>(</span><span class='id identifier rubyid_slope'>slope</span> <span class='op'>*</span> <span class='id identifier rubyid_x_mean'>x_mean</span><span class='rparen'>)</span>
|
915
|
-
|
916
|
-
<span class='kw'>return</span> <span class='lbracket'>[</span><span class='id identifier rubyid_y_intercept'>y_intercept</span><span class='comma'>,</span> <span class='id identifier rubyid_slope'>slope</span><span class='rbracket'>]</span>
|
917
|
-
|
918
|
-
<span class='kw'>end</span></pre>
|
919
|
-
</td>
|
920
|
-
</tr>
|
921
|
-
</table>
|
922
|
-
</div>
|
923
|
-
|
924
|
-
</div>
|
925
|
-
|
926
|
-
</div>
|
927
|
-
|
928
|
-
<div id="footer">
|
929
|
-
Generated on Sat Sep 28 07:01:33 2013 by
|
930
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
931
|
-
0.8.7.2 (ruby-1.9.3).
|
932
|
-
</div>
|
933
|
-
|
934
|
-
</body>
|
935
|
-
</html>
|