fcsparse 0.1.0 → 0.2.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.
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2013 Colin J. Fuller
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the Software), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,31 @@
1
+ A simple ruby parser for FCS-formatted flow cytometry data files. Supports writing of data and metadata to human-readable delimited text files or use as a library for further data analysis in ruby.
2
+
3
+ Requires a ruby interpreter (e.g. [http://ruby-lang.org]) with rubygems installed (this is installed by default for recent versions). Tested only on ruby versions 1.8.7 and 1.9.3.
4
+
5
+ For information on the default output formats see [output_formats Output Formats]
6
+
7
+ Currently processes v3.x FCS files only, and is limited at the moment to those with the data section in list mode and with floating point (single- or double-precision) data.
8
+
9
+ Full YARD api docs are available in the git repository. [http://fcsparse.googlecode.com/git/doc/index.html API Documentation Link].
10
+
11
+ To install as a ruby gem, run at the command line:
12
+ ```
13
+ gem install fcsparse
14
+ ```
15
+ (The gem can also be downloaded from [https://rubygems.org/gems/fcsparse].)
16
+
17
+
18
+ To run from the command line, install the gem, and run from the command line:
19
+ ```
20
+ fcsparse /path/to/mydata.fcs
21
+ ```
22
+ where `/path/to/mydata.fcs` is the full path to the file you want to process.
23
+
24
+
25
+ To process a file into human-readable comma-delimited data from ruby code (`require 'rubygems'` first for ruby 1.8):
26
+ ```
27
+ require 'fcsparse'
28
+
29
+ FCSParse.process_file(filename, include_header_row)
30
+ ```
31
+ where `filename` is the name (with path) to your FCS-formatted file, and `include_header_row` is an optional boolean parameter that specifies whether to write a title for each column in the output file.
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ #--
3
+ # Copyright (c) 2013 Colin J. Fuller
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the Software), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+ #++
23
+ #
24
+
25
+ require 'fcsparse'
26
+
27
+ FCSParse.process_file(ARGV[0], false)
@@ -0,0 +1,565 @@
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
+ Module: FCSParse
8
+
9
+ &mdash; Documentation by YARD 0.8.2.1
10
+
11
+ </title>
12
+
13
+ <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
14
+
15
+ <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" 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> &raquo;
35
+
36
+
37
+ <span class="title">FCSParse</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>Module: FCSParse
67
+
68
+
69
+
70
+ </h1>
71
+
72
+ <dl class="box">
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ <dt class="r1 last">Defined in:</dt>
82
+ <dd class="r1 last">lib/fcsparse.rb<span class="defines">,<br />
83
+ lib/fcsparse/fcsconst.rb,<br /> lib/fcsparse/fcsevent.rb</span>
84
+ </dd>
85
+
86
+ </dl>
87
+ <div class="clear"></div>
88
+
89
+ <h2>Overview</h2><div class="docstring">
90
+ <div class="discussion">
91
+
92
+ <p>Contains all classes and constants for parsing FCS v3.x formatted files.</p>
93
+
94
+
95
+ </div>
96
+ </div>
97
+ <div class="tags">
98
+
99
+
100
+ </div><h2>Defined Under Namespace</h2>
101
+ <p class="children">
102
+
103
+
104
+
105
+
106
+ <strong class="classes">Classes:</strong> <span class='object_link'><a href="FCSParse/FCSEvent.html" title="FCSParse::FCSEvent (class)">FCSEvent</a></span>, <span class='object_link'><a href="FCSParse/FCSFile.html" title="FCSParse::FCSFile (class)">FCSFile</a></span>, <span class='object_link'><a href="FCSParse/FCSParam.html" title="FCSParse::FCSParam (class)">FCSParam</a></span>
107
+
108
+
109
+ </p>
110
+
111
+ <h2>Constant Summary</h2>
112
+
113
+ <dl class="constants">
114
+
115
+ <dt id="H_VersionStart-constant" class="">H_VersionStart =
116
+ <div class="docstring">
117
+ <div class="discussion">
118
+
119
+ <p>byte offsets to the start and end of the version string</p>
120
+
121
+
122
+ </div>
123
+ </div>
124
+ <div class="tags">
125
+
126
+
127
+ </div>
128
+ </dt>
129
+ <dd><pre class="code"><span class='integer val'>0</span>
130
+ </pre></dd>
131
+
132
+ <dt id="H_VersionEnd-constant" class="">H_VersionEnd =
133
+
134
+ </dt>
135
+ <dd><pre class="code"><span class='integer val'>5</span>
136
+ </pre></dd>
137
+
138
+ <dt id="H_OffsetBlockLength-constant" class="">H_OffsetBlockLength =
139
+ <div class="docstring">
140
+ <div class="discussion">
141
+
142
+ <p>length of the block specifying the offsets of text, data, analysis sections</p>
143
+
144
+
145
+ </div>
146
+ </div>
147
+ <div class="tags">
148
+
149
+
150
+ </div>
151
+ </dt>
152
+ <dd><pre class="code"><span class='integer val'>8</span>
153
+ </pre></dd>
154
+
155
+ <dt id="H_TextBlockOffsetStart-constant" class="">H_TextBlockOffsetStart =
156
+ <div class="docstring">
157
+ <div class="discussion">
158
+
159
+ <p>offsets to the start and end of the text section offset</p>
160
+
161
+
162
+ </div>
163
+ </div>
164
+ <div class="tags">
165
+
166
+
167
+ </div>
168
+ </dt>
169
+ <dd><pre class="code"><span class='integer val'>10</span>
170
+ </pre></dd>
171
+
172
+ <dt id="H_TextBlockOffsetEnd-constant" class="">H_TextBlockOffsetEnd =
173
+
174
+ </dt>
175
+ <dd><pre class="code"><span class='integer val'>18</span>
176
+ </pre></dd>
177
+
178
+ <dt id="H_DataBlockOffsetStart-constant" class="">H_DataBlockOffsetStart =
179
+ <div class="docstring">
180
+ <div class="discussion">
181
+
182
+ <p>offsets to the start and end of the data section offset</p>
183
+
184
+
185
+ </div>
186
+ </div>
187
+ <div class="tags">
188
+
189
+
190
+ </div>
191
+ </dt>
192
+ <dd><pre class="code"><span class='integer val'>26</span>
193
+ </pre></dd>
194
+
195
+ <dt id="H_DataBlockOffsetEnd-constant" class="">H_DataBlockOffsetEnd =
196
+
197
+ </dt>
198
+ <dd><pre class="code"><span class='integer val'>34</span>
199
+ </pre></dd>
200
+
201
+ <dt id="H_AnalysisBlockOffsetStart-constant" class="">H_AnalysisBlockOffsetStart =
202
+ <div class="docstring">
203
+ <div class="discussion">
204
+
205
+ <p>offsets to the start and end of the analysis section offset</p>
206
+
207
+
208
+ </div>
209
+ </div>
210
+ <div class="tags">
211
+
212
+
213
+ </div>
214
+ </dt>
215
+ <dd><pre class="code"><span class='integer val'>42</span>
216
+ </pre></dd>
217
+
218
+ <dt id="H_AnalysisBlockOffsetEnd-constant" class="">H_AnalysisBlockOffsetEnd =
219
+
220
+ </dt>
221
+ <dd><pre class="code"><span class='integer val'>50</span>
222
+ </pre></dd>
223
+
224
+ <dt id="T_SupplTextStartKeyword-constant" class="">T_SupplTextStartKeyword =
225
+ <div class="docstring">
226
+ <div class="discussion">
227
+
228
+ <p>keyword specifying offset to supplementary text section</p>
229
+
230
+
231
+ </div>
232
+ </div>
233
+ <div class="tags">
234
+
235
+
236
+ </div>
237
+ </dt>
238
+ <dd><pre class="code"><span class='symbol val'>:$BEGINSTEXT</span>
239
+ </pre></dd>
240
+
241
+ <dt id="T_SupplTextEndKeyword-constant" class="">T_SupplTextEndKeyword =
242
+
243
+ </dt>
244
+ <dd><pre class="code"><span class='symbol val'>:$ENDSTEXT</span>
245
+ </pre></dd>
246
+
247
+ <dt id="T_AnalysisStartKeyword-constant" class="">T_AnalysisStartKeyword =
248
+ <div class="docstring">
249
+ <div class="discussion">
250
+
251
+ <p>keyword specifying offset to analysis section</p>
252
+
253
+
254
+ </div>
255
+ </div>
256
+ <div class="tags">
257
+
258
+
259
+ </div>
260
+ </dt>
261
+ <dd><pre class="code"><span class='symbol val'>:$BEGINANALYSIS</span>
262
+ </pre></dd>
263
+
264
+ <dt id="T_AnalysisEndKeyword-constant" class="">T_AnalysisEndKeyword =
265
+
266
+ </dt>
267
+ <dd><pre class="code"><span class='symbol val'>:$BEGINANALYSIS</span>
268
+ </pre></dd>
269
+
270
+ <dt id="T_DataStartKeyword-constant" class="">T_DataStartKeyword =
271
+ <div class="docstring">
272
+ <div class="discussion">
273
+
274
+ <p>keyword specifying offset to data section</p>
275
+
276
+
277
+ </div>
278
+ </div>
279
+ <div class="tags">
280
+
281
+
282
+ </div>
283
+ </dt>
284
+ <dd><pre class="code"><span class='symbol val'>:$BEGINDATA</span>
285
+ </pre></dd>
286
+
287
+ <dt id="T_DataEndKeyword-constant" class="">T_DataEndKeyword =
288
+
289
+ </dt>
290
+ <dd><pre class="code"><span class='symbol val'>:$ENDDATA</span>
291
+ </pre></dd>
292
+
293
+ <dt id="T_ModeKeyword-constant" class="">T_ModeKeyword =
294
+ <div class="docstring">
295
+ <div class="discussion">
296
+
297
+ <p>keyword specifying the data mode</p>
298
+
299
+
300
+ </div>
301
+ </div>
302
+ <div class="tags">
303
+
304
+
305
+ </div>
306
+ </dt>
307
+ <dd><pre class="code"><span class='symbol val'>:$MODE</span>
308
+ </pre></dd>
309
+
310
+ <dt id="T_DatatypeKeyword-constant" class="">T_DatatypeKeyword =
311
+ <div class="docstring">
312
+ <div class="discussion">
313
+
314
+ <p>keyword specifying the data type (e.g. integer, float, etc)</p>
315
+
316
+
317
+ </div>
318
+ </div>
319
+ <div class="tags">
320
+
321
+
322
+ </div>
323
+ </dt>
324
+ <dd><pre class="code"><span class='symbol val'>:$DATATYPE</span>
325
+ </pre></dd>
326
+
327
+ <dt id="T_ByteorderKeyword-constant" class="">T_ByteorderKeyword =
328
+ <div class="docstring">
329
+ <div class="discussion">
330
+
331
+ <p>keyword specifying byte order and value when little endian</p>
332
+
333
+
334
+ </div>
335
+ </div>
336
+ <div class="tags">
337
+
338
+
339
+ </div>
340
+ </dt>
341
+ <dd><pre class="code"><span class='symbol val'>:$BYTEORD</span>
342
+ </pre></dd>
343
+
344
+ <dt id="T_LittleEndianByteorder-constant" class="">T_LittleEndianByteorder =
345
+
346
+ </dt>
347
+ <dd><pre class="code"><span class='string val'>&quot;1,2,3,4&quot;</span>
348
+ </pre></dd>
349
+
350
+ <dt id="T_ParameterCountKeyword-constant" class="">T_ParameterCountKeyword =
351
+ <div class="docstring">
352
+ <div class="discussion">
353
+
354
+ <p>keyword specifying the number of parameters measured per event</p>
355
+
356
+
357
+ </div>
358
+ </div>
359
+ <div class="tags">
360
+
361
+
362
+ </div>
363
+ </dt>
364
+ <dd><pre class="code"><span class='symbol val'>:$PAR</span>
365
+ </pre></dd>
366
+
367
+ <dt id="T_EventCountKeyword-constant" class="">T_EventCountKeyword =
368
+ <div class="docstring">
369
+ <div class="discussion">
370
+
371
+ <p>keyword specifying total number of events</p>
372
+
373
+
374
+ </div>
375
+ </div>
376
+ <div class="tags">
377
+
378
+
379
+ </div>
380
+ </dt>
381
+ <dd><pre class="code"><span class='symbol val'>:$TOT</span>
382
+ </pre></dd>
383
+
384
+ <dt id="T_ParameterNameKeywordRegex-constant" class="">T_ParameterNameKeywordRegex =
385
+ <div class="docstring">
386
+ <div class="discussion">
387
+
388
+ <p>regular expressions matching names and ranges of all parameters</p>
389
+
390
+
391
+ </div>
392
+ </div>
393
+ <div class="tags">
394
+
395
+
396
+ </div>
397
+ </dt>
398
+ <dd><pre class="code"><span class='regexp val'>/P(\d+)N/</span>
399
+ </pre></dd>
400
+
401
+ <dt id="T_ParameterRangeKeywordRegex-constant" class="">T_ParameterRangeKeywordRegex =
402
+
403
+ </dt>
404
+ <dd><pre class="code"><span class='regexp val'>/P(\d+)R/</span>
405
+ </pre></dd>
406
+
407
+ </dl>
408
+
409
+
410
+
411
+
412
+
413
+
414
+
415
+
416
+
417
+ <h2>
418
+ Class Method Summary
419
+ <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
420
+ </h2>
421
+
422
+ <ul class="summary">
423
+
424
+ <li class="public ">
425
+ <span class="summary_signature">
426
+
427
+ <a href="#process_file-class_method" title="process_file (class method)">+ (Object) <strong>process_file</strong>(filename, data_header_row = true) </a>
428
+
429
+
430
+
431
+ </span>
432
+
433
+
434
+
435
+
436
+
437
+
438
+
439
+
440
+
441
+ <span class="summary_desc"><div class='inline'>
442
+ <p>Processes a specified FCS-formatted file, and writes human-readable output
443
+ to disk in the format specified by <span class='object_link'><a href="FCSParse/FCSFile.html#write_metadata_and_data-instance_method" title="FCSParse::FCSFile#write_metadata_and_data (method)">FCSFile#write_metadata_and_data</a></span>.</p>
444
+ </div></span>
445
+
446
+ </li>
447
+
448
+
449
+ </ul>
450
+
451
+
452
+
453
+
454
+ <div id="class_method_details" class="method_details_list">
455
+ <h2>Class Method Details</h2>
456
+
457
+
458
+ <div class="method_details first">
459
+ <h3 class="signature first" id="process_file-class_method">
460
+
461
+ + (<tt>Object</tt>) <strong>process_file</strong>(filename, data_header_row = true)
462
+
463
+
464
+
465
+
466
+
467
+ </h3><div class="docstring">
468
+ <div class="discussion">
469
+
470
+ <p>Processes a specified FCS-formatted file, and writes human-readable output
471
+ to disk in the format specified by <span class='object_link'><a href="FCSParse/FCSFile.html#write_metadata_and_data-instance_method" title="FCSParse::FCSFile#write_metadata_and_data (method)">FCSParse::FCSFile#write_metadata_and_data</a></span>.</p>
472
+
473
+ <p>the data file should have a header row with the name of each column’s
474
+ parameter. Defaults to true.</p>
475
+
476
+
477
+ </div>
478
+ </div>
479
+ <div class="tags">
480
+ <p class="tag_title">Parameters:</p>
481
+ <ul class="param">
482
+
483
+ <li>
484
+
485
+ <span class='name'>filename</span>
486
+
487
+
488
+ <span class='type'>(<tt>String</tt>)</span>
489
+
490
+
491
+
492
+ &mdash;
493
+ <div class='inline'>
494
+ <p>the filename of the FCS-encoded file (with path as required to locate it)</p>
495
+ </div>
496
+
497
+ </li>
498
+
499
+ <li>
500
+
501
+ <span class='name'>data_header_row</span>
502
+
503
+
504
+ <span class='type'>(<tt>Boolean</tt>)</span>
505
+
506
+
507
+ <em class="default">(defaults to: <tt>true</tt>)</em>
508
+
509
+
510
+ &mdash;
511
+ <div class='inline'>
512
+ <p>an optional parameter specifying whether</p>
513
+ </div>
514
+
515
+ </li>
516
+
517
+ </ul>
518
+
519
+
520
+ </div><table class="source_code">
521
+ <tr>
522
+ <td>
523
+ <pre class="lines">
524
+
525
+
526
+ 345
527
+ 346
528
+ 347
529
+ 348
530
+ 349
531
+ 350
532
+ 351
533
+ 352
534
+ 353</pre>
535
+ </td>
536
+ <td>
537
+ <pre class="code"><span class="info file"># File 'lib/fcsparse.rb', line 345</span>
538
+
539
+ <span class='rubyid_def def kw'>def</span> <span class='rubyid_self self kw'>self</span><span class='dot token'>.</span><span class='rubyid_process_file identifier id'>process_file</span><span class='lparen token'>(</span><span class='rubyid_filename identifier id'>filename</span><span class='comma token'>,</span> <span class='rubyid_data_header_row identifier id'>data_header_row</span> <span class='assign token'>=</span> <span class='rubyid_true true kw'>true</span><span class='rparen token'>)</span>
540
+
541
+ <span class='rubyid_fcsfile identifier id'>fcsfile</span> <span class='assign token'>=</span> <span class='rubyid_FCSFile constant id'>FCSFile</span><span class='dot token'>.</span><span class='rubyid_new_from_file identifier id'>new_from_file</span><span class='lparen token'>(</span><span class='rubyid_filename identifier id'>filename</span><span class='rparen token'>)</span>
542
+ <span class='rubyid_fcsfile identifier id'>fcsfile</span><span class='dot token'>.</span><span class='rubyid_parse identifier id'>parse</span>
543
+ <span class='rubyid_fcsfile identifier id'>fcsfile</span><span class='dot token'>.</span><span class='rubyid_write_metadata_and_data identifier id'>write_metadata_and_data</span><span class='lparen token'>(</span><span class='rubyid_data_header_row identifier id'>data_header_row</span><span class='rparen token'>)</span>
544
+
545
+ <span class='rubyid_nil nil kw'>nil</span>
546
+
547
+ <span class='rubyid_end end kw'>end</span>
548
+ </pre>
549
+ </td>
550
+ </tr>
551
+ </table>
552
+ </div>
553
+
554
+ </div>
555
+
556
+ </div>
557
+
558
+ <div id="footer">
559
+ Generated on Wed Jun 20 16:53:15 2012 by
560
+ <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
561
+ 0.8.2.1 (ruby-1.8.7).
562
+ </div>
563
+
564
+ </body>
565
+ </html>