원시데이터 수집 시스템
선정목록으로

An online peak extraction algorithm for ion mobility spectrometry data

관련 필름·전자재료 · (15) 디스플레이 패널재료

기본 정보

저자
  1. Dominik Kopczynski — Bioinformatics for High-Throughput Technologies, Computer Science XI, and Collaborative Research Center SFB 876, TU Dortmund, Dortmund, Germany
  2. Sven Rahmann — Bioinformatics for High-Throughput Technologies, Computer Science XI, and Collaborative Research Center SFB 876, TU Dortmund, Dortmund, Germany ; Genome Informatics, Institute of Human Genetics, University Hospital Essen, University of Duisburg-Essen, Essen, Germany|||Bioinformatics for High-Throughput Technologies, Computer Science XI, and Collaborative Research Center SFB 876, TU Dortmund, Dortmund, Germany
DOI
10.1186/s13015-015-0045-5
저널
Algorithms for Molecular Biology
발행년도
2015
발행기관
BioMed Central
피인용수
10
라이선스
cc-by
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.1186/s13015-015-0045-5
토픽
Analytical Chemistry and Sensors
OpenAlex ID
W2125573977

평가 내용

관련도
관련
사업분야
필름·전자재료 · (15) 디스플레이 패널재료
부 분야
–
R&D 측면
–
확신도
–
근거 용어
–
판단 근거
LLM(gemma-4-26b-a4b-it) 평가로 '필름·전자재료 > 디스플레이 패널재료' 분야에 선정된 논문입니다.
R&D 활용 포인트
–
평가 입력
–

초록

Ion mobility (IM) spectrometry (IMS), coupled with multi-capillary columns (MCCs), has been gaining importance for biotechnological and medical applications because of its ability to detect and quantify volatile organic compounds (VOC) at low concentrations in the air or in exhaled breath at ambient pressure and temperature. Ongoing miniaturization of spectrometers creates the need for reliable data analysis on-the-fly in small embedded low-power devices. We present the first fully automated online peak extraction method for MCC/IMS measurements consisting of several thousand individual spectra. Each individual spectrum is processed as it arrives, removing the need to store the measurement before starting the analysis, as is currently the state of the art. Thus the analysis device can be an inexpensive low-power system such as the Raspberry Pi. The key idea is to extract one-dimensional peak models (with four parameters) from each spectrum and then merge these into peak chains and finally two-dimensional peak models. We describe the different algorithmic steps in detail and evaluate the online method against state-of-the-art peak extraction methods.

본문 69,413자

