This is the vignette to explain the implementation of RGCxGC package. This text presents an end-to-end pipeline for the analysis of comprehensive two dimensional gas chromatography (GCxGC-MS) data. You can access a specific function help through the command help([‘function name’]).
A general workflow about signal preprocessing in chromatography is summarized in Figure 1. Raw chromatographic signals usually contains undesirable artifacts, such as chemical and instrumental noise. Therefore, noise in the data should be removed prior statistical analysis. Furthermore, noise can be significantly reduced by using preprocessing algorithms, herein smoothing, baseline correction, and peak alignment. Then, in order to reveal differences between groups, multivariate analysis can be performed.
In the RGCxGC package, first, the raw chromatogram is importing from a NetCDF file and is folded into the two-dimensional Total Intensity Chromatogram (2D-TIC). Next, you can perform three preprocessing methodologies in order to enhance signals, such as smooth, baseline correction, and peak alignment. Basically, smooth enhance the signal to noise ratio (S/N), baseline correction handles column blooding, and peak alignment corrects the retention time shift of the peaks across multiple runs. Finally, you can perform a multiway principal component analysis (MPCA) to look for systematic patterns that distinguish your samples.
The basic workflow of the RGCxGC package is composed of two main steps, preprocessing and multivariate analysis, after the data is imported (Figure 2).
The raw NetCDF file is imported with the read_chrom function, by providing the file name and modulation time that the GCxGC data was acquired. Next, you can perform preprocessing routines like smoothing and/or baseline correction by using the function wsmooth and baseline_corr, respectively. Then, peak alignment of a single sample against a reference chromatogram can be performed based on the two-dimensional correlation optimized warping (2DCOW) algorithm. Alternatively, multiple sample alignment can be performed with batch_2DCOW function. After signal preprocessing, MPCA can be performed over the dataset by using the m_prcomp functions. As result of the MPCA, you can access to the score matrix through scores function, or plot the loading matrix with the plot_loading function. Finally, the MPCA summary can be retrieved with the print_mpca function. On the other hand, the RGCxGC package can export the two-dimensional chromatograms in order to perform supervised models. It can be done through unfold_chrom. Supervised models can be done with the mixOmics functions.
You can install the package in different manners. The most common is to install it from CRAN.
Another way is to install it is through the developer version in github.
Once you have successfully installed the package, you can acces to every functions and data provided by calling the library.
## Loading required package: RNetCDF
## Loading required package: ptw
## ## Attaching package: 'RGCxGC'
## The following object is masked from 'package:graphics': ## ## plot
## The following object is masked from 'package:base': ## ## plot
The example data is retrieved form Diagnostic metabolite biomarkers of chronic typhoid carriage. You can access to the whole dataset with the identifier MTBLS579 in the MetaboLights database.
You can import the raw chromatogram through the read_chrom function. This function requires at least two parameters: the name of the NetCDF file (name), and the modulation time. This is an adaptation of Skov routine Skov and Bro (2008).
<- system.file("extdata", "08GB.cdf", package = "RGCxGC") chrom_08 <- read_chrom(chrom_08, mod_time = 5)MTBLS08
## Warning in base_GCxGC(Object = Object, mod_time = mod_time, sam_rate = ## sam_rate, : The last 51 signals will be omitted
## Warning in matrix(tic, nrow = len_1d, ncol = len_2d): data length  is not ## a sub-multiple or multiple of the number of rows 
## Retention time ranges: ## 1D (min): 7.98 18.16 ## 2D (sec): 0 5 ## Acquisition rate: 100
##  "chromatogram" "time" "name" "mod_time"
As we can see, the MTBLS08 object has four slots. The first one correspond to the 2D-TIC chromatogram. The second slot refers to the retention time in the first dimension. The third slot is the name of the NetCDF file, which is first check for validity before importing the chromatogram. Finally, the fourth slot is the modulation time in the second dimension.
To visualize chromatograms, you can use the plot function. It is built from filled.contour R base function. Since contour plots is a good choice to display non-native GCxGC data (Reichenbach et al. 2004). The default function only plots the most intense signals, into a few breaks. For a detailed tutorial on 2D chromagram visualization, please visit the tutorial web site.
Due to the large variety of metabolite concentrations in a sample, the total ion current can also have large variability in the intensity scale. Therefore, you have to set the number of levels in hundreds. As the number of levels increases, you can obtain a more detailed chromatogram. On the other hand, you can use color palettes presented in the colorRamps package (matlab.like & matlab.like2).
# nlevels: Number of levels # color.palette: The color palette to employ library(colorRamps) plot(MTBLS08, nlevels = 100, color.palette = matlab.like2)
In chromatography, the net metabolite signals are often obscured by instrumental and chemical noise. These undesirable signals disturbs the chemical interpretation of the results. In order to remove irrelevant information, some preprocessing steps can be employed. The most common preprocessing algorithms are: baseline correction, smoothing and peak alignment, which are reviewed in the following sections.
Baseline correction remove a steady and increasing intensity in the signal. For example, contamination of the instrument system injection or column bleeding. The baseline correction implemented in this package employs the asymmetric least squares algorithm (Eilers 2004).
<- baseline_corr(MTBLS08) MTBLS08_bc plot(MTBLS08_bc, nlevels = 100, color.palette = matlab.like2)
The result of this preprocessing step is a cleaner chromatogram. The baseline has been removed and all of the separation space has filled with a more intense blue.
The Whittaker smoother algorithm1 is used in this package (Eilers 2003). As the main advantages, it accounts with computational efficiency, control over smoothness and automatically interpolation. The Whittaker smoother for GCxGC is implemented in the first chromatogram dimension. In other words, smoothing is carry out to every chromatographic modulation.
The Whittaker smooth algorithm works with discrete penalized least squares. For instance, the penalty order (1 or 2) and the \(\lambda\) arguments has to be provided. While the penalty refers to the order to penalize the roughness of the signals, \(\lambda\) is factor which multiply the rougness signal level. For instance, greater parameter values will hava a stronger influence in the smmothing process.
# Linear penalty with lambda equal to 10 <- wsmooth(MTBLS08_bc, penalty = 1, lambda = 1e1) MTBLS08_sm1 plot(MTBLS08_sm1, nlevels = 100, color.palette = matlab.like, main = expression(paste(lambda, "= 10, penalty = 1")) )