Package {protViz}


Type: Package
Title: Visualizing and Analyzing Mass Spectrometry Related Data in Proteomics
Version: 0.7.14
Depends: R (≥ 4.4), methods
Imports: Rcpp (≥ 1.0)
LinkingTo: Rcpp (≥ 1.0)
RcppModules: FastaMod
Suggests: lattice, testthat, xtable
Description: Helps with quality checks, visualizations and analysis of mass spectrometry data, coming from proteomics experiments. The package is developed, tested and used at the Functional Genomics Center Zurich https://fgcz.ch. We use this package mainly for prototyping, teaching, and having fun with proteomics data. But it can also be used to do data analysis for small scale data sets.
License: GPL-3
URL: https://github.com/cpanse/protViz/
BugReports: https://github.com/cpanse/protViz/issues
Encoding: UTF-8
LazyData: true
NeedsCompilation: yes
Repository: CRAN
Config/roxygen2/version: 8.1.1
Packaged: 2026-11-27 17:35:40 UTC; cp
Author: Christian Panse ORCID iD [aut, cre], Jonas Grossmann ORCID iD [aut], Simon Barkow-Oesterreicher [ctb]
Maintainer: Christian Panse <cp@fgcz.ethz.ch>
Date/Publication: 2026-11-27 18:20:07 UTC

protViz: visualizing and analyzing mass spectrometry data in proteomics

Description

