PlotSpectra {MSclassifR}R Documentation

Plot mass spectra with detected peaks

Description

This function performs a plot of a AbstractMassObject object (see the MALDIquant R package). It can be used to highlight peaks in a mass spectrum.

Usage


PlotSpectra(SpectralData, absx="ALL", Peaks=NULL, Peaks2=NULL, col_spec=1, 
            col_peak=2, shape_peak=3, col_peak2=2, shape_peak2=2)

Arguments

SpectralData

MassSpectrum object of S4 class (see MALDIquant R package).

absx

vector indicating lower and upper bounds for the mass-over-charge values to plot.

Peaks

MassPeaks object (see MALDIquant R package). If NULL, peaks are not highlighted.

Peaks2

numeric vector of mass-over-charge values to plot on the mass spectrum.

col_spec

color of the mass spectrum.

col_peak

color of the peak points corresponding to Peaks.

shape_peak

shape of the peak points corresponding to Peaks.

col_peak2

color of the peak points corresponding to Peaks2.

shape_peak2

Shape of the peak points corresponding to Peaks2.

Value

A ggplot object (see ggplot2 R package). Mass-over-charge values are in x-axis and intensities in y-axis.

Examples


library("MSclassifR")

# Load mass spectra
data("CitrobacterRKIspectra", package = "MSclassifR")
# Plot raw mass spectrum
PlotSpectra(SpectralData = CitrobacterRKIspectra[[1]])
# standard pre-processing of mass spectra
spectra <- SignalProcessing(CitrobacterRKIspectra)
# Plot pre-processed mass spectrum
PlotSpectra(SpectralData=spectra[[1]])
# detection of peaks in pre-processed mass spectra
peaks <- PeakDetection(x = spectra, averageMassSpec=FALSE)
# Plot peaks on pre-processed mass spectrum
PlotSpectra(SpectralData=spectra[[1]],Peaks=peaks[[1]],col_spec="blue",col_peak="black")


[Package MSclassifR version 0.3.3 Index]