knitr::opts_chunk$set(echo = TRUE)


PeakSorter is a tool to process LC-MS peak lists so that the most relevant peaks are at the top.

There are three sorting methods implemented in PeakSorter:

Basic steps for using the PeakSorter R package:

  1. Loading the package, your peak data, and set of true positive peaks (if desired)
  2. Sorting using one or multiple sorting methods
  3. Visualizing and validating results

Load PeakSorter


Prepare input dataset

As an example, we'll sort the peak list from a metabolomics experiment with Idh1 knock-in mouse plasma. This data is included in the package.

If you have your own peak list file, you can load that using the read.peak.file function.

Please note:

# Inspect the Idh1 dataset

# Validate the peak data frame

Here are the peaks whose m/z match known metabolites from HMDB database (true positive peaks). You can define your own custom set of true positive peaks. This variable is only required for validating the peak sorting.

Note: all the peak IDs in the true positive set must appear in your peak data frame.


Sort the dataset using the binned method

# Sort dataset using binned sort
sorted <- bin.prioritize(idh1)

# Look at the binned sorted dataset

# Plot the top 100 peaks of the binned sorted dataset

# Validate the sorted dataset
roc.auc(sorted, idh1.true.pos)

Compare different sorting methods on the same dataset

# Sort the IDH1 dataset using different methods
sorted.peaks <- list(
  Binned=bin.prioritize(idh1, 0.01) # Instead of 0.01 min., you can choose your own bin width

Plot the sorted peaks

# Also, can take the top 100 peaks from each sorted list
top100 <- lapply(sorted.peaks, top.peaks)

# Plot the top 100 peaks

Validate the sorted peaks

# Plot the receiver operating characteristic (ROC) curves
# of peaks sorted using different methods
roc.plot(sorted.peaks, idh1.true.pos)

agentlans/PeakSorter documentation built on Sept. 14, 2017, 12:32 a.m.