MS::Spectrum - Base class for spectrum objects
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; }
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.
MS::Spectrum
These methods are required to be defined by subclasses.
Returns the spectrum ID as a string. The ID format is not defined and depends on the source of the data file.
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.
Returns an reference to an array containing ordered mass/charge values for the spectrum (must be equal in length to that returned by int() ).
Returns a reference to an array containing ordered intensity values for the spectrum (must be equal in length to that returned by mz() ).
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.
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.
Please reports bugs to the author.
Jeremy Volkening <jdv@base2bio.com>
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/>.
To install MS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MS
CPAN shell
perl -MCPAN -e shell install MS
For more information on module installation, please visit the detailed CPAN module installation guide.