본문 펼치기
Kopczynski and Rahmann _Algorithms for Molecular Biology_ (2015) 10:17 DOI 10.1186/s13015-015-0045-5 ## RESEARCH Open Access # An online peak extraction algorithm for ion mobility spectrometry data Dominik Kopczynski <sup>1</sup> and Sven Rahmann <sup>1,2*</sup> Abstract Ion mobility (IM) spectrometry (IMS), coupled with multi-capillary columns (MCCs), has been gaining importance for biotechnological and medical applications because of its ability to detect and quantify volatile organic compounds (VOC) at low concentrations in the air or in exhaled breath at ambient pressure and temperature. Ongoing miniaturization of spectrometers creates the need for reliable data analysis on-the-fly in small embedded low-power devices. We present the first fully automated online peak extraction method for MCC/IMS measurements consisting of several thousand individual spectra. Each individual spectrum is processed as it arrives, removing the need to store the measurement before starting the analysis, as is currently the state of the art. Thus the analysis device can be an inexpensive low-power system such as the Raspberry Pi. The key idea is to extract one-dimensional peak models (with four parameters) from each spectrum and then merge these into peak chains and finally two-dimensional peak models. We describe the different algorithmic steps in detail and evaluate the online method against state-of-the-art peak extraction methods. Keywords: Ion mobility spectrometry, Peak detection, Automated data analysis, Online analysis Introduction Ion mobility (IM) spectrometry (IMS), coupled with multi-capillary columns (MCCs), MCC/IMS for short, has been gaining importance for biotechnological and medical applications. With MCC/IMS, one can measure the presence and concentration of volatile organic compounds (VOCs) in the air or in exhaled breath with high sensitivity. In contrast to other technologies, such as mass spectrometry coupled with gas chromatography (GC/MS), MCC/IMS works at ambient pressure and temperature. Several diseases like chronic obstructive pulmonary disease (COPD) [1], sarcoidosis [2] or lung cancer [3] can potentially be diagnosed early with MCC/IMS technology. IMS is also used for the detection of drugs [4] and explosives [5]. Constant monitoring of VOC levels is of interest in biotechnology, e.g., for watching fermenters with yeast producing desired compounds [6] and in medicine, e.g., monitoring propofol levels in the exhaled breath of patients during surgery [7]. [*Correspondence: Sven.Rahmann@uni-due.de](mailto: Sven.Rahmann@uni-due.de) 1Bioinformatics for High-Throughput Technologies, Computer Science XI, and Collaborative Research Center SFB 876, TU Dortmund, Dortmund, Germany 2Genome Informatics, Institute of Human Genetics, University Hospital Essen, University of Duisburg-Essen, Essen, Germany IMS technology is moving towards miniaturization and small mobile devices. This creates new challenges for data analysis: The analysis should be possible _within_ the measuring device without requiring additional hardware like an external laptop or a compute server. Ideally, the spectra can be processed on a small embedded chip or small device like a Raspberry Pi or similar hardware with restricted resources. Algorithms in small mobile hardware face constraints, such as the need to use little energy (hence little random access memory), while maintaining prescribed time constraints. The basis of MCC/IMS analysis is _peak_ _extraction_, by which we mean a representation of all high-intensity regions (peaks) in the measurement by using a few descriptive parameters per peak instead of the full measurement data. State-of-the-art software (like IPHEx [8], Visual Now [9], PEAX [10]) only extracts peaks when the whole measurement is available, which may take up to 10 minutes because of the pre-separation of the analytes in the MCC. Our own PEAX software in fact defines modular pipelines for fully automatic peak extraction and compares favorably with a human domain expert doing the same work manually when presented with a whole MCC/IMS measurement. However, storing the whole © 2015 Kopczynski and Rahmann; licensee BioMed Central. This is an Open Access article distributed under the terms of the [Creative Commons Attribution License (http://creativecommons.org/licenses/by/4.0), which permits unrestricted use,](http://creativecommons.org/licenses/by/4.0) distribution, and reproduction in any medium, provided the original work is properly credited. The Creative Commons Public [Domain Dedication waiver (http://creativecommons.org/publicdomain/zero/1.0/) applies to the data made available in this](http://creativecommons.org/publicdomain/zero/1.0/) article, unless otherwise stated. Kopczynski and Rahmann _Algorithms for Molecular Biology_ (2015) 10:17 Page 2 of 14 measurement is not desirable or possible when the memory and CPU power is restricted. Here we introduce a method to extract peaks and estimate a parametric representation while the measurement is being captured. This is called _online_ _peak_ _extraction_, and this article presents the first algorithm for this purpose on MCC/IMS data. An extended abstract of this work has been published at WABI’14 [11]. Section ‘Background’ introduces the necessary background on the data produced by an MCC/IMS experiment, on peak modeling and on optimization methods. The basic idea of our algorithm is to process each IM spectrum as soon as it arrives (and before the next one arrives). After appropriate pre-processing including denoising and baseline correction described in Section ‘Denoising and baseline correction’, the single spectra are reduced into a mixture of parametric one-dimensional peak models, described in Section ‘Reducing a spectrum to peak models’. Accordingly, in Section ‘Aligning consecutive spectrum peak lists’ the approach of connecting models from two subsequent spectra into peak chains is explained. The main challenge is then to merge the peak chains into two-dimensional peak models, described in Section ‘Estimating 2-D peak models’. In Section ‘Peak clustering’ we introduce a novel approach for clustering peaks among several measurements e.g. for time series. An evaluation of our approach is presented in Section ‘Evaluation’ including a listing of all settings of the MCC/IMS as well as an explanation of all adjustable parameters, while Section ‘Discussion and conclusion’ contains a concluding discussion. Background Ion mobility spectrometers and their functions are well documented [12], and we do not go into technical details. Instead, we characterize the data generated by an MCC/IMS experiment (Section ‘Data from MCC/IMS measurements’). In Section ‘Peak models’ we describe a previously used parametric peak model, and in Section ‘Optimization methods’ we review two optimization methods that are being used as subroutines in this work. Data from MCC/IMS measurements In an MCC/IMS experiment, a mixture of several unknown volatile organic compounds (VOCs) is separated in two dimensions: first by retention time _r_ in the MCC (the time required for a particular compound to pass through the MCC) and second by drift time _d_ through the IM spectrometer. Instead of the drift time itself, a quantity normalized for pressure and temperature called the _inverse reduced mobility_ (IRM) _t_ is used to compare spectra taken under different or changing conditions. Thus we obtain a time series of IM spectra (one spectrum each 100 ms at each retention time point), and each spectrum is a vector of ion concentrations (measured by voltage change on a Faraday plate) at each IRM. Let _R_ be the set of (equidistant) retention time points and let _T_ be the set of (equidistant) IRMs where a measurement is made. If _D_ is the corresponding set of drift times (each 1/250000 second for 50 ms, that is 12 500 time points), there exists a constant _C_ t|d _>_ 0 depending on external conditions [12] such that _T_ = _C_ t|d · _D_ . Then the data is an | _R_ | × | _T_ | matrix _S_ = _(Sr_, _t)_ of measured ion intensities, which we call an _IM spectrum-chromatogram_ (IMSC). The matrix can be visualized as a heat map (Figure 1). A row of _S_ is a _spectrum_, while a column of _S_ is a _chromatogram_ . Areas of high intensity in _S_ are called peaks, and our goal is to discover them and to describe them by parametric models. Comparing peak coordinates with reference databases may reveal the identity of the corresponding compound. A peak caused by a VOC occurs over several IM spectra. We mention some properties of MCC/IMS data that complicate the analysis. - An IM spectrometer uses an ionized carrier gas. These ions are present in every spectrum in addition to the analyte ions, and they create the reactant ion peak (RIP). In the whole IMSC it is present as high-intensity chromatogram at a specific IRM (Figure 1). When no analytes are injected into the device, the spectra contain only the RIP and are called RIP-only spectra. - Every spectrum contains a tailing of the RIP, so the RIP is right-skewed (Figure 2). To extract peaks, the effect of the RIP and its tailing must be estimated and removed. - At higher concentrations, compounds can form dimer ions, and one may observe both the monomer and dimer peak from one compound. This means that there is not necessarily a one-to-one correspondence between peaks and compounds, and our work focuses on peak detection, not compound identification. - An IM spectrometer may operate in positive or negative mode, depending on which type of ions (positive or negative) one wants to detect. In either case, signals are reported in positive units. All experiments described here were done in positive mode. Peak models For our purpose of analyzing MCC/IMS measurements, a peak is characterized by the following assumptions. Assumptions 1. _An_ _n-dimensional_ _peak_ _P_ _is_ _a_ _prod-_ _uct of n log-concave functions with two inflection points in_ _each dimension. The peak width at half height ω_ 1 _/_ 2, _i can be_ Kopczynski and Rahmann _Algorithms for Molecular Biology_ (2015) 10:17 Page 3 of 14 Figure 1 Visualization of a raw measurement (IMSC) as a heat map; signal color: white (lowest) _<_ blue _<_ purple _<_ red _<_ yellow (highest). The constantly present reactant ion peak (RIP) with mode at 0.48 Vs _/_ cm <sup>2</sup> and exemplarily one VOC peak are annotated. _calculated_ _with_ _respect_ _to_ _the_ _mode_ _for_ _each_ _dimension_ _i._ _At its mode (m_ 1, _. . ._, _mn), peak P exceeds the average back-_ _ground_ _noise_ _level_ _by_ _a_ _certain_ _factor_ _times_ _the_ _standard_ _deviation of the noise._ For MCC/IMS measurements, we have _n_ = 2 dimensions, and in both retention time dimension and IRM dimension, we use the shifted Inverse Gaussian distribution _g_ [13] as peak model function: We also make use of the following empirically observable properties of peaks in real IMSCs that concern the peak widths on both the IRM axis and the retention time axis. The width can be described as the length _ω_ 1 _/_ 2 of the interval around the mode where the peak height is at least half of its maximum height. For a (symmetric) Gaussian distribution, there is a linear relation between the standard deviation _σ_ and _ω_ 1 _/_ 2: _ω_ 1 _/_ 2 = _φ_ - _σ_ with _φ_ = 2 2 ln 2 ≈ 2.3548 . (2) √ _g(x_ ; _μ_, _λ_, _o)_ := <sup><u>1[</u></sup> ~~√~~ <sup>_<u>x > o</u>_</sup> <sup><u>]</u></sup> <sup>_> o_</sup> <sup><u>]</u></sup> 2 _π_ - <sup>_λ ((x_</sup> <sup>−</sup> <sup>_<u>o)</u>_</sup> <sup>−</sup> <sup>_μ)_</sup> <sup>2</sup> 2 _μ_ <sup>2</sup> _(x_ - _o)_ _λ_ _(x_ - _o)_ <sup>3</sup> <sup>·</sup> <sup>exp</sup> . (1) This relation approximately holds as well for not too skewed Inverse Gaussian distributions and is a good approximation to estimate its descriptor _σ_ approximately from an empirically observed _ω_ 1 _/_ 2. Given the mode _d_ <sup>∗</sup> of a peak in drift time (in ms), we can estimate its descriptors _(m_, _σ_, _μ_ <sup>′</sup> _)_ in IRM units as follows. Recall that the IRM mode (in V s cm <sup>−2</sup> ) is simply _m_ = _C_ t|d - _d_ <sup>∗</sup>, where _C_ t|d is the conversion constant between drift time and IRM (see Section ‘Data from MCC/IMS measurements’). Spangler _<u>et al.</u>_ <u>[14]</u> ~~�~~ Its parameters are the shift (or offset) _o_, the relative mean _μ_ _>_ 0 (to the right of _o_ ) and the shape parameter _λ_ _>_ 0. A peak is then given as the product of two shifted Inverse Gaussians, scaled by a volume factor _v_, i.e., by seven parameters; so the density function of a peak is _p(r_, _t)_ := _v_ - _g(r_, _μ_ r, _λ_ r, _o_ r _)_ - _g(t_, _μ_ t, _λ_ t, _o_ t _)_ for all _r_ ∈ _R_, _t_ ∈ _T_ . Since the parameters _μ_, _λ_, _o_ of a shifted Inverse Gaussian may be different even though the resulting distributions have a similar shape, it is more intuitive to describe the shifted Inverse Gaussian in terms of three different _descriptors_ : the (absolute) mean _μ_ <sup>′</sup> = _o_ + _μ_, the standard deviation _σ_ and the mode _m_ . There is a bijection between _(μ_, _λ_, _o)_ and _(μ_ <sup>′</sup>, _σ_, _m)_ [13] summarized in Appendix A. Figure 2 A spectrum and its estimated tailing function. empirically derived that _ω_ 1 _/_ 2 = <u>nts’). Spangler</u> ~~�~~ _(_ 11.09 _D d_ <sup>∗</sup> _)/v_ <sup>2</sup> d <sup>2</sup> d <sup>+</sup> <sup>_d_</sup> <sup>2</sup> empirically derived that _ω_ 1 _/_ 2 = _(_ 11.09 _D d_ <sup>∗</sup> _)/v_ <sup>2</sup> d <sup>+</sup> <sup>_d_</sup> grid <sup>2</sup> <sup>,</sup> where _D_ is the diffusion coefficient, _v_ d the drift velocity. Using the Einstein relation [15], _D_ can be computed as _D_ = _kK_ B _T /q_, where _k_ is the ion mobility, _K_ B the Boltzmann constant, _T_ the absolute temperature and _q_ the electric charge. We then use (2) to estimate _σ_ ≈ _ω_ 1 _/_ 2 _/φ_ . Finally,� ~~�~~ the mean is empirically found to be <u>�</u> _μ_ <sup>′</sup> ≈ _C_ t|d _d_ <sup>∗</sup> + _(_ 4.246 · 10 <sup>−5</sup> _)_ <sup>2</sup> + _(d_ <sup>∗</sup> _)_ <sup>2</sup> _/_ 585048.1633 . <u>�</u> . ~~�~~ _(_ 4.246 · 10 <sup>−5</sup> _)_ <sup>2</sup> + _(d_ <sup>∗</sup> _)_ <sup>2</sup> _/_ 585048.1633 Kopczynski and Rahmann _Algorithms for Molecular Biology_ (2015) 10:17 Page 4 of 14 On the retention time axis, the peak width _ω_ 1 _/_ 2 grows approximately linearly with retention time, i.e., there are constants r_width_offset _>_ 0 and r_width_factor _>_ 0 such that width of a peak with maximum at retention time _r_ is approximately _ξ(r)_ := _r_ - r_width_factor + r_width_offset . (3) Optimization methods The online peak extraction algorithm makes use of nonlinear unconstrained minimization, similar to non-linear least squares, and of the EM algorithm. Both methods are summarized here. consists of two repeated steps: The E-step (expectation) estimates the expected membership of each data point in each component and then the component weights _ω_, given the current model parameters _θ_ . The M-step (maximization) estimates maximum likelihood parameters _θc_ for each parametric component _fc_ individually, using the expected memberships as hidden variables that decouple the model. E-Step. To estimate the expected membership _Wi_, _c_ of data point _xi_ in each component _c_, the component’s relative probability at that data point is computed, such that _c_ <sup>_Wi_</sup> <sup>,</sup> <sup>_c_</sup> <sup>=</sup> <sup>1</sup> <sup>for</sup> <sup>all</sup> <sup>_i_</sup> <sup>.</sup> <sup>Then</sup> <sup>the</sup> <sup>new</sup> <sup>component</sup> <sup>weight</sup> estimates _ωc_ <sup>+</sup> <sup>are</sup> <sup>the</sup> <sup>averages</sup> <sup>of</sup> <sup>_Wi_</sup> <sup>,</sup> <sup>_c_</sup> <sup>across</sup> <sup>all</sup> <sup>_n_</sup> <sup>data</sup> points. _Non-linear Least Squares_ The NLLS method is an iterative method to estimate parameters _θ_ = _(θ_ 1, _. . ._, _θq)_ of a supposed parametric function _f_, given _n_ observed data points _(x_ 1, _y_ 1 _)_, _. . ._, _(xn_, _yn)_ with _yi_ = _f (xi_ ; _θ)_ . The idea is to minimize the quadratic error <sup>�</sup> <sup>_n_</sup> _i_ =1 <sup>_r_</sup> _i_ <sup>2</sup> <sup>_(θ)_</sup> <sup>between the function and the</sup> _ωc fc(xi_ | _θc)_ _Wi_, _c_ = ~~�~~ _ωc_ <sup>+</sup> _k_ <sup>_ωk fk(xi_</sup> <sup>|</sup> <sup>_θk)_</sup> <sup>,</sup> _c_ <sup>+</sup> <sup>=</sup> <sup><u>1</u></sup> _n_ - _n_ _i_ =1 _Wi_, _c_, (4) <sup>_n_</sup> _i_ =1 <sup>_r_</sup> _i_ <sup>2</sup> quadratic error <sup>�</sup> <sup>_n_</sup> _i_ =1 <sup>_r_</sup> _i_ <sup>2</sup> <sup>_(θ)_</sup> <sup>between the function and the</sup> observed data, where _ri(θ)_ := _yi_ - _f (xi_ ; _θ)_ is the _residual_ of the _i_ -the datapoint. The necessary optimality condition is <sup>�</sup> _i_ <sup>_ri(θ)_</sup> <sup>·</sup> <sup>_∂ri(θ)/∂θj_</sup> <sup>=</sup> <sup>0</sup> <sup>for</sup> <sup>all</sup> <sup>_j_</sup> <sup>.</sup> <sup>If</sup> <sup>_f_</sup> <sup>is</sup> <sup>linear</sup> <sup>in</sup> <sup>_θ_</sup> Convergence. After each M-step of an EM cycle, we compare _θc_, _q_ (old parameter value) and _θc_ <sup>+</sup>, _q_ <sup>(updated</sup> is <sup>�</sup> _i_ <sup>_ri(θ)_</sup> <sup>·</sup> <sup>_∂ri(θ)/∂θj_</sup> <sup>=</sup> <sup>0</sup> <sup>for</sup> <sup>all</sup> <sup>_j_</sup> <sup>.</sup> <sup>If</sup> <sup>_f_</sup> <sup>is</sup> <sup>linear</sup> <sup>in</sup> <sup>_θ_</sup> (e.g., a polynomial in _x_ with _θ_ being the polynomial coefficients, a setting called polynomial regression), then the optimality condition results in a linear system, which can be solved in closed form. However, often _f_ is not linear in _θ_ and we obtain a non-linear system, which is solved iteratively, given initial parameter values, by linearizing it in each iteration. Details and different algorithms for NLLS can be found in the literature ([16], Chapter 10). In this paper, we use a different, non-symmetric loss function, but apply similar techniques to solve the problem (see below). compare _θc_, _q_ (old parameter value) and _θc_ <sup>+</sup>, _q_ <sup>(updated</sup> parameter value), where _q_ indexes the elements of _θc_, the parameters of component _c_ . We say that the algorithm has converged� when �the relative change _κc_, _q_ := �the relative change _κc_, _q_ := drops below a given thresh | _θc_ <sup>+</sup>, _q_ <sup>−</sup> <sup>_θc_</sup> <sup>,</sup> <sup>_q_</sup> <sup>|</sup> <sup>_/_</sup> <sup>max</sup> | _θc_ <sup>+</sup>, _c_ <sup>+</sup>, _q_ <sup>|, |</sup> <sup>_θc_</sup> <sup>,</sup> <sup>_q_</sup> <sup>|</sup> _The EM algorithm for mixtures with heterogeneous_ _components_ The observed data _x_ = _(x_ 1, _. . ._, _xn)_ is viewed as a _sample_ from a _mixture_ of probability distributions, where the mixture density is specified by _f (xi_ | _ω_, _θ)_ = - _C_ _c_ =1 <sup>_ωc_</sup> <sup>_fc(xi_</sup> <sup>|</sup> <sup>_θc)_</sup> <sup>.</sup> <sup>Here</sup> <sup>_c_</sup> <sup>indexes</sup> <sup>the</sup> <sup>_C_</sup> <sup>different</sup> <sup>com-</sup> ponent distributions _fc_, where _θc_ denotes the parameters of _fc_, and _θ_ = _(θ_ 1, _. . ._, _θC)_ is the collection of all parameters. The mixture coefficients satisfy _ωc_ ≥ 0 for all _c_, and _c_ <sup>_ωc_</sup> <sup>=</sup> <sup>1.</sup> <sup>Unlike</sup> <sup>in</sup> <sup>most</sup> <sup>applications,</sup> <sup>where</sup> <sup>all</sup> <sup>com-</sup> ponent distributions _fc_ are multivariate Gaussians, here the _fc_ are of different types (e.g., uniform and Inverse Gaussian). The goal is to determine the parameters _ω_ and _θ_ such that the probability of the observed sample is maximal (maximum likelihood paradigm). Since the resulting optimization problem is non-convex in _(ω_, _θ)_, the EM algorithm is an iterative method that will converge to a local optimum [17] in parameter space. The EM algorithm old thresh for all _c_, _q_, (if _θc_ <sup>+</sup>, _q_ = _θc_, _q_ = 0, we set _κc_, _q_ := 0). Having reviewed the necessary background, we now describe the methods we use for peak extraction from IMSCs. Denoising and baseline correction Background A major challenge during peak detection in an IM spectrum is to find peaks that only slightly exceed the background noise level in a spectrum _S_ = _(St)_ . To determine whether the intensity _St_ at coordinate _t_ belongs to a peak region or can be solely explained by background noise, we propose a method based on the EM algorithm. It runs in _O(τ_ | _T_ | _)_ time where _τ_ is the number of EM iterations. Mixture model Based on observations of IM spectra signal intensities, we assume that - the noise intensity has a Gaussian distribution over low intensity values with mean _μ_ N and standard deviation _σ_ N, <u>1</u> - exp - _(s_ - _μ_ N _)_ <sup>2</sup> _/(_ 2 _σ_ N <sup>2</sup> 2 _π σ_ N <u>1</u> _p_ N _(s_ | _μ_ N, _σ_ N _)_ = ~~√~~ N <sup>2</sup> <sup>_)_</sup> - the true signal intensity has an Inverse Gaussian distribution with mean _μ_ S and shape parameter _λ_ S, i.e., Kopczynski and Rahmann _Algorithms for Molecular Biology_ (2015) 10:17 Page 5 of 14 - _λ_ S _(s_ - _μ_ S _)_ <sup>2</sup> _/(_ 2 _μ_ <sup>2</sup> S <sup>_s)_</sup> E-step The hidden parameters _Wt_, _c_ are computed using (4), where the three component distributions _fc_ are the three component densities _p_ N, _p_ S, _p_ B with their parameters and the data _x_ is a mean-smoothed version of the original spectrum _S_ : _xt_ := 2 _<u>α</u>_ <u>1+1</u> <sup>·</sup> <sup>�</sup> <sup>_t_</sup> _t_ <sup>′+</sup> = <sup>_α_</sup> _t_ - _α_ <sup>_St_</sup> <sup>′</sup> <sup>, where the smoothing</sup> window margin is _α_ := _(_ 1 _/_ 2 _)_ - _d_ grid · _C_ t|d · | _T_ | _/T_ last. (Here _d_ grid is the grid opening time of the spectrometer and _T_ last is the maximum IRM in _T_ ). Maximum likelihood estimators In the maximization step (M-step) we estimate maximum likelihood parameters for the non-uniform components using the original intensities of _S_ again. _p_ S _(s_ | _μ_ S, _λ_ S _)_ = ~~�~~ _λ_ S _/(_ 2 _πs_ <sup>3</sup> _)_ ·exp - there is an unspecific background component which is not well captured by either of the two previous distributions; we model it by the uniform distribution over all intensities, _p_ B _(s)_ = 1 _/(_ max _(S)_ - min _(S))_, and we expect the weight _ω_ B of this component to be close to zero in standard IM spectra. High weights indicate an anomaly during the measurement. We interpret the observed spectrum _S_ as a sample of a mixture of these three components with unknown mixture coefficients. To illustrate this approach, consider Figure 3, which shows the empirical intensity distribution (histogram) of an arbitrary spectrum, together with the estimated components (except the uniform distribution, which has the expected coefficient of almost zero). It follows that there are six independent parameters to estimate: _μ_ N, _σ_ N, _μ_ S, _λ_ S and weights _ω_ N, _ω_ S, _ω_ B (noise, signal, background, where _ω_ B = 1 − _ω_ N − _ω_ S). Initial parameter values Background noise intensities are assumed to follow a Gaussian distribution at small intensity values. We can determine its approximate mean _μ_ N and standard deviation _σ_ N by considering the first and last 10% of data points in each spectrum. The initial weight of the noise component is set to cover most points covered by this Gaussian distribution, i.e., _ω_ N := |{ _t_ ∈ _T_ | _St_ ⩽ _μ_ N + 3 _σ_ N}| _/_ | _T_ |. We assume that almost all of the remaining weight belongs to the signal component, thus _ω_ S = _(_ 1 − _ω_ N _)_ 0.999, and _ω_ B = _(_ 1 − _ω_ N _)_ - 0.001. To obtain initial parameters for the signal model, let _I_ <sup>′</sup> := { _t_ ∈ _T_ | _St_ _>_ _μ_ N + 3 _σ_ N} (the complement of the intensities that are initially assigned to the noise com �� ponent). We set _μ_ S = _t_ ∈ _I_ <sup>′</sup> <sup>_(St_</sup> <sup>−</sup> <sup>_μ_</sup> <sup>N</sup> <sup>_)_</sup> _/_ | _I_ <sup>′</sup> | and _λ_ S = _μ_ N = _μ_ S = _σ_ N <sup>2</sup> <sup>=</sup> _λ_ S = _<u>t</u>_ <sup>_<u>Wt</u>_</sup> <sup><u>,N</u></sup> <sup>·</sup> <sup>_<u>St</u>_</sup> ~~�~~ _t_ <sup>_Wt_</sup> <sup>,N</sup> _<u>t</u>_ <sup>_<u>Wt</u>_</sup> <sup><u>,S</u></sup> ~~�~~ (8) _t_ <sup>_Wt_</sup> <sup>,S ·</sup> <sup>_(_</sup> <sup>1</sup> <sup>_/(St_</sup> <sup>−</sup> <sup>_μ_</sup> <sup>N</sup> <sup>_)_</sup> <sup>−</sup> <sup>1</sup> <sup>_/μ_</sup> <sup>S</sup> <sup>_)_</sup> , (5) _<u>t</u>_ <sup>_<u>Wt</u>_</sup> <sup><u>,S</u></sup> <sup>·</sup> <sup>_(St_</sup> <sup>−</sup> <sup>_μ_</sup> <sup><u>N</u></sup> <sup>_)_</sup> ~~�~~ _t_ <sup>_Wt_</sup> <sup>,S</sup> , (6) _<u>t</u>_ <sup>_<u>Wt</u>_</sup> <sup><u>,N</u></sup> <sup>·</sup> <sup>_(St_</sup> <sup>−</sup> <sup>_μ_</sup> <sup><u>N</u></sup> <sup>_)_</sup> <sup>2</sup> ~~�~~ , (7) ~~�~~ _t_ <sup>_Wt_</sup> <sup>,N</sup> for all _t_ ∈ _T_ . Final step After convergence, we correct the baseline and remove noise: We first subtract _μ_ N from the signal value and then reduce the remaining value by the estimated noise weight. The corrected spectrum _S_ <sup>+</sup> is , _t_ ∈ _T_ . _St_ <sup>+</sup> <sup>:= max</sup> _(_ 1 − _Wt_,N _)(St_ - _μ_ N _)_, 0 the intensities that are initially assigned to the noise com �� ponent). We set _μ_ S = _t_ ∈ _I_ <sup>′</sup> <sup>_(St_</sup> <sup>−</sup> <sup>_μ_</sup> <sup>N</sup> <sup>_)_</sup> _/_ | _I_ <sup>′</sup> | and _λ_ S = _(_ <sup>�</sup> _t_ ∈ _I_ <sup>′</sup> <sup>_(_</sup> <sup>1</sup> <sup>_/(St_</sup> <sup>−</sup> <sup>_μ_</sup> <sup>N</sup> <sup>_)_</sup> <sup>−</sup> <sup>1</sup> <sup>_/μ_</sup> <sup>S</sup> <sup>_))_</sup> <sup>−1 (which are the maximum</sup> �� _t_ ∈ _I_ <sup>′</sup> <sup>_(St_</sup> <sup>−</sup> <sup>_μ_</sup> <sup>N</sup> <sup>_)_</sup> _(_ <sup>�</sup> _t_ ∈ _I_ <sup>′</sup> <sup>_(_</sup> <sup>1</sup> <sup>_/(St_</sup> <sup>−</sup> <sup>_μ_</sup> <sup>N</sup> <sup>_)_</sup> <sup>−</sup> <sup>1</sup> <sup>_/μ_</sup> <sup>S</sup> <sup>_))_</sup> <sup>−1 (which are the maximum</sup> likelihood estimators for Inverse Gaussian parameters). Reducing a spectrum to peak models Background The idea of processing a single (noise-reduced) IM spectrum _S_ is to deconvolute it into separate components described with statistical distribution functions. Several components appear in each spectrum besides the peaks, namely the previously described RIP and the tailing Figure 3 Histogram of an arbitrary IM spectrum (green bars) and estimated distribution of the noise component (red line) and of the signal component (blue line). Parameters for both components were estimated with the EM algorithm. Kopczynski and Rahmann _Algorithms for Molecular Biology_ (2015) 10:17 Page 6 of 14 described in Section ‘Data from MCC/IMS measurements’. and background noise. We first determine and remove the RIP tailing function and then determine the peak parameters (including the RIP). Determining the tailing function The tailing function appears as a baseline in every spectrum (see Figure 2 for an example). Its shape and scale changes from spectrum to spectrum; so it has to be determined in each spectrum and subtracted in order to extract peaks from the remaining signal in the next step. Empirically, we observe that the tailing function _f (t)_ can be described by a scaled shifted Inverse Gaussian, _f (t)_ = _v_ - _g(t_ ; _μ_, _λ_, _o)_ with _g_ given by (1). The goal is to determine the parameters _θ_ = _(v_, _μ_, _λ_, _o)_ such that _fθ_ _(t)_ under-fits the given data _S_ = _(St)_, as shown in Figure 2. Let _rθ_ _(t)_ := _S(t)_ - _fθ_ _(t)_ be the residual function for a given choice _θ_ of parameters. As we want to penalize _r(t)_ _<_ 0 but not (severely) _r(t)_ _>_ 0, we use the following non-symmetric loss function that depends on a threshold parameter _γ_ _>_ 0: _et(θ_ ; _γ )_ := - _rθ_ _(t)_ 2 _/_ 2 if _rθ_ _(t) < γ_, _γ_ - _rθ_ _(t)_ - _γ_ <sup>2</sup> _/_ 2 if _rθ_ _(t)_ ≥ _γ_ . That is, the loss at time _t_ is the residual squared when it has a negative or small positive value less than the given threshold _γ_ _>_ 0, but becomes a linear function of the residual for larger positive residuals. The goal is to find _θ_ to minimize the total loss _L(θ)_ := _t_ <sup>_et(θ_</sup> <sup>;</sup> <sup>_γ )_</sup> <sup>for</sup> <sup>the</sup> <sup>given</sup> <sup>spectrum</sup> <sup>_S_</sup> <sup>and</sup> <sup>given</sup> <sup>_γ_</sup> <sup>_>_</sup> <sup>0.</sup> We use gradient descent to solve this nonlinear optimization problem, to which we refer as non-linear loss minimization (NLLM). To estimate the tailing function, 1. we determine reasonable initial values for the parameters _θ_ = _(v_, _μ_, _λ_, _o)_ (see below), 2. we solve NLLM with _γ_ = _σ_ N <sup>2</sup> <sup>to estimate the scaling</sup> factor _v_, leaving the other parameters fixed, 3. we solve NLLM with _γ_ = _σ_ N <sup>2</sup> <sup>to estimate all four</sup> parameters, 4. we solve NLLM with _γ_ = _σ_ N <sup>2</sup> <sup>_/_</sup> <sup>100 to re-estimate the</sup> scaling factor _v_ where _σ_ N is the standard deviation of the noise as described in Section ‘Denoising and baseline correction’. The initial parameter values _(v_, _μ_, _λ_, _o)_ are determined as follows: For the scaling factor, we initially set _v_ = _(_ 1 _/_ 2 _)_ <sup>�</sup> _t_ ⩽| _T_ | <sup>_St_</sup> <sup>.</sup> <sup>For</sup> <sup>the</sup> <sup>other</sup> <sup>parameters,</sup> <sup>we</sup> <sup>first</sup> <sup>esti-</sup> mate the descriptors _(μ_ <sup>′</sup>, _σ_, _m)_ as described below and then use the correspondence to the parameters listed in Appendix A. The initial _σ_ is set to the standard deviation of the whole RIP-only spectrum. We determine the initial _m_ as the RIP mode. It is a property of the Inverse Gaussian distributions under consideration such that the mean _μ_ <sup>′</sup> can only range within the interval _I_ = [ _m_, _m_ + 0.7 _σ_ ]. To obtain an appropriate value for _μ_ <sup>′</sup>, an auxiliary offset variable _o_ <sup>′</sup> is set to the largest IRM left of the RIP mode where the signal is below _σ_ N, and _μ_ <sup>′</sup> it is increased in small steps within _I_ . The candidate descriptors _(μ_ <sup>′</sup>, _σ_, _m)_ are converted into corresponding parameters _(μ_, _λ_, _o)_ until _o_ ≥ _o_ <sup>′</sup> . The so obtained parameters constitute the initial parameter values. Extracting peak parameters from a single spectrum To extract all peaks from a spectrum (from left to right), we repeat three sub-steps: 1. scanning for a potential peak, starting where the previous iteration stopped; 2. determining peak parameters (Inverse Gaussian distribution); 3. subtracting the peak from the spectrum and continuing with the remainder. Scanning. The algorithm scans for peaks, starting at the left end of _S_, by sliding a window of a given width across _S_ and fitting a quadratic polynomial model to the data points within the window. The window width (in index units) is related to the grid opening time _d_ grid of the spectrometer and given as _d_ grid _/D_ last - | _D_ | data points, where _D_ last is the maximum (last) drift time measured. The model is built in drift time (not IRM). Let _f (d_ ; _θ)_ = _θ_ 2 _d_ <sup>2</sup> + _θ_ 1 _d_ + _θ_ 0 be the fitted quadratic polynomial inside the window. We call a window a _peak_ _window_ if the following conditions are fulfilled: - the extreme drift time _d_ <sup>∗</sup> = _θ_ 1 _/(_ 2 _θ_ 2 _)_ lies within the drift times of the window; - the extreme drift time _d_ <sup>∗</sup> indicates a maximum (i.e., _θ_ 2 _<_ 0); - the maximum is sufficiently high above the noise level (which is zero after preprocessing): _f (d_ <sup>∗</sup> ; _θ)_ ≥ _σ_ N The first condition can be more strongly restricted to achieve more reliable results, by shrinking the interval towards the center of the window. If no peak is found, the moving window is shifted one index forward. If a peak is detected, the window is shifted half the window length forward before the next scan begins, but first the peak parameters are computed. Determining peak parameters. As described in Section ‘Peak models’, we can estimate all peak descriptors _(m_, _σ_, _μ_ <sup>′</sup> _)_ from its mode _d_ <sup>∗</sup> in drift time. We convert them into the parameters _(μ_, _λ_, _o)_ of the Inverse Gaussian parameterization (see Appendix A). The scaling factor _v_ for the peak is _v_ = _f (d_ <sup>∗</sup> ; _θ)/g(m_ ; _μ_, _λ_, _o)_ . Kopczynski and Rahmann _Algorithms for Molecular Biology_ (2015) 10:17 Page 7 of 14 The model function is subtracted from the spectrum, and the next iteration is started with a window shifted by _α_ index units (consider Section ‘E-step’). For each spectrum, the output of this step is a _spectrum peak list_, which is a set of parameters for a mixture of weighted Inverse Gaussian models describing the peaks. Aligning consecutive spectrum peak lists Background Having a set of peak parameters for each spectrum, the question arises how to merge the sets _P_ = _(Pi)_ and _P_ <sup>+</sup> = _(Pj_ <sup>+</sup> <sup>_)_</sup> <sup>of two consecutive spectra. For each peak</sup> <sup>_Pi_</sup> <sup>,</sup> _P_ <sup>+</sup> = _(Pj_ <sup>+</sup> <sup>_)_</sup> <sup>of two consecutive spectra. For each peak</sup> <sup>_Pi_</sup> <sup>,</sup> we have stored the Inverse Gaussian parameters _μi_, _λi_, _oi_, the peak descriptors _μ_ <sup>′</sup> _i_ <sup>,</sup> <sup>_σi_</sup> <sup>,</sup> <sup>_mi_</sup> <sup>(mean, standard deviation,</sup> the peak descriptors _μ_ <sup>′</sup> _i_ <sup>,</sup> <sup>_σi_</sup> <sup>,</sup> <sup>_mi_</sup> <sup>(mean, standard deviation,</sup> mode) and the scaling factor _vi_, and similarly so for the peaks _Pj_ <sup>+. The idea is to compute a global alignment simi-</sup> lar to the Needleman-Wunsch method [18] between _P_ and _P_ <sup>+</sup> . We need to specify how to score aligning _Pi_ to _Pj_ <sup>+</sup> <sup>and</sup> All completed peak chains are forwarded to the next step, two-dimensional peak model estimation. Estimating 2-D peak models Background Let _C_ = _(P_ 1, _. . ._, _Pn)_ be a chain of one-dimensional Inverse Gaussian models. The goal of this step is to estimate a two-dimensional peak model (product of two one-dimensional Inverse Gaussians) from the chain, as described in Section ‘Peak models’, or to reject the chain if the chain does not fit such a model well. Potential problems are that a peak chain may contain noisy 1-D peaks truncated at their borders, consist only of noise or in fact consist of several consecutive 2-D peaks at the same drift time and successive retention times. _P_ <sup>+</sup> . We need to specify how to score aligning _Pi_ to _Pj_ <sup>+</sup> <sup>and</sup> how to score leaving a peak unaligned (i.e., a gap). Scoring peak alignments The score _Zij_ for aligning _Pi_ to _Pj_ <sup>+</sup> The score _Zij_ for aligning _Pi_ to _Pj_ <sup>+</sup> <sup>is chosen by evaluating</sup> _Pi_ ’s density function at the new mode _m_ <sup>+</sup> _j_ and compar _Pi_ ’s density function at the new mode _m_ <sup>+</sup> _j_ and compar ing it to “typical” value an approximate standard deviation away from the mode (at _mi_ + _δ_, where _δ_ := _d_ grid · _C_ t|d _/φ_ ), resulting in the log-odds score _ζi_, _j_ = ln _g(m_ <sup>+</sup> _<u>j</u>_ _g(mi_ + _δ_ ; _μi_, _λi_, _oi)_ <sup>+</sup> _<u>j</u>_ <sup>;</sup> <sup>_μi_</sup> <sup>,</sup> <sup>_λi_</sup> <sup>,</sup> <sup>_oi)_</sup> . Alternatively, leaving a peak unmatched results in a gap score of zero. Applying Needleman-Wunsch global alignment, we can compute the optimal score of aligning the first _i_ peaks in the former spectrum with the first _j_ peaks in the current spectrum by dynamic programming. We initialize a matrix _Z_, setting all _Zi_,0 and _Z_ 0, _j_ to zero and then compute, for _i_ ≥ 1 and _j_ ≥ 1, Estimating the parameters As discussed in Section ‘Peak models’, the half-height width _ω_ 1 _/_ 2 in retention time of a peak centered at retention time _r_ can be described by an affine function _ξ(r)_, Eq. (3), and _ω_ 1 _/_ 2 can be converted to the corresponding number of data points (window width). We have the parameters _(v_ ˆ _i_, _μ_ ˆ _i_,t, _λ_ <sup>ˆ</sup> _i_,t, ˆ _oi_,t _)_ for each individual peak _i_ = 1, _. . ._, _n_ in a peak chain, and the corresponding descriptors _(_ ˆ _μ_ <sup>′</sup> _i_,t <sup>,</sup> <sup>_σ_</sup> <sup>ˆ</sup> <sup>_i_</sup> <sup>,t,</sup> <sup>_m_</sup> <sup>ˆ</sup> <sup>_i_</sup> <sup>,t</sup> <sup>_)_</sup> <sup>,</sup> <sup>as</sup> <sup>well</sup> <sup>as</sup> <sup>the</sup> associated retention time _ri_ and peak height _hi_ = _v_ ˆ _i_ _g(_ ˆ _mi_,t; _μ_ ˆ _i_,t, _λ_ <sup>ˆ</sup> _i_,t, ˆ _oi_,t _)_ . We proceed similarly to Section ‘Extracting peak parameters from a single spectrum’ by fitting quadratic polynomials _b(r_ ; _θ)_ = _θ_ 2 _r_ <sup>2</sup> + _θ_ 1 _r_ + _θ_ 0 in sliding windows of the appropriate width _ξ(ri)_ such that _hi_ ≈ _b(ri_ ; _θ)_ . Having found a window that fits a peak, we estimate initial descriptors for an Inverse Gaussian model in retention time as follows: _v_ <sup>′</sup> r <sup>′</sup> r <sup>= −</sup> <sup>_θ_</sup> 1 <sup>2</sup> 1 <sup>2</sup> <sup>_/(_</sup> <sup>4</sup> <sup>_θ_</sup> <sup>2</sup> <sup>_)_</sup> <sup>+</sup> <sup>_θ_</sup> <sup>0,</sup> _Zi_ −1, _j_ −1 + _ζi_, _j_, _Zi_ −1, _j_, _Zi_, _j_ −1. _v_ <sup><u>′</u></sup> r _/(_ 2| _θ_ 2| _)_, _Zi_, _j_ = max ⎧ ⎨ ⎩ _σ_ r = Obtaining peak chains The alignment is obtained with a traceback, recording the optimal case in each cell, as usual. There are three cases to consider. - If _Pj_ <sup>+</sup> <sup>is not aligned with a peak in</sup> <sup>_P_</sup> <sup>, potentially a new</sup> peak starts at this retention time. Thus model _Pj_ <sup>+</sup> <sup>is</sup> _m_ r = − _θ_ 1 _/(_ 2 _θ_ 2 _)_, _μ_ <sup>′</sup> r <sup>=</sup> <sup>_m_</sup> <sup>r +</sup> <sup>_ξ(m_</sup> <sup>r</sup> <sup>_) / (_</sup> <sup>4</sup> <sup>_φ)_</sup> <sup>.</sup> The descriptors are then converted into model parameters (see Appendix A). After processing each window, we have obtained a list of size, say, _k_, of Inverse Gaussian distributions. We expect these distributions to be a mixture of _k_ overlapping peaks in a single peak chain. To obtain an optimal deconvolution, we first normalize the volume factors _v_ <sup>′</sup> r <sup>of</sup> <sup>the</sup> _k_ components to obtain _v_ r, _j_ such that <sup>�</sup> <sup>_k_</sup> _j_ =1 <sup>_v_</sup> <sup>r,</sup> <sup>_r_</sup> <sup>=</sup> <sup>1</sup> <sup>and</sup> then apply the EM algorithm. As a byproduct, we obtain an _(n_ × _k)_ matrix _M_ = _(Mi_, _j)_ that determines the membership probability for each of the _n_ data points _(ri_, _hi)_ to each of the _k_ models. peak starts at this retention time. Thus model _Pj_ <sup>+</sup> <sup>is</sup> put into a new peak chain. - If _Pj_ <sup>+</sup> <sup>is aligned with a peak</sup> <sup>_Pi_</sup> <sup>, the chain containing</sup> _Pi_ is extended with _Pj_ <sup>+.</sup> _Pi_ is extended with _Pj_ <sup>+.</sup> - All peaks _Pi_ that are not aligned to any peak in _P_ <sup>+</sup> indicate the end of a peak chain at the current retention time. Kopczynski and Rahmann _Algorithms for Molecular Biology_ (2015) 10:17 Page 8 of 14 To obtain the Inverse Gaussian distribution parameters in the IRM dimension for each of the _k_ models, we first compute model descriptors using a membershipweighted average over the individual model descriptors: For _j_ ∈{1, _. . ._, _k_ }, let Let _X_ be the union of peak locations in all measurements, let | _X_ | =: _n_, and let _Xi_,R be the retention time of peak _i_ and _Xi_,T its IRM. We introduce a clustering approach using the EM algorithm with twodimensional Gaussian mixtures that differs from the standard approach by its ability to dynamically adjust the number of clusters in the process. _Mj_ := _i_ ⩽ _n_ _Mi_, _j_, <sup>′</sup> _j_,t <sup>:=</sup> <sup><u>1</u></sup> _μ_ <sup>′</sup> _j_ _Mj_ _i_ ⩽ _n_ _i_ ⩽ _n_ _i_ ⩽ _n_ _Mi_, _j_ - _μ_ ˆ <sup>′</sup> _i_,t <sup>,</sup> _Mi_, _j_ - _σ_ ˆ _i_,t, _Mi_, _j_ - _m_ ˆ _i_,t. _σj_,t := <sup><u>1</u></sup> _Mj_ _mj_,t := <sup><u>1</u></sup> _Mj_ We then convert these descriptors back into model parameters (Appendix A). The final peak volume is computed as _v_ <sup>∗</sup> _j_ <sup>=</sup> <sup>_v_</sup> <sup>′</sup> _j_,r <sup>· �</sup> _i_ ⩽ _n_ <sup>_vi_</sup> <sup>,t.</sup> For every model _j_ ∈{1, _. . ._, _k_ }, we check the following conditions: <sup>′</sup> _j_,r <sup>· �</sup> <sup>∗</sup> _j_ <sup>=</sup> <sup>_v_</sup> <sup>′</sup> _j_ - The width at half height in the retention time dimension has approximately the expected size (cf. Eqs. (2), (3)): _ξ(mj_,r _)/_ 2 ⩽ _σj_,r _/φ_ _<_ 2 · _ξ(mj_,r _)_, - The peak height at its maximum is sufficiently above the noise level: _v_ <sup>∗</sup> _j_ <sup>·</sup> <sup>_g(mj_</sup> <sup>,t;</sup> <sup>_μj_</sup> <sup>,t,</sup> <sup>_λj_</sup> <sup>,t,</sup> <sup>_oj_</sup> <sup>,t</sup> <sup>_)_</sup> <sup>·</sup> _g(mj_,r; _μj_,r, _λj_,r, _oj_,r _)_ ≥ noise_margin · _σ_ N, where noise_margin _>_ 0 is a tunable parameter, - the Inverse Gaussian peak model _g_ in retention time correlates well (in terms of the Pearson product-moment correlation coefficient _ρ_ ) with its quadratic approximation _b_ in a window around the mode. More precisely, consider the window _W_ = [ _mj_,r − _ξ(mj_,r _)/φ_, _mj_,r + _ξ(mj_,r _)/φ_ ], the model vector _G_ = _g(x_ ; _μj_,r, _λj_,r, _oj_,r _)_ for _x_ ∈ _W_ and the quadratic approximation vector _B_ = _bj(x_ ; _θ)_ for _x_ ∈ _W_, and test whether the Pearson correlation satisfies _ρ(G_, _B)_ ≥ _ρ_ min. Mixture model We assume that the measured retention times and IRMs belonging to peaks from the same compound are independently normally distributed in both dimensions around the (unknown) true retention time and IRM. Let _θj_ := _(μj_,R, _σj_,R, _μj_,T, _σj_,T _)_ be the parameters for component _j_, and let _fj(x_ <sup>′</sup> _givenθj_ be a two-dimensional Gaussian product distribution for a peak location _x_ = _(x_ R, _x_ T _)_ with these parameters. The mixture distribution is _f (x)_ = <sup>�</sup> <sup>_C_</sup> _j_ =1 <sup>_ωj fj(x_</sup> <sup>|</sup> <sup>_θj)_</sup> <sup>with</sup> a yet undetermined number _C_ of clusters. Note that there is no “background” model component. Initial parameter values In the beginning, we initialize the algorithm with as many clusters as peaks, i.e., we set _C_ := _n_ . This assignment makes a background model obsolete, because all peaks are assigned to at least one cluster. All clusters get as start parameters for _μj_,R, _μj_,T the original retention time and IRM of peak location _Xj_, respectively, for _j_ = 1, _. . ._, _n_ . We set _σj_,T := t_width _>_ 0 and _σj_,R := _ξ(Xj_,R _)/φ_ . loop. When� | _μj_,T −� _μk_,T| _<_ t_width and | _μj_,R − _μk_,R| _<_ _ξ_ max{ _μj_,R, _μk_,R}, then clusters _j_ and _k_ are merged by summing the EM weights: _ω_ <sup>+</sup> := _ωj_ + _ωk_ and _Wi_,+ := _Wi_, _j_ + _Wi_, _k_ for all _i_ . The summed weights are assigned to the location of the cluster with larger weight. (The recomputation of the parameters happens immediately after merging in the maximization step). The comparison order may matter in rare cases for deciding which peaks are merged first, but since new means and variances are computed, possible merges that were omitted in the current iteration will be performed in the next iteration. This merging step is applied after in the second EM iteration, since the cluster means need at least one iteration to move towards each other. Maximum likelihood estimators The maximum likelihood estimators for mean and variance of a two-dimensional Gaussian are the standard ones, taking into account the membership weights, Dynamic adjustment of the number of clusters After computing weights in the E-step, but before starting the M-step, we dynamically adjust the number of clusters by merging clusters whose centers are close to each other. Every pair _j_ _<_ _k_ of clusters is compared in a nested forloop. When� | _μj_,T −� _μk_,T| _<_ t_width and | _μj_,R − _μk_,R| _<_ _ξ_ max{ _μj_,R, _μk_,R}, then clusters _j_ and _k_ are merged by loop. When� | _μj_,T max{ _μj_,R, _μk_,R} If all conditions are satisfied, we have identified a 2-D peak model _(v_ <sup>∗</sup> _j_ <sup>,</sup> <sup>_μj_</sup> <sup>,t,</sup> <sup>_λj_</sup> <sup>,t,</sup> <sup>_oj_</sup> <sup>,t,</sup> <sup>_μj_</sup> <sup>,r,</sup> <sup>_λj_</sup> <sup>,r,</sup> <sup>_oj_</sup> <sup>,r</sup> <sup>_)_</sup> <sup>.</sup> <sup>Otherwise</sup> the model is discarded. Peak clustering Background We now consider a series of IMS measurements, for each of which we have extracted peaks available in the form of parameter vectors or descriptors. The question arises how to decide which descriptors in different measurements represent the same peak (and hence potentially the same VOC). Kopczynski and Rahmann _Algorithms for Molecular Biology_ (2015) 10:17 Page 9 of 14 _μj_, _d_ = _σj_ <sup>2</sup>, _d_ <sup>=</sup> - _n_ _<u>i</u>_ <u>=1</u> <sup>_Wi_</sup> <sup><u>,</u></sup> <sup>_<u>j</u>_</sup> <sup>·</sup> <sup>_Xi_</sup> <sup><u>,</u></sup> <sup>_<u>d</u>_</sup> ~~�~~ _<u>n</u>_ _i_ =1 <sup>_Wi_</sup> <sup>,</sup> <sup>_j_</sup> ~~�~~ _<u>n</u>_ _i_ =1 <sup>_Wi_</sup> <sup>,</sup> <sup>_j_</sup> , _d_ ∈{T,R}, (9) - _n_ _<u>i</u>_ <u>=1</u> <sup>_Wi_</sup> <sup><u>,</u></sup> <sup>_<u>j</u>_</sup> <sup>·</sup> <sup>_(Xi_</sup> <sup><u>,</u></sup> <sup>_<u>d</u>_</sup> <sup>−</sup> <sup>_μj_</sup> <sup><u>,</u></sup> <sup>_<u>d)</u>_</sup> <sup>2</sup> , _d_ ∈{T,R}, (10) Wornowizki [19] that determines the agreement between an observed set of data points, interpreted as an empirical distribution function _F_ (the data) and a model distribution _G_ (the mixture distribution obtained from the peak list parameters). The approach writes _F_ = ˜ _s_ - _G_ + _(_ 1−˜ _s)_ - _H_ with _s_ ˜ ∈ [ 0, 1], where _H_ is a non-parametric distribution whose inclusion ensures the fit of the model _G_ to the data _F_ . If the weight _s_ ˜ is close to 1.0, then _F_ is a plausible sample from _G_ . We compare the original spectra and reduced spectra (peaks from peak lists) from a previously used dataset [20]. This set contains 69 measurements preprocessed with a 5 × 5 average. Every measurement contains 1200 spectra. For each spectrum in all measurements, we computed the reduced spectrum model and determined ˜ _s_ . Over 92% of all 82 000 models achieved ˜ _s_ = 1 and over 99% reached ˜ _s_ ≥ 0.9. No ˜ _s_ dropped below 85%. In summary, spectrum reduction provides an accurate parametric representation of most spectra. Execution time We tested our method on two different platforms, (1) a desktop PC with Intel(R) Core(TM) i5 2.80GHz CPU, 8GB memory, Ubuntu 12.04 (64bit) OS and (2) a Raspberry Pi [21] type B with ARM1176JZF-S 700MHz CPU, 512 MB memory, Raspbian Wheezy (32bit) OS, once with the factory defaults of 700 MHz and once overclocked up to 900 MHz. The Raspberry Pi was chosen because it is a complete credit-card-sized low-cost single-board computer with low CPU and power consumption (3.5 w). This kind of device is appropriate for data analysis in future mobile measurement devices. Recall that each spectrum contains 12 500 data points. It is current practice to analyze not the full spectra, but aggregated ones, where five consecutive values are averaged. Here we consider the full spectra, slightly aggregated ones (average over two values, 6 250 data points) and standard aggregated ones (average over five values, 2 500 data points). We measured the average execution time of denoising, baseline correction and consecutive spectrum reduction. Table 1 shows the results. It is remarkable that at the highest resolution (Average 1) the Raspberry Pi with 900 MHz keeps barely the time bound of 100 ms between consecutive spectra. At lower resolutions, the Raspberry Pi satisfies the time restrictions easily. The desktop PC copes with the analysis effortless on any setting. We found that in the steps that use the EM algorithm, on average 25–30 EM iterations were necessary for a precision of thresh := 0.001 (i.e., 0.1%) (see Convergence in Section ‘The EM Algorithm for mixtures with heterogeneous components’). Relaxing the threshold from 0.001 to 0.01 halved the number of iterations without noticeable difference in the resulting estimated parameters. for all components _j_ = 1, _. . ._, _C_ . One problem using this approach emerges from the fact that initially each cluster contains only one peak, leading to an estimated variance of zero in many cases. To prevent this, minimum values are enforced such that _σj_,T ≥ t_width and _σj_,R ≥ _ξ(μj_,R _)/φ_ for all _j_ . Final step The EM loop terminates when no merging occurs and the convergence criteria for all parameters are fulfilled. The resulting membership weights determine the number of clusters as well as the membership coefficient of peak location _Xi_ to cluster _j_ . If a hard clustering is desired, the merging step has to be traced. Evaluation We evaluate different properties of the online method: 1. the quality of reducing a single spectrum to a peak list (denoising/baseline correction (Section ‘Denoising and baseline correction’) and spectrum reduction (Section ‘Reducing a spectrum to peak models’), 2. the execution time of both steps, 3. the quality of the new clustering approach, 4. the correlation between manual annotations on full IMSCs by a computer-assisted expert and our automated online extraction method. Parameters. For evaluation measurements, the MCC was adjusted to a temperature of 40°C and throughput of 150 mL min <sup>−1</sup> . The IMS had a voltage of 4380 V, a grid opening time of 300 μs and a throughput of 150 mL min <sup>−1</sup> . We chose the following parameters [9]: - r_width_offset = 2.5 s (width offset for peaks in retention time), - r_width_factor = 0.06 (width slope for peaks in retention time), - t_width = 0.003 V s cm <sup>−2</sup> (standard deviation for peaks in IRM), - thresh (convergence threshold; value varies within evaluation), - noise_margin = 4 (factor multiplied with standard deviation of background noise for minimal peak height), - _ρ_ min = 0.95 (minimal Pearson product-moment correlation coefficient). Quality of single spectrum reduction In a first experiment, we tested the quality of the spectrum reduction method using an idea by Munteanu and Kopczynski and Rahmann _Algorithms for Molecular Biology_ (2015) 10:17 Page 10 of 14 Table 1 Average processing time of denoising, baseline correction and spectrum reduction on two platforms with different clock rates, averaging methods (single spectra, averages of 2 and 5 spectra) and convergence thresholds thresh thresh _Platform_ _Avg 1_ _Avg 2_ _Avg 5_ Desktop PC 4.36 ms 2.09 ms 0.88 ms 0.1% 1.0% Rasp. Pi (700 MHz) 119.48 ms 55.02 ms 21.82 ms Rasp. Pi (900 MHz) 97.19 ms 43.62 ms 17.42 ms Desktop PC 4.26 ms 2.01 ms 0.66 ms Rasp. Pi (700 MHz) 116.69 ms 52.63 ms 16.99 ms Rasp. Pi (900 MHz) 94.03 ms 41.46 ms 13.48 ms (reduced mobility width for in single cell within _M_ ) and _λ_ r = 1 _/(μ_ r - 0.002 + 0.2 _)_ . For the uniform distribution, we used an ellipsoid with radii _ν_ t = 0.006 and _ν_ r = _μ_ r · 0.02 + 1. We compared our adaptive EM clustering with two common clustering methods: _k_ -means and DBSCAN. Since _k_ -means needs a fixed number of clusters _k_ and appropriate start values for the centroids, used _k_ means++ [22] for estimating good starting values and give it an advantage by assigning the true number of partitions. DBSCAN has the advantages that it does not need to know the number of clusters in advance and that it can find non-linear cluster boundaries, but it does not easily yield parametric cluster descriptors. To measure the quality of an obtained clustering _C_ we use the Fowlkes-Mallows index (FMI, [23]) and the normalized variation of information (NVI) score [24]. For the FMI one considers all pairs of data points. If two data points belong to the same true partition of _P_, they are called _connected_ . Accordingly, a pair of data points is called _clustered_ if they are clustered together by the clustering method are evaluating. Pairs of data points that are both connected and clustered are called true positives (TP). False positives (FP, not connected but clustered) and false negatives (FN, connected but not clustered) are computed analogously. The FMI is the geometric <u>mean</u> <u>of</u> <u>precision</u> <u>and</u> recall: FMI _(P_, _C)_ := √ _TP/(TP_ <u>+</u> _FP)_ <u>·</u> _TP/(TP_ <u>+</u> _FN)_, where _P_ is the true partition and _C_ is the clustering. We have FMI _(P_, _C)_ ∈ [ 0, 1], and FMI _(P_, _C)_ = 1 indicates perfect agreement. The FMI is difficult to interpret when the number of clusters in _C_ and _P_ differs significantly. Therefore we use a second measure that considers cluster sizes only, the normalized variation of information (NVI). To compute the NVI, an auxiliary (| _P_ | × | _C_ |)dimensional matrix _A_ = _(ai_, _j)_ is computed, where _ai_, _j_ is the number of data points within partition _i_ that are assigned to cluster _j_ . The NVI score is defined via entropies; let _n_ be the number of data points and Clustering To evaluate peak clustering methods, we simulate peak locations according to locations in real MCC/IMS datasets, together with the true partition _P_ of peaks. Most of the detected peaks appear in a small dense area early in the measurement. The remaining peaks are distributed widely, which is referred to as the sparse area (we let the areas overlap such that the dense are is contained in the sparse area). The areas approximately have the following boundaries (in units of (V s cm <sup>−2</sup>, s) from lower left to upper right point, cf. Figure 1: measurement: _(_ 0, 0 _)_, _(_ 1.45, 600 _)_ dense area: _(_ 0.5, 4 _)_, _(_ 0.7, 60 _)_ sparse area: _(_ 0.5, 4 _)_, _(_ 1.2, 450 _)_ Peak clusters are ellipsoidal and dense. From [9], we know the minimum required distance between two peaks in order to be identified as two separate compounds. We simulate 30 peak cluster centroids in the dense area and 20 in the sparse area, all picked randomly and uniformly distributed in the respective area. We then randomly pick the number of peaks per cluster. We also randomly pick the distribution of peaks within a cluster. Since we do not know the actual distribution model, we decided to simulate with three models: normal (n), exponential (e) and uniform (u) distribution with the following densities: _f_ n _(r_, _t_ | _μ_ t, _σ_ t, _μ_ r, _σ_ r _)_ = _N (t_ | _μ_ t, _σ_ t _)_ - _N (r_ | _μ_ r, _σ_ r _)_ _H(P)_ := − _H(C)_ := − _H(P_ | _C)_ := − _H(C_ | _P)_ := − _<u>j</u>_ ⩽| _C_ | <sup>_ai_</sup> <sup>,</sup> <sup>_j_</sup> , _n_ _<u>i</u>_ <u>⩽|</u> _<u>P</u>_ <u>|</u> <sup>_ai_</sup> <sup>,</sup> <sup>_j_</sup> , _n_ _i_ ⩽| _P_ | _<u>j</u>_ ⩽| _C_ | <sup>_ai_</sup> <sup>,</sup> <sup>_j_</sup> log _n_ _<u>i</u>_ <u>⩽|</u> _<u>P</u>_ <u>|</u> <sup>_ai_</sup> <sup>,</sup> <sup>_j_</sup> log _n_ _f_ e _(r_, _t_ | _μ_ t, _λ_ t, _μ_ r, _λ_ r _)_ _/_ 4 _j_ ⩽| _C_ | = _λ_ t _λ_ r exp - _(λ_ t| _t_ - _μ_ t| + _λr_ | _r_ - _μ_ r| _)_ _f_ u _(r_, _t_ | _μ_ t, _ν_ t, _μ_ r, _ν_ r _)_ _<u>ai</u>_ <u>,</u> _<u>j</u>_ _<u>ai</u>_ <u>,</u> _<u>j</u>_ _n_ <sup>log</sup> ~~�~~ _i_ <sup>′</sup> ⩽| _P_ | <sup>_ai_</sup> <sup>′,</sup> <sup>_j_</sup> <sup>_<u>μ</u>_</sup> <sup><u>r|2</u></sup> ⩽ 1 _ν_ r <sup>2</sup> _j_ ⩽| _C_ | _i_ ⩽| _P_ | - , _ai_ <u>,</u> _<u>j</u>_ = _(πν_ t _ν_ r _)_ <sup>−1</sup> if <sup><u>|</u></sup> <sup>_<u>t</u>_</sup> <sup><u>−</u></sup> _ν_ <sup>_<u>μ</u>_</sup> <sup>2</sup> <sup><u>t|2</u></sup> 0 otherwise _ν_ t <sup>2</sup> <sup>_<u>μ</u>_</sup> t <sup>2</sup> <sup><u>t|2</u></sup> + <sup><u>|</u></sup> <sup>_<u>r</u>_</sup> <sup><u>−</u></sup> _ν_ <sup>_<u>μ</u>_</sup> r <sup>2</sup> <sup><u>r|2</u></sup> Here _(μ_ t, _μ_ r _)_ is the coordinate of the centroid with RIM in Vs _/_ cm <sup>2</sup> and retention time in s. For the normal distribution, we used _σ_ t = 0.002 and _σ_ r = _μ_ r · 0.002 + 0.2. For the exponential distribution, we used _λ_ t = _(_ 1.45 · 2500 _)_ <sup>−1</sup> _j_ ⩽| _C_ | _i_ ⩽| _P_ | _<u>i</u>_ <u>,</u> _<u>j</u>_ _<u>ai</u>_ <u>,</u> _<u>j</u>_ _n_ <sup>log</sup> ~~�~~ _i_ <sup>′</sup> ⩽| _P_ | <sup>_ai_</sup> <sup>′,</sup> <sup>_j_</sup> _<u>i</u>_ <u>,</u> _<u>j</u>_ _ai_ <u>,</u> _<u>j</u>_ _n_ <sup>log</sup> ~~�~~ _j_ <sup>′</sup> ⩽| _C_ | <sup>_ai_</sup> <sup>,</sup> <sup>_j_</sup> <sup>′</sup> <sup>,</sup> _<u>H(P</u>_ <u>|</u> _<u>C)</u>_ <u>+</u> _<u>H(C</u>_ <u>|</u> _<u>P)</u>_ _NVI(P_, _C)_ := _<u>H(P</u>_ <u>|</u> _<u>CH)</u>_ <u>+</u> _<u>(PH)(C</u>_ <u>|</u> _<u>P)</u>_ if _H(P)_ ̸ = 0, _H(C)_ otherwise. Kopczynski and Rahmann _Algorithms for Molecular Biology_ (2015) 10:17 Page 11 of 14 Figure 4 Histograms of Fowlkes-Mallows index (FMI; higher is better) and normalized variation of information (NVI; lower is better) comparing 100 simulated measurements containing partitioned peak locations with their clusters produced by the different methods. Here _NVI(P_, _C)_ = 0 indicates perfect agreement between the cluster size distributions. Together, an FMI of 1 and an NVI score of 0 indicate a perfect clustering. For the first test, we evaluated 100 sets of data points distributed as described above. The cluster model (normal, exponential or uniform) was drawn randomly. The results show that even with the advantage that _k_ -means knows the true _k_, our adaptive EM clustering performs best on average in terms of FMI and NVI score (Figure 4). For the second test, we additionally inserted 200 uniformly distributed (noise) peaks into the measurement area. All these peaks are singletons and have no matching Figure 5 Histograms similar to Figure 4, but in a more realistic noisy scenario (see text). An FMI of 1 and NVI of 0 would be optimal. Kopczynski and Rahmann _Algorithms for Molecular Biology_ (2015) 10:17 Page 12 of 14 Figure 6 Time series of discovered intensities of two peaks. Left: A peak with agreement between manual and automated online annotation. Right: A peak where the online method fails to extract the peak in several measurements. If one treated zeros as missing data, the overall trend would still be visible. peaks. The results (Figure 5) show that the adaptive EM clustering still performs best on average, whereas _k_ -means fails. Comparison of automated online peak extraction with manual offline annotation The fourth experiment compares extracted peaks from a time series of measurements of two automated methods to an expert manual annotation. The automated methods are our online analysis process described here and automated peak detection using the commercial VisualNow software. Here 15 rats were monitored in 20 minute intervals for up to a day. Each rat resulted in 30–40 measurements (a time series) for a total of 515 measurements. To track peaks over time, we used the previously described EM clustering method. As an example, Figure 6 shows time series of intensities of two peaks detected by computer-assisted manual annotation and using our online algorithm. The example shows that there are cases where the sensitivity of the online algorithm is not perfect; this is mainly true for peaks whose intensity only slightly exceeds the background noise. To obtain an overview over all time series, we computed the cosine similarity _γ_ ∈ [ −1, +1] time series of peak intensities discovered by manual annotation and each automated method. We also computed the recall automated method for each time series, that is, the relative fraction of measurements where the peak was found by the algorithm among those where it was found by manual annotation. Figure 7 shows overall good agreement between both automated methods (our online method and automated VisualNow peak extraction) with Figure 7 Kernel density estimation (kde) plots of recall and cosine similarity of peak intensity, comparing automatically picked peaks from our online algorithm and VisualNow against expert annotation. Each dot corresponds to a time series of one peak. Optimal results would be a recall of 1.0 and a cosine similarity of 1.0 for each time series. Kopczynski and Rahmann _Algorithms for Molecular Biology_ (2015) 10:17 Page 13 of 14 - 2 _(m_ - _μ_ <sup>′</sup> _)_, - _m(_ 2 _μ_ <sup>′</sup> + _m)_ + 3 · _(μ_ <sup>′2</sup> - _σ_ <sup>2</sup> _)_ - _m(_ 3 _σ_ <sup>2</sup> + _μ_ <sup>′</sup> - _m)_ - _μ_ <sup>′3�</sup> the expert manual annotation. The cosine similarity of the inferred time series is in better agreement than the more variable recall. When comparing automated methods against each other, we outperform VisualNow in terms of sensitivity and computation time: About 31% of the points extracted by the online method exceed 90% recall and 98% cosine similarity whereas only 5% of the time series extracted by VisualNow achieve these values. The peak detection of one measurement takes about 2 seconds on average (when the whole measurement is available at once) with the online method and about 20 seconds with VisualNow on the desktop computer described above. VisualNow only provides the position and signal intensity of the peak’s maximum, whereas our method additionally provides shape parameters. Problems of our online method stem from low-intensity peaks only slightly above the detection threshold, and resulting fragmentary or rejected peak chains. Discussion and conclusion We presented the first approach to extract peaks from MCC/IMS measurements while they are being captured, with the long-term goal to remove the need for storing full measurements before analyzing them in small embedded devices. Our method is fast and satisfies the time restrictions even on a low-power CPU platform like a Raspberry Pi and outperforms existing software. While performing well on single spectra, there is room for improvement in merging one-dimensional peak models into two-dimensional peak models. Our method has to be further evaluated in clinical studies or biotechnological monitoring settings. It also has not been tested with the negative mode of an IMS for lack of data. In general, the robustness of the method under adversarial conditions (high concentrations with formation of dimer ions, changes in temperature or carrier gas flow in the MCC) has to be evaluated and probably improved. Appendix A: peak descriptors and parameters The shifted Inverse Gaussian distribution with parameters _o_ (shift or offset), _μ_ (mean minus shift, also called relative mean) and _λ_ (shape) is given by (1). There is a bijection [13] between _(μ_, _λ_, _o)_ and the descriptors _(μ_ <sup>′</sup>, _σ_, _m)_, which are the absolute mean _μ_ <sup>′</sup> = _o_ + _μ_, the standard deviation _σ_ and the mode _m_ . Given _(μ_, _λ_, _o)_, we have _p_ := _q_ := _/_ - 2 _(m_ - _μ_ <sup>′</sup> _)_, _/_ _o_ = − _p/_ 2 − _μ_ = _μ_ <sup>′</sup> - _o_, _λ_ = _μ_ <sup>3</sup> _/σ_ <sup>2</sup> . _p_ <sup>2</sup> _/_ 4 − _q_, _μ_ <sup>′</sup> = _μ_ + _o_, _σ_ = ~~�~~ _μ_ <sup>3</sup> _/λ_, _m_ = _μ_ - <sup>~~�~~</sup> 1 + _(_ 9 _μ_ <sup>2</sup> _)/(_ 4 _λ_ <sup>2</sup> _)_ - _(_ 3 _μ)/(_ 2 _λ)_ + _o_, and, given _(μ_ <sup>′</sup>, _σ_, _m)_, we use auxiliary expressions _p_ and _q_ to find Competing interests The authors declare that they have no competing interests. Authors’ contributions DK developed and implemented the methods and evalutated them in consultation with SR. DK and SR wrote the manuscript. Both authors read and approved the final manuscript. Acknowledgements DK and SR acknowledge the support of Deutsche Forschungsgemeinschaft [(DFG) within the Collaborative Research Center SFB 876 (http://sfb876.tu-](http://sfb876.tu-dortmund.de) [dortmund.de), “Providing Information by Resource-Constrained Data Analysis”,](http://sfb876.tu-dortmund.de) subproject TB1. We are grateful to Jörg Ingo Baumbach for help with numerous questions and for providing datasets. We thank Max Wornowizki from subproject C3 for providing methodology for the first evaluation. Received: 20 March 2015 Accepted: 2 April 2015 References 1. Bessa V, Darwiche K, Teschler H, Sommerwerck U, Rabis T, Baumbach JI, et al. Detection of volatile organic compounds (VOCs) in exhaled breath of patients with chronic obstructive pulmonary disease (COPD) by ion mobility spectrometry. Int J Ion Mobility Spectrom. 2011;14:7–13. 2. Bunkowski A, Bödeker B, Bader S, Westhoff M, Litterst P, Baumbach JI. MCC/IMS signals in human breath related to sarcoidosis – results of a feasibility study using an automated peak finding procedure. J Breath Res. 2009;3(4):046001. 3. Westhoff M, Litterst P, Freitag L, Urfer W, Bader S, Baumbach JI. Ion mobility spectrometry for the detection of volatile organic compounds in exhaled breath of lung cancer patients. Thorax. 2009;64:744–8. 4. Keller T, Schneider A, Tutsch-Bauer E, Jaspers J, Aderjan R, Skopp G. Ion mobility spectrometry for the detection of drugs in cases of forensic and criminalistic relevance. Int J Ion Mobility Spectrom. 1999;2(1):22–34. 5. Ewing RG, Atkinson DA, Eiceman GJ, Ewing GJ. A critical review of ion mobility spectrometry for the detection of explosives and explosive related compounds. Talanta. 2001;54(3):515–29. 6. Kolehmainen M, Rönkkö P, Raatikainen O. Monitoring of yeast fermentation by ion mobility spectrometry measurement and data visualisation with self-organizing maps. Anal Chim Acta. 2003;484(1):93–100. 7. Kreuder AE, Buchinger H, Kreuer S, Volk T, Maddula S, Baumbach J. Characterization of propofol in human breath of patients undergoing anesthesia. Int J Ion Mobility Spectrom. 2011;14:167–75. 8. Bunkowski A. MCC-IMS data analysis using automated spectra processing and explorative visualisation methods. PhD thesis: Bielefeld University; 2011. 9. Bödeker B, Vautz W, Baumbach JI. Peak finding and referencing in MCC/IMS-data. Int J Ion Mobility Spectrom. 2008;11(1):83–7. 10. D’Addario M, Kopczynski D, Baumbach JI, Rahmann S. A modular computational framework for automated peak extraction from ion mobility spectra. BMC Bioinformatics. 2014;15(1):25. 11. Kopczynski D, Rahmann S. An online peak extraction algorithm for ion mobility spectrometry data. In: WABI. Lecture Notes in Computer Science. New York: Springer; 2014. p. 232–46. 12. Eiceman GA, Karpas Z. Ion Mobility Spectrom, Second Edition. New York: Taylor & Francis; 2005. 13. Kopczynski D, Baumbach JI, Rahmann S. Peak modeling for ion mobility spectrometry measurements. In: Signal Processing Conference (EUSIPCO), 2012 Proceedings of the 20th European. New York, NY, USA: IEEE; 2012. p. 1801–5. Kopczynski and Rahmann _Algorithms for Molecular Biology_ (2015) 10:17 Page 14 of 14 14. Spangler GE, Collins CI. Peak shape analysis and plate theory for plasma chromatography. Anal Chem. 1975;47(3):403–7. 15. Einstein A. Über die von der molekularkinetischen Theorie der Wärme geforderte Bewegung von in ruhenden Flüssigkeiten suspendierten Teilchen. Annalen der Physik. 1905;322(8):549–60. 16. Nocedal J, Wright SJ. Numerical Optimization, 2nd edn. New York: Springer; 2006. 17. Dempster AP, Laird NM, Rubin DB. Maximum likelihood from incomplete data via the EM algorithm. J R Stat Soc Ser B (Methodological). 1977;39:1–38. 18. Needleman SB, Wunsch CD. A general method applicable to the search for similarities in the amino acid sequence of two proteins. J Mol Biol. 1970;48(3):443–53. 19. Munteanu A, Wornowizki M. Demixing empirical distribution functions. Technical Report 2014-02, Collaborative Research Center 876, TU Dortmund. 2014. 20. Hauschild AC, Kopczynski D, D’Addario M, Baumbach JI, Rahmann S, Baumbach J. Peak detection method evaluation for ion mobility spectrometry by using machine learning approaches. Metabolites. 2013;3(2):277–93. 21. [Raspberry Pi Foundation. Raspberry Pi. 2014. http://www.raspberrypi.org/.](http://www.raspberrypi.org/) 22. Arthur D, Vassilvitskii S. K-means++: The advantages of careful seeding. In: Proceedings of the Eighteenth Annual ACM-SIAM Symposium on Discrete Algorithms. SODA ‘07. Philadelphia: Society for Industrial and Applied Mathematics; 2007. p. 1027–35. 23. Fowlkes EB, Mallows CL. A method for comparing two hierarchical clusterings. J Am Stat Assoc. 1983;78(383):553–69. 24. Reichart R, Rappoport A. The nvi clustering evaluation measure. In: Proceedings of the Thirteenth Conference on Computational Natural Language Learning. Stroudsburg, PA, USA: Association for Computational Linguistics; 2009. [p. 165–73. http://dl.acm.org/citation.cfm?id=1596374.](http://dl.acm.org/citation.cfm?id=1596374.1596401) [1596401.](http://dl.acm.org/citation.cfm?id=1596374.1596401) Submit your next manuscript to BioMed Central and take full advantage of: • Convenient online submission • Thorough peer review • No space constraints or color figure charges • Immediate publication on acceptance • Inclusion in PubMed, CAS, Scopus and Google Scholar • Research which is freely available for redistribution Submit your manuscript at www.biomedcentral.com/submit

