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

NAME

MS::Spectrum - Base class for spectrum objects

SYNOPSIS

    use MS::Reader::Foo;

    my $reader = MS::Reader::Foo->new('spectra.file');

    while (my $spectrum = $reader->next_spectrum) {
        
        # $spectrum inherits from MS::Spectrum, so you can always do:
        my $id  = $spectrum->id;
        my $rt  = $spectrum->rt;
        my $mz  = $spectrum->mz;
        my $int = $spectrum->int;
        my $lvl = $spectrum->ms_level;

    }

DESCRIPTION

MS::Spectrum is a base class for spectrum objects generated by file parsers. It defines a minimum set of methods that subclasses should provide (currently required but not enforced). Subclasses can (and should) provide additional methods depending on the information available - see individual subclass documentation for details.

METHODS

These methods are required to be defined by subclasses.

id

Returns the spectrum ID as a string. The ID format is not defined and depends on the source of the data file.

rt

Returns the retention time of the spectrum in seconds. Subclasses should ensure that any necessary conversions are carried out to return a value with the proper units.

mz

Returns an reference to an array containing ordered mass/charge values for the spectrum (must be equal in length to that returned by int() ).

int

Returns a reference to an array containing ordered intensity values for the spectrum (must be equal in length to that returned by mz() ).

ms_level

Returns the MS level (e.g. MS1, MS2) of the spectrum as a positive integer. Should return undefined if the level cannot be determined from input.

mz_int_by_range

    my ($mz, $int) = $spectrum->mz_int_by_range(
        [200, 300],
        [500, 600],
    );

A convenience method that takes an array of array references, each containing a pair of start and end m/z values. Returns two references to arrays of m/z and intensity values that occur within the specified windows.

CAVEATS AND BUGS

Please reports bugs to the author.

AUTHOR

Jeremy Volkening <jdv@base2bio.com>

COPYRIGHT AND LICENSE

Copyright 2016-2019 Jeremy Volkening

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.