PlotSpec {InterpretMSSpectrum}R Documentation

Plot Mass Spectrum.

Description

PlotSpec will read, evaluate and plot a deconvoluted mass spectrum (mass*intensity pairs) from TMS-derivatized GC-APCI-MS data. The main purpose is to visualize the relation between deconvoluted masses.

Usage

PlotSpec(
  x = NULL,
  masslab = 0.1,
  rellab = FALSE,
  cutoff = 0.01,
  cols = NULL,
  txt = NULL,
  mz_prec = 4,
  ionization = NULL,
  neutral_losses = NULL,
  neutral_loss_cutoff = NULL,
  substitutions = NULL,
  precursor = NULL,
  xlim = NULL,
  ylim = NULL
)

Arguments

x

A two-column matrix with ("mz", "int") information.

masslab

The cutoff value (relative to basepeak) for text annotation of peaks.

rellab

TRUE/FALSE. Label masses relative to largest mass in plot (if TRUE), absolute (if FALSE) or to specified mass (if numeric).

cutoff

Show only peaks with intensity higher than cutoff*I(base peak). This will limit the x-axis accordingly.

cols

Color vector for peaks with length(cols)==nrow(x).

txt

Label peaks with specified text (column 1 specifies x-axis value, column 2 specifies label).

mz_prec

Numeric precision of m/z (=number of digits to plot).

ionization

Either APCI or ESI (important for main peak determination).

neutral_losses

Data frame of defined building blocks (Name, Formula, Mass). If not provided data("neutral_losses") will be used.

neutral_loss_cutoff

Specifies the allowed deviation in mDa for neutral losses to be accepted from the provided neutral loss list.

substitutions

May provide a two column table of potential substitutions (for adducts in ESI-MS).

precursor

Internally main peaks will be determined up to a supposed precursor obtained by 'DetermineIsomainPeaks' and annotations will only be plotted up to this mass. To plot annotations for the full mass range, set 'precursor' to a higher mass.

xlim

To specify xlim explicitly (for comparative plotting).

ylim

To specify ylim explicitly (for comparative plotting).

Value

An annotated plot of the mass spectrum.

Examples

#load test data and apply function
utils::data(apci_spectrum, package = "InterpretMSSpectrum")
PlotSpec(x=apci_spectrum, ionization="APCI")

# normalize test data by intensity
s <- apci_spectrum
s[,2] <- s[,2]/max(s[,2])
PlotSpec(x=s)

# use relative labelling
PlotSpec(x=s, rellab=364.1789)

# avoid annotation of masses and fragments
PlotSpec(x=s, masslab=NULL, neutral_losses=NA)

# provide individual neutral loss set
tmp <- data.frame("Name"=c("Loss1","Loss2"),"Formula"=c("",""),"Mass"=c(90.05,27.995))
PlotSpec(x=s, neutral_losses=tmp)

# provide additional color and annotation information per peak
PlotSpec(x=s, cols=1+(s[,2]>0.1), txt=data.frame("x"=s[s[,2]>0.1,1],"txt"="txt"))

# annotate a sum formula
PlotSpec(x=s, txt=data.frame("x"=s[which.max(s[,2]),1],"txt"="C[6]~H[12]~O[6]","expr"=TRUE))

# simulate a Sodium adduct to the spectrum (and annotate using substitutions)
p <- which.max(s[,2])
s <- rbind(s, c(21.98194+s[p,1], 0.6*s[p,2]))
PlotSpec(x=s, substitutions=matrix(c("H","Na"),ncol=2,byrow=TRUE))

#load ESI test data and apply function
utils::data(esi_spectrum)
PlotSpec(x=esi_spectrum, ionization="ESI")

[Package InterpretMSSpectrum version 1.4.5 Index]