Finnigan

 view release on metacpan or  search on metacpan

bin/uf-scan-light  view on Meta::CPAN

177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
Gives the number of a single scan to process
 
=item B<-b[ookends]>
 
Sets the number of empty bins to add prepend and append to each profile chunk. Doing so can enhance the appearance of peak shapes rendered on simple plots when the profiles are filtered. Threshold filtering removes the bases of detected peaks as well...
 
=back
 
=head1 DESCRIPTION
 
B<uf-scan-light> can be used to list the scan data for a single scan. Unlike L<uf-scan>, it is based on a lightweight version of scan data decoder, L<Finnigan::Scan>, which does not preserve the location and type data of decoded elements and therefor...
 
Also, B<uf-scan-light> does not output the raw profiles. It automatically converts frequency values to M/z.
 
The B<-profile> option instructs B<uf-scan-light> to print the profile data. The B<-list> option lists the peaks.
 
Options B<-profile> and B<-list> are mutually exclusive.
 
To convert the raw scan data into M/z values, use the B<-v> option.
 
Option B<-bookends> adds the specified number of empty bins to each side of a profile chunk. If the gap is smaller than 2x the number of bookend bins, it is completely zeroed out.

lib/Finnigan.pm  view on Meta::CPAN

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
=head1 SYNOPSIS
 
  use Finnigan;
 
  seek INPUT, $object_address, 0
  my $o = Finnigan::Object->decode(\*STREAM, $arg);
  $o->dump;
 
where 'Object' is a symbol for any of the specific decoder objects
(C<Finnigan::*>) and C<STREAM> is an open filehandle positioned at the
start of the structure to be decoded. Some decoders may require an
additional argument (file format version).
 
=head1 DESCRIPTION
 
C<Finnigan> is a non-functional package whose only purpose is to pull
in all other packages in the module into its namespace. It does no
work; all work is done in the sub-modules. Each submodule has its own
documentation; please see the L</SUBMODULES> section below or visit
L<the project's home page|http://code.google.com/p/unfinnigan> for a
more detailed descripion of the file format, data structures, decoders

lib/Finnigan.pm  view on Meta::CPAN

97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
recombining the existing decoders.
 
=head3 Common submodule methods
 
=over 4
 
=item decode($stream, $arg)
 
Each C<Finnigan::*> object has a constructor method named C<decode()>,
whose first argument is a filehandle positioned at the start of the
object to be decoded. Some decoders require additional arguments, such
as the file version number. A single argument is passed as it is,
while multiple arguments can be passed as an array reference.
 
The constructor advances the handle to the start of the next object,
so seeking to the start of the object of interest is only necessary
when doing partial reads; in principle, the entire file can be read by
calling of object constructors in sequency. In reality, it is often
more efficient to seek ahead to fetch an index structure stored near
the end of the file, then go back to the data stream using the
pointers in the index.
 
The decoded data can be obtained by calling accessor methods on the
object or by de-referencing the object reference (since all Finnigan
objects are blessed hash references):
 
  $x = $object->element
 
or
 
  $x = $object->{element}
 
The accessor option is nicer, as it leads to less clutter in the code

lib/Finnigan.pm  view on Meta::CPAN

132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
this reason, hash dereference is preferred in performance-critical
code (inside loops).
 
This is an "instance" method; it must be defined in each non-trivial
decoder object.
 
=item dump(%args)
 
All Finnigan objects are the descendants of L<Finnigan::Decoder>. One
of the methods they inherit is C<dump>, which provides an easy way to
explore the contents of decoded objects. The C<dump> method prints out
the structure of the object it is called on in a few styles, with
relative or absolute addressess.
 
For example, many object dumps used in L<this
thus:
 
  $object->dump(style => 'wiki', relative => 1);
 
The C<style> argument can have the values of C<wiki>, C<html> or no

lib/Finnigan.pm  view on Meta::CPAN

