parse_fasta 0.0.5 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/COPYING +674 -0
- data/README.md +56 -6
- data/Rakefile +6 -0
- data/doc/FastaFile.html +292 -0
- data/doc/File.html +212 -0
- data/doc/ParseFasta.html +144 -0
- data/doc/Sequence.html +361 -0
- data/doc/_index.html +136 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +161 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +161 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +178 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +71 -0
- data/doc/top-level-namespace.html +114 -0
- data/lib/parse_fasta/fasta_file.rb +46 -0
- data/lib/parse_fasta/sequence.rb +55 -0
- data/lib/parse_fasta/version.rb +19 -1
- data/lib/parse_fasta.rb +11 -21
- data/parse_fasta.gemspec +3 -0
- data/spec/lib/fasta_file_spec.rb +46 -0
- data/spec/lib/sequence_spec.rb +52 -0
- data/spec/spec_helper.rb +19 -0
- data/test_files/benchmark.rb +70 -0
- data/test_files/test.fa +9 -0
- metadata +75 -5
- data/LICENSE.txt +0 -22
- data/benchmark.rb +0 -22
data/README.md
CHANGED
@@ -18,16 +18,36 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Overview ##
|
20
20
|
|
21
|
-
|
21
|
+
I wanted a simple, fast way to parse fasta files so I wouldn't have to
|
22
|
+
keep writing annoying boilerplate fasta parsing code everytime I go to
|
23
|
+
do something with one. I will probably add more, but likely only tasks
|
24
|
+
that I find myself doing over and over.
|
22
25
|
|
23
|
-
|
26
|
+
## Usage ##
|
24
27
|
|
25
|
-
|
26
|
-
fasta files!
|
28
|
+
### Version 1.0.0 (current) ###
|
27
29
|
|
28
|
-
|
30
|
+
The monkey patch of the `File` class is no more! Here is the new print
|
31
|
+
length example:
|
32
|
+
|
33
|
+
require 'parse_fasta'
|
34
|
+
|
35
|
+
FastaFile.open(ARGV.first, 'r').each_record do |header, sequence|
|
36
|
+
puts [header, sequence.length].join("\t")
|
37
|
+
end
|
38
|
+
|
39
|
+
And here, a script to calculate GC content:
|
40
|
+
|
41
|
+
require 'parse_fasta'
|
42
|
+
|
43
|
+
FastaFile.open(ARGV.first, 'r').each_record do |header, sequence|
|
44
|
+
puts [header, sequence.gc].join("\t")
|
45
|
+
end
|
46
|
+
|
47
|
+
### Version 0.0.5 (old) ###
|
29
48
|
|
30
|
-
An example that lists the length for each sequence.
|
49
|
+
An example that lists the length for each sequence. (Won't work in
|
50
|
+
version 1.0.0)
|
31
51
|
|
32
52
|
require 'parse_fasta'
|
33
53
|
|
@@ -37,6 +57,12 @@ An example that lists the length for each sequence.
|
|
37
57
|
|
38
58
|
## Benchmark ##
|
39
59
|
|
60
|
+
Take these with a grain of salt since `BioRuby` is a heavy weight
|
61
|
+
module with lots of features and error checking, whereas `parse_fasta`
|
62
|
+
is meant to be lightweight and easy to use for my own coding.
|
63
|
+
|
64
|
+
### FastaFile#each_record ###
|
65
|
+
|
40
66
|
Just for fun, I wanted to compare the execution time to that of
|
41
67
|
BioRuby. I calculated sequence length for each fasta record with both
|
42
68
|
the `each_record` method from this gem and using the `FastaFormat`
|
@@ -52,6 +78,30 @@ was 1.1 gigabytes. Here are the results from Ruby's `Benchmark` class:
|
|
52
78
|
I just wanted a nice, clean way to parse fasta files, but being nearly
|
53
79
|
twice as fasta as BioRuby doesn't hurt either!
|
54
80
|
|
81
|
+
### Sequence#gc ###
|
82
|
+
|
83
|
+
I played around with a few different implementations for the `#gc`
|
84
|
+
method and found this one to be the fastest.
|
85
|
+
|
86
|
+
The test is done one random strings mating `/[AaCcTtGgUu]/`. `this_gc`
|
87
|
+
is `Sequence.new(str).gc`, and `bioruby_gc` is
|
88
|
+
`Bio::Sequence::NA.new(str).gc_content`.
|
89
|
+
|
90
|
+
To see how the methods scale, the test 1 string was 2,000,000 bases,
|
91
|
+
test 2 was 4,000,000 and test 3 was 8,000,000 bases.
|
92
|
+
|
93
|
+
user system total real
|
94
|
+
this_gc 1 0.030000 0.000000 0.030000 ( 0.029145)
|
95
|
+
bioruby_gc 1 2.030000 0.010000 2.040000 ( 2.157512)
|
96
|
+
|
97
|
+
this_gc 2 0.060000 0.000000 0.060000 ( 0.059408)
|
98
|
+
bioruby_gc 2 4.060000 0.020000 4.080000 ( 4.334159)
|
99
|
+
|
100
|
+
this_gc 3 0.120000 0.000000 0.120000 ( 0.185434)
|
101
|
+
bioruby_gc 3 8.060000 0.020000 8.080000 ( 8.659071)
|
102
|
+
|
103
|
+
Nice!
|
104
|
+
|
55
105
|
## Notes ##
|
56
106
|
|
57
107
|
Currently in doesn't check whether your file is actually a fasta file
|
data/Rakefile
CHANGED
data/doc/FastaFile.html
ADDED
@@ -0,0 +1,292 @@
|
|
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: FastaFile
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.4
|
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#!FastaFile.html";
|
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">FastaFile</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: FastaFile
|
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">File</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">File</li>
|
82
|
+
|
83
|
+
<li class="next">FastaFile</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/parse_fasta/fasta_file.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>Provides simple interface for parsing fasta format files.</p>
|
108
|
+
|
109
|
+
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
<div class="tags">
|
113
|
+
|
114
|
+
|
115
|
+
</div>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
<h2>
|
124
|
+
Instance Method Summary
|
125
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
126
|
+
</h2>
|
127
|
+
|
128
|
+
<ul class="summary">
|
129
|
+
|
130
|
+
<li class="public ">
|
131
|
+
<span class="summary_signature">
|
132
|
+
|
133
|
+
<a href="#each_record-instance_method" title="#each_record (instance method)">- (Object) <strong>each_record</strong> {|header, sequence| ... }</a>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
</span>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
<span class="summary_desc"><div class='inline'>
|
148
|
+
<p>Analagous to File#each_line, #each_record is used to go through a fasta
|
149
|
+
file record by record.</p>
|
150
|
+
</div></span>
|
151
|
+
|
152
|
+
</li>
|
153
|
+
|
154
|
+
|
155
|
+
</ul>
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
<div id="instance_method_details" class="method_details_list">
|
162
|
+
<h2>Instance Method Details</h2>
|
163
|
+
|
164
|
+
|
165
|
+
<div class="method_details first">
|
166
|
+
<h3 class="signature first" id="each_record-instance_method">
|
167
|
+
|
168
|
+
- (<tt>Object</tt>) <strong>each_record</strong> {|header, sequence| ... }
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
</h3><div class="docstring">
|
175
|
+
<div class="discussion">
|
176
|
+
|
177
|
+
<p>Analagous to File#each_line, #each_record is used to go through a fasta
|
178
|
+
file record by record.</p>
|
179
|
+
|
180
|
+
|
181
|
+
</div>
|
182
|
+
</div>
|
183
|
+
<div class="tags">
|
184
|
+
|
185
|
+
<div class="examples">
|
186
|
+
<p class="tag_title">Examples:</p>
|
187
|
+
|
188
|
+
|
189
|
+
<p class="example_title"><div class='inline'>
|
190
|
+
<p>Parsing a fasta file</p>
|
191
|
+
</div></p>
|
192
|
+
|
193
|
+
<pre class="example code"><code><span class='const'>FastaFile</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>reads.fna</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>r</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_each_record'>each_record</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_header'>header</span><span class='comma'>,</span> <span class='id identifier rubyid_sequence'>sequence</span><span class='op'>|</span>
|
194
|
+
<span class='id identifier rubyid_puts'>puts</span> <span class='lbracket'>[</span><span class='id identifier rubyid_header'>header</span><span class='comma'>,</span> <span class='id identifier rubyid_sequence'>sequence</span><span class='period'>.</span><span class='id identifier rubyid_gc'>gc</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\t</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
195
|
+
<span class='kw'>end</span></code></pre>
|
196
|
+
|
197
|
+
</div>
|
198
|
+
|
199
|
+
<p class="tag_title">Yields:</p>
|
200
|
+
<ul class="yield">
|
201
|
+
|
202
|
+
<li>
|
203
|
+
|
204
|
+
|
205
|
+
<span class='type'></span>
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
<div class='inline'>
|
211
|
+
<p>The header and sequence for each record in the fasta file to the block</p>
|
212
|
+
</div>
|
213
|
+
|
214
|
+
</li>
|
215
|
+
|
216
|
+
</ul>
|
217
|
+
<p class="tag_title">Yield Parameters:</p>
|
218
|
+
<ul class="yieldparam">
|
219
|
+
|
220
|
+
<li>
|
221
|
+
|
222
|
+
<span class='name'>header</span>
|
223
|
+
|
224
|
+
|
225
|
+
<span class='type'>(<tt>String</tt>)</span>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
—
|
230
|
+
<div class='inline'>
|
231
|
+
<p>The header of the fasta record without the leading '>'</p>
|
232
|
+
</div>
|
233
|
+
|
234
|
+
</li>
|
235
|
+
|
236
|
+
<li>
|
237
|
+
|
238
|
+
<span class='name'>sequence</span>
|
239
|
+
|
240
|
+
|
241
|
+
<span class='type'>(<tt><span class='object_link'><a href="Sequence.html" title="Sequence (class)">Sequence</a></span></tt>)</span>
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
—
|
246
|
+
<div class='inline'>
|
247
|
+
<p>The sequence of the fasta record</p>
|
248
|
+
</div>
|
249
|
+
|
250
|
+
</li>
|
251
|
+
|
252
|
+
</ul>
|
253
|
+
|
254
|
+
</div><table class="source_code">
|
255
|
+
<tr>
|
256
|
+
<td>
|
257
|
+
<pre class="lines">
|
258
|
+
|
259
|
+
|
260
|
+
35
|
261
|
+
36
|
262
|
+
37
|
263
|
+
38
|
264
|
+
39
|
265
|
+
40</pre>
|
266
|
+
</td>
|
267
|
+
<td>
|
268
|
+
<pre class="code"><span class="info file"># File 'lib/parse_fasta/fasta_file.rb', line 35</span>
|
269
|
+
|
270
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_each_record'>each_record</span>
|
271
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n></span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_line'>line</span><span class='op'>|</span>
|
272
|
+
<span class='id identifier rubyid_header'>header</span><span class='comma'>,</span> <span class='id identifier rubyid_sequence'>sequence</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_line'>parse_line</span><span class='lparen'>(</span><span class='id identifier rubyid_line'>line</span><span class='rparen'>)</span>
|
273
|
+
<span class='kw'>yield</span><span class='lparen'>(</span><span class='id identifier rubyid_header'>header</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='comma'>,</span> <span class='const'>Sequence</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_sequence'>sequence</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
274
|
+
<span class='kw'>end</span>
|
275
|
+
<span class='kw'>end</span></pre>
|
276
|
+
</td>
|
277
|
+
</tr>
|
278
|
+
</table>
|
279
|
+
</div>
|
280
|
+
|
281
|
+
</div>
|
282
|
+
|
283
|
+
</div>
|
284
|
+
|
285
|
+
<div id="footer">
|
286
|
+
Generated on Tue Jun 3 22:55:41 2014 by
|
287
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
288
|
+
0.8.7.4 (ruby-2.1.1).
|
289
|
+
</div>
|
290
|
+
|
291
|
+
</body>
|
292
|
+
</html>
|
data/doc/File.html
ADDED
@@ -0,0 +1,212 @@
|
|
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: File
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.4
|
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#!File.html";
|
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">File</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: File
|
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">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">File</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/parse_fasta/file.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
|
105
|
+
<p>You should have received a copy of the GNU General Public License along
|
106
|
+
with parse_fasta. If not, see <<a
|
107
|
+
href="http://www.gnu.org/licenses">www.gnu.org/licenses</a>/>.</p>
|
108
|
+
|
109
|
+
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
<div class="tags">
|
113
|
+
|
114
|
+
|
115
|
+
</div><div id="subclasses">
|
116
|
+
<h2>Direct Known Subclasses</h2>
|
117
|
+
<p class="children"><span class='object_link'><a href="FastaFile.html" title="FastaFile (class)">FastaFile</a></span></p>
|
118
|
+
</div>
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
<h2>
|
128
|
+
Instance Method Summary
|
129
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
130
|
+
</h2>
|
131
|
+
|
132
|
+
<ul class="summary">
|
133
|
+
|
134
|
+
<li class="public ">
|
135
|
+
<span class="summary_signature">
|
136
|
+
|
137
|
+
<a href="#each_record-instance_method" title="#each_record (instance method)">- (Object) <strong>each_record</strong> </a>
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
</span>
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
152
|
+
|
153
|
+
</li>
|
154
|
+
|
155
|
+
|
156
|
+
</ul>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
<div id="instance_method_details" class="method_details_list">
|
162
|
+
<h2>Instance Method Details</h2>
|
163
|
+
|
164
|
+
|
165
|
+
<div class="method_details first">
|
166
|
+
<h3 class="signature first" id="each_record-instance_method">
|
167
|
+
|
168
|
+
- (<tt>Object</tt>) <strong>each_record</strong>
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
</h3><table class="source_code">
|
175
|
+
<tr>
|
176
|
+
<td>
|
177
|
+
<pre class="lines">
|
178
|
+
|
179
|
+
|
180
|
+
20
|
181
|
+
21
|
182
|
+
22
|
183
|
+
23
|
184
|
+
24
|
185
|
+
25</pre>
|
186
|
+
</td>
|
187
|
+
<td>
|
188
|
+
<pre class="code"><span class="info file"># File 'lib/parse_fasta/file.rb', line 20</span>
|
189
|
+
|
190
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_each_record'>each_record</span>
|
191
|
+
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>\n></span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_line'>line</span><span class='op'>|</span>
|
192
|
+
<span class='id identifier rubyid_header'>header</span><span class='comma'>,</span> <span class='id identifier rubyid_sequence'>sequence</span> <span class='op'>=</span> <span class='id identifier rubyid_parse_line'>parse_line</span><span class='lparen'>(</span><span class='id identifier rubyid_line'>line</span><span class='rparen'>)</span>
|
193
|
+
<span class='kw'>yield</span> <span class='id identifier rubyid_header'>header</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='comma'>,</span> <span class='id identifier rubyid_sequence'>sequence</span>
|
194
|
+
<span class='kw'>end</span>
|
195
|
+
<span class='kw'>end</span></pre>
|
196
|
+
</td>
|
197
|
+
</tr>
|
198
|
+
</table>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
</div>
|
202
|
+
|
203
|
+
</div>
|
204
|
+
|
205
|
+
<div id="footer">
|
206
|
+
Generated on Tue Jun 3 22:41:14 2014 by
|
207
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
208
|
+
0.8.7.4 (ruby-2.1.1).
|
209
|
+
</div>
|
210
|
+
|
211
|
+
</body>
|
212
|
+
</html>
|