Simple Peak Alignment for Gas-Chromatography Data

Aligns peak based on peak retention times and matches homologous peaks across samples. The underlying alignment procedure comprises three sequential steps. (1) Full alignment of samples by linear transformation of retention times to maximise similarity among homologous peaks (2) Partial alignment of peaks within a user-defined retention time window to cluster homologous peaks (3) Merging rows that are likely representing homologous substances (i.e. no sample shows peaks in both rows and the rows have similar retention time means). The algorithm is described in detail in Ottensmann et al., 2018 .

output: github_document self_contained: no

Build Status CRAN_Status_Badge

GCalignR provides simple functions to align peak lists obtained from Gas Chromatography Flame Ionization Detectors (GC-FID) based on retention times and plots to evaluate the quality of the alignment. The package supports any other one-dimensional chromatograpy technique that enables the user to create a peak list with at least one column specifying retention times as illustrated below.

plot of chunk unnamed-chunk-2

A short note on the input format

As with many software you need to get used to the input format which is shown in the illustration:

  • Row 1: All sample names
  • Row 2: Variable names
  • Row 3-N: GC data
    • Each block belongs to a sample as shown for sample A (green) and sample B (orange) above

Installing GCalignR:

  • The current release 1.0.1 is on CRAN.
install.packages("GCalignR", dependencies = T)
  • Get the latest developmental version
    if (!("devtools" %in% rownames(installed.packages()))) { 
    } else if (packageVersion("devtools") < 1.6) {
    devtools::install_github("mottensmann/GCalignR", build_vignettes = TRUE)

Get started with GCalignR

To get started read the vignettes:


If you encounter bugs or if you have any suggestions for improvement, just contact meinolf.ottensmann[at]

Also I´m happy to provide help if you can´t get it to work. Usually it is easy to solve small problems. However, in order to simplifiy this process please send a short describton of the problem along with the code you have been using as a script file (.R) together with a minimal example input file (.txt).


Ottensmann M, Stoffel MA, Nichols HJ, Hoffman JI (2018) GCalignR: An R package for aligning gas-chromatography data for ecological and evolutionary studies. PLoS ONE 13(6): e0198311.



Changes since release 0.1.0


  • Retention times are not rounded to two decimals anymore. Calculations still capture a precision of two decimals for purely computational reasons.
  • Within the aligned results, retention times correspond to the input values. Linear adjustments are only used internally and are documented within the Logfile found in the output.


The bioconductor package (MassSpecWavelet)[] is added as in R solution for picking peaks from GC data.

warning messages

  • Warnings addressing formatting issues are now more explicit and partly rephrased to avoid ambiguity


  • Added horitontal axis to barplots summarising peak numbers in plot.GCalign
  • Changed to more prominent colours in binary heatmaps with gc_heatmap


  • Extended workflow and more comprehensive explainations

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.0.3 by Meinolf Ottensmann, a year ago

Report a bug at

Browse source code at

Authors: Meinolf Ottensmann [aut, cre] , Martin Stoffel [aut] , Hazel J. Nichols [aut] , Joseph I. Hoffman [aut]

Documentation:   PDF Manual  

GPL (>= 2) | file LICENSE license

Imports ggplot2, graphics, stats, readr, reshape2, stringr, utils, pbapply, tibble

Suggests knitr, pander, rmarkdown, testthat, vegan

See at CRAN