169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
The C<$template_list> argument names all fields to decode (in this
case, just one: C<length>), the template to use for each field (in
this example, C<V>), and provides a human-readable symbol for the
template, which can be used in a number of ways; for example, when
inspecting the structures with the C<dump> method.
 
This may seem like a kludgy way of reading four bytes, but the upshot
is that the resulting C<$object> will have the size, type and location
information tucked into it, so it can be analysed and dumped in a way
consistent with other decoded objects. The advantage becomes even more
apparent when the structure is more complex than a single scalar object.
 
The inherited C<read> method provides the core functionality in all Finnigan
decoders.
 
If only the value of the object is sought, then this even more kludgy
code can be used:
 
  my $stream_length = Finnigan::Decoder->read(\*INPUT, ['length' => ['V', 'UInt32']])->{data}->{length}->{value};

lib/Finnigan/Decoder.pm  view on Meta::CPAN

421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
every odd item specifies the unpack template.
 
Perl unpack templates are used to decode most fields. For some fields, non-perl templates are used, such as:
 
=over 2
 
=item * object: instructs the current decoder to call another Finnigan decoder at that location.
 
=item * windows_time: instructs Finingan::Decoder to call its own Windows timestamp routine.
 
=item * varstr: decoded as a Windows Pascal string in a special case in the Finnigan::Decoder::read() method.
 
=back
 
=head2 METHODS
 
=over 4
 
=item read($class, $stream, $fields, $any_arg)
 
Returns a new decoder blessed into class C<$class> and initialized
with the values read from C<$stream> and decoded according to a list
of templates specified in C<$fields>.
 
The fourth argument, C<$any_arg> is not used by the Decoder class, but
may be used by derived classes to pass parse context to their
component decoders. For example, this can be useful to parse
structures whose layout is governed by the data they contain; in that
case if the layout indicator is read by the top-level decoder, it can
be passed to lower-level decoders whose work depends on it. Also, this
argument is used by the user program to pass the Finnigan file version
to version-sensitive decoders.

lib/Finnigan/Decoder.pm  view on Meta::CPAN

455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
  my $fields = [
    "mz"        => ['f<', 'Float32'],
    "abundance" => ['f<', 'Float32'],
  ];
 
=item decode($stream, $fields, $any_arg)
 
This method must be called on a blessed, instantiated Decoder. The
C<read()> method calls it internally, but it can also be used by the
user code in those cases where not all data can be decoded with a
plain list of templates. In some cases, it may be necessary to decode
one part of an object, analyse it, make decisions about the rest
(calculate sizes, layouts, etc.), and then grow the object under
construction by decoding more data from the stream.
 
 
=item iterate_scalar($stream, $count, $name, $desc)
 
This method is similar to the C<decode> metod, in that it does not
instantiate a Decoder, but rather adds data to an existing one. Its

lib/Finnigan/Decoder.pm  view on Meta::CPAN

481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
integers, the template description must be of the form:
 
  $desc = ['V', 'UInt32']
 
 
=item iterate_object($stream, $count, $name, $class, $any_arg)
 
Similarly to C<iterate_scalar()>, this method can be used to read a
list of structures into the current decoder's attribute specified in
the C<$name> argument, but in this case, the list elements can be
complex structures to be decoded with their own decoder specified in
C<$class>. The optional argument C<$any_arg> can be used to parse
context information to that decoder.
 
=item purge_unused_data
 
Delete the location, size and type data for all structure
elements. Calling this method will free some memory when no
introspection is needeed (the necessary measure in production-grade
code)
 
=back
 
=head2 METHODS
 
=over 4
 
=item addr
 
Get the seek address of the decoded object
 
=item size
 
Get object size
 
=item data
 
Get the object's data hash (equivalent to $obj->{data}). Every data hash element contains the decoded value as well as location and type data.
 
=item item($key)
 
Get an item by name (equivalent to $obj->{data}->{$key})
 
=item values
 
Extract the simple value hash (no location data, only the element names and values)
 
=item dump($param)

lib/Finnigan/GenericDataHeader.pm  view on Meta::CPAN