섹션 본문 229문단 · 84,762자

(제목 없음)

1Ion mobility (IM) spectrometry (IMS), coupled with multi-capillary columns (MCCs), has been gaining importance for biotechnological and medical applications because of its ability to detect and quantify volatile organic compounds (VOC) at low concentrations in the air or in exhaled breath at ambient pressure and temperature. Ongoing miniaturization of spectrometers creates the need for reliable data analysis on-the-fly in small embedded low-power devices. We present the first fully automated online peak extraction method for MCC/IMS measurements consisting of several thousand individual spectra. Each individual spectrum is processed as it arrives, removing the need to store the measurement before starting the analysis, as is currently the state of the art. Thus the analysis device can be an inexpensive low-power system such as the Raspberry Pi.The key idea is to extract one-dimensional peak models (with four parameters) from each spectrum and then merge these into peak chains and finally two-dimensional peak models. We describe the different algorithmic steps in detail and evaluate the online method against state-of-the-art peak extraction methods.

Introduction

2Ion mobility (IM) spectrometry (IMS), coupled with multi-capillary columns (MCCs), MCC/IMS for short, has been gaining importance for biotechnological and medical applications. With MCC/IMS, one can measure the presence and concentration of volatile organic compounds (VOCs) in the air or in exhaled breath with high sensitivity. In contrast to other technologies, such as mass spectrometry coupled with gas chromatography (GC/MS), MCC/IMS works at ambient pressure and temperature. Several diseases like chronic obstructive pulmonary disease (COPD) [1], sarcoidosis [2] or lung cancer [3] can potentially be diagnosed early with MCC/IMS technology. IMS is also used for the detection of drugs [4] and explosives [5]. Constant monitoring of VOC levels is of interest in biotechnology, e.g., for watching fermenters with yeast producing desired compounds [6] and in medicine, e.g., monitoring propofol levels in the exhaled breath of patients during surgery [7].

