Finnigan::Profile -- a full-featured decoder for Finnigan scan profiles


  use Finnigan;

  say $entry->offset; # returns an offset from the start of scan data stream 
  say $entry->data_size;
  my $profile = Finnigan::Profile->decode( \*INPUT, $packet_header->layout );
  say $profile->first_value;
  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


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.

Every scan done in the 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 are simply discarded, leaving gaps in the profile -- the reason for the ProfileChunk structure to exist.

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 for sparse ones.

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 bin width is common for all bins and it is also stored in the same header. With these data, it is possible to calculate the bin values based on the bin indices.

The programs reading these data must convert the frequencies into the M/z values using the conversion function specific to the type of analyser used to acquire the signal. The calibrated coefficients for this convesion function are stored in the ScanEvent structure (one instance of this structure exists for every scan).

The bins method of Finnigan::Profile returns the converted bins, optionally filling the gaps with zeroes.


decode($stream, $layout)

The constructor method


Get the number of chunks in the profile


Get the total number of bins in the profile


Get the the value of the first bin in the profile


Get the bin width and the direction of change (the frequency step needed to go from one bin to the next is a negative value)

chunk, chunks

Get the list of Finnigan::ProfileChunk? objects representing the profile data


Set the converter function (f -> M/z)


Set the inverse converter function (M/z -> f)


Get the reference to an array of bin values. Each array element contains an (_M/z_, abundance) pair.

List the bin contents to STDOUT



Replaced with nchunks










Gene Selkov, <>


Copyright (C) 2010 by Gene Selkov

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.