The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MassSpec::ViewSpectrum - Perl extension for viewing a mass spectrum.

SYNOPSIS

use MassSpec::ViewSpectrum;

open PNG, ">mygraphic.png" or die "Unable to open output file\n";
binmode PNG;

my @masses = (1036.4,1133,1437,1480,1502);
my @intensities = (0.1,0.15,0.05,0.10,0.2);
my @annotations = ('b','w','internal w', '','internal y');

my $vs = MassSpec::ViewSpectrum->new(\@masses,\@intensities, \@annotations);
$vs->set(yaxismultiplier => 1.8); # a sample tweak to adjust the output
my $output = $vs->plot();

print PNG $output;
close PNG;

DESCRIPTION

MassSpec::ViewSpectrum - Perl extension for viewing a mass spectrum, e.g. typically obtained from the fragmentation of proteins or peptides.

At present this is only implemented using GD graphics, but in principle this could be subclassed in the future to include alternative graphic paradigms such as SVG and Tk.

The current implementation uses a mixture of GD::Graph and native GD, since GD::Graph 1.43 fails to draw the required vertical lines correctly.

OPTIONS

width, height

The width and height of the canvas in pixels. Default: 500 x 500

linewidth

Width of vertical spectra in pixels. Default: 2

ylabeldelta

Offset of annotations on y axis measured in pixels. This is used to permit some whitespace separation between annotations and peaks. Default: 4

xticknumber

Number of tick marks on X axis. Default: 5

xlabeldelta

Number of pixels for offset of annotations on x axis. Default: 6

yaxismultiplier

A ratio, used to permit vertical room for peak annotations. Default: 2.0

outputformat

One of 'png', 'jpg' or 'gif'. Your local GD installation might only support a subset of these. Default: 'png'

x_label

The label which appears on the X axis. Default: 'm/z'

y_label

The label which appears on the Y axis Default: 'Intensity'

SEE ALSO

AUTHOR

Jonathan Epstein, <Jonathan_Epstein@nih.gov>

COPYRIGHT AND LICENSE

                         PUBLIC DOMAIN NOTICE

      National Institute for Child Health and Human Development

This software/database is a "United States Government Work" under the
terms of the United States Copyright Act.  It was written as part of
the author's official duties as a United States Government employee and
thus cannot be copyrighted.  This software/database is freely available
to the public for use. The National Institutes of Health and the U.S.
Government have not placed any restriction on its use or reproduction.

Although all reasonable efforts have been taken to ensure the accuracy
and reliability of the software and data, the NIH and the U.S.
Government do not and cannot warrant the performance or results that
may be obtained by using this software or data. The NIH and the U.S.
Government disclaim all warranties, express or implied, including
warranties of performance, merchantability or fitness for any particular
purpose.

Please cite the author in any work or product based on this material.

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