3IMS technology is moving towards miniaturization and small mobile devices. This creates new challenges for data analysis: The analysis should be possible within the measuring device without requiring additional hardware like an external laptop or a compute server. Ideally, the spectra can be processed on a small embedded chip or small device like a Raspberry Pi or similar hardware with restricted resources. Algorithms in small mobile hardware face constraints, such as the need to use little energy (hence little random access memory), while maintaining prescribed time constraints.

4The basis of MCC/IMS analysis is peak extraction, by which we mean a representation of all high-intensity regions (peaks) in the measurement by using a few descriptive parameters per peak instead of the full measurement data. State-of-the-art software (like IPHEx [8], Visual Now [9], PEAX [10]) only extracts peaks when the whole measurement is available, which may take up to 10 minutes because of the pre-separation of the analytes in the MCC. Our own PEAX software in fact defines modular pipelines for fully automatic peak extraction and compares favorably with a human domain expert doing the same work manually when presented with a whole MCC/IMS measurement. However, storing the whole measurement is not desirable or possible when the memory and CPU power is restricted. Here we introduce a method to extract peaks and estimate a parametric representation while the measurement is being captured. This is called online peak extraction, and this article presents the first algorithm for this purpose on MCC/IMS data. An extended abstract of this work has been published at WABI'14 [11].

