TITLE: Tutorial on PARADISe: PARAFAC2-based Deconvolution and Identification System for processing GC–MS data
AUTHORS: Beatriz Quintanilla-Casas, Rasmus Bro, Jesper Løve Hinrich, Cleo L. Davie-Martin

[DESCRIPTION]
The present protocol provides general guidelines for users working with PARADISe, a deconvolution and identification system for processing GC-MS data. This tool allows users to perform untargeted analysis of large datasets efficiently and minimizes inter-user variability. The final output is a peak table, in excel format, containing the peak area and the purified spectrum for each resolved compound.

[GUIDELINES]
Introduction:

Traditionally, GC-MS data have been handled through targeted analyses, which involve the identification and quantification of predefined compounds. Such a strategy, besides being time consuming, is often subject to inter-person variability (Ballin & Laursen, 2019). Furthermore, it usually ignores undiscovered compounds, even if the raw analytical data provides comprehensive information. 

In contrast, untargeted methods are gaining importance and provide approaches that overcome many of the problems associated with targeted approaches. Various tools have emerged over the past decades to achieve efficient, untargeted profiling analyses of GC-MS data. Some of these tools were based on the analysis of single chromatograms or a batch of sample chromatograms, and with both open accessible e.g., XCMS (Smith, et al., 2006) and proprietary toolboxes (i.e., MassHunter®, Agilent™). Yet, most methods are still time-consuming and require users to make decisions on settings that can lead to biases.

The present tool, PARADISe, is a PARAllel FACtor analysis 2 (PARAFAC2)-based deconvolution and identification system that applies a tensor decomposition model on the 3-way array considering all samples. It uses collinearity of the mass spectral mode in relation to the concentration of co-eluting peaks. One of the main advantages of the PARAFAC2 model is that it allows for retention time shifting between samples, which are commonly found in chromatographic data. Nonetheless, alignment algorithms can be automatically applied to GC-MS data in PARADISe to ease the confusion associated with interval selection when severe retention time shifts are present. The performance of PARAFAC2 models will be assured, as long as the user provides a large dataset (at least 20 samples) and the different chemical compounds present different individual mass spectra compared to each other, especially when they elute at very close retention times. The final output that PARADISe generates is a peak table of peak areas for each of the selected compounds. Moreover, if the user has access to a NIST MS database, the software will also identify the chemical compounds found.

 

This protocol aims to provide an overall explanation of the PARADISe software (v6.0.1), from the basis of the methods to practical issues. The protocol will be updated when significant changes to the PARADISe workflow are effected. The PARADISe software adapts a semantic versioning scheme (per PARADISe v6.0.1), such that version number X.Y.Z denotes the major version X,minor version Y, and patch version Z (bug fixes and improvements). Thus, analysis perform in earlier versions of PARADISe will be loadable in newer versions, as long as the major version X is the same.

PARADISe tabs:

1. The Welcome tab (given in below figure) provides simple tips on getting started.
 