78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
The constructor method
 
=item n
 
Get the number of fields in each record
 
=item fields
 
Get the list of Finnigan::GenericDataDescriptor objects. Each
descriptor object corresponds to a field in the GenericRecord
structure to be decoded with this header.
 
=item labels
 
Get the list of descriptor labels in the order they occur in the header
 
=item field_templates
 
Get the list of unpack templates for the entire record in the form
that can be passed to Finnigan::Decoder.

lib/Finnigan/GenericRecord.pm  view on Meta::CPAN

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
  my $record = Finnigan::GenericRecord->decode(\*INPUT, $header);
 
=head1 DESCRIPTION
 
Finnigan::GenericRecord is a pass-through decorder that only passes
the field definitions it obtains from the header
(Finnigan::GenericDataHeader) to Finnigan::Decoder.
 
Because Thermo's GenericRecord objects are odered and may have
"virtual" gaps and section titles in them, the Finnigan::Decoder's
method of stashing the decoded data into a hash is not directly
applicable. A GenericRecord may have duplicate keys and the key order
needs to be preserved. That is why Finnigan::GenericRecord relies on
the B<field_templates> method of Finnigan::GenericDataHeader to insert
ordinal numbers into the keys.
 
=head2 METHODS
 
=over 4
 
=item decode

lib/Finnigan/InstrumentLogRecord.pm  view on Meta::CPAN

60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
This decoder is prototyped on Finnigan::GenericRecord, which is a
pass-through decorder that only passes the field definitions it
obtains from the header (Finnigan::GenericDataHeader) to
Finnigan::Decoder. It is essentially a copy of the
Finnigan::GenericRecord code with one specific field (retention time)
prepended to the template list.
 
Because Thermo's GenericRecord objects are odered and may have
"virtual" spacers and section titles in them, the Finnigan::Decoder's
method of stashing the decoded data into a hash is not directly
applicable. A GenericRecord may have duplicate keys and the key order
needs to be preserved. That is why Finnigan::GenericRecord relies on
the B<field_templates> method of Finnigan::GenericDataHeader to insert
ordinal numbers into the keys.
 
=head2 METHODS
 
=over 4
 
=item decode($stream)
 
The constructor method
 
=item time
 
Get the timestamp. The timestamp is retention time measured in seconds
and stored as floating-point value.
 
=item fields
 
Get the list of all fields in the record. Each field is decoded with
the Finnigan::GenericRecord decoder using the definitions from
Finnigan::GenericDataHeader, and it contains, for example, the
following data:
 
  {
    value => '8.1953125',
    type => 'Float32',
    addr => 803445,
    seq => 70,
    size => 4

lib/Finnigan/OLE2DirectoryEntry.pm  view on Meta::CPAN

254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
efficiency of access). The directory entry's constructor method
B<new()> is called recursively starting from the root directory
contained in the file's 0-th property.
 
=head2 METHODS
 
=over 4
 
=item new($file, $propertyIndex)
 
The constructor method. Its first argument is a reference to Finnigan::OLE2File, and the second argument is the index of the file's property (Finnigan::OLE2Property) to be decoded as a directory entry. The root directory is always found in property n...
 
=item list($style)
 
Lists the directory's contents to STDOUT. The style argument can have
three values: wiki, html, and plain (or undefined). The wiki and html
styles have not been implemented yet.
 
This method is not useful as part of the API (directory listings are
better understood by humans). But once the path to a node is known, it
can be retrieved with the find method.

lib/Finnigan/OLE2Header.pm  view on Meta::CPAN

91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
=head1 SYNOPSIS
 
  use Finnigan;
  my $header = Finnigan::OLE2Header->decode(\*INPUT);
  say "$header";
 
=head1 DESCRIPTION
 
This is an auxiliary decoder used by Finnigan::OLE2File; it is of no use on its own.
 
The OLE2 header is the first the first object to be decoded on the way
to parsing the embedded filesystem. It contains the key parameters that
determine the shape of the filesystem.
 