5Section 'Background' introduces the necessary background on the data produced by an MCC/IMS experiment, on peak modeling and on optimization methods. The basic idea of our algorithm is to process each IM spectrum as soon as it arrives (and before the next one arrives). After appropriate pre-processing including denoising and baseline correction described in Section 'Denoising and baseline correction' , the single spectra are reduced into a mixture of parametric one-dimensional peak models, described in Section 'Reducing a spectrum to peak models' . Accordingly, in Section 'Aligning consecutive spectrum peak lists' the approach of connecting models from two subsequent spectra into peak chains is explained. The main challenge is then to merge the peak chains into two-dimensional peak models, described in Section 'Estimating 2-D peak models' . In Section 'Peak clustering' we introduce a novel approach for clustering peaks among several measurements e.g. for time series. An evaluation of our approach is presented in Section 'Evaluation' including a listing of all settings of the MCC/IMS as well as an explanation of all adjustable parameters, while Section 'Discussion and conclusion' contains a concluding discussion.

Background

6Ion mobility spectrometers and their functions are well documented [12], and we do not go into technical details. Instead, we characterize the data generated by an MCC/IMS experiment (Section 'Data from MCC/IMS measurements'). In Section 'Peak models' we describe a previously used parametric peak model, and in Section 'Optimization methods' we review two optimization methods that are being used as subroutines in this work.

Data from MCC/IMS measurements

7In an MCC/IMS experiment, a mixture of several unknown volatile organic compounds (VOCs) is separated in two dimensions: first by retention time r in the MCC (the time required for a particular compound to pass through the MCC) and second by drift time d through the IM spectrometer. Instead of the drift time itself, a quantity normalized for pressure and temperature called the inverse reduced mobility (IRM) t is used to compare spectra taken under different or changing conditions. Thus we obtain a time series of IM spectra (one spectrum each 100 ms at each retention time point), and each spectrum is a vector of ion concentrations (measured by voltage change on a Faraday plate) at each IRM.

8Let R be the set of (equidistant) retention time points and let T be the set of (equidistant) IRMs where a measurement is made. If D is the corresponding set of drift times (each 1/250000 second for 50 ms, that is 12 500 time points), there exists a constant C t|d > 0 depending on external conditions [12] such that T = C t|d · D. Then the data is an |R| × |T| matrix S = (S r,t ) of measured ion intensities, which we call an IM spectrum-chromatogram (IMSC). The matrix can be visualized as a heat map ( Figure 1). A row of S is a spectrum, while a column of S is a chromatogram.

9Areas of high intensity in S are called peaks, and our goal is to discover them and to describe them by parametric models. Comparing peak coordinates with reference databases may reveal the identity of the corresponding compound. A peak caused by a VOC occurs over several IM spectra. We mention some properties of MCC/IMS data that complicate the analysis.

10• An IM spectrometer uses an ionized carrier gas.

11These ions are present in every spectrum in addition to the analyte ions, and they create the reactant ion peak (RIP). In the whole IMSC it is present as high-intensity chromatogram at a specific IRM ( Figure 1). When no analytes are injected into the device, the spectra contain only the RIP and are called RIP-only spectra. • Every spectrum contains a tailing of the RIP, so the RIP is right-skewed ( Figure 2). To extract peaks, the effect of the RIP and its tailing must be estimated and removed. • At higher concentrations, compounds can form dimer ions, and one may observe both the monomer and dimer peak from one compound. This means that there is not necessarily a one-to-one correspondence between peaks and compounds, and our work focuses on peak detection, not compound identification. • An IM spectrometer may operate in positive or negative mode, depending on which type of ions (positive or negative) one wants to detect. In either case, signals are reported in positive units. All experiments described here were done in positive mode.

Peak models

12For our purpose of analyzing MCC/IMS measurements, a peak is characterized by the following assumptions.

13Assumptions 1. An n-dimensional peak P is a product of n log-concave functions with two inflection points in each dimension. The peak width at half height ω1 /2,i can be Figure 1 Visualization of a raw measurement (IMSC) as a heat map; signal color: white (lowest) < blue < purple < red < yellow (highest). The constantly present reactant ion peak (RIP) with mode at 0.48 Vs/cm 2 and exemplarily one VOC peak are annotated.

14calculated with respect to the mode for each dimension i. At its mode (m 1 , . . . , m n ), peak P exceeds the average background noise level by a certain factor times the standard deviation of the noise.

15For MCC/IMS measurements, we have n = 2 dimensions, and in both retention time dimension and IRM dimension, we use the shifted Inverse Gaussian distribution g [13] as peak model function:

16Its parameters are the shift (or offset) o, the relative mean μ > 0 (to the right of o) and the shape parameter λ > 0. A peak is then given as the product of two shifted Inverse Gaussians, scaled by a volume factor v, i.e., by seven parameters; so the density function of a peak is p(r, t) := v·g(r, μ r , λ r , o r )·g(t, μ t , λ t , o t ) for all r ∈ R, t ∈ T.

17Since the parameters μ, λ, o of a shifted Inverse Gaussian may be different even though the resulting distributions have a similar shape, it is more intuitive to describe the shifted Inverse Gaussian in terms of three different descriptors: the (absolute) mean μ = o + μ, the standard deviation σ and the mode m. There is a bijection between (μ, λ, o) and (μ , σ , m) [13] summarized in Appendix A.

18We also make use of the following empirically observable properties of peaks in real IMSCs that concern the peak widths on both the IRM axis and the retention time axis. The width can be described as the length ω1 /2 of the interval around the mode where the peak height is at least half of its maximum height. For a (symmetric) Gaussian distribution, there is a linear relation between the standard deviation σ and ω1 /2 :

19This relation approximately holds as well for not too skewed Inverse Gaussian distributions and is a good approximation to estimate its descriptor σ approximately from an empirically observed ω1 /2 .

20Given the mode d * of a peak in drift time (in ms), we can estimate its descriptors (m, σ , μ ) in IRM units as follows. Recall that the IRM mode (in V s cm −2 ) is simply m = C t|d · d * , where C t|d is the conversion constant between drift time and IRM (see Section 'Data from MCC/IMS measurements'). Spangler et al. [14] empirically derived that ω1 /2 = (11.09 D d * )/v 2 d + d 2 grid , where D is the diffusion coefficient, v d the drift velocity. Using the Einstein relation [15], D can be computed as D = kK B T /q, where k is the ion mobility, K B the Boltzmann constant, T the absolute temperature and q the electric charge. We then use (2) to estimate σ ≈ ω1 /2 /φ. Finally, the mean is empirically found to be μ ≈ C t|d · d * + (4.246 · 10 −5 ) 2 + (d * ) 2 /585048.1633 . On the retention time axis, the peak width ω1 /2 grows approximately linearly with retention time, i.e., there are constants r_width_offset > 0 and r_width_factor > 0 such that width of a peak with maximum at retention time r is approximately ξ(r) := r · r_width_factor + r_width_offset .

21(3)

Optimization methods

22The online peak extraction algorithm makes use of nonlinear unconstrained minimization, similar to non-linear least squares, and of the EM algorithm. Both methods are summarized here.

Non-linear Least Squares

23The NLLS method is an iterative method to estimate parameters θ = (θ 1 , . . . , θ q ) of a supposed parametric function f , given n observed data points (x 1 , y 1 ), . . . , (x n , y n ) with y i = f (x i ; θ). The idea is to minimize the quadratic error n i=1 r 2 i (θ) between the function and the observed data, where r i (θ) := y i − f (x i ; θ) is the residual of the i-the datapoint. The necessary optimality condition is i r i (θ) · ∂r i (θ)/∂θ j = 0 for all j. If f is linear in θ (e.g., a polynomial in x with θ being the polynomial coefficients, a setting called polynomial regression), then the optimality condition results in a linear system, which can be solved in closed form. However, often f is not linear in θ and we obtain a non-linear system, which is solved iteratively, given initial parameter values, by linearizing it in each iteration. Details and different algorithms for NLLS can be found in the literature ( [16], Chapter 10). In this paper, we use a different, non-symmetric loss function, but apply similar techniques to solve the problem (see below).

The EM algorithm for mixtures with heterogeneous components

24The observed data x = (x 1 , . . . , x n ) is viewed as a sample from a mixture of probability distributions, where the mixture density is specified by

25where θ c denotes the parameters of f c , and θ = (θ 1 , . . . , θ C ) is the collection of all parameters. The mixture coefficients satisfy ω c ≥ 0 for all c, and c ω c = 1. Unlike in most applications, where all component distributions f c are multivariate Gaussians, here the f c are of different types (e.g., uniform and Inverse Gaussian). The goal is to determine the parameters ω and θ such that the probability of the observed sample is maximal (maximum likelihood paradigm). Since the resulting optimization problem is non-convex in (ω, θ), the EM algorithm is an iterative method that will converge to a local optimum [17] in parameter space. The EM algorithm consists of two repeated steps: The E-step (expectation) estimates the expected membership of each data point in each component and then the component weights ω, given the current model parameters θ. The M-step (maximization) estimates maximum likelihood parameters θ c for each parametric component f c individually, using the expected memberships as hidden variables that decouple the model.

26,

27Convergence. After each M-step of an EM cycle, we compare θ c,q (old parameter value) and θ + c,q (updated parameter value), where q indexes the elements of θ c , the parameters of component c. We say that the algorithm has converged when the relative change κ c,q :=

28Having reviewed the necessary background, we now describe the methods we use for peak extraction from IMSCs.

Denoising and baseline correction

29Background A major challenge during peak detection in an IM spectrum is to find peaks that only slightly exceed the background noise level in a spectrum S = (S t ). To determine whether the intensity S t at coordinate t belongs to a peak region or can be solely explained by background noise, we propose a method based on the EM algorithm. It runs in O(τ |T|) time where τ is the number of EM iterations.

Mixture model

30Based on observations of IM spectra signal intensities, we assume that

31• the noise intensity has a Gaussian distribution over low intensity values with mean μ N and standard deviation σ N ,

32• the true signal intensity has an Inverse Gaussian distribution with mean μ S and shape parameter λ S , i.e.,

33• there is an unspecific background component which is not well captured by either of the two previous distributions; we model it by the uniform distribution over all intensities,

34and we expect the weight ω B of this component to be close to zero in standard IM spectra. High weights indicate an anomaly during the measurement.

35We interpret the observed spectrum S as a sample of a mixture of these three components with unknown mixture coefficients. To illustrate this approach, consider Figure 3, which shows the empirical intensity distribution (histogram) of an arbitrary spectrum, together with the estimated components (except the uniform distribution, which has the expected coefficient of almost zero).

36It follows that there are six independent parameters to estimate:

Initial parameter values

37Background noise intensities are assumed to follow a Gaussian distribution at small intensity values. We can determine its approximate mean μ N and standard deviation σ N by considering the first and last 10% of data points in each spectrum.

38The initial weight of the noise component is set to cover most points covered by this Gaussian distribution, i.e.,

39We assume that almost all of the remaining weight belongs to the signal component, thus

40To obtain initial parameters for the signal model, let

E-step

41The hidden parameters W t,c are computed using (4), where the three component distributions f c are the three component densities p N , p S , p B with their parameters and the data x is a mean-smoothed version of the original spectrum S:

42where the smoothing window margin is α := (1/2) · d grid · C t|d · |T|/T last . (Here d grid is the grid opening time of the spectrometer and T last is the maximum IRM in T).

Maximum likelihood estimators

43In the maximization step (M-step) we estimate maximum likelihood parameters for the non-uniform components using the original intensities of S again.

44for all t ∈ T.

Final step

45After convergence, we correct the baseline and remove noise: We first subtract μ N from the signal value and then reduce the remaining value by the estimated noise weight. The corrected spectrum S + is

46Reducing a spectrum to peak models

Background

47The idea of processing a single (noise-reduced) IM spectrum S is to deconvolute it into separate components described with statistical distribution functions. Several components appear in each spectrum besides the peaks, namely the previously described RIP and the tailing described in Section 'Data from MCC/IMS measurements' . and background noise. We first determine and remove the RIP tailing function and then determine the peak parameters (including the RIP).

Determining the tailing function

48The tailing function appears as a baseline in every spectrum (see Figure 2 for an example). Its shape and scale changes from spectrum to spectrum; so it has to be determined in each spectrum and subtracted in order to extract peaks from the remaining signal in the next step. Empirically, we observe that the tailing function f (t) can be described by a scaled shifted Inverse Gaussian,

49be the residual function for a given choice θ of parameters. As we want to penalize r(t) < 0 but not (severely) r(t) > 0, we use the following non-symmetric loss function that depends on a threshold parameter γ > 0:

50That is, the loss at time t is the residual squared when it has a negative or small positive value less than the given threshold γ > 0, but becomes a linear function of the residual for larger positive residuals.

51The goal is to find θ to minimize the total loss L(θ) := t e t (θ; γ ) for the given spectrum S and given γ > 0. We use gradient descent to solve this nonlinear optimization problem, to which we refer as non-linear loss minimization (NLLM). To estimate the tailing function, 1. we determine reasonable initial values for the parameters θ = (v, μ, λ, o) (see below), 2. we solve NLLM with γ = σ 2 N to estimate the scaling factor v, leaving the other parameters fixed, 3. we solve NLLM with γ = σ 2 N to estimate all four parameters, 4. we solve NLLM with γ = σ 2 N /100 to re-estimate the scaling factor v where σ N is the standard deviation of the noise as described in Section 'Denoising and baseline correction' .

52The initial parameter values (v, μ, λ, o) are determined as follows: For the scaling factor, we initially set v = (1/2) t |T| S t . For the other parameters, we first estimate the descriptors (μ , σ , m) as described below and then use the correspondence to the parameters listed in Appendix A. The initial σ is set to the standard deviation of the whole RIP-only spectrum. We determine the initial m as the RIP mode. It is a property of the Inverse Gaussian distributions under consideration such that the mean μ can only range within the interval I = [ m, m + 0.7σ ]. To obtain an appropriate value for μ , an auxiliary offset variable o is set to the largest IRM left of the RIP mode where the signal is below σ N , and μ it is increased in small steps within I. The candidate descriptors (μ , σ , m) are converted into corresponding param- eters (μ, λ, o) until o ≥ o . The so obtained parameters constitute the initial parameter values.

Extracting peak parameters from a single spectrum

53To extract all peaks from a spectrum (from left to right), we repeat three sub-steps:

541. scanning for a potential peak, starting where the previous iteration stopped; 2. determining peak parameters (Inverse Gaussian distribution); 3. subtracting the peak from the spectrum and continuing with the remainder.

55Scanning. The algorithm scans for peaks, starting at the left end of S, by sliding a window of a given width across S and fitting a quadratic polynomial model to the data points within the window. The window width (in index units) is related to the grid opening time d grid of the spectrometer and given as d grid /D last · |D| data points, where D last is the maximum (last) drift time measured. The model is built in drift time (not IRM). Let f (d; θ) = θ 2 d 2 + θ 1 d + θ 0 be the fitted quadratic polynomial inside the window. We call a window a peak window if the following conditions are fulfilled:

56• the extreme drift time d * = θ 1 /(2θ 2 ) lies within the drift times of the window; • the extreme drift time d * indicates a maximum (i.e., θ 2 < 0); • the maximum is sufficiently high above the noise level (which is zero after preprocessing):

57The first condition can be more strongly restricted to achieve more reliable results, by shrinking the interval towards the center of the window. If no peak is found, the moving window is shifted one index forward. If a peak is detected, the window is shifted half the window length forward before the next scan begins, but first the peak parameters are computed.

58Determining peak parameters. As described in Section 'Peak models' , we can estimate all peak descriptors (m, σ , μ ) from its mode d * in drift time. We convert them into the parameters (μ, λ, o) of the Inverse Gaussian parameterization (see Appendix A). The scaling factor v for the peak is v = f (d * ; θ)/g(m; μ, λ, o).