Furthermore, there is a series of short videos with extended information about the software and its utilities on our YouTube channel “Chemometrics and Machine Learning in Copenhagen” (https://www.youtube.com/@QualityAndTechnology), within the “PARADISe version 6” playlist. 

2. The Data tab (given in below figure) is where the user reads in data, either by importing CDF files or previous PARADISe sessions. The Data tab also has the option to “Export” PARADISe intervals and chromatography data in the top right-hand corner, but this is not necessary as the current PARADISe session (and models) are automatically saved to the Session Name folder specified.
 

3. The Editor tab (given in the below figure) is where the user can navigate through the overlaid chromatograms and select intervals. Different settings for data visualization are possible e.g., TIC/BPC or even specific m/z (EIC).
 

4. Models for the selected intervals are fitted and evaluated in the Analysis tab (given in the below figure) according to the features set in the Settings tab (see below). Once models are fitted, the user explores them manually in order to decide the optimum number of components and to select which components correspond to chemical peaks, which will end up in the final peak table.
 

5. In the Settings tab (below figure), overall PARADISe options are set. Usually, it is only the PARADISe session name, data save directory, and NIST directory where changes are required. However, modelling features can also be adjusted in this tab.
 

 

6. The Logbook tab (Figure 6) contains a record of all “steps” taken in the PARADISe session and is saved automatically to the Session Name folder. It can be used for troubleshooting if the user encounters persistent problems.
 

 


Troubleshooting:

PART A. Interval selection
Example 1. Cut-off peaks
The interval should capture the entire target peak, including the curved fronting and tailing areas nearer the baseline, even if it means that interval includes part of another (cut-off) peak (Figure below a). The portion of cut-off peak will be excluded in later model evaluation steps. Figure below b show examples of a poor interval selection, where either the “front” (left) or “tail” (right) of the target peak are not correctly captured by the interval (grey shading).

 

Example 2. Overlapped intervals
It can happen that boundaries of some intervals will end up overlapped, especially for compounds with very close retention indices. In Figure below, we have three peaks that do have some overlap, but are clearly distinct and their boundaries are clear. The example to the left shows the three peaks selected appropriately as three separate, slightly overlapping, intervals. It is advisable to avoid lazy interval selection in these cases, as shown in the right example, where a single interval covers all three peaks. The more peaks in an interval, the higher the risk of running into problems with recovering the pertinent information correctly.

 

Nonetheless, when target peaks are actually co-eluting, we have no choice but to define a single interval covering both peaks. For instance, in Figure below, the two peaks seems to be independent, but co-eluting to the extent that the boundaries between them are not clear. Therefore, it is perhaps safer to define both peaks in a single interval than to risk incorrectly selecting individual intervals and cutting off part of the peak. In case they are actually two different compounds, they will be separated based on their mass spectra during the later model selection.

 


PART B. Model analysis
Example 1. A target peak and cut-off peak are described by the same model component 
When a given interval contains a target and a cut-off peak, it can occur that both of them are described by the same component. Usually, this situation can be avoided by selecting a PARAFAC2 model with a greater number of components as seen in Figure below.

 

Example 2. Two co-eluting target peaks are described by the same model component
In this case, increasing the number of components does not solve the issue: two co-eluting peaks are still described by the same component (Figure below, blue component). This phenomenon might arise due to e.g., two co-eluting sesquiterpenes whose mass spectra cannot be distinguished, or (more likely), that the samples in the left-hand peak were run in a different analysis batch on the GC-MS to the right-hand peak and there has been a very subtle shift in retention time between the batches. Here, the overlap is too great and the peaks should be exported as a single model component.

 

Example 3. Dealing with saturated peaks
The example below shows a single peak in the TIC with a 99.95% fit for the 1-component model(Figure below a). It looks like the fit will drastically improve if choosing the 2-component model(Figure below b), but the reality is that you end up with much worse peak shape (1-component split into two wobbly peaks) and an improvement of only 0.03% in the fit. This phenomena is found in saturated (overloaded) peaks, where we it is recommended to select the 1-component model to avoid overfitting.

 

If you run into other kinds of minor/major issues with PARADISe, we encourage users to check the Q&A forum available at https://ucphchemometrics.com/paradise/.

[STEPS]
SECTION: Load GC-MS data (Data tab)
1. First-time use

Firstly, it is recommended you define a unique PARADISe session name.
 

SECTION: Load GC-MS data (Data tab)
1.1. In PARADISe, GC-MS data can be imported as:

CDF (Computable Document Format) files: Data tab > Add CDF Files. It is advisable that all files are loaded from the same directory location (local) in order to avoid importing failures.nGenerally, it is possible to export raw data files as CDF files from the GC-MS software the user is working with e.g., exporting Data to AIA format from Chemstation. 

However, open source software for chromatographic data are also available to convert any type of raw data to CDF files, such as Openchrom from Lablicate. 

SECTION: Load GC-MS data (Data tab)
1.2. Data array built in Matlab (*.mat): Data tab > Import/Export > Import chromatographic data.
For the *.exe installation, the installation folder (default is C:\Program Files\University of Copenhagen\paradise\application\) contains a sub-folder named “ExampleFiles” which includes an example example-data-array.mat file. The format (v6.0.1) requires the following variables:

Data which is an array with size: samples × retention time points (scans) × mz channels.
rt which is a column vector specifying the time (in minutes) for each retention time point.
mz which is a row vector specifying the mz values.
PathsAndFilenames which is a cell array (samples × 2), where the first column contains the paths to the sample and the second column contains the filename of each sample.

The *.mat file should be saved in –v7.3 or later – to allow reading the compressed file efficiently.
The imported files can be removed from PARADISe by selecting them in the Data tab and then clicking the Remove Selected Files button. Furthermore, if the user presses the Reset PARADISe Session, all elements belonging to that specific session (data, intervals, and models) will be removed – this is equivalent to starting a new session.
Note that if the imported dataset contains blanks (sample or column blanks), PARADISe will include them for modelling. Thus, it is the user’s choice to decide whether to keep or remove blanks from the data.

SECTION: Load GC-MS data (Data tab)
2. Continued use

The user is able to import previous PARADISe sessions (Data tab > Import/Export > Import Paradise session) or intervals that have been previously defined for any session (Data tab > Import/Export > Import Paradise session). 

Intervals can also be imported as an .xlsx file with the header row Start and End, which list the start and end times for each interval (in minutes), as shown in below figure.

 

SECTION: Visual assessment of GC-MS chromatograms
3. The Editor tab shows the overlaid chromatograms of all imported samples (Figure below a), but it is also possible to visualize a single or a few overlaid chromatograms by selecting specific samples in the left panel list called Signals (Figure below b).
 

 

SECTION: Visual assessment of GC-MS chromatograms
4. It is possible to navigate through the overlaid chromatograms by left-clicking and dragging the cursor over a selected area to zoom in and by right clicking and selecting Reset Zoom to zoom back out. The small lower panel shows that selected region highlighted in purple (Figure below).
 

 

SECTION: Visual assessment of GC-MS chromatograms
5. By default, the Total Ion Chromatogram (TIC) is shown, but the user can switch to the Base Ion Chromatogram (BPC).
Furthermore, specific masses can be investigated by typing them into the EIC Mass(es) field, hover over the field to see a tooltip describing how to specify masses. 
These visualization tools are found at the bottom of the Editor tab (Figure below).

 

SECTION: Visual assessment of GC-MS chromatograms
6. When having a large dataset, it is quite usual to observe retention time shifting across samples. Even though PARAFAC2 models handle shifted data, sometimes raw GC-MS data needs to be aligned in advance to ease the interval selection when shifts are too big. 

SECTION: Visual assessment of GC-MS chromatograms
7. The user is welcome to carry out this step automatically in PARADISe by pressing the Data Alignment (Auto) button at the bottom-right side of the Editor tab. Note that the alignment is a fully automated approach and it cannot currently be undone, so if the result is not satisfactory, the user will need to reload the data. 
 

SECTION: Visual assessment of GC-MS chromatograms
8. The automated alignment consists of an initial coshifting (Larsen, Van den Berg & Engelsen, 2006) to handle possible single samples that are shifted dramatically differently from the bulk. 

SECTION: Visual assessment of GC-MS chromatograms
9. This is followed by a correlation optimized warping (Tomasi, Van den Berg & Andersson,2004), where the parameters are estimated based upon an optimization routine (Skov, Van den Berg, Tomasi & Bro, 2006). Usually, the results are simply assessed visually.
 

SECTION: Interval selection
10. The user is in charge of performing the manual selection of intervals through the Editor tab as follows:
SECTION: Interval selection
10.1. Hold down shift and then left click and drag from left to right to form the boundaries of the peak. The interval will appear shaded in grey and an interval entry for the peak will appear in the bottom left-hand “Intervals” panel.

SECTION: Interval selection
10.2. The user is able to adjust interval boundaries by hovering the cursor against the boundary (a red line will appear at the boundary, along with a sideways arrow). Click and drag the boundary where desired. 
Alternatively, it is also possible to manually enter the numerical retention time for the boundary in the Intervals panel (bottom left-hand corner) (Figure below).

 

SECTION: Interval selection
10.3. Intervals can also be removed by right clicking either on the interval (grey area) or in the Intervals panel and selecting Delete/Remove Selected Intervals.

SECTION: Interval selection
10.4. Repeat the interval selection across all peaks.
SECTION: Interval selection
11. We are aware that GC-MS data is usually very complex and that could be a reason for the user to run into hesitations when setting intervals. Therefore, we provide some tips to handle some of the most common issues in this step in the Troubleshooting section (part A) of this protocol.

SECTION: Fitting PARAFAC2 models
12. Once the intervals have been selected, one model for each interval will be fitted by pressing Fit models on the Paradise Workflow in the upper-left part of the Analysis tab. When the model calculations are complete, an informative pop-up window will appear.
 

 

 

SECTION: Fitting PARAFAC2 models
12.1. Max. Number of Components: it is set to eight by default. You may wish to reduce or increase this number, depending on the complexity of the selected intervals e.g., co-eluted compounds within a single interval. It is also possible to add additional components to selected intervals and recalculate models later, if needed.

SECTION: Fitting PARAFAC2 models
12.2. Max. Iterations (per model) and Convergence Threshold: The data is decomposed using PARAFAC2 based models, which require an iterative fitting approach. 

The fitting continues until the least squares error is below the convergence threshold or a maximum number of iterations are reached. 
The default convergence threshold is 10-8, which is our recommendation. The default maximum number of iterations is 5000, which is enough for most datasets. 
If particularly difficult intervals are selected, such as many overlapping peaks, then more iterations can be beneficial. 
Decreasing the maximum number of iterations will speed up the modelling, but too few iterations can result in poor modelling.

SECTION: Fitting PARAFAC2 models
12.3. Method (ID): while method 4 is selected by default, other methods are also available. It is beyond the scope of this tutorial to go into the details of these algorithms and we note that there is little reason to change the default settings. 

Nway PARAFAC2
Nway PARAFAC2 with non-negativity
Nway PARAFAC2 with fast non-negativity
Flexible coupling PARAFAC2 with non-negativity
Flexible coupling PARAFAC2 with fast non-negativity

SECTION: Fitting PARAFAC2 models
13. The user is also able to switch computation mode to parallel when they have many intervals (>10) and many cores (>2), then PARADISe will use one core to fit one interval. Note that MATLAB has an upper limit of 512 cores.

SECTION: Assessment of fitted models
14. The user is able to inspect the fitted PARAFAC2 models in order to choose the optimal number of components.

 

SECTION: Assessment of fitted models
15. PARADISe has a supporting tool available to identify actual chemical compounds, based on deep learning (Risum & Bro, 2019). This should automatically have been run after fitting the models, but if the model fitting was cancelled by the user, then just press the Analyse Peaks (DL) button on the Paradise Workflow in the upper-left panel of the Analysis tab. 

SECTION: Assessment of fitted models
16. This process takes much less time than the model-fitting step. As a result, the bottom-left panel in the Analysis tab (Figure below),where the models fitted with different number of components are displayed, will be painted according to the number of chemical compounds found.

 

SECTION: Assessment of fitted models
17. The darker the background, the greater the number of true peaks present in that model. Contrarily, the background remains white where the deep learning tool finds no peaks. That same panel also shows:
 

SECTION: Assessment of fitted models
17.1. Fit (%): indicator of how well the model describes the information contained within the GC-MS chromatograms. 
A higher fit % value means that a better fit has been achieved for a model including a given number of components; therefore, we aim to maximize the fit and expect values of at least >95%. 
Generally, increasing the number of model components will improve the fit, but when it reaches a plateau, increasing the number of components may result in an over-fitted model.

SECTION: Assessment of fitted models
17.2. Core consistency: the internal colour of the circle gives an indication of the “Core consistency” of the model, which is a measure of how adequate the model is. 
The higher the core consistency (i.e., darker shading), the better. As the number of components in the model increases, the core consistency will typically decrease towards zero (black ~100%, white ~0%). 
Ideally, we aim to maximize both core consistency and fit, but in practice, the fit (%) will take precedence.

SECTION: Assessment of fitted models
17.3. The thick red circle indicates which component model is currently being displayed.

SECTION: Assessment of fitted models
17.4. The arrow at the top of the panel allows the user to increase the number of components in case the maximum number of components is not enough to describe the complexity of a giveninterval. 
After this, the new models have to be fitted by pressing again the Fit models button (upper-right panel) which will skip already calculated models.

SECTION: Assessment of fitted models
18. Panel A in Figure below shows the Total Ion Chromatogram (TIC) at the given interval used for modelling (raw or aligned). 
Here, one can make a visual assessment of the number of peaks to expect within the current interval.
By clicking on the TIC, it displays the Model residuals, which are essentially a measure of the TIC (i.e., the whole signal) minus the individual elution profiles for the model components (i.e., the structured signals (peaks) we are trying to model).

 

SECTION: Assessment of fitted models
19. 
 

 

SECTION: Assessment of fitted models
20. Panel B in Figure below a shows the individual elution profiles for the model components (i.e., the structured signals). 
Elution profiles can be coloured according to the number of components or the type of peak defined by the deep learning tool outcome (true peak=red, baseline=blue, offset peak=green, and unknown=grey). 
The user can switch the colouring type in the upper-right panel (Figure below b, green arrow).

 

 

SECTION: Assessment of fitted models
21. It is possible to change the view in panel B to see the normalized elution profiles by clicking directly on the panel. The normalization scales each component, such that its Euclidian norm is one across samples. 
This can sometimes be helpful to assess if components have a nice peak shape (i.e., approximately Gaussian). 
However, it can also scale up noise, which often gives rise to a saw-tack pattern (Figure below) – this happens especially for small peaks and peaks that are only present in a few samples. 
If this occurs, it is advisable to view the non-normalized profiles and iteratively remove the largest peak from view (untick the View box for that component).

 

SECTION: Assessment of fitted models
22. In panel D (Figure below), the user is able to select/deselect the compounds to be displayed on panel B (View column), selected as true peaks (Peak column), or exported to the peak table (Export column). 
In some cases, it may be necessary to deselect a large peak from view, in order to better visualize smaller peaks and baseline components. 
Selected components to be exported to the peak table are plotted as a bold line instead of a thin line.

 

SECTION: Assessment of fitted models
23. Finally, panel C in Figure below shows the resolved mass spectra for each model component (only if they have been selected in panel D to be visualized). This information is crucial to decide whether two peaks (model components) are indeed different chemical compounds, when they present different mass spectra.
If, contrarily, these components have the same or very similar mass spectra, then it is very likely that the model is over-fitted and too many components have been selected. 
Additionally, the user can choose in which way the mass spectra is plotted (Bars, Lines, Stairs, and Stems) to the right of the plot.

 

SECTION: Assessment of fitted models
24. Sometimes, it is also useful to check the distribution of relative concentrations (scores as estimated area) for each component between samples. This information can also be displayed in panel C by clicking on it once (Figure below).

 

SECTION: Assessment of fitted models
25. In case the user is interested on looking up if a given mass spectrum matches with a specific chemical compound, it is possible to do so by pressing the Lookup Components in NISTMS button at the middle-bottom part of the Analysis tab, where Interval Specific Options are shown (Figure below). 

 

SECTION: Assessment of fitted models
26. This requires that the NIST MS Search Program has been separately obtained and installed. 
 

SECTION: Assessment of fitted models
27. The location of the MSSEARCH folder (containing the nistms.exe and nistms$.exe files) has to be specified at: Settings tab > SpectralDatabases > NIST > Location.
 

SECTION: Assessment of fitted models
28. In that same tab, the user is also able to specify reporting parameters, such as how compounds are sorted in the peak list (by retention time within or across intervals), among others. 
The number of NISTMS hits and other search parameters needs to be specified through the nistms.exe program.

SECTION: Assessment of fitted models
29. Back to the Interval Specific Options, it is also possible to Clear Selected Model (which can then be refitted by pressing Fit models) and Export Interval Data. 
Exporting an interval may prove useful when having problematic or illustrative intervals for further processing, the exported data is in .mat (MATLAB) format.

SECTION: Create a PARADISe report
30. The user must go through all models fitted for the selected intervals (left-middle Intervals panel in the Analysis tab, Figure below) to decide the optimal number of components for each model and select which components should be exported to the peak table. 

 

SECTION: Create a PARADISe report
31. After this, the final step is to create the peak table by pressing the Export Selected Peaks (PARADISe Report) in the bottom right-hand corner of the Analysis tab (Figure below). The user will be prompted to select the filename and where to save the report.

 

SECTION: Create a PARADISe report
31.1. Overview – Gives a few details on the data, the steps performed in PARADISe, and the software version used.

SECTION: Create a PARADISe report
31.2. Peak Area – Gives the peak integration (peak areas) of all exported peaks for each sample, together with the interval and model information, and the most suitable chemical identification according to the NIST match factor (highest match factor).

SECTION: Create a PARADISe report
31.3. Resolved Mass Spectra – Gives the estimated mz-spectra (as also shown in PARADISe) for each exported peak.

SECTION: Create a PARADISe report
31.4. Top NIST hits for each component that has been exported, where the maximum number of 
hits is defined through nistms.exe.

SECTION: Create a PARADISe report
31.5. Interval Details – Details on the PARAFAC2 model performance, which is nice to have along with the report in case of troubleshooting.

SECTION: Create a PARADISe report
32. The peak table (Peak Area sheet) can now be used for further analysis outside of PARADISe.