=head2 METHODS
 
=over 4
 
=item  decode($stream)
 
The constructor method

lib/Finnigan/Peaks.pm  view on Meta::CPAN

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
  say $peaks->size;
  $peaks->list;
 
=head1 DESCRIPTION
 
This decoder reads the stream of floating-point numbers into a list of
L<Finnigan::Peak> objects, each containing an (M/z, abundance) pair.
 
It is a simple but full-featured decoder for the PeakList structure,
part of ScanDataPacket. The data it generates contain the seek
addresses, sizes and types of all decoded elements, no matter how
small. That makes it very handy in the exploration of the file format
and in writing new code, but it is not very efficient in production
work.
 
In performance-sensitive applications, the more lightweight
L<Finnigan::Scan> module should be used, which includes
L<Finnigan::Scan::CentroidList> and other related submodules. It can be
used as a drop-in replacement for the full-featured modules, but it
does not store the seek addresses and object types, greatly reducing
the overhead.

lib/Finnigan/Profile.pm  view on Meta::CPAN

244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
  say $profile->nchunks;
  say $profile->nbins;
  $profile->set_converter( $converter_function_ref );
  my $bins = $profile->bins; # calls the converter
  my ($mz, $abundance) = @{$bins->[0]} # data in the first bin
 
=head1 DESCRIPTION
 
Finningan::Profile is a full-featured decoder for Finnigan scan
profiles. The data it generates contain the seek addresses, sizes and
types of all decoded elements, no matter how small. That makes it very
handy in the exploration of the file format and in writing new code,
but it is not very efficient in production work.
 
 
In performance-sensitive applications, the more lightweight
Finnigan::Scan module should be used, which includes
Finnigan::Scan::Profile and other related submodules. It can be used
as a drop-in replacement for the full-featured modules, but it does
not store the seek addresses and object types, greatly reducing the
overhead.

lib/Finnigan/ProfileChunk.pm  view on Meta::CPAN

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
  say $chunk->first_bin;
  say $chunk->fudge;
  my $nbins = $chunk->nbins;
  say $chunk->fudge;
  foreach my $i ( 0 .. $nbins - 1) {
    say $chunk->signal->[$i];
  }
 
=head1 DESCRIPTION
 
Finningan::ProfileChunk is a full-featured decoder for the ProfileChunk structure, a segment of a Profile. The data it generates contain the seek addresses, sizes and types of all decoded elements, no matter how small. That makes it very handy in the...
 
In performance-sensitive applications, the more lightweight Finnigan::Scan? module should be used, which includes Finnigan::Scan::ProfileChunk? and other related submodules. It can be used as a drop-in replacement for the full-featured modules, but i...
 
Every scan done in the B<profile mode> has a profile, which is either a time-domain signal or a frequency spectrum accumulated in histogram-like bins.
 
A profile can be either raw or filtered. Filtered profiles are sparse; they consist of separate data chunks. Each chunk consists of a contiguous range of bins containing the above-threshold signal. The bins whose values fall below a cerain threshold ...
 
One special case is raw profile, which preserves all data. Since there are no gaps in a raw profile, it is represented by a single chunk covering the entire range of bins, so the same container structure is suitable for complete profiles, as well as ...
 
The bins store the signal intensity, and the bin co-ordinates are typically the frequencies of Fourier-transformed signal. Since the bins are equally spaced in the frequency domain, only the first bin frequency is stored in each profile header. The b...

lib/Finnigan/ScanParameters.pm  view on Meta::CPAN

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
    say $key  . "\t" . $p->{data}->{$key}->{value};
  }
 
 
=head2 METHODS
 
=over 4
 
=item decode($stream, $header->field_templates)
 
The constructor method. It needs a previously decoded header to work.
 
=item charge_state
 
Get the charge state of the base ion
 
=item injection_time
 
Get ion injection time in milliseconds
 
=item monoisotopic_mz



( run in 0.411 second using v1.01-cache-2.11-cpan-4e96b696675 )