59The model function is subtracted from the spectrum, and the next iteration is started with a window shifted by α index units (consider Section 'E-step'). For each spectrum, the output of this step is a spectrum peak list, which is a set of parameters for a mixture of weighted Inverse Gaussian models describing the peaks.

Background

60Having a set of peak parameters for each spectrum, the question arises how to merge the sets P = (P i ) and P + = (P + j ) of two consecutive spectra. For each peak P i , we have stored the Inverse Gaussian parameters μ i , λ i , o i , the peak descriptors μ i , σ i , m i (mean, standard deviation, mode) and the scaling factor v i , and similarly so for the peaks P + j . The idea is to compute a global alignment similar to the Needleman-Wunsch method [18] between P and P + . We need to specify how to score aligning P i to P + j and how to score leaving a peak unaligned (i.e., a gap).

Scoring peak alignments

61The score Z ij for aligning P i to P + j is chosen by evaluating P i 's density function at the new mode m + j and comparing it to "typical" value an approximate standard deviation away from the mode (at m i + δ, where δ := d grid · C t|d /φ), resulting in the log-odds score

62Alternatively, leaving a peak unmatched results in a gap score of zero.

63Applying Needleman-Wunsch global alignment, we can compute the optimal score of aligning the first i peaks in the former spectrum with the first j peaks in the current spectrum by dynamic programming. We initialize a matrix Z, setting all Z i,0 and Z 0,j to zero and then compute, for i ≥ 1 and j ≥ 1,

Obtaining peak chains

64The alignment is obtained with a traceback, recording the optimal case in each cell, as usual. There are three cases to consider.

65• If P + j is not aligned with a peak in P, potentially a new peak starts at this retention time. Thus model P + j is put into a new peak chain.

66• If P + j is aligned with a peak P i , the chain containing P i is extended with P + j . • All peaks P i that are not aligned to any peak in P + indicate the end of a peak chain at the current retention time.

67All completed peak chains are forwarded to the next step, two-dimensional peak model estimation.

Estimating 2-D peak models

68Background Let C = (P 1 , . . . , P n ) be a chain of one-dimensional Inverse Gaussian models. The goal of this step is to estimate a two-dimensional peak model (product of two one-dimensional Inverse Gaussians) from the chain, as described in Section 'Peak models' , or to reject the chain if the chain does not fit such a model well. Potential problems are that a peak chain may contain noisy 1-D peaks truncated at their borders, consist only of noise or in fact consist of several consecutive 2-D peaks at the same drift time and successive retention times.

Estimating the parameters

69As discussed in Section 'Peak models' , the half-height width ω1 /2 in retention time of a peak centered at retention time r can be described by an affine function ξ(r), Eq. (3), and ω1 /2 can be converted to the corresponding number of data points (window width).

70We have the parameters (v i ,μ i,t ,λ i,t ,ô i,t ) for each individual peak i = 1, . . . , n in a peak chain, and the corresponding descriptors (μ i,t ,σ i,t ,m i,t ), as well as the associated retention time r i and peak height h i =v i · g(m i,t ;μ i,t ,λ i,t ,ô i,t ).

71We proceed similarly to Section 'Extracting peak parameters from a single spectrum' by fitting quadratic polynomials b(r; θ) = θ 2 r 2 + θ 1 r + θ 0 in sliding windows of the appropriate width ξ(r i ) such that h i ≈ b(r i ; θ).

72Having found a window that fits a peak, we estimate initial descriptors for an Inverse Gaussian model in retention time as follows:

The descriptors are then converted into model parameters (see Appendix A).

73After processing each window, we have obtained a list of size, say, k, of Inverse Gaussian distributions. We expect these distributions to be a mixture of k overlapping peaks in a single peak chain. To obtain an optimal deconvolution, we first normalize the volume factors v r of the k components to obtain v r,j such that k j=1 v r,r = 1 and then apply the EM algorithm. As a byproduct, we obtain an (n × k) matrix M = (M i,j ) that determines the membership probability for each of the n data points (r i , h i ) to each of the k models.

74To obtain the Inverse Gaussian distribution parameters in the IRM dimension for each of the k models, we first compute model descriptors using a membershipweighted average over the individual model descriptors: For j ∈ {1, . . . , k}, let

75We then convert these descriptors back into model parameters (Appendix A). The final peak volume is computed as v * j = v j,r · i n v i,t . For every model j ∈ {1, . . . , k}, we check the following conditions:

76• The width at half height in the retention time dimension has approximately the expected size (cf. Eqs. (2), (3)): ξ(m j,r )/2 σ j,r /φ < 2 · ξ(m j,r ), • The peak height at its maximum is sufficiently above the noise level: v * j · g(m j,t ; μ j,t , λ j,t , o j,t )· g(m j,r ; μ j,r , λ j,r , o j,r ) ≥ noise_margin · σ N , where noise_margin > 0 is a tunable parameter, • the Inverse Gaussian peak model g in retention time correlates well (in terms of the Pearson product-moment correlation coefficient ρ) with its quadratic approximation b in a window around the mode. More precisely, consider the window W = [ m j,r − ξ(m j,r )/φ, m j,r + ξ(m j,r )/φ], the model vector G = g(x; μ j,r , λ j,r , o j,r ) for x ∈ W and the quadratic approximation vector B = b j (x; θ) for x ∈ W , and test whether the Pearson correlation satisfies ρ(G, B) ≥ ρ min .

77If all conditions are satisfied, we have identified a 2-D peak model (v * j , μ j,t , λ j,t , o j,t , μ j,r , λ j,r , o j,r ). Otherwise the model is discarded.

Background

78We now consider a series of IMS measurements, for each of which we have extracted peaks available in the form of parameter vectors or descriptors. The question arises how to decide which descriptors in different measurements represent the same peak (and hence potentially the same VOC).

79Let X be the union of peak locations in all measurements, let |X| =: n, and let X i,R be the retention time of peak i and X i,T its IRM. We introduce a clustering approach using the EM algorithm with twodimensional Gaussian mixtures that differs from the standard approach by its ability to dynamically adjust the number of clusters in the process.

Mixture model

