The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Finnigan::Scan -- a lightweight scan data decoder

SUBMODULES

Finnigan::Scan::Profile

Finnigan::Scan::ProfileChunk

Finnigan::Scan::CentroidList

SYNOPSIS

  my $scan = Finnigan::Scan->decode(\*INPUT);
  say $scan->header->profile_size;
  say $scan->header->peak_list_size;

  my $profile = $scan->profile;
  $profile->set_converter( $converter ); # from ScanEvent
  my $bins = $profile->bins;
  my ($mz, $abundance) = @{$bins->[0]} # data in the first bin

  my $c = $scan->centroids
  say $c->count;

  say $c->list->[0]->[0]; # the first centroid M/z
  say $c->list->[0]->[1]; # abundance

DESCRIPTION

This decoder reads the entire ScanDataPacket, discarding the location and type meta-data. It is a more efficient alternative to the full-featured combination decoders using the Finnigan::Profile, Finnigan::Peaks and Finnigan::Peak modules.

METHODS

decode

The constructor method

Get the Finnigan::PacketHeader object. It is the only full-featured decoder object used in this module; since it occurs only once in each scan, there is no significant performance loss.

profile

Get the Finingan::Scan::Profile object containing the profile, if it exists

centroids

Get the Finnigan::Scan::CentroidList object containing the peak centroid list, if it exists

SEE ALSO

Finnigan::Scan: (lightweight decoder object)

Finnigan::PacketHeader (decoder object)

Finnigan::Scan::Profile (lightweight decoder object)

Finnigan::Scan::CentroidList (lightweight decoder object)

NAME

Finnigan::Scan::Profile -- a lightweight decoder for Finnigan scan profiles

SYNOPSIS use Finnigan;

  my $scan = Finnigan::Scan->decode(\*INPUT);
  my $profile = $scan->profile;
  $profile->set_converter( $converter ); # from ScanEvent
  my $bins = $profile->bins;
  my ($mz, $abundance) = @{$bins->[0]} # data in the first bin

DESCRIPTION

Finningan::Scan::Profile is a lightweight decoder for the Profile structure. It does not save the location and type information for the elements it decodes, nor does it provide element-level accessor methods. That makes it fast, at the cost of a slight reduction in convenience of access to the data.

It does not do file reads either, decoding part of the stream of profile chunks it receives as a constructor argument from the caller. Its full-featured equivalent, Finnigan::Profile, does a file read for every data element down to a single integer of floating-point number, which makes it very slow.

Finnigan::Scan::Profile is good for use in production-level programs that need extensive debugging. In a situation that calls for detailed exploration (e.g., a new file format), better use Finnigan::Peaks, which has an equivalent interface.

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::Scan::Profile returns the converted bins, optionally filling the gaps with zeroes.

METHODS

new($buffer, $layout)

The constructor method

nchunks

Get the number of chunks in the profile

set_converter($func_ref)

Set the converter function (f → M/z)

set_inverse_converter($func_ref)

Set the inverse converter function (M/z → f)

bins

Get the reference to an array of bin values. Each array element contains an (M/z, abundance) pair. This method calls the converter set by the set_converter method.

find_peak_intensity($query_mz)

Get the nearest peak in the profile for a given query value. The search will fail if nothing is found within 0.025 kHz of the target value (the parameter set internally as $MAX_DIST). This method supports the search for precursor intensity in uf-mzxml.

SEE ALSO

Profile (structure)

ProfileChunk (structure)

Finnigan::Scan::ProfileChunk (lightweight decoder)

Finnigan::PacketHeader (decoder object)

Finnigan::Profile (full-featured decoder)

Finnigan::Scan (lightweight decoder)

ScanEvent (structure containing conversion coefficients)

Finnigan::ScanEvent (decoder object)

uf-scan (command-line tool)

NAME

Finnigan::Scan::ProfileChunk -- a lightweight decoder for a single ProfileChunk structure

SYNOPSIS

  use Finnigan;

  my $chunk = new Finnigan::Scan::ProfileChunk($buffer, $offset, $packet_header->layout);
  $offset += $chunk->{size};

  say $chunk->{"first bin"} ;
  say $chunk->{fudge};
  my $nbins = $chunk->{nbins};
  foreach my $i ( 0 .. $nbins - 1) {
    say $chunk->signal->[$i];
  }

DESCRIPTION

Finningan::Scan::ProfileChunk is a lightweight decoder for the ProfileChunk structure, a segment of a Profile. It does not save the location and type information for the individual list elements, nor does it provide element-level accessor methods. That makes it fast, at the cost of a slight reduction in convenience of access to the data.

It does not do file reads either, decoding part of the stream of profile chunks it receives as a constructor argument from the caller. Its full-featured equivalent, Finnigan::Peaks, does a file read for every data element down to a single integer of floating-point number, which makes it very slow.

Finnigan::Scan::ProfileChunk is good for use in production-level programs that need extensive debugging. In a situation that calls for detailed exploration (e.g., a new file format), better use Finnigan::Peaks, which has an equivalent interface.

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.

Each ProfileChunk structure stores the first bin index, the number of bins, and a list of bin intensities. Additionally, in some layouts, it stores a small floating-point value that most probably represents the instrument drift relative to its calibrated value; this "fudge" value is added to the result of the the frequency to M/z conversion. The chunk layout (the presence or absence of the fudge value) is determined by the layout flag in PacketHeader.

METHODS

new($buffer, $offset, $layout)

The constructor method

This module defines no accessor method because doing so would defeat its goal of being a fast decoder.

NAME

Finnigan::Scan::CentroidList -- a lightweight decoder for PeakList, the list of peak centroids

SYNOPSIS

  use Finnigan;

  my $c = Finnigan::Scan::CentroidList->new($buffer);
  say $c->count;
  say $c->list->[0]->[0]; # M/z
  say $c->list->[0]->[1]; # abundance

DESCRIPTION

This simple and lightweight decoder for the PeakList structure does not save the location and type information for the individual list elements, nor does it provide element-level accessor methods. That makes it fast, at the cost of a slight reduction in convenience of access to the data.

It does not do file reads either, decoding the stream of floating-point numbers it receives as a constructor argument into an array of (M/z, abundance) pairs. Its full-featured equivalent, Finnigan::Peaks, does a file read for each peak, which makes it very slow.

It is good for use in production-level programs that do not need extensive debugging. In a situation that calls for detailed exploration (e.g., a new file format), better use Finnigan::Peaks, which has an equivalent interface.

METHODS

new($buffer)

The constructor method

count

Get the number of peaks in the list

list

Get the reference to an array containing the pairs of (M/z, abundance) values of each centroided peak

SEE ALSO

Finnigan::Scan: (lightweight decoder object)

Finnigan::PacketHeader (decoder object)

AUTHOR

Gene Selkov, <selkovjr@gmail.com>

COPYRIGHT AND LICENSE

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.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 595:

Non-ASCII character seen before =encoding in '→'. Assuming UTF-8