protViz helps with quality checks, visualizations and analysis of mass spectrometry data coming from proteomics experiments. It is developed and used at the Functional Genomics Center Zurich (https://fgcz.ch), mainly for prototyping and teaching, and for the analysis of small data sets.

Peptide and fragment masses

Spectra and peptide-spectrum matches

Post-translational modifications

Quantification

Instrument QC and queue generation

Data sets

AA, averagine, msms, HexNAc, ADPR, iRTpeptides, iTRAQ, fetuinLFQ, pgLFQfeature, pgLFQprot, pressureProfile.

Vignettes

See browseVignettes("protViz"), in particular the primer (vignette("protViz")) and vignette("PTM_MarkerFinder"). Use citation("protViz") to cite the package.

Author(s)

Maintainer: Christian Panse cp@fgcz.ethz.ch (ORCID)

Authors:

Other contributors:

References

Panse C, Gerrits B, Schlapbach R (2009). PEAKPLOT: Visualizing fragmented peptide mass spectra in proteomics. useR!2009.

Nanni P, Panse C, Gehrig P, Mueller S, Grossmann J, Schlapbach R (2013). PTM MarkerFinder, a software tool to detect and validate spectra from peptides carrying post-translational modifications. Proteomics 13(15). doi:10.1002/pmic.201300036

See Also

Useful links:


Amino acid table

Description

Elemental formula and residue masses of the 20 proteinogenic amino acids. The masses are residue masses, i.e., the mass of the amino acid minus water, as they occur within a peptide chain.

Usage

data(AA)

Format

A data frame with 20 rows (one per amino acid) and 5 columns:

letter1

factor, one-letter code, e.g., "A".

letter3

factor, three-letter code, e.g., "Ala".

formula

factor, elemental formula of the residue, e.g., "C3H5ON".

Monoisotopic

numeric, monoisotopic residue mass in Dalton.

Average

numeric, average residue mass in Dalton.

Author(s)

Christian Panse 2013

Source

See Also

aa2mass(), parentIonMass(), fragmentIon()

Examples

data(AA)
AA

# average versus monoisotopic residue mass
plot(AA$Monoisotopic, AA$Average, xlab = "monoisotopic mass [Da]",
  ylab = "average mass [Da]")
abline(lm(Average ~ Monoisotopic, data = AA), col = "grey")
text(AA$Monoisotopic, AA$Average, AA$letter1, pos = 3)

# mass defect between average and monoisotopic mass
plot(AA$Average - AA$Monoisotopic, xlab = "", ylab = "Average - Monoisotopic [Da]",
  axes = FALSE)
axis(1, 1:20, AA$letter1); axis(2); box()

# use a custom amino acid table with aa2mass
aa2mass("ELVISK", mass = AA$Monoisotopic, letter1 = as.character(AA$letter1))

ADP-ribosylated peptide spectra

Description

Tandem mass spectra, peak annotations, and plot settings for reproducing Figures 1-5 of Gehrig et al. (2021), see References, on the fragmentation of ADP-ribosylated peptides. The data set consists of three objects that are loaded together by data(ADPR); there is no object named ADPR.

Usage

data(ADPR)

Format

ADPR.ms2

a list of 5 tandem mass spectra (scans 9210, 13738, 14908, 7590, 10718). Each element is a list with numeric vectors mZ and intensity (peaks with zero intensity removed) and the scan number scan.

ADPR.annotation

a data frame with 171 rows of peak assignments and 5 columns: scanNr (scan number), PepSeq (peptide sequence with the ADP-ribose acceptor site in square brackets, e.g., "IEEALGDKAVFAG[ADPr-R]K"), mz (m/z of the annotated peak), LabelLow (ion label, e.g., "a2" or "Adenine"), and color (label color).

ADPR.lim

a data frame with 7 rows of plot settings per scan and 4 columns: scan, rintensity (relative intensity cut-off in percent of the base peak below which peaks are not labelled), and xmin/xmax (m/z range of the plot).

Note that ADPR.annotation and ADPR.lim also cover scans 10325 and 12992, which are not contained in ADPR.ms2.

Author(s)

Christian Panse 2022

Source

Spectra were read with rawrr::readSpectrum() from the Thermo raw file ⁠20171220_15_Muscle_HCD35.raw⁠ of the PRIDE project PXD017013. The code used to assemble the objects is shown in the package vignette ADP-Ribosylated-peptides.

References

Gehrig PM et al. (2021). Gas-Phase Fragmentation of ADP-Ribosylated Peptides: Arginine-Specific Side-Chain Losses and Their Implication in Database Searches. J Am Soc Mass Spectrom. doi:10.1021/jasms.0c00040

See Also

PTM_MarkerFinder(), peakplot()

Examples

data(ADPR)
vapply(ADPR.ms2, function(x) x$scan, 1)
head(ADPR.annotation)
ADPR.lim

# plot scan 9210 and mark the annotated peaks
spec <- ADPR.ms2[[1]]
lim <- ADPR.lim[ADPR.lim$scan == spec$scan, ]
a <- ADPR.annotation[ADPR.annotation$scanNr == spec$scan, ]
plot(spec$mZ, spec$intensity, type = "h", col = "grey",
  xlim = c(lim$xmin, lim$xmax), xlab = "m/z", ylab = "intensity",
  main = unique(a$PepSeq))
abline(v = a$mz, col = a$color, lty = 3)

FASTA file reader (Rcpp module)

Description

Fasta is an Rcpp module class that reads a protein FASTA file and provides summaries and in-silico tryptic digests. Only protein sequences are supported.

Format

An Rcpp module class. Create an object with F <- Fasta$new(filename), where filename is the path to a FASTA file. The object provides the methods

F$getSequences()

a character vector of protein sequences.

F$getTrypticPeptides()

a character vector of tryptic peptides (cleavage after K and R).

F$getNumberOfSequences(), F$getNumberOfDescriptions()

the number of sequences and description lines.

F$getNumberOfTrypticPeptides(), F$getNumberOfAminoAcids()

the number of tryptic peptides and amino acids.

F$summary()

a list with the file name, the number of amino acids, proteins, and tryptic peptides.

Author(s)

Christian Panse 2006-2017

References

https://en.wikipedia.org/wiki/FASTA_format

See Also

parentIonMass(), ssrc()

Other mass: aa2mass(), defaultIon(), genMod(), parentIonMass(), ssrc()

Examples

# >sp|P12763|FETUA_BOVIN Alpha-2-HS-glycoprotein OS=Bos taurus
fname <- system.file("extdata", 'P12763.fasta', package = "protViz")
F <- Fasta$new(fname)
F$summary()
(tp <- F$getTrypticPeptides())

plot(parentIonMass(tp), ssrc(tp), log = 'xy',
    xlab = 'parent ion mass', ylab = 'SSRC hydrophobicity')
text(parentIonMass(tp), ssrc(tp), tp, pos = 3, cex = 0.5)

N-HexNAc glycopeptide spectra (HCD and ETD)

Description

Eleven tandem mass spectra for demonstrating PTM_MarkerFinder(). A sample containing enriched glycopeptides from yeast was analysed by LC-MS/MS on an LTQ-Orbitrap Velos instrument using sequential HCD and ETD fragmentation. Three pairs of HCD/ETD spectra correspond to peptides carrying an N-HexNAc modification identified with high confidence (6 spectra), one pair corresponds to N-HexNAc peptides identified with very low confidence (2 spectra), and the remaining 3 spectra are from unmodified peptides.

Usage

data(HexNAc)

Format

A list of 11 spectra. Each spectrum is a list with the elements

peptideSequence

character, the assigned peptide (NA if none).

mascotScore

numeric, Mascot ion score.

modification

character, a string of one digit per residue plus both termini; a digit i > 0 refers to the i-th variable modification.

MonoisotopicAAmass

numeric, monoisotopic residue masses.

proteinInformation

character, protein accession.

title

character, MGF title of the spectrum.

pepmass

numeric, precursor m/z.

charge

numeric, precursor charge.

scans

numeric, scan number.

rtinseconds

numeric, retention time in seconds.

mZ, intensity

numeric vectors, the peak list.

Details

The HexNAc marker ions have the m/z values c(126.05495, 138.05495, 144.06552, 168.06552, 186.07608, 204.08665).

Author(s)

Paolo Nanni, Christian Panse, 2013

References

Nanni P, Panse C, Gehrig P, Mueller S, Grossmann J, Schlapbach R (2013). PTM MarkerFinder, a software tool to detect and validate spectra from peptides carrying post-translational modifications. Proteomics 13(15), 2251-2255. doi:10.1002/pmic.201300036

See Also

PTM_MarkerFinder(), peakplot()

Examples

data(HexNAc)
sapply(HexNAc, function(x) x$peptideSequence)

plot(HexNAc[[1]]$mZ, HexNAc[[1]]$intensity, type = "h",
  xlab = "m/z", ylab = "intensity", main = HexNAc[[1]]$peptideSequence)

Find and validate spectra of peptides carrying PTMs by marker ions

Description

PTM_MarkerFinder() screens tandem mass spectra (MS2) for marker ions specific to a post-translational modification (PTM), e.g., oxonium ions of glycans, and draws a validation report for every spectrum containing them.

findMz() performs the same marker ion screening on a psmSet or mascot object without plotting and returns the found marker ions as a table.

Usage

PTM_MarkerFinder(
  data,
  modification,
  modificationName,
  mZmarkerIons,
  minNumberIons = 2,
  itol_ppm = 10,
  minMarkerIntensityRatio = 5,
  mgfFilename = -1,
  PEAKPLOT = TRUE
)

findMz(
  data,
  mZmarkerIons,
  itol_ppm = 10,
  minNumberIons = 2,
  minMarkerIntensityRatio = 10
)

## S3 method for class 'mascot'
findMz(
  data,
  mZmarkerIons,
  itol_ppm = 10,
  minNumberIons = 2,
  minMarkerIntensityRatio = 10
)

## S3 method for class 'psmSet'
findMz(
  data,
  mZmarkerIons,
  itol_ppm = 10,
  minNumberIons = 2,
  minMarkerIntensityRatio = 10
)

Arguments

data

for PTM_MarkerFinder(), a list of spectra ordered by scan number; each element is a list with the components mZ, intensity, scans, title, pepmass, charge, rtinseconds, peptideSequence, modification (a string of modification indices, one digit per amino acid plus one for each terminus, e.g. "00200000000"), mascotScore, and proteinInformation, as in the HexNAc data or as written by exec/protViz_mascotDat2RData.pl. For findMz(), a psmSet or mascot object.

modification

a numeric vector of the monoisotopic masses of the modified amino acids; element k + 1 corresponds to modification index k in data[[i]]$modification (element 1 is "unmodified").

modificationName

a character vector of the modification names, in the same order as modification. They are shown in square brackets in the peptide sequence of the plot titles.

mZmarkerIons

a numeric vector of the marker ion m/z values to be searched.

minNumberIons

minimal number of marker ions that must be found in a spectrum. Default is 2.

itol_ppm

marker ion mass tolerance in ppm. Default is 10 ppm.

minMarkerIntensityRatio

minimal summed marker ion intensity in percent of the total ion intensity of the spectrum. Default is 5 for PTM_MarkerFinder() and 10 for findMz().

mgfFilename

if a file name is given, a Mascot Generic File (MGF) is written containing the spectra having the marker ions (HCD) and their corresponding ETD spectra. Default -1 writes no file.

PEAKPLOT

logical. If FALSE, the spectra are plotted without peptide assignment and nothing is returned but TRUE. Default is TRUE.

Details

PTM_MarkerFinder() iterates over the spectra (starting at the second one) and searches for the marker ions. If at least minNumberIons are found and their intensity ratio exceeds minMarkerIntensityRatio, the spectrum is taken as HCD scan and drawn with peakplot() (b and y ions). The function then searches the next four scans for an ETD scan of the same precursor (pepmass within 1 Da) with a peptide assignment and draws it with c, y, and z ions. The PTM MarkerFinder thus expects the ETD scan right after the HCD scan; other acquisition schemes need an adaption.

For each HCD scan the report shows the HCD and ETD spectra, the ppm error versus marker ion m/z, the marker ion intensities, and two pie charts of the relative and absolute marker ion intensities. Use pdf() to collect the report in a file; see also PTM_MarkerFinder_util().

Value

PTM_MarkerFinder() returns a data.frame with one row per found marker ion and the columns scans, mZ (measured m/z), markerIonMZ, markerIonIntensity, markerIonMzError (Da), markerIonPpmError, query (index in data), pepmass, peptideSequence, and modification. If PEAKPLOT = FALSE it returns TRUE.

findMz() returns a data.frame with one row per found marker ion and the columns query, percent.mZmarkerIons, sum.intensity, markerIonIntensity, markerIonMZ, peptideSequence, markerIonPpmError (the tolerance in Dalton used for the match), mZ, pepmass, charge, rtinseconds, modification, and score; NULL if data is not a psmSet.

Author(s)

Paolo Nanni, Peter Gehrig, Christian Panse 2011-2013

References

Nanni P, Panse C, Gehrig P, Mueller S, Grossmann J, Schlapbach R (2013) PTM MarkerFinder, a software tool to detect and validate spectra from peptides carrying post-translational modifications. Proteomics 13(15):2251-5. doi:10.1002/pmic.201300036

The ADP-ribose marker ions c(136.0618, 250.0935, 348.0704, 428.0367) have been used in: Bilan V, Leutert M, Nanni P, Panse C, Hottiger MO (2017) Combining Higher-Energy Collision Dissociation and Electron-Transfer/Higher-Energy Collision Dissociation Fragmentation in a Product-Dependent Manner Confidently Assigns Proteomewide ADP-Ribose Acceptor Sites. Anal Chem 89(3):1523-1530. doi:10.1021/acs.analchem.6b03365

See Also

peakplot(), HexNAc, ADPR

Other PTM: PTM_MarkerFinder_util()

Examples

# some marker ions
Glykan_MarkerIons <- c(109.02841, 127.03897, 145.04954, 163.06010, 325.11292)
HexNAc_MarkerIons <- c(126.05495, 138.05495, 144.06552, 168.06552,
  186.07608, 204.08665)
ADP_Ribose <- c(136.0618, 250.0935, 348.0704, 428.0367)

data(HexNAc)

# modifications: index 0 unmodified, 1 HexNAc (N), 2 Oxidation (M)
m <- data.frame(AA = c("-", "N", "M"),
  mono = c(0.0, 317.122300, 147.035400),
  desc = c("unmodified", "HexNAc", "Oxidation"),
  unimodAccID = c(NA, 2, 1))

S <- PTM_MarkerFinder(data = HexNAc,
  modification = m$mono,
  modificationName = m$desc,
  minMarkerIntensityRatio = 3,
  itol_ppm = 20,
  mZmarkerIons = HexNAc_MarkerIons)

boxplot(markerIonIntensity ~ markerIonMZ,
  data = S,
  log = 'y',
  main = 'marker ion intensities of all pPTM spectra',
  xlab = 'marker ion m/z',
  ylab = 'marker ion intensity')

# one row per scan, one column per marker ion
w <- reshape(S[, c("scans", "query", "markerIonMZ", "markerIonIntensity")],
  direction = 'wide',
  timevar = "markerIonMZ",
  idvar = c('scans', 'query'))
w

# findMz on a psmSet
P <- lapply(seq_along(HexNAc), function(i){
  c(HexNAc[[i]], list(id = i, searchEngine = "mascot"))})
class(P) <- c("psmSet", "list")
findMz(P, HexNAc_MarkerIons, itol_ppm = 20, minMarkerIntensityRatio = 3)

Batch PTM MarkerFinder report from an RData file

Description

PTM_MarkerFinder_util() runs PTM_MarkerFinder() on the spectra stored in an RData file and writes the report, the selected spectra, and optionally a marker ion table to files next to it.

Usage

PTM_MarkerFinder_util(
  dataFileName,
  mZmarkerIons = c(126.055, 138.055, 144.0655, 168.0655, 186.0761, 204.0866),
  minMarkerIntensityRatio = 2,
  minNumberIons = 2,
  itol_ppm = 20,
  write_csv = FALSE
)

Arguments

dataFileName

the RData file name without the .RData extension, relative to the working directory (it must not contain a path, see Details). The file must contain the objects ⁠<dataFileName>⁠ (the spectra, see data in PTM_MarkerFinder()), ⁠<dataFileName>.modification.mass⁠, and ⁠<dataFileName>.modification.description⁠, as written by exec/protViz_mascotDat2RData.pl.

mZmarkerIons

a numeric vector of the marker ion m/z values. Default are the HexNAc oxonium ions.

minMarkerIntensityRatio

minimal summed marker ion intensity in percent of the total ion intensity. Default is 2.

minNumberIons

minimal number of marker ions per spectrum. Default is 2.

itol_ppm

marker ion mass tolerance in ppm. Default is 20 ppm.

write_csv

logical. If TRUE, a table of marker ion intensities (one row per spectrum, one column per marker ion) is written to ⁠<dataFileName>.csv⁠. Default is FALSE.

Details

The object names are derived from dataFileName, which therefore has to be a plain file name; change the working directory with setwd() if needed. The PDF report ⁠<dataFileName>.pdf⁠ contains a summary of the settings, per-spectrum marker ion plots and pie charts, a boxplot of the marker ion intensities, a barplot of the summed marker ion intensity per scan, and the PTM_MarkerFinder() report of every spectrum.

Value

Called for its side effects; returns NULL invisibly. The files ⁠<dataFileName>.pdf⁠, ⁠<dataFileName>.mgf⁠, and, if requested, ⁠<dataFileName>.csv⁠ are written.

Author(s)

Paolo Nanni, Christian Panse 2012-2013

See Also

Other PTM: PTM_MarkerFinder()

Examples

data(HexNAc)
HexNAc.modification.mass <- c(0.0, 317.122300, 147.035400)
HexNAc.modification.description <- c("unmodified", "HexNAc", "Oxidation")

owd <- setwd(tempdir())
save(HexNAc, HexNAc.modification.mass, HexNAc.modification.description,
  file = "HexNAc.RData")
PTM_MarkerFinder_util("HexNAc", write_csv = TRUE)
list.files(pattern = "^HexNAc")
read.csv("HexNAc.csv")
setwd(owd)

Amino acid masses of peptide sequences

Description

Maps each residue of one or more peptide sequences to its mass. Unlike parentIonMass(), no N- or C-terminal masses are added, which makes aa2mass handy for building custom (e.g., modified) residue mass vectors that can be passed on to fragmentIon().

Usage

aa2mass(peptideSequence, mass = AA$Monoisotopic, letter1 = AA$letter1)

Arguments

peptideSequence

a character vector of peptide sequences (1-letter amino acid code).

mass

a numeric vector of residue masses in Dalton. Default is AA$Monoisotopic (see AA).

letter1

a character vector of 1-letter amino acid codes, of the same length and order as mass. Default is AA$letter1.

Details

To compute the ⁠[M+H]+⁠ mass of a peptide add the N-terminal (H, 1.007825), C-terminal (OH, 17.002740) and proton masses to the sum of the residue masses (see example).

Value

a list with one numeric vector per input sequence; each vector contains the residue masses in sequence order.

Author(s)

Christian Panse 2014

See Also

AA, parentIonMass(), fragmentIon()

Other mass: Fasta, defaultIon(), genMod(), parentIonMass(), ssrc()

Examples

peptides <- c('HTLNQIDSVK', 'ALGGEDVR', 'TPIVGQPSIPGGPVR')

C_term <- 17.002740
N_term <- 1.007825
H_ <- 1.008

# the difference to parentIonMass is (almost) zero
sapply(aa2mass(peptides), sum) + C_term + N_term + H_ - parentIonMass(peptides)

# fragment ions computed from residue masses
lapply(aa2mass(peptides), function(x){ fragmentIon(x)[[1]] })

# phosphorylation (+79.966331 Da) of the serine at position 8
peptide <- 'HTLNQIDSVK'
mod <- rep(0.0, nchar(peptide)); mod[8] <- 79.966331
aa2mass(peptide)[[1]] + mod

Assign plate positions to a measurement queue

Description

Assigns each row (sample) of a queue, in the given order, to a position on an autosampler plate, e.g., a 48-well plate (85.4 x 127.5 mm) of 6 rows (A-F) and 8 columns (1-8). Positions are filled row by row; when a plate is full, the next plate is used.

Usage

assignPlatePosition(
  S,
  x = as.character(1:8),
  y = c("A", "B", "C", "D", "E", "F"),
  plate = 1:4,
  volume = 1,
  reserve = 46:48
)

Arguments

S

a data.frame, one row per sample in measurement order, e.g., the output of blockRandom().

x

a character vector of the column (x) coordinates of a plate.

y

a character vector of the row (y) coordinates of a plate.

plate

a vector of available plate identifiers.

volume

the injection volume. Used for all rows if S has no volume column, otherwise only to fill its missing values.

reserve

plate positions intended to be reserved for other samples, e.g., standards inserted by insertSamples(). Currently not used.

Value

S with the additional columns run (running number), x, y, plate, and volume. An error is raised if there are more samples than available plate positions.

Author(s)

Christian Panse 2021

See Also

Other queue: blockRandom(), insertSamples()

Examples

set.seed(1)
iris[c(1:15, 51:65, 101:115), ] |>
  blockRandom(x = "Species", check = FALSE) |>
  assignPlatePosition()

Averagine isotope envelopes

Description

Theoretical isotope envelopes of averagine peptides (peptides with an average amino acid composition) for masses from 100 to 8000 Dalton.

Usage

data(averagine)

Format

A numeric matrix with 8 rows and 791 columns. Each column is the isotope envelope of an averagine peptide; the column names give the mass in Dalton ("100", "110", ..., "8000", step 10). The 8 rows are the relative intensities of the monoisotopic peak and the following seven isotope peaks. Each column is L2 normalized, i.e., colSums(averagine^2) is 1.

Author(s)

Witold Wolski and Christian Panse 2013

Source

Generated using the IsotopeEnvelopeEstimator class of ProteoWizard https://proteowizard.sourceforge.io/.

References

Yergey JA (1983). A general approach to calculating isotopic distributions for mass spectrometry. International Journal of Mass Spectrometry and Ion Physics 52(2-3), 337-349. doi:10.1016/0020-7381(83)85053-0

See Also

deisotoper(), which uses averagine as default isotope model.

Examples

data(averagine)
dim(averagine)

# isotope envelope of a 1500 Da peptide
barplot(averagine[, "1500"], names.arg = 0:7, xlab = "isotope peak",
  main = "averagine 1500 Da")

# all envelopes as image; rows are the isotope peaks, columns the masses
r <- seq(0, 1, length = 200); cm <- c(rgb(r, r, r), "#555599")
image(averagine, col = rev(cm), axes = FALSE,
  main = "normalized isotope intensities",
  sub = "the blue color indicates fields with value 0.",
  xlab = "isotope peak", ylab = "mass [Da]")
box()
axis(1, seq(0, 1, length = nrow(averagine)), 0:(nrow(averagine) - 1))
axis(2, seq(0, 1, length = 10),
  colnames(averagine)[seq(1, ncol(averagine), length = 10)])

Block randomization of a sample table

Description

Derives a block-randomized run order of the rows of a sample table. Each block contains one sample of each group (level of column x); both the samples within a group and the order of the groups within each block are randomized. This avoids confounding the group with the acquisition order in an LC-MS measurement queue.

Usage

blockRandom(S, x = NA, check = TRUE)

Arguments

S

a data.frame, one row per sample.

x

the name of the column in S defining the groups (blocks). If NA (default), the rows are randomized without blocking.

check

logical. If TRUE (default), stop if the groups are not of equal size.

Details

If the groups have different sizes, the incomplete blocks are padded with rows of NA values and a warning is issued; with check = TRUE (default) unequal group sizes cause an error instead. If x is NA, all rows are considered as one group, i.e., the table is simply randomized (with a warning), and a column dummy is added.

Call set.seed() beforehand to obtain a reproducible order.

Value

a data.frame with the rows of S in block-randomized order. Padding rows of incomplete blocks contain NA values.

Author(s)

Christian Panse 2021

References

Oberg A.L., Vitek O. (2009), Statistical design of quantitative mass spectrometry-based proteomic experiments. J Proteome Res 8(5):2144-2156. doi:10.1021/pr8010099

doi:10.1021/acs.jproteome.0c00536

See Also

Other queue: assignPlatePosition(), insertSamples()

Examples

set.seed(1)
iris[c(1:2, 51:52, 101:103), ] |>
  blockRandom(x = "Species", check = FALSE)

Centroid a spectrum acquired in profile mode

Description

Converts a profile mode spectrum into a centroid spectrum. Each profile peak is reduced to its intensity-weighted mean m/z and its area under the curve (trapezoidal rule).

Usage

centroid(mZ, intensity, tolppm = 100, debug = FALSE)

Arguments

mZ

a numeric vector of profile m/z values, sorted in increasing order.

intensity

a numeric vector of corresponding intensity values.

tolppm

maximal distance, in ppm of the m/z value, between two adjacent profile data points of the same peak. Default is 100.

debug

logical; if TRUE, diagnostic plots of the m/z spacing and of every peak profile are drawn. Default is FALSE.

Details

Peaks are detected as local intensity maxima and extended to both sides while the intensity decreases and adjacent data points are closer than tolppm. Overlapping peaks are not resolved. The method was tested on Orbitrap Fusion Lumos (FSN20242) data.

Value

a data.frame with the columns mZ (centroid m/z) and intensity (peak area); NULL if no peak was found. Peak profiles with fewer than three data points are dropped.

Note

Thanks to Nienke Meekel and Andrea Brunner (kwrwater.nl) and Witold E. Wolski.

Author(s)

Christian Panse and Jonas Grossmann, April 2020

See Also

deisotoper(); MSnbase pickPeaks; https://proteowizard.sourceforge.io/

Other spectrum: de_novo(), deisotoper(), findNN()

Examples

# Orbitrap Fusion Lumos FSN20242, scan 1959,
# CC(C)(C)C(O)C(OC1=CC=C(Cl)C=C1)N1C=NC=N1, exact mass 295.1088,
# FTMS + p ESI d Full ms2 296.1162@uvpd50.00
# (internal demo data, not part of the exported API)
p <- protViz:::.getProfileMS2()

# m/z spacing of the profile data
plot(diff(p$mZ) ~ p$mZ[2:length(p$mZ)], log = 'y')
abline(h = 0.1, col = 'red')
points(p$mZ, 1E-4 * p$mZ, col = 'grey', type = 'l')
abline(v = 296.1162, col = 'cyan')

op <- par(mfrow = c(2, 1))
plot(p$mZ, p$intensity, type = 'h',
    main = 'profile', xlim = c(100, 300))
abline(v = 296.1162, col = 'cyan')

plot(centroid(p$mZ, p$intensity), type = 'h',
    main = "centroid", xlim = c(100, 300))
par(op)


# one diagnostic plot per peak
op <- par(mfrow = c(3, 3))
rv <- centroid(p$mZ, p$intensity, debug = TRUE)
par(op)


Naive de novo annotation of a tandem mass spectrum

Description

Computes all pairwise mass differences between the most intense MS2 peaks and matches them to amino acid residue masses. The result is drawn as a debug plot; intended for teaching and demonstration only.

Usage

de_novo(data)

Arguments

data

a tandem mass spectrum, i.e., a list with the numeric vectors mZ and intensity and the elements pepmass, charge and title, as in msms.

Details

The 30 most intense peaks, plus peaks having a complementary peak with respect to the precursor mass (tolerance 0.1 Da), are considered. Peak pairs whose mass difference matches a residue mass within 0.1 Da are connected and labelled with the amino acid letter.

Value

called for its side effect (a plot); returns NULL invisibly.

Author(s)

Christian Panse 2013

See Also

peakplot(), psm()

Other spectrum: centroid(), deisotoper(), findNN()

Examples

data(msms)
de_novo(msms[[1]])

Compute the fragment ions of peptide sequences

Description

Computes the singly charged, positive-mode fragment ions of peptide sequences. By default the b, y, c and z ions are returned, which cover CID/HCD (b, y) and ETD (c, z) fragmentation. Further ion types can be derived via FUN.

Usage

defaultIon(b, y)

fragmentIon(
  sequence,
  FUN = defaultIon,
  modified = numeric(),
  modification = numeric(),
  N_term = 1.007825,
  C_term = 17.00274
)

## S3 method for class 'fragmentIonSet'
as.data.frame(x, ...)

Arguments

b, y

numeric vectors of singly charged b and y ion masses.

sequence

a character vector of peptide sequences (1-letter amino acid code), or a numeric vector of residue masses (see aa2mass()).

FUN

a function ⁠function(b, y)⁠ returning a matrix (or data.frame) of ion masses, one column per ion type. Default is defaultIon.

modified

a character vector of the same length as sequence; each string has one digit per residue giving the modification id (0 = unmodified), as produced by genMod(). Default is numeric() (no variable modifications).

modification

a numeric vector of modification masses in Dalton, indexed by modification id + 1 (the first element is the unmodified case, usually 0). Only used if length(modification) > 1.

N_term

N-terminal mass in Dalton. Default is 1.007825 (currently ignored, see Details).

C_term

C-terminal mass in Dalton. Default is 17.002740 (currently ignored, see Details).

x

a fragmentIonSet object as returned by fragmentIon.

...

unused.

Details

The fragment ions are computed following the rules proposed in Roepstorff and Fohlman (1984). Cysteine is set to carbamidomethyl cysteine (160.030649 Da) as fixed modification; other fixed modifications are not supported, but can be emulated by passing residue masses (see aa2mass()).

Note: N_term and C_term are currently not passed to the underlying C code and therefore have no effect; the terminal masses are fixed to their default values.

Value

fragmentIon returns an object of class fragmentIonSet, a list with one data.frame (class fragmentIon) per sequence. Each row corresponds to a residue position and each column to an ion type (e.g., b, y, c, z); the peptide sequence is stored in the sequence attribute. If sequence is numeric, the list contains a single data.frame.

as.data.frame converts a fragmentIonSet into a long-format data.frame with columns type, mass, pos, fragment and sequence, sorted by mass (the full-length ions are removed).

Functions

Author(s)

Christian Panse, Bertran Gerrits 2006

References

Roepstorff P, Fohlman J. Proposal for a common nomenclature for sequence ions in mass spectra of peptides. Biomed Mass Spectrom. 1984; 11(11):601. doi:10.1002/bms.1200111109

Kinter M, Sherman NE. Protein Sequencing and Identification Using Tandem Mass Spectrometry. Wiley-Interscience; 2000.

See Also

psm(), peakplot(), parentIonMass(), aa2mass(), genMod()

Other mass: Fasta, aa2mass(), genMod(), parentIonMass(), ssrc()

Examples

peptide.AA <- "KINHSFLR"

peptide.AA.weights <- c(128.09496, 113.08406, 114.04293,
    137.05891, 87.03203, 147.06841, 113.08406, 156.10111)

fragmentIon(peptide.AA)
fragmentIon(peptide.AA.weights)

# custom ion series, e.g., ETD
ETD_Ion <- function(b, y){
    Hydrogen <- 1.007825
    Oxygen <- 15.994915
    Nitrogen <- 14.003074

    y_0 <- y - Oxygen - Hydrogen - Hydrogen
    c <- b + (Nitrogen + (3 * Hydrogen))
    z <- y - (Nitrogen + (3 * Hydrogen))

    cbind(y_0, c, z)
}
fragmentIon(peptide.AA, FUN = ETD_Ion)

# doubly charged b and y ions
doublyCharged <- function(b, y){
    Hydrogen <- 1.007825
    cbind(b, y, b2 = (b + Hydrogen) / 2, y2 = (y + Hydrogen) / 2)
}
fragmentIon(peptide.AA, FUN = doublyCharged)

peptides <- c('HTLNQIDSVK', 'ALGGEDVR', 'TPIVGQPSIPGGPVR')

pim <- parentIonMass(peptides)
fi <- fragmentIon(peptides)
head(as.data.frame(fi))

op <- par(mfrow = c(3, 1))
for (i in seq_along(peptides)){
    plot(0, 0,
        xlab = 'm/Z',
        ylab = '',
        xlim = range(c(fi[[i]]$b, fi[[i]]$y)),
        ylim = c(0, 1),
        type = 'n',
        axes = FALSE,
        sub = paste(peptides[i], "/", pim[i], "Da"))
    box()
    axis(1, fi[[i]]$b, round(fi[[i]]$b, 1), las = 2)
    axis(1, fi[[i]]$y, round(fi[[i]]$y, 1), las = 2)

    pepSeq <- strsplit(peptides[i], "")
    axis(3, fi[[i]]$b, paste("b", row.names(fi[[i]]), sep = ''), las = 2)
    axis(3, fi[[i]]$y, paste("y", row.names(fi[[i]]), sep = ''), las = 2)

    text(fi[[i]]$b, rep(0.3, nchar(peptides[i])),
        pepSeq[[1]], pos = 3, cex = 4, lwd = 4, col = "#aaaaaaaa")

    abline(v = fi[[i]]$b, col = 'red')
    abline(v = fi[[i]]$y, col = 'blue', lwd = 2)
}
par(op)

# b and y ions add up to the [M+2H]2+ mass
fi <- fragmentIon(c("ATSFYK", "XGXFNAGVGK"))[[2]]
fi$b[1] + fi$y[9]
fi$b[2] + fi$y[8]

Find isotope patterns in mass spectra

Description

Detects isotope clusters in each mass spectrum for the given charge states and scores them against an averagine isotope model.

Usage

deisotoper(
  data,
  Z = 1:4,
  isotopPatternDF = averagine,
  massError = 0.005,
  plot = FALSE
)

Arguments

data

a list of mass spectra; each spectrum is a list with the numeric vectors mZ and intensity (and optionally title).

Z

an integer vector of charge states to be considered. Default is 1:4.

isotopPatternDF

a data frame of isotope envelopes of averagine peptides. Default is averagine. Note: currently the bundled averagine data is always used, see Details.

massError

mass tolerance in Dalton. Default is 0.005.

plot

logical; if TRUE, the spectrum and the detected isotope clusters are plotted. Default is FALSE.

Details

The isotope chain detection is based on the idea of Yuan et al. (2011). Each peak represents one node of a graph G=(V,E) with V = \{1, \ldots, n\}. An edge is defined between two peaks if their m/z difference matches the isotope spacing for a given charge within massError. The isotope chains are determined by a depth-first search. The time complexity is O(n \log n) where n is the number of peaks.

Peaks are sorted by m/z before processing. The isotopPatternDF argument is currently ignored by the implementation, which always uses the package's averagine data.

Value

a list with one element per input spectrum (spectra with fewer than two peaks are skipped). Each element is a list with

result

a list with one entry per charge state in Z, each a list of isotope clusters given as 0-based peak indices.

score, score1

lists, parallel to result, holding the L2-normalized dot-product score of each cluster against the averagine model (score1 omits the first peak).

group

a list with one integer vector per peak giving, for each charge state, the 0-based cluster index the peak belongs to (NA if none).

peaksMass, peaksIntensity, peaksCharge

the input peaks (sorted by m/z) and their assigned charge.

Author(s)

Witold Eryk Wolski, Christian Trachsel, and Christian Panse 2013

References

Yuan Z, Shi J, Lin W, Chen B, Wu FX. Features-Based Deisotoping Method for Tandem Mass Spectra. Adv Bioinformatics. 2011;2011:210805. doi:10.1155/2011/210805

See Also

averagine, centroid()

Other spectrum: centroid(), de_novo(), findNN()

Examples

# example 1 - tandem MS
x <- list(mZ = c(726.068, 726.337, 726.589, 726.842, 727.343, 727.846,
        728.346, 728.846, 729.348, 730.248, 730.336, 730.581, 730.836),
    intensity = c(6.77850e+03, 2.81688e+04, 6.66884e+04, 1.22032e+07,
        9.90405e+06, 4.61409e+06, 1.50973e+06, 3.33996e+05, 5.09421e+04,
        1.15869e+03, 2.14788e+03, 5.37853e+03, 5.79094e+02))

out <- deisotoper(data = list(x), Z = 2:4, isotopPatternDF = averagine)
str(out[[1]]$result)

# example 2 - MS of a heavy labelled peptide in water background
x <- list(mZ = c(642.572, 643.054, 643.569, 644.062, 644.557),
    intensity = c(17000, 25000, 12000, 9000, 4000))

diff(x$mZ)

out2 <- deisotoper(data = list(x), Z = 1:2, isotopPatternDF = averagine,
    massError = 0.02, plot = TRUE)

Fetuin spike-in data set for label-free quantification

Description

Abundance read-outs of three label-free quantification methods (APEX, emPAI, and T3PQ) for bovine Fetuin spiked into a complex yeast background and for seven yeast proteins whose abundance is unchanged. Fetuin was spiked in at concentrations from 20 to 300 fmol on column, in triplicates.

Usage

data(fetuinLFQ)

Format

A list of three data frames named t3pq (235 rows), apex (228 rows), and empai (179 rows), each with 4 columns:

conc

integer, spiked Fetuin amount in fmol on column (0 to 300).

prot

factor, protein, "Fetuin" or a yeast UniProt accession.

abundance

numeric, the abundance estimated by the method.

method

factor, one of "T3PQ", "APEX", "emPAI".

Details

Samples were analyzed on a LTQ-FTICR Ultra mass spectrometer (Thermo Fisher Scientific, Bremen, Germany) coupled to an Eksigent Nano-HPLC system (Eksigent Technologies, Dublin (CA), USA).

Author(s)

Christian Panse 2009, 2010

Source

Derived from 32 LC-MS runs (⁠20080816_01_fetuin.mzXML⁠ to ⁠20080819_32_fetuin.mzXML⁠, about 180 MB each; the file names encode the spiked amount), available as a 3 GB tarball at http://fgcz-data.uzh.ch/public/fqms.tgz (md5 af804e209844d055c0eded716ef9eea8). The T3PQ values can be computed using the code at https://sourceforge.net/projects/fqms/.

References

Grossmann J et al. (2010). Implementation and evaluation of relative and absolute quantification in shotgun proteomics with label-free methods. J Proteomics. doi:10.1016/j.jprot.2010.05.011

See Also

pgLFQtNpq() for the top N peptide (TNPQ) approach.

Examples

data(fetuinLFQ)
str(fetuinLFQ)

if (requireNamespace("lattice", quietly = TRUE)) {
  # replace apex by empai or t3pq to see the other methods
  lattice::xyplot(abundance ~ conc | prot * method,
    data = fetuinLFQ$apex,
    groups = prot,
    aspect = 1,
    panel = function(x, y, subscripts, groups) {
      if (groups[subscripts][1] == "Fetuin") {
        lattice::panel.fill(col = "#ffcccc")
      }
      lattice::panel.grid(h = -1, v = -1)
      lattice::panel.xyplot(x, y)
      lattice::panel.loess(x, y, span = 1)
    },
    xlab = "Fetuin concentration spiked into experiment [fmol]",
    ylab = "Abundance")
}

Find the index of the nearest neighbor in a sorted vector

Description

Given a sorted numeric vector vec of length n and a vector of m query values q, findNN returns for each q[i] the index o of the element of vec closest to q[i], i.e., there is no k with abs(vec[k] - q[i]) < abs(vec[o] - q[i]).

Usage

findNN(q, vec, check = FALSE)

findNN_(q, vec, check = FALSE)

lower_bound_(xq, xvec)

Arguments

q

a numeric vector of query values.

vec

a numeric vector sorted in increasing order (the "database").

check

logical; if TRUE, test whether vec is sorted. Default is FALSE.

xq, xvec

query and sorted database vector for lower_bound_.

Details

The search is a binary search with O(m \log_2 n) time complexity, where n is length(vec) and m is length(q). findNN is implemented using the C library function bsearch(), while findNN_ (Rcpp) uses the C++ STL function std::lower_bound(). Results may differ for ties, i.e., when vec contains duplicated values (see example).

Value

findNN and findNN_ return an integer vector of length length(q) with 1-based indices into vec. If check = TRUE and vec is not sorted, findNN returns list(error = "vec is not sorted") instead (no error is raised). lower_bound_ returns, for each element of xq, the 1-based index of the first element of xvec that is not less than it (C++ std::lower_bound).

Author(s)

Christian Panse 2007-2015

References

https://cplusplus.com/reference/algorithm/lower_bound/

See Also

findInterval(), psm()

Other spectrum: centroid(), de_novo(), deisotoper()

Examples

(NNidx <- findNN(q <- c(1, 1.0001, 1.24, 1.26), DB <- seq(1, 5, by = 0.25)))
stopifnot(NNidx == c(1, 1, 2, 2))

DB <- sort(rnorm(100, mean = 100, sd = 10))
# should be 0
unique(DB[findNN(DB, DB)] - DB)

q <- rnorm(100, mean = 100)
hist(DB[findNN(q, DB)] - q)

# the definition of findNN holds
findNN(3.5, 1:5)
findNN(3.5, 1:6)

# compare ANSI-C binary search with C++ std::lower_bound
DB <- c(rep(1.0, 3), rep(2.0, 3))
q <- c(-1, 1.0, 1.01, 1.5, 1.9)
abs(DB[findNN(q, DB)] - q)
abs(DB[findNN_(q, DB)] - q)

lower_bound_(c(1.5, 2), c(1, 2, 3))

Generate all modification patterns of peptide sequences

Description

Enumerates all combinations of up to nModification variable modifications on each peptide sequence. This can be used to screen precursor masses for meaningful mass shifts which could correspond to post-translational modifications. Only use a handful of modifications; the number of combinations grows quickly.

Usage

genMod(sequences, modificationPattern, nModification = 2)

Arguments

sequences

a character vector of peptide sequences (1-letter amino acid code).

modificationPattern

a character vector of 1-letter amino acid codes, one per modification. The first element is a placeholder for "unmodified" (e.g., "-"); element i defines modification id i - 1, i.e., the residue it can be attached to.

nModification

maximal number of modifications per peptide. Default is 2.

Value

a list with one character vector per input sequence. Each string has nchar(sequence) digits encoding, per residue, the modification id (0 = unmodified). The unmodified pattern is always the first element. The encoding is the one used by the modified argument of fragmentIon().

Author(s)

Hubert Rehrauer and Christian Panse 2012

See Also

fragmentIon(), PTM_MarkerFinder()

Other mass: Fasta, aa2mass(), defaultIon(), parentIonMass(), ssrc()

Examples

ptm.0 <- cbind(AA = "-",
    mono = 0.0, avg = 0.0, desc = "unmodified", unimodAccID = NA)

ptm.616 <- cbind(AA = 'S',
    mono = -27.010899, avg = NA, desc = "Substitution",
    unimodAccID = 616)

ptm.651 <- cbind(AA = 'N',
    mono = 27.010899, avg = NA, desc = "Substitution",
    unimodAccID = 651)

m <- as.data.frame(rbind(ptm.0, ptm.616, ptm.651))

(gm <- genMod(c('TAFDEAIAELDTLNEESYK', 'TAFDEAIAELDTLSEESYK'), m$AA))

# fragment ions of all modified variants of the first peptide
fi <- fragmentIon(rep('TAFDEAIAELDTLNEESYK', length(gm[[1]])),
    modified = gm[[1]], modification = m$mono)
length(fi)

iRT peptides - indexed retention time peptides

Description

Peptide sequences and normalized retention times (iRT) of the iRT reference peptides of Escher et al. (2012), which can be used to normalize retention times across LC-MS runs.

Usage

data(iRTpeptides)

Format

A data frame with 31 rows and 2 columns:

peptide

factor, peptide sequence.

rt

numeric, normalized retention time (iRT, dimensionless; ranges from about -25 to 122).

Use as.character(iRTpeptides$peptide) when passing the peptides to functions expecting character input.

Author(s)

Jonas Grossmann and Christian Panse 2013

References

Escher C, Reiter L, MacLean B, Ossola R, Herzog F, Chilton J, MacCoss MJ, Rinner O (2012). Using iRT, a normalized retention time for more targeted measurement of peptides. Proteomics 12(8), 1111-1121. doi:10.1002/pmic.201100463

See Also

ssrc(), parentIonMass()

Examples

data(iRTpeptides)
plot(sort(iRTpeptides$rt), ylab = "iRT")

# peptide mass versus iRT
plot(parentIonMass(as.character(iRTpeptides$peptide)) ~ iRTpeptides$rt,
  xlab = "iRT", ylab = "[M+H]+")

# predicted hydrophobicity versus iRT
plot(sapply(as.character(iRTpeptides$peptide), ssrc) ~ iRTpeptides$rt,
  xlab = "iRT", ylab = "SSRC hydrophobicity")

A small 8-plex iTRAQ data set

Description

Quantification data of confidently identified peptides from 5 human proteins measured with iTRAQ (isobaric tag for relative and absolute quantification) 8-plex labelling on a Thermo LTQ-Orbitrap. Mascot generic files were produced with MascotDistiller and searched with ProteinPilot V.4 (ABSciex). The peptide summary was filtered for confident peptides (confidence above 90), and only the protein accession, peptide sequence, the eight reporter ion areas, and the protein description were kept.

Usage

data(iTRAQ)

Format

A data frame with 264 rows and 11 columns:

prot

factor, UniProt accession (5 proteins).

peptide

factor, peptide sequence.

area113, area114, area115, area116, area117, area118, area119, area121

numeric, reporter ion areas of the 8 channels.

desc

factor, protein description.

Details

The analysis functions are not restricted to ProteinPilot exports; any tool exporting reporter ion areas or intensities per channel can be used.

Author(s)

Jonas Grossmann, Christian Panse, 2012

References

doi:10.1016/j.jprot.2012.09.011

See Also

iTRAQ2GroupAnalysis()

Examples

data(iTRAQ)
head(iTRAQ)
table(iTRAQ$prot)
boxplot(log2(iTRAQ[, 3:10] + 1), ylab = "log2(reporter ion area + 1)", las = 2)

Two-group analysis of iTRAQ reporter ion data

Description

Compares two groups of reporter ion channels, e.g., of an 8-plex iTRAQ experiment, by a two-sample t-test for each protein (or peptide).

Usage

iTRAQ2GroupAnalysis(
  data,
  group1,
  group2,
  INDEX,
  FUN = function(x) {
     return(x)
 },
  plot = FALSE
)

Arguments

data

a data.frame with one row per peptide spectrum match and one numeric column per reporter channel, like iTRAQ.

group1

an integer vector of the column indices of the first group.

group2

an integer vector of the column indices of the second group.

INDEX

a factor (or a vector coercible to a factor) of length nrow(data) defining the aggregation level, e.g., protein accession or the combination of protein and peptide sequence.

FUN

a function for transforming the aggregated intensities, e.g., log() or asinh(). Default is the identity.

plot

logical. If TRUE, a boxplot is drawn for each level of INDEX. Default is FALSE.

Details

For each reporter channel (column) in group1 and group2, the intensities are summed per level of INDEX (e.g., per protein accession) using tapply(), ignoring missing values, and transformed with FUN. For each level a Welch two-sample t.test() between the channels of group1 and group2 is computed.

If plot = TRUE, one boxplot per level is drawn showing the two groups, filled light green if the p-value is below 0.05 and light red otherwise.

The function is not restricted to ProteinPilot exports such as the iTRAQ data set; any table having one column per reporter channel can be used.

Value

a data.frame with one row per level of INDEX and the columns name (the level), p_value (the t-test p-value, rounded to three digits), and the columns ⁠Group1.*⁠ and ⁠Group2.*⁠. Note that the ⁠Group1.*⁠ and ⁠Group2.*⁠ values are copied from the i-th row of data, not from the aggregated (INDEX-level) intensities.

Author(s)

Christian Panse, Jonas Grossmann 2011

References

doi:10.1016/j.jprot.2012.09.011

See Also

iTRAQ, t.test()

Other quantification: pgImporter(), pgLFQaov(), pgLFQtNpq()

Examples

data(iTRAQ)

op <- par(mfrow = c(2, 3))
qProt <- iTRAQ2GroupAnalysis(data = iTRAQ,
  group1 = 3:6,
  group2 = 7:10,
  INDEX = iTRAQ$prot,
  plot = TRUE)
par(op)
qProt[, c("name", "p_value")]

qPeptide <- iTRAQ2GroupAnalysis(data = iTRAQ,
  group1 = 3:6,
  group2 = 7:10,
  INDEX = paste(iTRAQ$prot, iTRAQ$peptide),
  FUN = asinh)
head(qPeptide[, c("name", "p_value")])

Insert standard samples into a measurement queue

Description

Inserts standard or blank samples, e.g., quality control runs or column cleaning runs, into a queue, all taken from one plate position.

Usage

insertSamples(
  S,
  stdName = "autoQC01",
  stdPosX = "8",
  stdPosY = "F",
  plate = 1,
  volume = 2,
  method = "",
  ...
)

Arguments

S

a data.frame of the queue, typically the output of assignPlatePosition(). It should contain the columns x, y, plate, and volume.

stdName

the name of the inserted sample; used for the type and name columns.

stdPosX

the x (column) coordinate of the standard on the plate.

stdPosY

the y (row) coordinate of the standard on the plate.

plate

the plate of the standard.

volume

the injection volume of the standard.

method

the path to the instrument method file used for the standard (optional).

...

further arguments defining the insert positions; see Details.

Details

The arguments passed by ... define where the standards are inserted:

howoften

insert after every howoften-th sample (default 1). A value of 0 disables the insertions between samples.

howmany

the number of standards inserted each time (default 1).

begin

logical; insert one standard at the beginning of the queue (default FALSE).

end

logical; insert one standard at the end of the queue (default FALSE).

between

logical; insert standards between samples (default TRUE).

Value

a data.frame containing the rows of S and the inserted standards. The columns type ("sample" or stdName), method, and name are added if missing.

Author(s)

Christian Panse 2021

See Also

Other queue: assignPlatePosition(), blockRandom()

Examples

iris[c(1:15, 51:65, 101:115), ] |>
  assignPlatePosition() |>
  insertSamples(howoften = 4, begin = FALSE, end = FALSE,
    stdPosX = '6', stdPosY = 'F', plate = 1, stdName = "clean")

LC-MS map of precursors

Description

Draws an LC-MS overview map: retention time (x axis) versus precursor m/z (y axis) of all MS2 precursors. Precursors with a charge state in charges and a score of at least score.cutoff are coloured by charge state; low-scoring precursors with other charge states are drawn in light grey.

Usage

lcmsmap(data, charges = 2:3, score.cutoff = 30, ...)

Arguments

data

a psmSet or a mascot object.

charges

integer vector of the charge states to be highlighted.

score.cutoff

numeric score cut-off; precursors scoring below are not highlighted.

...

passed to plot().

Value

Called for its side effect (a plot). Returns NULL invisibly, and NULL without plotting if data is neither a psmSet nor a mascot object.

Author(s)

Christian Panse and Jonas Grossmann 2013

References

The idea is taken from the Pep3D view of the Trans-Proteomic Pipeline: Li XJ, Pedrioli PG, Eng J, et al. (2004) A tool to visualize and evaluate data obtained by liquid chromatography-electrospray ionization-mass spectrometry. Anal Chem 76(13):3856-60. doi:10.1021/ac035375s

See Also

Other psm: mdp(), peakplot(), psm(), psmSet

Examples

# build a psmSet from the HexNAc example spectra
data(HexNAc)
S <- lapply(seq_along(HexNAc), function(i){
  c(HexNAc[[i]], list(id = i, searchEngine = "mascot", fileName = "HexNAc"))})
class(S) <- c("psmSet", "list")

lcmsmap(S, charges = 2:3, score.cutoff = 20)

Methods for Mascot search results

Description

S3 methods for mascot objects, i.e., Mascot Server search results exported as XML and parsed into a nested list, and for their mascot_query elements (one query = one MS2 spectrum and its peptide assignment).

Usage

## S3 method for class 'mascot'
as.data.frame(x, ...)

## S3 method for class 'mascot_query'
as.psm(object, ...)

## S3 method for class 'mascot'
summary(object, ...)

is.mascot(object, class2)

is.mascot_query(object, class2)

## S3 method for class 'mascot'
plot(x, ...)

## S3 method for class 'mascot_query'
plot(x, obj = NULL, FUN = defaultIon, ...)

Arguments

x, object

a mascot object, or a mascot_query object for plot.mascot_query(), is.mascot_query(), and as.psm.mascot_query().

...

passed to lcmsmap() by plot.mascot(), ignored otherwise.

class2

unused; present for compatibility with the methods::is() signature.

obj

the mascot object x belongs to. Required by plot.mascot_query() if the query has a peptide assignment: its masses (amino acid masses) and variable_mods are used to compute the fragment ions.

FUN

a function computing the fragment ion series, see fragmentIon(). Default is defaultIon().

Details

A mascot object is created on the Mascot Server by exporting a result .dat file to XML,

⁠./export_dat_2.pl $EXPORTOPTIONS file=$DAT⁠

with ⁠$EXPORTOPTIONS⁠ set to "_minpeplen=5 _server_mudpit_switch=0.000000001 _showsubsets=1 _sigthreshold=0.05 do_export=1 export_format=XML group_family=1 pep_calc_mr=1 pep_delta=1 pep_end=1 pep_exp_mr=1 pep_exp_mz=1 pep_exp_z=1 pep_expect=1 pep_isbold=1 pep_isunique=1 pep_miss=1 pep_query=1 pep_rank=1 pep_scan_title=1 pep_score=1 pep_seq=1 pep_start=1 pep_var_mod=1 peptide_master=1 prot_acc=1 prot_cover=1 prot_desc=1 prot_empai=1 prot_hit_num=1 prot_len=1 prot_mass=1 prot_matches=1 prot_pi=1 prot_score=1 prot_seq=1 protein_master=1 query_master=1 query_params=1 query_peaks=1 query_qualifiers=1 query_raw=1 query_title=1 search_master=1 show_format=1 show_header=1 show_masses=1 show_mods=1 show_params=1 show_pep_dupes=1 use_homology=1 user=command line", and parsing the XML file in R with XML::xmlToList(XML::xmlParse(xml_file_name)). Assign the class "mascot" to the result and "mascot_query" to each element of its queries list.

A mascot_query must contain query_charge, query_moverz, SCANS, StringIons1 (the peak list as "mz:intensity,..."), RTINSECONDS, and StringTitle; a peptide assignment is stored in q_peptide (pep_seq, pep_score, pep_expect, pep_var_mod_pos, ...).

Value

Author(s)

Christian Panse 2017; Bernd Roschitzki 2017 (as.data.frame())

References

Mascot Server, Matrix Science, https://www.matrixscience.com/

See Also

peakplot(), lcmsmap(), as.psmSet(), findMz(), https://CRAN.R-project.org/package=XML

Other search results: summary.cometdecoy()

Examples

# a minimal mascot object made of the two msms example spectra
data(msms)
peptides <- c("TAFDEAIAELDTLNEESYK", "TAFDEAIAELDTLSEESYK")
queries <- lapply(1:2, function(i){
  q <- list(.attrs = as.character(i),
    query_charge = "2+",
    query_moverz = msms[[i]]$pepmass[1],
    SCANS = msms[[i]]$scans,
    StringIons1 = paste(msms[[i]]$mZ, msms[[i]]$intensity,
      sep = ":", collapse = ","),
    RTINSECONDS = msms[[i]]$rtinseconds,
    StringTitle = msms[[i]]$title,
    q_peptide = list(pep_seq = peptides[i], pep_score = 60 + i,
      pep_expect = 1e-5, pep_scan_title = msms[[i]]$title))
  class(q) <- c("mascot_query", "list")
  q})
M <- list(queries = queries,
  masses = lapply(seq_len(nrow(AA)), function(i){
    list(.attrs = as.character(AA$letter1[i]), text = AA$Monoisotopic[i])}),
  variable_mods = list())
class(M) <- c("mascot", "list")

is.mascot(M)
summary(M)
as.data.frame(M)[, c("query", "moverz", "pep_seq", "pep_score")]

plot(M$queries[[1]], obj = M)

psm1 <- as.psm.mascot_query(M$queries[[1]])
is.psm(psm1)

Mass deviation plot

Description

mdp() draws a histogram of the precursor mass deviations (in ppm) of the peptide spectrum matches of a psmSet-like list, overlays the deviations of the confident PSMs (score > 30) and a fitted normal density, and marks the mean and the 1, 2, and 3 sigma bands.

Usage

mdp(data, sub = data[[1]]$title)

Arguments

data

a list of PSMs, each having the components pepmass, charge, peptideSequence, modification, and mascotScore (or score), e.g., a psmSet object.

sub

a sub title for the plot. Default is the title of the first spectrum.

Details

The experimental mass is computed from pepmass and charge, the theoretical one with parentIonMass(). Modified peptides (non-zero modification) are ignored, as are deviations outside of +/- 10 ppm.

Value

The mean mass deviation (ppm) of the PSMs with a score above 30. If fewer than two such PSMs exist, nothing is plotted and NULL is returned.

Author(s)

Christian Panse 2012-2013

References

Zubarev R, Mann M. (2007) On the proper use of mass accuracy in proteomics. Mol Cell Proteomics 6(3):377-81. doi:10.1074/mcp.M600380-MCP200

See Also

Other psm: lcmsmap(), peakplot(), psm(), psmSet

Examples

# a synthetic set of PSMs with a 2 ppm systematic mass error
set.seed(1)
peptides <- c("HTLNQIDSVK", "ALGGEDVR", "TPIVGQPSIPGGPVR", "QQTQHAVEGDCDIHVLK",
  "EPACDDPDTEQAALAAVDYINK", "AHYDLR", "LCPDCPLLAPLNDSR")
S <- lapply(rep(peptides, 10), function(p){
  M <- parentIonMass(p) * (1 + rnorm(1, mean = 2, sd = 1.5) * 1e-6)
  list(peptideSequence = p, charge = 2, pepmass = (M + 1.008) / 2,
    modification = "0", mascotScore = runif(1, 10, 80), title = "synthetic")})

mdp(S)

Tandem mass spectra of a mouse brain LC-MS/MS experiment

Description

Two tandem mass spectra for demonstrating peptide identification methods such as peakplot() and psm(). The spectra were measured on a linear ion trap coupled to an Orbitrap mass analyzer (Thermo Scientific, Bremen, Germany).

Usage

data(msms)

Format

A list of 2 spectra. Each spectrum is a list with the elements

title

character, MGF title of the spectrum.

scans

numeric, scan number.

rtinseconds

numeric, retention time in seconds.

pepmass

numeric vector of length 2, precursor m/z and intensity.

charge

numeric, precursor charge.

mZ, intensity

numeric vectors, the peak list; mZ is sorted.

The spectra are assigned to the peptides TAFDEAIAELDTLNEESYK and TAFDEAIAELDTLSEESYK, respectively.

Details

The protein sample originates from 10% wild type mouse brain homogenate, prepared in sterile PBS containing protease inhibitors (Complete; Roche, Switzerland) by repeated extrusion through syringe needles of successively smaller size. To remove gross cellular debris, the homogenate was centrifuged for 10 min at 2400 rpm at 4 degrees Celsius.

Author(s)

Dorothea Rutishauser, Jonas Grossmann, Christian Panse 2008

Source

Acquired within the EU Sixth Framework Programme project SysProt (FP6-37457).

See Also

peakplot(), psm(), de_novo()

Examples

data(msms)
str(msms[[1]])
peakplot("TAFDEAIAELDTLNEESYK", msms[[1]])

Compute the parent ion mass of peptide sequences

Description

Computes the monoisotopic mass of the singly protonated peptide, ⁠[M+H]+⁠, for each element of a vector of peptide sequences. Note: the returned mass includes one proton, i.e., it is the singly charged precursor m/z.

Usage

parentIonMass(sequence, fixmod = NULL, NTerm = 1.007825)

Arguments

sequence

a character vector of peptide sequences (1-letter amino acid code).

fixmod

NULL (default) or a numeric vector of length 26 with the residue mass for each letter A to Z; use this to define fixed modifications or custom residue masses. If NULL, the built-in monoisotopic masses are used (cysteine as carbamidomethyl cysteine, 160.030649 Da).

NTerm

N-terminal mass in Dalton, only used if fixmod is given. Default is 1.007825.

Value

a numeric vector of ⁠[M+H]+⁠ masses, one per sequence.

Author(s)

Christian Panse 2006

See Also

aa2mass(), fragmentIon(), ssrc()

Other mass: Fasta, aa2mass(), defaultIon(), genMod(), ssrc()

Examples

fetuin <- list(sequence = c('MK', 'SFVLLFCLAQLWGCHSIPLDPVAGYK',
    'EPACDDPDTEQAALAAVDYINK',
    'HLPR', 'GYK', 'HTLNQIDSVK', 'VWPR',
    'RPTGEVYDIEIDTLETTCHVLDPTPLANCSVR',
    'QQTQHAVEGDCDIHVLK', 'QDGQFSVLFTK',
    'CDSSPDSAEDVR', 'K', 'LCPDCPLLAPLNDSR',
    'VVHAVEVALATFNAESNGSYLQLVEISR',
    'AQFVPLPVSVSVEFAVAATDCIAK',
    'EVVDPTK', 'CNLLAEK', 'QYGFCK',
    'GSVIQK', 'ALGGEDVR',
    'VTCTLFQTQPVIPQPQPDGAEAEAPSAVPDAAGPTPSAAGPPVASVVVGPSVVAVPLPLHR',
    'AHYDLR', 'HTFSGVASVESSSGEAFHVGK',
    'TPIVGQPSIPGGPVR', 'LCPGR', 'IR', 'YFK', 'I'),
    description = "FETUA_BOVIN Alpha-2-HS-glycoprotein")

plot(peptideMass <- parentIonMass(sequence = fetuin$sequence),
    sub = list(fetuin$description, cex = 0.75),
    main = "tryptic digested peptides")

# residue masses A..Z
AA <- c(71.037114, 114.534940, 160.030649, 115.026943, 129.042593,
    147.068414, 57.021464, 137.058912, 113.084064, 0.000000,
    128.094963, 113.084064, 131.040485, 114.042927, 0.000000,
    97.052764, 128.058578, 156.101111, 87.032028, 101.047679,
    150.953630, 99.068414, 186.079313, 111.000000, 163.063329,
    128.550590)

parentIonMass(c("ELVIS", "ELVISK"), fixmod = AA)

Label a peptide fragment ion mass spectrum

Description

peakplot() draws a tandem mass spectrum and labels the peaks matching the in-silico fragment ions of a peptide sequence. The matching is computed with psm(). a, b, c-like ions are drawn in black at the bottom axis, x, y, z-like ions in blue at the top axis.

Usage

peakplot(
  peptideSequence,
  spec,
  FUN = defaultIon,
  fi = fragmentIon(peptideSequence, FUN = FUN)[[1]],
  sub = paste(peptideSequence, spec$title, sep = " / "),
  itol = 0.6,
  pattern.abc = "[abc].*",
  pattern.xyz = "[xyz].*",
  ion.axes = TRUE,
  ...
)

Arguments

peptideSequence

a peptide sequence, a single character string using the one-letter amino acid code.

spec

a tandem mass spectrum (also called peaklist): a list with the equally sized numeric vectors mZ (sorted increasingly) and intensity, and optionally title.

FUN

a function computing the fragment ion series, see fragmentIon(). Default is defaultIon() (b and y ions).

fi

a fragment ion table (data.frame, one column per ion series). Default is fragmentIon(peptideSequence, FUN = FUN)[[1]]. Pass your own table to consider PTMs or a selection of ion series.

sub

a sub title for the plot. Default is the peptide sequence and spec$title.

itol

fragment ion tolerance in Dalton. Peaks with a smaller absolute mass error are labelled. Default is 0.6 Da.

pattern.abc

a regular expression matching the labels of a, b, c-like ions. Ion series not matching pattern.abc or pattern.xyz are not labelled.

pattern.xyz

a regular expression matching the labels of x, y, z-like ions.

ion.axes

logical. If TRUE (default), the axes show the fragment ion labels; otherwise the bottom axis shows m/z values and the top axis all matched ion labels.

...

passed to plot(), e.g., xlim or main.

Details

The right axis shows the relative intensity in percent. A legend lists the m/z values of all matched fragment ions.

Value

The peptide spectrum match computed by psm(): a list containing mZ.Da.error, mZ.ppm.error, idx, label, score, sequence, and fragmentIon.

Author(s)

Bertran Gerrits, Christian Panse 2006-2017

References

Panse C, Gerrits B, Schlapbach R (2009) PEAKPLOT: Visualizing Fragmented Peptide Mass Spectra in Proteomics. useR!2009, Rennes. https://www.r-project.org/conferences/useR-2009/abstracts/pdf/Panse+Gerrits+Schlapbach.pdf

peakplot() has been used for figures and supplemental material in doi:10.1074/mcp.M600046-MCP200, doi:10.1038/msb4100182, doi:10.1371/journal.pone.0036980, doi:10.1002/pmic.201300036, and doi:10.1074/mcp.M115.052548.

See Also

PTM_MarkerFinder(), mascot

Other psm: lcmsmap(), mdp(), psm(), psmSet

Examples

data(msms)
op <- par(mfrow = c(2, 1))
p1 <- peakplot("TAFDEAIAELDTLNEESYK", msms[[1]])
p2 <- peakplot("TAFDEAIAELDTLSEESYK", msms[[2]])
par(op)

# label c, y, and z ions only
fi <- fragmentIon("TAFDEAIAELDTLNEESYK")
fi.cyz <- as.data.frame(cbind(c = fi[[1]]$c, y = fi[[1]]$y, z = fi[[1]]$z))
p <- peakplot("TAFDEAIAELDTLNEESYK", spec = msms[[1]],
    fi = fi.cyz, itol = 0.6, ion.axes = FALSE)

# a custom ion series function
ions <- function(b, y){
  Hydrogen <- 1.007825
  Oxygen <- 15.994915
  Nitrogen <- 14.003074

  y0 <- y - Oxygen - Hydrogen - Hydrogen
  c <- b + (Nitrogen + (3 * Hydrogen))
  z <- y - (Nitrogen + (3 * Hydrogen))

  cbind(b, y, c, z, y0)
}
p <- peakplot("TAFDEAIAELDTLNEESYK", msms[[1]], FUN = ions)
table(substr(p$label[abs(p$mZ.Da.error) < 0.6], 1, 1))

Import a Progenesis LC-MS CSV export

Description

Reads a feature or protein CSV file exported by the commercial software Progenesis LC-MS (Nonlinear Dynamics) and splits it into its logical blocks: the general output columns, the peptide annotation, and one table per exported quantity (e.g., normalized abundance, raw abundance).

Usage

pgImporter(file, sep = ";")

Arguments

file

the name of the CSV file to read.

sep

the field separator character. Default is a semicolon.

Details

The parser expects the Progenesis layout with three header lines:

  1. the name of each per-sample quantity (e.g., ⁠Normalized abundance⁠), placed in the first column of its block;

  2. the experimental group (condition) of the samples, placed in the first column of each group;

  3. the column names.

All quantity blocks must have the same number of columns (one per sample). The annotation columns (e.g., Sequence, Protein) are expected between the last two quantity blocks, and every line ends with a trailing separator. Cells are quoted by ⁠"⁠.

The field separator depends on the Progenesis version and on the system language settings; use sep to switch between semicolon and comma. Although written for Progenesis LC-MS, the importer can be used for other feature maps following the same structure.

Value

a list with the elements

grouping

a character vector giving the group of each sample.

scoreNames

a character vector of the quantity block names.

output

a data.frame with the leading general columns, e.g., feature number, m/z, retention time, charge.

peptideInfo

a data.frame with the annotation columns, e.g., Sequence and Protein.

one element per quantity

named after scoreNames; a data.frame with one row per feature and one column per sample.

Author(s)

Christian Panse, Hubert Rehrauer, Jonas Grossmann 2012

See Also

pgLFQfeature and pgLFQprot for objects created by pgImporter.

Other quantification: iTRAQ2GroupAnalysis(), pgLFQaov(), pgLFQtNpq()

Examples

## a tiny file mimicking the Progenesis feature export layout
csv <- c(
  ';;Normalized abundance;;;;Raw abundance;;;;;;Spectral counts;;;;',
  ';;WT;;KO;;WT;;KO;;;;WT;;KO;;',
  '#;m/z;S1;S2;S3;S4;S1;S2;S3;S4;Sequence;Protein;S1;S2;S3;S4;',
  '1;500.25;10;12;30;33;9;11;29;31;PEPTIDEK;P12345;1;1;2;2;',
  '2;612.80;20;19;18;21;19;18;17;20;ELVISK;P67890;2;1;1;2;')
## Progenesis quotes every cell
csv <- vapply(strsplit(csv, ";", fixed = TRUE),
  function(x) paste0(paste0('"', x, '"', collapse = ";"), ";"), "")
f <- tempfile(fileext = ".csv")
writeLines(csv, f)

pg <- pgImporter(f)
pg$grouping
pg$peptideInfo
pg$"Normalized abundance"

One-way ANOVA for each row of a label-free quantification table

Description

Performs, for each selected row (protein or feature) of a quantification table such as pgLFQprot$"Normalized abundance", a one-way analysis of variance (aov()) of the abundances against the experimental groups.

Usage

pgLFQaov(
  data,
  groups,
  names,
  idx = 1:nrow(data),
  plot = FALSE,
  FUN = function(x) {
     return(x)
 }
)

Arguments

data

a numeric data.frame or matrix, one row per protein (or feature) and one column per LC-MS run, e.g., pgLFQprot$"Normalized abundance".

groups

a factor of length ncol(data) assigning each run to an experimental group.

names

a character vector used as the title of each boxplot, e.g., protein accessions; indexed like the rows of data.

idx

an integer vector of the row indices to be processed. Default is all rows.

plot

logical. If TRUE, a boxplot is drawn for each processed row. Default is FALSE.

FUN

a function for transforming the data before the analysis, e.g., log() or asinh(). Default is the identity.

Details

For each row i in idx the model FUN(data[i, ]) ~ groups is fitted and the ⁠Pr(>F)⁠ value of the group effect is stored, rounded to four digits. If plot = TRUE, a boxplot per row is drawn, filled light green if the p-value is below 0.05 and light red otherwise.

Value

a numeric vector of length nrow(data) containing the ANOVA ⁠Pr(>F)⁠ values in the order of the rows of data; rows not in idx are NA.

Author(s)

Christian Panse, Jonas Grossmann 2012

See Also

pgLFQprot, aov()

Other quantification: iTRAQ2GroupAnalysis(), pgImporter(), pgLFQtNpq()

Examples

data(pgLFQprot)

op <- par(mfrow = c(4, 3))
ANOVA <- pgLFQaov(pgLFQprot$"Normalized abundance",
    groups = as.factor(pgLFQprot$grouping),
    names = pgLFQprot$output$Accession,
    idx = 1:12,
    plot = TRUE)
par(op)
head(ANOVA, 12)

Progenesis LC-MS feature map export

Description

The 1239 most abundant features (peptide ions) from 24 LC-MS/MS runs measured on an Orbitrap Velos, as exported by Progenesis LC-MS and read with pgImporter(). The samples are digested proteins of human HeLa cells infected with Shigella bacteria in a time course: 6 biological replicates of 4 conditions (not infected WT_NI, and infected for 1, 2, and 3 hours: Inf_1h, Inf_2h, Inf_3h).

Usage

data(pgLFQfeature)

Format

A list with 9 elements:

grouping

named character vector of length 24, the condition of each run.

scoreNames

named character vector, the names of the quantitative blocks of the export.

output

data frame (1239 x 12) of feature properties: ⁠#⁠, m/z, ⁠Retention time (min)⁠, ⁠Retention time window (min)⁠, Mass, Charge, ⁠Max fold change⁠, ⁠Highest mean condition⁠, ⁠Lowest mean condition⁠, Anova, Included, ⁠Maximum CV⁠.

peptideInfo

data frame (1239 x 10) of feature annotations, among others Score, ⁠Mass error (ppm)⁠, Protein, Sequence, ⁠Variable modifications ([position] description)⁠, Description.

⁠Normalized abundance⁠, ⁠Raw abundance⁠, Intensity, ⁠Sample retention time (min)⁠, ⁠Best peptide spectral counts⁠

data frames (1239 x 24), one column per LC-MS run.

Details

The 24 runs were aligned and a master map (feature map) was generated from which normalized MS1 volumes were extracted for all features. Some features are annotated with peptide sequences and protein accessions using Mascot with an ion score cut-off of 25.

Author(s)

Christian Panse, Jonas Grossmann 2012

Source

Exported from Progenesis LC-MS (Nonlinear Dynamics). Depending on the language settings, the export uses semicolons or commas as field separator; see the sep argument of pgImporter().

References

Grossmann J et al. (2010). Implementation and evaluation of relative and absolute quantification in shotgun proteomics with label-free methods. J Proteomics. doi:10.1016/j.jprot.2010.05.011

See Also

pgLFQprot, pgImporter(), pgLFQtNpq(), pgLFQaov()

Examples

data(pgLFQfeature)
table(pgLFQfeature$grouping)

# sample correlation
op <- par(mar = c(18, 18, 4, 1), cex = 0.5)
samples <- names(pgLFQfeature$"Normalized abundance")
image(cor(asinh(pgLFQfeature$"Normalized abundance")),
  col = gray(seq(0, 1, length = 20)),
  main = "pgLFQfeature correlation", axes = FALSE)
axis(1, at = seq(0, 1, length.out = length(samples)), labels = samples, las = 2)
axis(2, at = seq(0, 1, length.out = length(samples)), labels = samples, las = 2)
par(op)

# feature 1239: annotation and abundances. Conflicts are caused by
# shared peptides, mapping to more than one peptide, or a second-ranked
# peptide above threshold.
pgLFQfeature$peptideInfo$Sequence[1239]
pgLFQfeature$peptideInfo$Protein[1239]
pgLFQfeature$output$Included[1239]

# protein quantification using the top 3 peptides
tNpq <- pgLFQtNpq(QuantitativeValue = pgLFQfeature$"Normalized abundance",
  peptide = pgLFQfeature$peptideInfo$Sequence,
  protein = pgLFQfeature$peptideInfo$Protein, N = 3, plot = FALSE)
dim(tNpq)

Progenesis LC-MS protein export

Description

The 252 most abundant proteins identified from the 24 LC-MS/MS runs described in pgLFQfeature, as exported by Progenesis LC-MS and read with pgImporter(). Feature volumes of non-conflicting features were summed up to protein abundances for each run.

Usage

data(pgLFQprot)

Format

A list with 7 elements:

grouping

named character vector of length 24, the condition of each run (WT_NI, Inf_1h, Inf_2h, Inf_3h; 6 runs each).

scoreNames

named character vector, the names of the quantitative blocks of the export.

output

data frame (252 x 9) of protein properties: Accession, ⁠Peptide count⁠, ⁠Peptides used for quantitation⁠, ⁠Confidence score⁠, Anova (p), ⁠Max fold change⁠, ⁠Highest mean condition⁠, ⁠Lowest mean condition⁠, Description.

peptideInfo

data frame (252 x 4), spectral counts of the first four runs.

⁠Normalized abundance⁠, ⁠Raw abundance⁠, ⁠Spectral counts⁠

data frames (252 x 24), one column per LC-MS run.

Author(s)

Christian Panse, Jonas Grossmann 2012

Source

Exported from Progenesis LC-MS (Nonlinear Dynamics); see pgLFQfeature.

References

Grossmann J et al. (2010). Implementation and evaluation of relative and absolute quantification in shotgun proteomics with label-free methods. J Proteomics. doi:10.1016/j.jprot.2010.05.011

See Also

pgLFQfeature, pgImporter(), pgLFQaov()

Examples

data(pgLFQprot)
head(pgLFQprot$output[, c("Accession", "Peptide count", "Anova (p)")])

# sample correlation
op <- par(mar = c(18, 18, 4, 1), cex = 0.5)
samples <- names(pgLFQprot$"Normalized abundance")
image(cor(asinh(pgLFQprot$"Normalized abundance")),
  main = "pgLFQprot correlation", axes = FALSE,
  col = gray(seq(0, 1, length = 20)))
axis(1, at = seq(0, 1, length.out = length(samples)), labels = samples, las = 2)
axis(2, at = seq(0, 1, length.out = length(samples)), labels = samples, las = 2)
par(op)

Label-free protein quantification using the top N peptide approach

Description

Implements the TopN ("top N peptide") strategy: for each protein, only the N most intense peptides (features) are summed up to obtain the protein abundance. Because only the best-flying peptides contribute, the resulting protein values are comparable between proteins within one condition, which allows estimating protein stoichiometries and copy numbers per cell.

Usage

pgLFQtNpq(QuantitativeValue, peptide, protein, N = 3, plot = TRUE, FUN = asinh)

Arguments

QuantitativeValue

a numeric data.frame or matrix of feature abundances, one row per feature and one column per LC-MS run, e.g., pgLFQfeature$"Normalized abundance".

peptide

a character vector of peptide sequences, one per row of QuantitativeValue.

protein

a character vector of protein accessions, one per row of QuantitativeValue.

N

the number of top flying peptides used per protein.

plot

logical. If TRUE (default), an image of the sample-by-sample correlation matrix of the protein values is drawn.

FUN

a function used to transform the protein values before the correlation matrix is computed for the plot. Default is asinh().

Details

The peptides of a protein are ranked by their summed abundance over all samples (columns of QuantitativeValue). Feature intensities of peptides occurring several times (e.g., different charge states) are aggregated per peptide sequence before ranking. Proteins having fewer than N distinct peptides are dropped.

The approach was first described by Silva et al. (2006) for Waters Q-TOF instruments running in MSe mode. Grossmann et al. (2010) showed that it also works for Orbitrap and FT-ICR instruments.

Value

a numeric matrix with one row per quantified protein (row names are the protein accessions) and one column per LC-MS run, containing the sum of the top N peptide abundances.

Author(s)

Christian Panse, Jonas Grossmann 2012

References

Silva J.C. et al. (2006), Absolute quantification of proteins by LCMSE: a virtue of parallel MS acquisition. Mol Cell Proteomics 5(1):144-156. doi:10.1074/mcp.M500230-MCP200

Grossmann J. et al. (2010), Implementation and evaluation of relative and absolute quantification in shotgun proteomics with label-free methods. J Proteomics 73(9):1740-1746. doi:10.1016/j.jprot.2010.05.011

See Also

pgLFQfeature, pgImporter()

Other quantification: iTRAQ2GroupAnalysis(), pgImporter(), pgLFQaov()

Examples

data(pgLFQfeature)
op <- par(mfrow = c(2, 4), mar = c(4, 4, 4, 1))
for (i in 1:4) {
  tNpq <- pgLFQtNpq(QuantitativeValue = pgLFQfeature$"Normalized abundance",
    peptide = pgLFQfeature$peptideInfo$Sequence,
    protein = pgLFQfeature$peptideInfo$Protein,
    N = i)
}

for (i in 1:4) {
  tNpq <- pgLFQtNpq(QuantitativeValue = pgLFQfeature$"Normalized abundance",
    peptide = pgLFQfeature$peptideInfo$Sequence,
    protein = pgLFQfeature$peptideInfo$Protein,
    plot = FALSE,
    N = i)
  boxplot(t(tNpq), xlab = 'proteins', ylab = 'protein value')
}
par(op)

Plot pressure profiles of nano LC pumps

Description

Draws the column pressure Pc versus time of a sequence of LC runs, e.g., recorded by Eksigent NanoLC pumps, to spot problems of the LC system over a series of measurements with the same gradient.

Usage

ppp(data)

Arguments

data

a data.frame like pressureProfile. The first column must identify the run (e.g., filename) and the second column must be the time; in addition the columns time, Pc (pressure), and Qb (flow) are required.

Details

Runs are grouped by their (rounded) maximal run time, and one figure is drawn for each group of runs having the same gradient length. Each figure consists of two panels: the pressure profiles of all runs of the group, colored by run and overlaid with the scaled flow Qb (grey dashed lines), and a legend listing for each run the time t0 of the maximal flow and the time t1 of the minimal pressure after t0.

Value

NULL, invisibly; called for its side effect of drawing plots.

Author(s)

Bernd Roschitzki, Christian Trachsel, Christian Panse 2012

See Also

pressureProfile

Other LC QC: pps()

Examples

data(pressureProfile)
ppp(pressureProfile[pressureProfile$filename == "F12", ])

Sample pressure profiles at given time points

Description

For each run in a pressure profile data set, determines the measurements closest in time to the given time points (using findNN()) and returns the corresponding pressure values. The result is convenient for comparing runs at fixed time slots, e.g., with boxplots or lattice plots, as a quality check over a sequence of experiments.

Usage

pps(data, time = seq(min(data$time), max(data$time), by = 1))

Arguments

data

a data.frame like pressureProfile containing the columns filename (the run identifier; the column is accessed as data$file), time, and Pc.

time

a numeric vector of time points. Default is every minute from the minimal to the maximal time in data.

Value

a list of four equal-length vectors having one entry per run and time point:

file

the run identifier.

time

the requested time point.

error

the difference between the time of the nearest measurement and the requested time point.

Pc

the pressure of the nearest measurement.

Author(s)

Christian Panse 2012

See Also

pressureProfile, findNN()

Other LC QC: ppp()

Examples

data(pressureProfile)

pps.data <- pps(pressureProfile, time = seq(1, 140, by = 5))
boxplot(Pc ~ time, data = pps.data,
  xlab = 'time [in minutes]', ylab = 'Pc(psi)')

if (requireNamespace("lattice", quietly = TRUE)) {
  pps.data <- pps(pressureProfile, time = seq(25, 40, by = 5))
  print(lattice::xyplot(Pc ~ as.factor(file) |
      paste("time =", as.character(time), "minutes"),
    panel = function(x, y) {
      m <- sum(y) / length(y)
      m5 <- (max(y) - min(y)) * 0.05
      lattice::panel.abline(h = c(m - m5, m, m + m5),
        col = rep("#ffcccc", 3), lwd = c(1, 2, 1))
      lattice::panel.grid(h = -1, v = 0)
      lattice::panel.xyplot(x, y)
    },
    ylab = 'Pc [psi]',
    layout = c(1, 4),
    sub = 'Red lines: mean and mean +/- 5 percent of the range.',
    scales = list(x = list(rot = 45)),
    data = pps.data))
}

NanoLC pressure profiles

Description

Flow and pressure profiles of consecutive injections on an Eksigent NanoLC-Ultra 1D plus system. Each profile covers a 140 min gradient.

Usage

data(pressureProfile)

Format

A data frame with 193187 rows and 4 columns:

filename

factor, the run identifier ("F01", ..., "F24"; 23 runs, "F15" is missing).

time

numeric, time in minutes (0 to 140).

Qb

numeric, flow of pump B in nL/min.

Pc

integer, column pressure in psi.

Details

Samples were separated on a 100 um ID column of 150 mm length packed with C-18 AQ 200A beads (Dr. Maisch GmbH). The column was heated to 50 degrees Celsius during the entire run. The acquisition queue consisted of seven blocks of three samples with a 140 min gradient, each block followed by an autocalibration run with a 25 min gradient.

Author(s)

Christian Trachsel 2012

Source

Eksigent pump log files, extracted with exec/protViz_extractPressureProfiles.bash.

See Also

ppp(), pps()

Examples

data(pressureProfile)
ppp(pressureProfile[pressureProfile$filename == "F01", ])

pps.data <- pps(pressureProfile, time = seq(1, 140, by = 5))
boxplot(Pc ~ time, data = pps.data,
  xlab = "time [min]", ylab = "Pc [psi]")

if (requireNamespace("lattice", quietly = TRUE)) {
  pps.data <- pps(pressureProfile, time = seq(25, 40, by = 5))
  lattice::xyplot(Pc ~ as.factor(file) | paste("time =", time, "minutes"),
    panel = function(x, y) {
      m <- mean(y)
      m5 <- (max(y) - min(y)) * 0.05
      lattice::panel.abline(h = c(m - m5, m, m + m5),
        col = rep("#ffcccc", 3), lwd = c(2, 4, 2))
      lattice::panel.grid(h = -1, v = 0)
      lattice::panel.xyplot(x, y)
    },
    ylab = "Pc [psi]",
    layout = c(1, 4),
    sub = "The red lines indicate the mean and the mean +/- 5% of the range.",
    scales = list(x = list(rot = 45)),
    data = pps.data)
}

Match a peptide sequence against a tandem mass spectrum

Description

psm() computes a peptide spectrum match (PSM) between a peptide sequence and a tandem mass spectrum (MS2). For every in-silico fragment ion of the peptide it determines the nearest measured peak, using the binary search in findNN_(), and reports the mass error in Dalton and ppm. A fragment ion counts as a hit if its absolute mass error is below fragmentIonError.

Usage

psm(
  sequence,
  spec,
  FUN = defaultIon,
  plot = TRUE,
  fi = fragmentIon(sequence, FUN = FUN)[[1]],
  fragmentIonError = 0.6
)

is.psm(object)

## S3 method for class 'psm'
plot(x, ...)

Arguments

sequence

a peptide sequence, a single character string using the one-letter amino acid code.

spec

a tandem mass spectrum: a list with the equally sized numeric vectors mZ (sorted increasingly) and intensity.

FUN

a function computing the fragment ion series, passed to fragmentIon(). Default is defaultIon() (b and y ions).

plot

logical. If TRUE (default), two mass error plots are drawn.

fi

a fragment ion table (data.frame, one column per ion series). Default is fragmentIon(sequence, FUN = FUN)[[1]]. Pass your own table to consider PTMs or specific ion series.

fragmentIonError

fragment ion mass tolerance in Dalton. Default is 0.6 Da; it is only used for the plot.

object

an object to test.

x

a psm object, e.g., an element of a psmSet.

...

passed to peakplot().

Details

The function is useful for assigning, validating or disambiguating peptide sequences assigned to a spectrum, and for building spectral libraries. Note that score is a placeholder and always -1.

plot() on a psm object draws the spectrum with peakplot(), taking the variable modification masses in x$varModification into account; if no peptide sequence is assigned, the plain spectrum is drawn.

Value

A list with the components

mZ.Da.error

mass error (measured - theoretical) in Dalton for each fragment ion.

mZ.ppm.error

the same error in ppm.

idx

index of the nearest peak in spec$mZ for each fragment ion.

label

fragment ion labels, e.g. "b1", "y3".

score

always -1 (not implemented).

sequence

the input peptide sequence.

fragmentIon

the fragment ion table fi.

is.psm() returns TRUE if object has all components of a psm object (MonoisotopicAAmass, charge, id, intensity, mZ, mascotScore, modification, pepmass, peptideSequence, proteinInformation, rtinseconds, scans, searchEngine, title), otherwise FALSE with a message naming the missing components.

Author(s)

Christian Panse 2007-2017

See Also

fragmentIon(), findNN(), peakplot()

Other psm: lcmsmap(), mdp(), peakplot(), psmSet

Examples

spec <- list(scans = 1138,
    title = "178: (rt=22.3807) [20080816_23_fetuin_160.RAW]",
    rtinseconds = 1342.8402,
    charge = 2,
    mZ = c(195.139940, 221.211970, 239.251780, 290.221750,
    316.300770, 333.300050, 352.258420, 448.384360, 466.348830,
    496.207570, 509.565910, 538.458310, 547.253380, 556.173940,
    560.358050, 569.122080, 594.435500, 689.536940, 707.624790,
    803.509240, 804.528220, 822.528020, 891.631250, 909.544400,
    916.631600, 973.702160, 990.594520, 999.430580, 1008.583600,
    1017.692500, 1027.605900),
    intensity = c(931.8, 322.5, 5045, 733.9, 588.8, 9186, 604.6,
    1593, 531.8, 520.4, 976.4, 410.5, 2756, 2279, 5819, 2.679e+05,
    1267, 1542, 979.2, 9577, 3283, 9441, 1520, 1310, 1.8e+04,
    587.5, 2685, 671.7, 3734, 8266, 3309))

op <- par(mfrow = c(2, 1))
m <- psm("HTLNQIDSVK", spec, plot = TRUE)
par(op)

# fragment ions matched within 0.6 Da
m$label[abs(m$mZ.Da.error) < 0.6]
hist(m$mZ.ppm.error)

Sets of peptide spectrum matches

Description

A psmSet is a list of psm objects, i.e., MS2 spectra together with their peptide assignment, as obtained from a search engine result.

Usage

## S3 method for class 'psmSet'
as.data.frame(x, ...)

as.psmSet(object, ...)

## S3 method for class 'mascot'
as.psmSet(object, ...)

## S3 method for class 'psmSet'
summary(object, ...)

## S3 method for class 'psmSet'
plot(x, iRTpeptides = iRTpeptides, ...)

is.psmSet(object)

Arguments

x

a psmSet object.

...

further arguments; passed to lcmsmap() by plot() and to data.frame() by as.data.frame(), ignored otherwise.

object

an object (any for is.psmSet(), a psmSet for summary(), a mascot object for as.psmSet()).

iRTpeptides

currently unused (iRT peptide highlighting is disabled); defaults to the iRTpeptides data.

Value

as.data.frame() returns a data.frame with one row per precursor and the columns RTINSECONDS, moverz (precursor m/z), intensity (summed MS2 intensity), score (search engine score), and charge.

is.psmSet() returns TRUE or FALSE. as.psmSet() returns a psmSet object, or NULL if object cannot be converted. summary() and plot() are called for their side effects.

Author(s)

Christian Panse 2017

See Also

findMz(), mdp()

Other psm: lcmsmap(), mdp(), peakplot(), psm()

Examples

# a psmSet made of the HexNAc example spectra
data(HexNAc)
S <- lapply(seq_along(HexNAc), function(i){
  c(HexNAc[[i]], list(id = i, searchEngine = "mascot", fileName = "HexNAc"))})
class(S) <- c("psmSet", "list")

is.psmSet(S)
summary(S)
as.data.frame(S)
plot(S, charges = 2:3, score.cutoff = 20)

Class "ptmmf"

Description

An S4 class for PTM MarkerFinder results; currently unused.

Slots

scans,query,peptideSequence,modification

character.

mZ,markerIonMZ,markerIonIntensity,markerIonMzError,markerIonPpmError,relativeFragmentIntensity,pepmass

numeric.


Sequence specific retention calculator

Description

Computes a hydrophobicity value for each peptide sequence (tryptic peptides) which can be used to predict reversed-phase retention times. The calculation follows the SSRCalc model of Krokhin et al. (2004).

Usage

ssrc(x, H = list())

Arguments

x

a character vector of peptide sequences, e.g., x = "ELIVSK".

H

a named list of 20 retention coefficients, one per amino acid (1-letter code). If not of length 20 (default list()), the Rc values of table II (column 2) in Krokhin et al. (2004) are used.

Value

a named numeric vector of hydrophobicity values (names are the input sequences); NA for sequences shorter than three residues.

Author(s)

Christian Panse, Christian Trachsel 2015

References

Krokhin OV, et al. An improved model for prediction of retention times of tryptic peptides in ion pair reversed-phase HPLC: its application to protein peptide mapping by off-line HPLC-MALDI MS. Mol Cell Proteomics. 2004;3(9):908-919. doi:10.1074/mcp.M400031-MCP200

See Also

iRTpeptides, parentIonMass()

Other mass: Fasta, aa2mass(), defaultIon(), genMod(), parentIonMass()

Examples

# example of table IV in Krokhin et al. (2004)
ssrc(c("SCHTAVGR", "SCHTGLGR", "EDLIAYLK"))

plot(ssrc(as.character(iRTpeptides$peptide)) ~ iRTpeptides$rt,
    xlab = 'iRT', ylab = 'SSRC hydrophobicity')

Target-decoy FDR summary of Comet search results

Description

Estimates the false discovery rate (FDR) of a Comet target-decoy search on the peptide spectrum match (PSM), peptide, and protein level, and reports how many identifications pass a given PSM-level FDR cut-off.

Usage

## S3 method for class 'cometdecoy'
summary(
  object,
  psmFdrCutoff = 0.05,
  idx = rev(order(object[["sp_score"]])),
  decoyPattern = "^REV_",
  ...
)

Arguments

object

a data.frame of Comet search results with at least the columns num (rank of the hit for its spectrum), sp_score, protein, and plain_peptide, e.g., read from a Comet .txt output. Assign the class c("cometdecoy", "data.frame") to dispatch on summary().

psmFdrCutoff

the PSM-level FDR cut-off. Default is 0.05.

idx

an ordering of the rows, best hit first. Default is decreasing sp_score. Must have length nrow(object). Note that idx is checked against the unfiltered object but applied after filtering for first-ranked hits (see Details), so object should contain first-ranked hits only (all(object$num == 1)).

decoyPattern

a regular expression matching the accessions of decoy proteins in column protein. Default is "^REV_".

...

ignored.

Details

Only the first-ranked hit of each spectrum (num == 1) is considered. The PSMs are sorted by idx, and for every rank i the FDR is estimated as

FDR_i = D_i / (i - D_i),

where D_i is the number of decoy PSMs among the top i PSMs (decoys divided by targets). nConfidentPSM is the first rank at which this estimate exceeds psmFdrCutoff; all PSMs up to that rank are taken as confident. Peptides are counted as unique plain_peptide sequences; proteins are counted by the first accession of each (comma separated) protein group, which gives fewer but less redundant protein groups.

If no decoy hit is found, a warning is issued and the counts and FDRs that cannot be determined are NA.

Value

A one-row data.frame with the columns

nPSM

number of first-ranked PSMs.

psmFdrCutoff

the FDR cut-off used.

nDecoyPSM

number of decoy PSMs among the confident PSMs.

nConfidentPSM

number of confident PSMs (targets and decoys).

nDecoyPeptide, nConfidentPeptide

number of unique decoy and target peptide sequences among the confident PSMs.

nDecoyProteins, nConfidentProteins

number of decoy and target protein groups among the confident PSMs.

fdrPSM, fdrPeptide, fdrProtein

the decoy/target ratios nDecoyPSM / nConfidentPSM, nDecoyPeptide / nConfidentPeptide, and nDecoyProteins / nConfidentProteins.

Author(s)

Christian Panse, Jonas Grossmann

References

Elias JE, Gygi SP (2007) Target-decoy search strategy for increased confidence in large-scale protein identifications by mass spectrometry. Nat Methods 4(3):207-14. doi:10.1038/nmeth1019

Eng JK, Jahan TA, Hoopmann MR (2013) Comet: an open-source MS/MS sequence database search tool. Proteomics 13(1):22-4. doi:10.1002/pmic.201200439

See Also

summary.mascot()

Other search results: mascot

Examples

# a synthetic Comet result of 200 first-ranked PSMs;
# targets score higher than decoys on average
set.seed(1)
n <- 200
isDecoy <- runif(n) < 0.2
S <- data.frame(
  num = 1,
  sp_score = ifelse(isDecoy, rnorm(n, 300, 80), rnorm(n, 600, 150)),
  protein = ifelse(isDecoy, paste0("REV_P", sample(1:50, n, TRUE)),
    paste0("P", sample(1:50, n, TRUE))),
  plain_peptide = paste0("PEPTIDE", sample(1:150, n, TRUE)))
class(S) <- c("cometdecoy", "data.frame")

summary(S)
summary(S, psmFdrCutoff = 0.01)