80We assume that the measured retention times and IRMs belonging to peaks from the same compound are independently normally distributed in both dimensions around the (unknown) true retention time and IRM. Let θ j := (μ j,R , σ j,R , μ j,T , σ j,T ) be the parameters for component j, and let f j (x givenθ j be a two-dimensional Gaussian product distribution for a peak location x = (x R , x T ) with these parameters.

81The mixture distribution is

82with a yet undetermined number C of clusters. Note that there is no "background" model component.

Initial parameter values

83In the beginning, we initialize the algorithm with as many clusters as peaks, i.e., we set C := n. This assignment makes a background model obsolete, because all peaks are assigned to at least one cluster. All clusters get as start parameters for μ j,R , μ j,T the original retention time and IRM of peak location X j , respectively, for j = 1, . . . , n. We set σ j,T := t_width > 0 and σ j,R := ξ(X j,R )/φ.

Dynamic adjustment of the number of clusters

84After computing weights in the E-step, but before starting the M-step, we dynamically adjust the number of clusters by merging clusters whose centers are close to each other. Every pair j < k of clusters is compared in a nested forloop. When |μ j,T − μ k,T | < t_width and |μ j,R − μ k,R | < ξ max{μ j,R , μ k,R } , then clusters j and k are merged by summing the EM weights: ω + := ω j + ω k and W i,+ := W i,j + W i,k for all i. The summed weights are assigned to the location of the cluster with larger weight. (The recomputation of the parameters happens immediately after merging in the maximization step). The comparison order may matter in rare cases for deciding which peaks are merged first, but since new means and variances are computed, possible merges that were omitted in the current iteration will be performed in the next iteration. This merging step is applied after in the second EM iteration, since the cluster means need at least one iteration to move towards each other.

Maximum likelihood estimators

85The maximum likelihood estimators for mean and variance of a two-dimensional Gaussian are the standard ones, taking into account the membership weights,

86for all components j = 1, . . . , C.

87One problem using this approach emerges from the fact that initially each cluster contains only one peak, leading to an estimated variance of zero in many cases. To prevent this, minimum values are enforced such that σ j,T ≥ t_width and σ j,R ≥ ξ(μ j,R )/φ for all j.

Final step

88The EM loop terminates when no merging occurs and the convergence criteria for all parameters are fulfilled. The resulting membership weights determine the number of clusters as well as the membership coefficient of peak location X i to cluster j. If a hard clustering is desired, the merging step has to be traced.

Evaluation

89We evaluate different properties of the online method:

901. the quality of reducing a single spectrum to a peak list (denoising/baseline correction (Section 'Denoising and baseline correction') and spectrum reduction (Section 'Reducing a spectrum to peak models'), 2. the execution time of both steps, 3. the quality of the new clustering approach, 4. the correlation between manual annotations on full IMSCs by a computer-assisted expert and our automated online extraction method.

91Parameters. For evaluation measurements, the MCC was adjusted to a temperature of 40°C and throughput of 150 mL min −1 . The IMS had a voltage of 4380 V, a grid opening time of 300 μs and a throughput of 150 mL min −1 . We chose the following parameters [9]:

92• r_width_offset = 2.5 s (width offset for peaks in retention time), • r_width_factor = 0.06 (width slope for peaks in retention time), • t_width = 0.003 V s cm −2 (standard deviation for peaks in IRM), • thresh (convergence threshold; value varies within evaluation), • noise_margin = 4 (factor multiplied with standard deviation of background noise for minimal peak height), • ρ min = 0.95 (minimal Pearson product-moment correlation coefficient).

Quality of single spectrum reduction

93In a first experiment, we tested the quality of the spectrum reduction method using an idea by Munteanu and

94Wornowizki [19] that determines the agreement between an observed set of data points, interpreted as an empirical distribution function F (the data) and a model distribution G (the mixture distribution obtained from the peak list parameters). The approach writes F =s·G +(1−s)·H withs ∈ [ 0, 1], where H is a non-parametric distribution whose inclusion ensures the fit of the model G to the data F. If the weights is close to 1.0, then F is a plausible sample from G. We compare the original spectra and reduced spectra (peaks from peak lists) from a previously used dataset [20]. This set contains 69 measurements preprocessed with a 5 × 5 average. Every measurement contains 1200 spectra. For each spectrum in all measurements, we computed the reduced spectrum model and determineds. Over 92% of all 82 000 models achieveds = 1 and over 99% reacheds ≥ 0.9. Nos dropped below 85%. In summary, spectrum reduction provides an accurate parametric representation of most spectra.

Execution time

95We tested our method on two different platforms, (1) a desktop PC with Intel(R) Core(TM) i5 2.80GHz CPU, 8GB memory, Ubuntu 12.04 (64bit) OS and (2) a Raspberry Pi [21] type B with ARM1176JZF-S 700MHz CPU, 512 MB memory, Raspbian Wheezy (32bit) OS, once with the factory defaults of 700 MHz and once overclocked up to 900 MHz. The Raspberry Pi was chosen because it is a complete credit-card-sized low-cost single-board computer with low CPU and power consumption (3.5 w). This kind of device is appropriate for data analysis in future mobile measurement devices.

96Recall that each spectrum contains 12 500 data points. It is current practice to analyze not the full spectra, but aggregated ones, where five consecutive values are averaged. Here we consider the full spectra, slightly aggregated ones (average over two values, 6 250 data points) and standard aggregated ones (average over five values, 2 500 data points). We measured the average execution time of denoising, baseline correction and consecutive spectrum reduction. Table 1 shows the results. It is remarkable that at the highest resolution (Average 1) the Raspberry Pi with 900 MHz keeps barely the time bound of 100 ms between consecutive spectra. At lower resolutions, the Raspberry Pi satisfies the time restrictions easily. The desktop PC copes with the analysis effortless on any setting.

97We found that in the steps that use the EM algorithm, on average 25-30 EM iterations were necessary for a precision of thresh := 0.001 (i.e., 0.1%) (see Convergence in Section 'The EM Algorithm for mixtures with heterogeneous components'). Relaxing the threshold from 0.001 to 0.01 halved the number of iterations without noticeable difference in the resulting estimated parameters.

Clustering

98To evaluate peak clustering methods, we simulate peak locations according to locations in real MCC/IMS datasets, together with the true partition P of peaks.

99Most of the detected peaks appear in a small dense area early in the measurement. The remaining peaks are distributed widely, which is referred to as the sparse area (we let the areas overlap such that the dense are is contained in the sparse area). The areas approximately have the following boundaries (in units of (V s cm −2 , s) from lower left to upper right point, cf. Peak clusters are ellipsoidal and dense. From [9], we know the minimum required distance between two peaks in order to be identified as two separate compounds. We simulate 30 peak cluster centroids in the dense area and 20 in the sparse area, all picked randomly and uniformly distributed in the respective area. We then randomly pick the number of peaks per cluster. We also randomly pick the distribution of peaks within a cluster. Since we do not know the actual distribution model, we decided to simulate with three models: normal (n), exponential (e) and uniform (u) distribution with the following densities: Here (μ t , μ r ) is the coordinate of the centroid with RIM in Vs/cm 2 and retention time in s. For the normal distribution, we used σ t = 0.002 and σ r = μ r · 0.002 + 0.2. For the exponential distribution, we used λ t = (1.45 · 2500) −1 (reduced mobility width for in single cell within M) and λ r = 1/(μ r · 0.002 + 0.2). For the uniform distribution, we used an ellipsoid with radii ν t = 0.006 and ν r = μ r · 0.02 + 1.

100We compared our adaptive EM clustering with two common clustering methods: k-means and DBSCAN. Since k-means needs a fixed number of clusters k and appropriate start values for the centroids, used k-means++ [22] for estimating good starting values and give it an advantage by assigning the true number of partitions. DBSCAN has the advantages that it does not need to know the number of clusters in advance and that it can find non-linear cluster boundaries, but it does not easily yield parametric cluster descriptors.

101To measure the quality of an obtained clustering C we use the Fowlkes-Mallows index (FMI, [23]) and the normalized variation of information (NVI) score [24].

102For the FMI one considers all pairs of data points. If two data points belong to the same true partition of P, they are called connected. Accordingly, a pair of data points is called clustered if they are clustered together by the clustering method are evaluating. Pairs of data points that are both connected and clustered are called true positives (TP). False positives (FP, not connected but clustered) and false negatives (FN, connected but not clustered) are computed analogously. The FMI is the geometric mean of precision and recall: FMI(P, C) := √ TP/(TP + FP) · TP/(TP + FN), where P is the true partition and C is the clustering. We have FMI(P, C) ∈ [ 0, 1], and FMI(P, C) = 1 indicates perfect agreement. The FMI is difficult to interpret when the number of clusters in C and P differs significantly.

103Therefore we use a second measure that considers cluster sizes only, the normalized variation of information (NVI). To compute the NVI, an auxiliary (|P| × |C|)dimensional matrix A = (a i,j ) is computed, where a i,j is the number of data points within partition i that are assigned to cluster j. The NVI score is defined via entropies; let n be the number of data points and if H(P) = 0, H(C) otherwise.

Figure 4

104Histograms of Fowlkes-Mallows index (FMI; higher is better) and normalized variation of information (NVI; lower is better) comparing 100 simulated measurements containing partitioned peak locations with their clusters produced by the different methods.

105Here NVI(P, C) = 0 indicates perfect agreement between the cluster size distributions. Together, an FMI of 1 and an NVI score of 0 indicate a perfect clustering.

106For the first test, we evaluated 100 sets of data points distributed as described above. The cluster model (normal, exponential or uniform) was drawn randomly. The results show that even with the advantage that k-means knows the true k, our adaptive EM clustering performs best on average in terms of FMI and NVI score (Figure 4).

107For the second test, we additionally inserted 200 uniformly distributed (noise) peaks into the measurement area. All these peaks are singletons and have no matching Time series of discovered intensities of two peaks. Left: A peak with agreement between manual and automated online annotation. Right: A peak where the online method fails to extract the peak in several measurements. If one treated zeros as missing data, the overall trend would still be visible.

108peaks. The results ( Figure 5) show that the adaptive EM clustering still performs best on average, whereas k-means fails.

Comparison of automated online peak extraction with manual offline annotation

109The fourth experiment compares extracted peaks from a time series of measurements of two automated methods to an expert manual annotation. The automated methods are our online analysis process described here and automated peak detection using the commercial VisualNow software.

110Here 15 rats were monitored in 20 minute intervals for up to a day. Each rat resulted in 30-40 measurements (a time series) for a total of 515 measurements. To track peaks over time, we used the previously described EM clustering method.

111As an example, Figure 6 shows time series of intensities of two peaks detected by computer-assisted manual annotation and using our online algorithm. The example shows that there are cases where the sensitivity of the online algorithm is not perfect; this is mainly true for peaks whose intensity only slightly exceeds the background noise.

112To obtain an overview over all time series, we computed the cosine similarity γ ∈ [ −1, +1] time series of peak intensities discovered by manual annotation and each automated method. We also computed the recall automated method for each time series, that is, the relative fraction of measurements where the peak was found by the algorithm among those where it was found by manual annotation. Figure 7 shows overall good agreement between both automated methods (our online method and automated VisualNow peak extraction) with the expert manual annotation. The cosine similarity of the inferred time series is in better agreement than the more variable recall. When comparing automated methods against each other, we outperform VisualNow in terms of sensitivity and computation time: About 31% of the points extracted by the online method exceed 90% recall and 98% cosine similarity whereas only 5% of the time series extracted by VisualNow achieve these values. The peak detection of one measurement takes about 2 seconds on average (when the whole measurement is available at once) with the online method and about 20 seconds with VisualNow on the desktop computer described above. VisualNow only provides the position and signal intensity of the peak's maximum, whereas our method additionally provides shape parameters.

113Problems of our online method stem from low-intensity peaks only slightly above the detection threshold, and resulting fragmentary or rejected peak chains.

Discussion and conclusion

114We presented the first approach to extract peaks from MCC/IMS measurements while they are being captured, with the long-term goal to remove the need for storing full measurements before analyzing them in small embedded devices. Our method is fast and satisfies the time restrictions even on a low-power CPU platform like a Raspberry Pi and outperforms existing software.

115While performing well on single spectra, there is room for improvement in merging one-dimensional peak models into two-dimensional peak models. Our method has to be further evaluated in clinical studies or biotechnological monitoring settings. It also has not been tested with the negative mode of an IMS for lack of data. In general, the robustness of the method under adversarial conditions (high concentrations with formation of dimer ions, changes in temperature or carrier gas flow in the MCC) has to be evaluated and probably improved.

Introduction

116Ion mobility (IM) spectrometry (IMS), coupled with multi-capillary columns (MCCs), MCC/IMS for short, has been gaining importance for biotechnological and medical applications. With MCC/IMS, one can measure the presence and concentration of volatile organic compounds (VOCs) in the air or in exhaled breath with high sensitivity. In contrast to other technologies, such as mass spectrometry coupled with gas chromatography (GC/MS), MCC/IMS works at ambient pressure and temperature. Several diseases like chronic obstructive pulmonary disease (COPD) [1], sarcoidosis [2] or lung cancer [3] can potentially be diagnosed early with MCC/IMS technology. IMS is also used for the detection of drugs [4] and explosives [5]. Constant monitoring of VOC levels is of interest in biotechnology, e.g., for watching fermenters with yeast producing desired compounds [6] and in medicine, e.g., monitoring propofol levels in the exhaled breath of patients during surgery [7].

117IMS technology is moving towards miniaturization and small mobile devices. This creates new challenges for data analysis: The analysis should be possible within the measuring device without requiring additional hardware like an external laptop or a compute server. Ideally, the spectra can be processed on a small embedded chip or small device like a Raspberry Pi or similar hardware with restricted resources. Algorithms in small mobile hardware face constraints, such as the need to use little energy (hence little random access memory), while maintaining prescribed time constraints.

118The basis of MCC/IMS analysis is peak extraction, by which we mean a representation of all high-intensity regions (peaks) in the measurement by using a few descriptive parameters per peak instead of the full measurement data. State-of-the-art software (like IPHEx [8], Visual Now [9], PEAX [10]) only extracts peaks when the whole measurement is available, which may take up to 10 minutes because of the pre-separation of the analytes in the MCC. Our own PEAX software in fact defines modular pipelines for fully automatic peak extraction and compares favorably with a human domain expert doing the same work manually when presented with a whole MCC/IMS measurement. However, storing the whole measurement is not desirable or possible when the memory and CPU power is restricted. Here we introduce a method to extract peaks and estimate a parametric representation while the measurement is being captured. This is called online peak extraction, and this article presents the first algorithm for this purpose on MCC/IMS data. An extended abstract of this work has been published at WABI'14 [11].

119Section 'Background' introduces the necessary background on the data produced by an MCC/IMS experiment, on peak modeling and on optimization methods. The basic idea of our algorithm is to process each IM spectrum as soon as it arrives (and before the next one arrives). After appropriate pre-processing including denoising and baseline correction described in Section 'Denoising and baseline correction' , the single spectra are reduced into a mixture of parametric one-dimensional peak models, described in Section 'Reducing a spectrum to peak models' . Accordingly, in Section 'Aligning consecutive spectrum peak lists' the approach of connecting models from two subsequent spectra into peak chains is explained. The main challenge is then to merge the peak chains into two-dimensional peak models, described in Section 'Estimating 2-D peak models' . In Section 'Peak clustering' we introduce a novel approach for clustering peaks among several measurements e.g. for time series. An evaluation of our approach is presented in Section 'Evaluation' including a listing of all settings of the MCC/IMS as well as an explanation of all adjustable parameters, while Section 'Discussion and conclusion' contains a concluding discussion.

Background

120Ion mobility spectrometers and their functions are well documented [12], and we do not go into technical details. Instead, we characterize the data generated by an MCC/IMS experiment (Section 'Data from MCC/IMS measurements'). In Section 'Peak models' we describe a previously used parametric peak model, and in Section 'Optimization methods' we review two optimization methods that are being used as subroutines in this work.

Data from MCC/IMS measurements

121In an MCC/IMS experiment, a mixture of several unknown volatile organic compounds (VOCs) is separated in two dimensions: first by retention time r in the MCC (the time required for a particular compound to pass through the MCC) and second by drift time d through the IM spectrometer. Instead of the drift time itself, a quantity normalized for pressure and temperature called the inverse reduced mobility (IRM) t is used to compare spectra taken under different or changing conditions. Thus we obtain a time series of IM spectra (one spectrum each 100 ms at each retention time point), and each spectrum is a vector of ion concentrations (measured by voltage change on a Faraday plate) at each IRM.

122Let R be the set of (equidistant) retention time points and let T be the set of (equidistant) IRMs where a measurement is made. If D is the corresponding set of drift times (each 1/250000 second for 50 ms, that is 12 500 time points), there exists a constant C t|d > 0 depending on external conditions [12] such that T = C t|d · D. Then the data is an |R| × |T| matrix S = (S r,t ) of measured ion intensities, which we call an IM spectrum-chromatogram (IMSC). The matrix can be visualized as a heat map ( Figure 1). A row of S is a spectrum, while a column of S is a chromatogram.

123Areas of high intensity in S are called peaks, and our goal is to discover them and to describe them by parametric models. Comparing peak coordinates with reference databases may reveal the identity of the corresponding compound. A peak caused by a VOC occurs over several IM spectra. We mention some properties of MCC/IMS data that complicate the analysis.

124• An IM spectrometer uses an ionized carrier gas.

125These ions are present in every spectrum in addition to the analyte ions, and they create the reactant ion peak (RIP). In the whole IMSC it is present as high-intensity chromatogram at a specific IRM ( Figure 1). When no analytes are injected into the device, the spectra contain only the RIP and are called RIP-only spectra. • Every spectrum contains a tailing of the RIP, so the RIP is right-skewed ( Figure 2). To extract peaks, the effect of the RIP and its tailing must be estimated and removed. • At higher concentrations, compounds can form dimer ions, and one may observe both the monomer and dimer peak from one compound. This means that there is not necessarily a one-to-one correspondence between peaks and compounds, and our work focuses on peak detection, not compound identification. • An IM spectrometer may operate in positive or negative mode, depending on which type of ions (positive or negative) one wants to detect. In either case, signals are reported in positive units. All experiments described here were done in positive mode.

Peak models

126For our purpose of analyzing MCC/IMS measurements, a peak is characterized by the following assumptions.

127Assumptions 1. An n-dimensional peak P is a product of n log-concave functions with two inflection points in each dimension. The peak width at half height ω1 /2,i can be Figure 1 Visualization of a raw measurement (IMSC) as a heat map; signal color: white (lowest) < blue < purple < red < yellow (highest). The constantly present reactant ion peak (RIP) with mode at 0.48 Vs/cm 2 and exemplarily one VOC peak are annotated.

128calculated with respect to the mode for each dimension i. At its mode (m 1 , . . . , m n ), peak P exceeds the average background noise level by a certain factor times the standard deviation of the noise.

129For MCC/IMS measurements, we have n = 2 dimensions, and in both retention time dimension and IRM dimension, we use the shifted Inverse Gaussian distribution g [13] as peak model function:

130Its parameters are the shift (or offset) o, the relative mean μ > 0 (to the right of o) and the shape parameter λ > 0. A peak is then given as the product of two shifted Inverse Gaussians, scaled by a volume factor v, i.e., by seven parameters; so the density function of a peak is p(r, t) := v·g(r, μ r , λ r , o r )·g(t, μ t , λ t , o t ) for all r ∈ R, t ∈ T.

131Since the parameters μ, λ, o of a shifted Inverse Gaussian may be different even though the resulting distributions have a similar shape, it is more intuitive to describe the shifted Inverse Gaussian in terms of three different descriptors: the (absolute) mean μ = o + μ, the standard deviation σ and the mode m. There is a bijection between (μ, λ, o) and (μ , σ , m) [13] summarized in Appendix A.

132We also make use of the following empirically observable properties of peaks in real IMSCs that concern the peak widths on both the IRM axis and the retention time axis. The width can be described as the length ω1 /2 of the interval around the mode where the peak height is at least half of its maximum height. For a (symmetric) Gaussian distribution, there is a linear relation between the standard deviation σ and ω1 /2 :

133This relation approximately holds as well for not too skewed Inverse Gaussian distributions and is a good approximation to estimate its descriptor σ approximately from an empirically observed ω1 /2 .

134Given the mode d * of a peak in drift time (in ms), we can estimate its descriptors (m, σ , μ ) in IRM units as follows. Recall that the IRM mode (in V s cm −2 ) is simply m = C t|d · d * , where C t|d is the conversion constant between drift time and IRM (see Section 'Data from MCC/IMS measurements'). Spangler et al. [14] empirically derived that ω1 /2 = (11.09 D d * )/v 2 d + d 2 grid , where D is the diffusion coefficient, v d the drift velocity. Using the Einstein relation [15], D can be computed as D = kK B T /q, where k is the ion mobility, K B the Boltzmann constant, T the absolute temperature and q the electric charge. We then use (2) to estimate σ ≈ ω1 /2 /φ. Finally, the mean is empirically found to be μ ≈ C t|d · d * + (4.246 · 10 −5 ) 2 + (d * ) 2 /585048.1633 . On the retention time axis, the peak width ω1 /2 grows approximately linearly with retention time, i.e., there are constants r_width_offset > 0 and r_width_factor > 0 such that width of a peak with maximum at retention time r is approximately ξ(r) := r · r_width_factor + r_width_offset .

135(3)

Optimization methods

136The online peak extraction algorithm makes use of nonlinear unconstrained minimization, similar to non-linear least squares, and of the EM algorithm. Both methods are summarized here.

Non-linear Least Squares

137The NLLS method is an iterative method to estimate parameters θ = (θ 1 , . . . , θ q ) of a supposed parametric function f , given n observed data points (x 1 , y 1 ), . . . , (x n , y n ) with y i = f (x i ; θ). The idea is to minimize the quadratic error n i=1 r 2 i (θ) between the function and the observed data, where r i (θ) := y i − f (x i ; θ) is the residual of the i-the datapoint. The necessary optimality condition is i r i (θ) · ∂r i (θ)/∂θ j = 0 for all j. If f is linear in θ (e.g., a polynomial in x with θ being the polynomial coefficients, a setting called polynomial regression), then the optimality condition results in a linear system, which can be solved in closed form. However, often f is not linear in θ and we obtain a non-linear system, which is solved iteratively, given initial parameter values, by linearizing it in each iteration. Details and different algorithms for NLLS can be found in the literature ( [16], Chapter 10). In this paper, we use a different, non-symmetric loss function, but apply similar techniques to solve the problem (see below).

The EM algorithm for mixtures with heterogeneous components

138The observed data x = (x 1 , . . . , x n ) is viewed as a sample from a mixture of probability distributions, where the mixture density is specified by

139where θ c denotes the parameters of f c , and θ = (θ 1 , . . . , θ C ) is the collection of all parameters. The mixture coefficients satisfy ω c ≥ 0 for all c, and c ω c = 1. Unlike in most applications, where all component distributions f c are multivariate Gaussians, here the f c are of different types (e.g., uniform and Inverse Gaussian). The goal is to determine the parameters ω and θ such that the probability of the observed sample is maximal (maximum likelihood paradigm). Since the resulting optimization problem is non-convex in (ω, θ), the EM algorithm is an iterative method that will converge to a local optimum [17] in parameter space. The EM algorithm consists of two repeated steps: The E-step (expectation) estimates the expected membership of each data point in each component and then the component weights ω, given the current model parameters θ. The M-step (maximization) estimates maximum likelihood parameters θ c for each parametric component f c individually, using the expected memberships as hidden variables that decouple the model.

140,

141Convergence. After each M-step of an EM cycle, we compare θ c,q (old parameter value) and θ + c,q (updated parameter value), where q indexes the elements of θ c , the parameters of component c. We say that the algorithm has converged when the relative change κ c,q :=

142Having reviewed the necessary background, we now describe the methods we use for peak extraction from IMSCs.

Denoising and baseline correction

143Background A major challenge during peak detection in an IM spectrum is to find peaks that only slightly exceed the background noise level in a spectrum S = (S t ). To determine whether the intensity S t at coordinate t belongs to a peak region or can be solely explained by background noise, we propose a method based on the EM algorithm. It runs in O(τ |T|) time where τ is the number of EM iterations.

Mixture model

144Based on observations of IM spectra signal intensities, we assume that

145• the noise intensity has a Gaussian distribution over low intensity values with mean μ N and standard deviation σ N ,

146• the true signal intensity has an Inverse Gaussian distribution with mean μ S and shape parameter λ S , i.e.,

147• there is an unspecific background component which is not well captured by either of the two previous distributions; we model it by the uniform distribution over all intensities,

148and we expect the weight ω B of this component to be close to zero in standard IM spectra. High weights indicate an anomaly during the measurement.

149We interpret the observed spectrum S as a sample of a mixture of these three components with unknown mixture coefficients. To illustrate this approach, consider Figure 3, which shows the empirical intensity distribution (histogram) of an arbitrary spectrum, together with the estimated components (except the uniform distribution, which has the expected coefficient of almost zero).

150It follows that there are six independent parameters to estimate:

Initial parameter values

151Background noise intensities are assumed to follow a Gaussian distribution at small intensity values. We can determine its approximate mean μ N and standard deviation σ N by considering the first and last 10% of data points in each spectrum.

152The initial weight of the noise component is set to cover most points covered by this Gaussian distribution, i.e.,

153We assume that almost all of the remaining weight belongs to the signal component, thus

154To obtain initial parameters for the signal model, let

E-step

155The hidden parameters W t,c are computed using (4), where the three component distributions f c are the three component densities p N , p S , p B with their parameters and the data x is a mean-smoothed version of the original spectrum S:

156where the smoothing window margin is α := (1/2) · d grid · C t|d · |T|/T last . (Here d grid is the grid opening time of the spectrometer and T last is the maximum IRM in T).

Maximum likelihood estimators

157In the maximization step (M-step) we estimate maximum likelihood parameters for the non-uniform components using the original intensities of S again.

158for all t ∈ T.

Final step

159After convergence, we correct the baseline and remove noise: We first subtract μ N from the signal value and then reduce the remaining value by the estimated noise weight. The corrected spectrum S + is

160Reducing a spectrum to peak models

Background

161The idea of processing a single (noise-reduced) IM spectrum S is to deconvolute it into separate components described with statistical distribution functions. Several components appear in each spectrum besides the peaks, namely the previously described RIP and the tailing described in Section 'Data from MCC/IMS measurements' . and background noise. We first determine and remove the RIP tailing function and then determine the peak parameters (including the RIP).

Determining the tailing function

162The tailing function appears as a baseline in every spectrum (see Figure 2 for an example). Its shape and scale changes from spectrum to spectrum; so it has to be determined in each spectrum and subtracted in order to extract peaks from the remaining signal in the next step. Empirically, we observe that the tailing function f (t) can be described by a scaled shifted Inverse Gaussian,

163be the residual function for a given choice θ of parameters. As we want to penalize r(t) < 0 but not (severely) r(t) > 0, we use the following non-symmetric loss function that depends on a threshold parameter γ > 0:

164That is, the loss at time t is the residual squared when it has a negative or small positive value less than the given threshold γ > 0, but becomes a linear function of the residual for larger positive residuals.

165The goal is to find θ to minimize the total loss L(θ) := t e t (θ; γ ) for the given spectrum S and given γ > 0. We use gradient descent to solve this nonlinear optimization problem, to which we refer as non-linear loss minimization (NLLM). To estimate the tailing function, 1. we determine reasonable initial values for the parameters θ = (v, μ, λ, o) (see below), 2. we solve NLLM with γ = σ 2 N to estimate the scaling factor v, leaving the other parameters fixed, 3. we solve NLLM with γ = σ 2 N to estimate all four parameters, 4. we solve NLLM with γ = σ 2 N /100 to re-estimate the scaling factor v where σ N is the standard deviation of the noise as described in Section 'Denoising and baseline correction' .

166The initial parameter values (v, μ, λ, o) are determined as follows: For the scaling factor, we initially set v = (1/2) t |T| S t . For the other parameters, we first estimate the descriptors (μ , σ , m) as described below and then use the correspondence to the parameters listed in Appendix A. The initial σ is set to the standard deviation of the whole RIP-only spectrum. We determine the initial m as the RIP mode. It is a property of the Inverse Gaussian distributions under consideration such that the mean μ can only range within the interval I = [ m, m + 0.7σ ]. To obtain an appropriate value for μ , an auxiliary offset variable o is set to the largest IRM left of the RIP mode where the signal is below σ N , and μ it is increased in small steps within I. The candidate descriptors (μ , σ , m) are converted into corresponding param- eters (μ, λ, o) until o ≥ o . The so obtained parameters constitute the initial parameter values.

Extracting peak parameters from a single spectrum

167To extract all peaks from a spectrum (from left to right), we repeat three sub-steps:

1681. scanning for a potential peak, starting where the previous iteration stopped; 2. determining peak parameters (Inverse Gaussian distribution); 3. subtracting the peak from the spectrum and continuing with the remainder.

169Scanning. The algorithm scans for peaks, starting at the left end of S, by sliding a window of a given width across S and fitting a quadratic polynomial model to the data points within the window. The window width (in index units) is related to the grid opening time d grid of the spectrometer and given as d grid /D last · |D| data points, where D last is the maximum (last) drift time measured. The model is built in drift time (not IRM). Let f (d; θ) = θ 2 d 2 + θ 1 d + θ 0 be the fitted quadratic polynomial inside the window. We call a window a peak window if the following conditions are fulfilled:

170• the extreme drift time d * = θ 1 /(2θ 2 ) lies within the drift times of the window; • the extreme drift time d * indicates a maximum (i.e., θ 2 < 0); • the maximum is sufficiently high above the noise level (which is zero after preprocessing):

171The first condition can be more strongly restricted to achieve more reliable results, by shrinking the interval towards the center of the window. If no peak is found, the moving window is shifted one index forward. If a peak is detected, the window is shifted half the window length forward before the next scan begins, but first the peak parameters are computed.

172Determining peak parameters. As described in Section 'Peak models' , we can estimate all peak descriptors (m, σ , μ ) from its mode d * in drift time. We convert them into the parameters (μ, λ, o) of the Inverse Gaussian parameterization (see Appendix A). The scaling factor v for the peak is v = f (d * ; θ)/g(m; μ, λ, o).

173The model function is subtracted from the spectrum, and the next iteration is started with a window shifted by α index units (consider Section 'E-step'). For each spectrum, the output of this step is a spectrum peak list, which is a set of parameters for a mixture of weighted Inverse Gaussian models describing the peaks.

Background

174Having a set of peak parameters for each spectrum, the question arises how to merge the sets P = (P i ) and P + = (P + j ) of two consecutive spectra. For each peak P i , we have stored the Inverse Gaussian parameters μ i , λ i , o i , the peak descriptors μ i , σ i , m i (mean, standard deviation, mode) and the scaling factor v i , and similarly so for the peaks P + j . The idea is to compute a global alignment similar to the Needleman-Wunsch method [18] between P and P + . We need to specify how to score aligning P i to P + j and how to score leaving a peak unaligned (i.e., a gap).

Scoring peak alignments

175The score Z ij for aligning P i to P + j is chosen by evaluating P i 's density function at the new mode m + j and comparing it to "typical" value an approximate standard deviation away from the mode (at m i + δ, where δ := d grid · C t|d /φ), resulting in the log-odds score

176Alternatively, leaving a peak unmatched results in a gap score of zero.

177Applying Needleman-Wunsch global alignment, we can compute the optimal score of aligning the first i peaks in the former spectrum with the first j peaks in the current spectrum by dynamic programming. We initialize a matrix Z, setting all Z i,0 and Z 0,j to zero and then compute, for i ≥ 1 and j ≥ 1,

Obtaining peak chains

178The alignment is obtained with a traceback, recording the optimal case in each cell, as usual. There are three cases to consider.

179• If P + j is not aligned with a peak in P, potentially a new peak starts at this retention time. Thus model P + j is put into a new peak chain.

180• If P + j is aligned with a peak P i , the chain containing P i is extended with P + j . • All peaks P i that are not aligned to any peak in P + indicate the end of a peak chain at the current retention time.

181All completed peak chains are forwarded to the next step, two-dimensional peak model estimation.

Estimating 2-D peak models

182Background Let C = (P 1 , . . . , P n ) be a chain of one-dimensional Inverse Gaussian models. The goal of this step is to estimate a two-dimensional peak model (product of two one-dimensional Inverse Gaussians) from the chain, as described in Section 'Peak models' , or to reject the chain if the chain does not fit such a model well. Potential problems are that a peak chain may contain noisy 1-D peaks truncated at their borders, consist only of noise or in fact consist of several consecutive 2-D peaks at the same drift time and successive retention times.

Estimating the parameters

183As discussed in Section 'Peak models' , the half-height width ω1 /2 in retention time of a peak centered at retention time r can be described by an affine function ξ(r), Eq. (3), and ω1 /2 can be converted to the corresponding number of data points (window width).

184We have the parameters (v i ,μ i,t ,λ i,t ,ô i,t ) for each individual peak i = 1, . . . , n in a peak chain, and the corresponding descriptors (μ i,t ,σ i,t ,m i,t ), as well as the associated retention time r i and peak height h i =v i · g(m i,t ;μ i,t ,λ i,t ,ô i,t ).

185We proceed similarly to Section 'Extracting peak parameters from a single spectrum' by fitting quadratic polynomials b(r; θ) = θ 2 r 2 + θ 1 r + θ 0 in sliding windows of the appropriate width ξ(r i ) such that h i ≈ b(r i ; θ).

186Having found a window that fits a peak, we estimate initial descriptors for an Inverse Gaussian model in retention time as follows:

The descriptors are then converted into model parameters (see Appendix A).

187After processing each window, we have obtained a list of size, say, k, of Inverse Gaussian distributions. We expect these distributions to be a mixture of k overlapping peaks in a single peak chain. To obtain an optimal deconvolution, we first normalize the volume factors v r of the k components to obtain v r,j such that k j=1 v r,r = 1 and then apply the EM algorithm. As a byproduct, we obtain an (n × k) matrix M = (M i,j ) that determines the membership probability for each of the n data points (r i , h i ) to each of the k models.

188To obtain the Inverse Gaussian distribution parameters in the IRM dimension for each of the k models, we first compute model descriptors using a membershipweighted average over the individual model descriptors: For j ∈ {1, . . . , k}, let

189We then convert these descriptors back into model parameters (Appendix A). The final peak volume is computed as v * j = v j,r · i n v i,t . For every model j ∈ {1, . . . , k}, we check the following conditions:

190• The width at half height in the retention time dimension has approximately the expected size (cf. Eqs. (2), (3)): ξ(m j,r )/2 σ j,r /φ < 2 · ξ(m j,r ), • The peak height at its maximum is sufficiently above the noise level: v * j · g(m j,t ; μ j,t , λ j,t , o j,t )· g(m j,r ; μ j,r , λ j,r , o j,r ) ≥ noise_margin · σ N , where noise_margin > 0 is a tunable parameter, • the Inverse Gaussian peak model g in retention time correlates well (in terms of the Pearson product-moment correlation coefficient ρ) with its quadratic approximation b in a window around the mode. More precisely, consider the window W = [ m j,r − ξ(m j,r )/φ, m j,r + ξ(m j,r )/φ], the model vector G = g(x; μ j,r , λ j,r , o j,r ) for x ∈ W and the quadratic approximation vector B = b j (x; θ) for x ∈ W , and test whether the Pearson correlation satisfies ρ(G, B) ≥ ρ min .

191If all conditions are satisfied, we have identified a 2-D peak model (v * j , μ j,t , λ j,t , o j,t , μ j,r , λ j,r , o j,r ). Otherwise the model is discarded.

Background

192We now consider a series of IMS measurements, for each of which we have extracted peaks available in the form of parameter vectors or descriptors. The question arises how to decide which descriptors in different measurements represent the same peak (and hence potentially the same VOC).

193Let X be the union of peak locations in all measurements, let |X| =: n, and let X i,R be the retention time of peak i and X i,T its IRM. We introduce a clustering approach using the EM algorithm with twodimensional Gaussian mixtures that differs from the standard approach by its ability to dynamically adjust the number of clusters in the process.

Mixture model

194We assume that the measured retention times and IRMs belonging to peaks from the same compound are independently normally distributed in both dimensions around the (unknown) true retention time and IRM. Let θ j := (μ j,R , σ j,R , μ j,T , σ j,T ) be the parameters for component j, and let f j (x givenθ j be a two-dimensional Gaussian product distribution for a peak location x = (x R , x T ) with these parameters.

195The mixture distribution is

196with a yet undetermined number C of clusters. Note that there is no "background" model component.

Initial parameter values

197In the beginning, we initialize the algorithm with as many clusters as peaks, i.e., we set C := n. This assignment makes a background model obsolete, because all peaks are assigned to at least one cluster. All clusters get as start parameters for μ j,R , μ j,T the original retention time and IRM of peak location X j , respectively, for j = 1, . . . , n. We set σ j,T := t_width > 0 and σ j,R := ξ(X j,R )/φ.

Dynamic adjustment of the number of clusters

198After computing weights in the E-step, but before starting the M-step, we dynamically adjust the number of clusters by merging clusters whose centers are close to each other. Every pair j < k of clusters is compared in a nested forloop. When |μ j,T − μ k,T | < t_width and |μ j,R − μ k,R | < ξ max{μ j,R , μ k,R } , then clusters j and k are merged by summing the EM weights: ω + := ω j + ω k and W i,+ := W i,j + W i,k for all i. The summed weights are assigned to the location of the cluster with larger weight. (The recomputation of the parameters happens immediately after merging in the maximization step). The comparison order may matter in rare cases for deciding which peaks are merged first, but since new means and variances are computed, possible merges that were omitted in the current iteration will be performed in the next iteration. This merging step is applied after in the second EM iteration, since the cluster means need at least one iteration to move towards each other.

Maximum likelihood estimators

199The maximum likelihood estimators for mean and variance of a two-dimensional Gaussian are the standard ones, taking into account the membership weights,

200for all components j = 1, . . . , C.

201One problem using this approach emerges from the fact that initially each cluster contains only one peak, leading to an estimated variance of zero in many cases. To prevent this, minimum values are enforced such that σ j,T ≥ t_width and σ j,R ≥ ξ(μ j,R )/φ for all j.

Final step

202The EM loop terminates when no merging occurs and the convergence criteria for all parameters are fulfilled. The resulting membership weights determine the number of clusters as well as the membership coefficient of peak location X i to cluster j. If a hard clustering is desired, the merging step has to be traced.

Evaluation

203We evaluate different properties of the online method:

2041. the quality of reducing a single spectrum to a peak list (denoising/baseline correction (Section 'Denoising and baseline correction') and spectrum reduction (Section 'Reducing a spectrum to peak models'), 2. the execution time of both steps, 3. the quality of the new clustering approach, 4. the correlation between manual annotations on full IMSCs by a computer-assisted expert and our automated online extraction method.

205Parameters. For evaluation measurements, the MCC was adjusted to a temperature of 40°C and throughput of 150 mL min −1 . The IMS had a voltage of 4380 V, a grid opening time of 300 μs and a throughput of 150 mL min −1 . We chose the following parameters [9]:

206• r_width_offset = 2.5 s (width offset for peaks in retention time), • r_width_factor = 0.06 (width slope for peaks in retention time), • t_width = 0.003 V s cm −2 (standard deviation for peaks in IRM), • thresh (convergence threshold; value varies within evaluation), • noise_margin = 4 (factor multiplied with standard deviation of background noise for minimal peak height), • ρ min = 0.95 (minimal Pearson product-moment correlation coefficient).

Quality of single spectrum reduction

207In a first experiment, we tested the quality of the spectrum reduction method using an idea by Munteanu and

208Wornowizki [19] that determines the agreement between an observed set of data points, interpreted as an empirical distribution function F (the data) and a model distribution G (the mixture distribution obtained from the peak list parameters). The approach writes F =s·G +(1−s)·H withs ∈ [ 0, 1], where H is a non-parametric distribution whose inclusion ensures the fit of the model G to the data F. If the weights is close to 1.0, then F is a plausible sample from G. We compare the original spectra and reduced spectra (peaks from peak lists) from a previously used dataset [20]. This set contains 69 measurements preprocessed with a 5 × 5 average. Every measurement contains 1200 spectra. For each spectrum in all measurements, we computed the reduced spectrum model and determineds. Over 92% of all 82 000 models achieveds = 1 and over 99% reacheds ≥ 0.9. Nos dropped below 85%. In summary, spectrum reduction provides an accurate parametric representation of most spectra.

Execution time

209We tested our method on two different platforms, (1) a desktop PC with Intel(R) Core(TM) i5 2.80GHz CPU, 8GB memory, Ubuntu 12.04 (64bit) OS and (2) a Raspberry Pi [21] type B with ARM1176JZF-S 700MHz CPU, 512 MB memory, Raspbian Wheezy (32bit) OS, once with the factory defaults of 700 MHz and once overclocked up to 900 MHz. The Raspberry Pi was chosen because it is a complete credit-card-sized low-cost single-board computer with low CPU and power consumption (3.5 w). This kind of device is appropriate for data analysis in future mobile measurement devices.

210Recall that each spectrum contains 12 500 data points. It is current practice to analyze not the full spectra, but aggregated ones, where five consecutive values are averaged. Here we consider the full spectra, slightly aggregated ones (average over two values, 6 250 data points) and standard aggregated ones (average over five values, 2 500 data points). We measured the average execution time of denoising, baseline correction and consecutive spectrum reduction. Table 1 shows the results. It is remarkable that at the highest resolution (Average 1) the Raspberry Pi with 900 MHz keeps barely the time bound of 100 ms between consecutive spectra. At lower resolutions, the Raspberry Pi satisfies the time restrictions easily. The desktop PC copes with the analysis effortless on any setting.

211We found that in the steps that use the EM algorithm, on average 25-30 EM iterations were necessary for a precision of thresh := 0.001 (i.e., 0.1%) (see Convergence in Section 'The EM Algorithm for mixtures with heterogeneous components'). Relaxing the threshold from 0.001 to 0.01 halved the number of iterations without noticeable difference in the resulting estimated parameters.

Clustering

212To evaluate peak clustering methods, we simulate peak locations according to locations in real MCC/IMS datasets, together with the true partition P of peaks.

213Most of the detected peaks appear in a small dense area early in the measurement. The remaining peaks are distributed widely, which is referred to as the sparse area (we let the areas overlap such that the dense are is contained in the sparse area). The areas approximately have the following boundaries (in units of (V s cm −2 , s) from lower left to upper right point, cf. Peak clusters are ellipsoidal and dense. From [9], we know the minimum required distance between two peaks in order to be identified as two separate compounds. We simulate 30 peak cluster centroids in the dense area and 20 in the sparse area, all picked randomly and uniformly distributed in the respective area. We then randomly pick the number of peaks per cluster. We also randomly pick the distribution of peaks within a cluster. Since we do not know the actual distribution model, we decided to simulate with three models: normal (n), exponential (e) and uniform (u) distribution with the following densities: Here (μ t , μ r ) is the coordinate of the centroid with RIM in Vs/cm 2 and retention time in s. For the normal distribution, we used σ t = 0.002 and σ r = μ r · 0.002 + 0.2. For the exponential distribution, we used λ t = (1.45 · 2500) −1 (reduced mobility width for in single cell within M) and λ r = 1/(μ r · 0.002 + 0.2). For the uniform distribution, we used an ellipsoid with radii ν t = 0.006 and ν r = μ r · 0.02 + 1.

214We compared our adaptive EM clustering with two common clustering methods: k-means and DBSCAN. Since k-means needs a fixed number of clusters k and appropriate start values for the centroids, used k-means++ [22] for estimating good starting values and give it an advantage by assigning the true number of partitions. DBSCAN has the advantages that it does not need to know the number of clusters in advance and that it can find non-linear cluster boundaries, but it does not easily yield parametric cluster descriptors.

215To measure the quality of an obtained clustering C we use the Fowlkes-Mallows index (FMI, [23]) and the normalized variation of information (NVI) score [24].

216For the FMI one considers all pairs of data points. If two data points belong to the same true partition of P, they are called connected. Accordingly, a pair of data points is called clustered if they are clustered together by the clustering method are evaluating. Pairs of data points that are both connected and clustered are called true positives (TP). False positives (FP, not connected but clustered) and false negatives (FN, connected but not clustered) are computed analogously. The FMI is the geometric mean of precision and recall: FMI(P, C) := √ TP/(TP + FP) · TP/(TP + FN), where P is the true partition and C is the clustering. We have FMI(P, C) ∈ [ 0, 1], and FMI(P, C) = 1 indicates perfect agreement. The FMI is difficult to interpret when the number of clusters in C and P differs significantly.

217Therefore we use a second measure that considers cluster sizes only, the normalized variation of information (NVI). To compute the NVI, an auxiliary (|P| × |C|)dimensional matrix A = (a i,j ) is computed, where a i,j is the number of data points within partition i that are assigned to cluster j. The NVI score is defined via entropies; let n be the number of data points and if H(P) = 0, H(C) otherwise.

Figure 4

218Histograms of Fowlkes-Mallows index (FMI; higher is better) and normalized variation of information (NVI; lower is better) comparing 100 simulated measurements containing partitioned peak locations with their clusters produced by the different methods.

219Here NVI(P, C) = 0 indicates perfect agreement between the cluster size distributions. Together, an FMI of 1 and an NVI score of 0 indicate a perfect clustering.

220For the first test, we evaluated 100 sets of data points distributed as described above. The cluster model (normal, exponential or uniform) was drawn randomly. The results show that even with the advantage that k-means knows the true k, our adaptive EM clustering performs best on average in terms of FMI and NVI score (Figure 4).

221For the second test, we additionally inserted 200 uniformly distributed (noise) peaks into the measurement area. All these peaks are singletons and have no matching Time series of discovered intensities of two peaks. Left: A peak with agreement between manual and automated online annotation. Right: A peak where the online method fails to extract the peak in several measurements. If one treated zeros as missing data, the overall trend would still be visible.

222peaks. The results ( Figure 5) show that the adaptive EM clustering still performs best on average, whereas k-means fails.

Comparison of automated online peak extraction with manual offline annotation

223The fourth experiment compares extracted peaks from a time series of measurements of two automated methods to an expert manual annotation. The automated methods are our online analysis process described here and automated peak detection using the commercial VisualNow software.

224Here 15 rats were monitored in 20 minute intervals for up to a day. Each rat resulted in 30-40 measurements (a time series) for a total of 515 measurements. To track peaks over time, we used the previously described EM clustering method.

225As an example, Figure 6 shows time series of intensities of two peaks detected by computer-assisted manual annotation and using our online algorithm. The example shows that there are cases where the sensitivity of the online algorithm is not perfect; this is mainly true for peaks whose intensity only slightly exceeds the background noise.

226To obtain an overview over all time series, we computed the cosine similarity γ ∈ [ −1, +1] time series of peak intensities discovered by manual annotation and each automated method. We also computed the recall automated method for each time series, that is, the relative fraction of measurements where the peak was found by the algorithm among those where it was found by manual annotation. Figure 7 shows overall good agreement between both automated methods (our online method and automated VisualNow peak extraction) with the expert manual annotation. The cosine similarity of the inferred time series is in better agreement than the more variable recall. When comparing automated methods against each other, we outperform VisualNow in terms of sensitivity and computation time: About 31% of the points extracted by the online method exceed 90% recall and 98% cosine similarity whereas only 5% of the time series extracted by VisualNow achieve these values. The peak detection of one measurement takes about 2 seconds on average (when the whole measurement is available at once) with the online method and about 20 seconds with VisualNow on the desktop computer described above. VisualNow only provides the position and signal intensity of the peak's maximum, whereas our method additionally provides shape parameters.

227Problems of our online method stem from low-intensity peaks only slightly above the detection threshold, and resulting fragmentary or rejected peak chains.

Discussion and conclusion

228We presented the first approach to extract peaks from MCC/IMS measurements while they are being captured, with the long-term goal to remove the need for storing full measurements before analyzing them in small embedded devices. Our method is fast and satisfies the time restrictions even on a low-power CPU platform like a Raspberry Pi and outperforms existing software.

229While performing well on single spectra, there is room for improvement in merging one-dimensional peak models into two-dimensional peak models. Our method has to be further evaluated in clinical studies or biotechnological monitoring settings. It also has not been tested with the negative mode of an IMS for lack of data. In general, the robustness of the method under adversarial conditions (high concentrations with formation of dimer ions, changes in temperature or carrier gas flow in the MCC) has to be evaluated and probably improved.

참고문헌 27건

  1. MCC-IMS data analysis using automated spectra processing and explorative visualisation methods 2012
  2. Peak modeling for Ion mobility spectrometry measurements 2012
  3. Using the Expectation Maximization Algorithm with Heterogeneous Mixture Components for the Analysis of Spectrometry Data arXiv (Cornell University) · Cornell University · 2014 10.48550/arxiv.1405.5501
  4. A critical review of ion mobility spectrometry for the detection of explosives and explosive related compounds Talanta · Elsevier BV · 2001 10.1016/s0039-9140(00)00565-8
  5. Detection of volatile organic compounds (VOCs) in exhaled breath of patients with chronic obstructive pulmonary disease (COPD) by ion mobility spectrometry International Journal for Ion Mobility Spectrometry · Springer Science+Business Media · 2011 10.1007/s12127-011-0060-2
  6. The NVI clustering evaluation measure 2009 10.3115/1596374.1596401
  7. Monitoring of yeast fermentation by ion mobility spectrometry measurement and data visualisation with Self-Organizing Maps Analytica Chimica Acta · Elsevier BV · 2003 10.1016/s0003-2670(03)00307-6
  8. Peak shape analysis and plate theory for plasma chromatography Analytical Chemistry · American Chemical Society · 1975 10.1021/ac60353a013
  9. Characterization of propofol in human breath of patients undergoing anesthesia International Journal for Ion Mobility Spectrometry · Springer Science+Business Media · 2011 10.1007/s12127-011-0080-y
  10. A Method for Comparing Two Hierarchical Clusterings Journal of the American Statistical Association · 1983 10.1080/01621459.1983.10478008
  11. Über die von der molekularkinetischen Theorie der Wärme geforderte Bewegung von in ruhenden Flüssigkeiten suspendierten Teilchen Annalen der Physik · Wiley · 1905 10.1002/andp.19053220806
  12. Peak finding and referencing in MCC/IMS-data International Journal for Ion Mobility Spectrometry · Springer Science+Business Media · 2008 10.1007/s12127-008-0012-7
  13. Maximum Likelihood from Incomplete Data Via the <i>EM</i> Algorithm Journal of the Royal Statistical Society Series B (Statistical Methodology) · Oxford University Press · 1977 10.1111/j.2517-6161.1977.tb01600.x
  14. Peak Detection Method Evaluation for Ion Mobility Spectrometry by Using Machine Learning Approaches Metabolites · Multidisciplinary Digital Publishing Institute · 2013 10.3390/metabo3020277
  15. k-means++: the advantages of careful seeding Symposium on Discrete Algorithms · 2007 10.5555/1283383.1283494
  16. A general method applicable to the search for similarities in the amino acid sequence of two proteins Journal of Molecular Biology · Elsevier BV · 1970 10.1016/0022-2836(70)90057-4
  17. MCC/IMS signals in human breath related to sarcoidosis—results of a feasibility study using an automated peak finding procedure Journal of Breath Research · IOP Publishing · 2009 10.1088/1752-7155/3/4/046001
  18. A modular computational framework for automated peak extraction from ion mobility spectra BMC Bioinformatics · BioMed Central · 2014 10.1186/1471-2105-15-25
  19. An online peak extraction algorithm for ion mobility spectrometry data Algorithms for Molecular Biology · BioMed Central · 2015 10.1186/s13015-015-0045-5
  20. Ion mobility spectrometry for the detection of volatile organic compounds in exhaled breath of patients with lung cancer: results of a pilot study Thorax · BMJ · 2009 10.1136/thx.2008.099465
  21. Proceedings of the Eighteenth Annual ACM-SIAM Symposium on Discrete Algorithms Society for Industrial and Applied Mathematics eBooks · Society for Industrial and Applied Mathematics · 2007
  22. Signal Processing Conference (EUSIPCO), 2012 Proceedings of the 20th European 2012
  23. Proceedings of the Thirteenth Conference on Computational Natural Language Learning 2009
  24. Numerical optimization Cambridge University Press eBooks · Cambridge University Press · 2021 10.1017/9781108993456.011
  25. Deleted Work 1955
  26. Ion Mobility Spectrometry CRC Press eBooks · Informa · 2005 10.1201/9781420038972
  27. Numerical Optimization Springer eBooks · Springer Nature · 2006 10.1007/978-3-540-35447-5