BACKGROUND
metabolomics refers to an all-inclusive profiling of low-molecular weight metabolites with an implicit aim to interpret results in the context of the organism's genome and its global metabolic network  <cit> .
the term metabolic profiling is used to denote either targeted or non-targeted profiling of small molecules in biological samples.
a targeted analysis focuses on specific, a priori known compounds, and therefore only parts of the chromatogram data matrix generated by the instrument may be considered relevant.
in a non-targeted approach all detectable signals are analyzed, and the aim of such analysis is to achieve as wide coverage of metabolites as permitted by a particular experimental technique.
a non-targeted metabolic profiling is an essential component of metabolomics, together with bioinformatics approaches for data analysis, interpretation, and integration  <cit> .
in recent years metabolic profiling is increasingly being used in studies of microbial metabolism  <cit> , biomarker discovery  <cit> , toxicology  <cit> , nutrition  <cit> , and integrated systems biology  <cit> .
hyphenated mass spectrometry approaches, in particular gas chromatography-mass spectrometry   <cit>  and liquid chromatography-mass spectrometry   <cit> , are often used for metabolic profiling because of their inherent robustness, sensitivity, and large dynamic range.
gc-ms is particularly well suited for studies of low polarity metabolites with high sensitivity and specificity  <cit> .
the processing of gc-ms data is based on the detection of chromatogram signal peaks, a step performed either with proprietary software or with freely available software such as amdis  <cit> .
the net result of peak detection is a set of signal peaks that represent components present in the sample.
metabolic profiling experiments are relatively rapid, and typically multiple replicates per sample state are recorded to facilitate robust statistical analyses  <cit> .
in order to compare multiple samples, one needs to account for retention time drifts inherent in chromatographic separations  <cit> .
the retention time drifts arise because of instrument imperfections , column variations , and sample matrix effects   <cit> .
a review of the literature shows that there is a pressing need for better algorithms for retention time correction in gc-ms small molecule profiling experiments.
a summary of approaches used in the past for correcting retention time drifts in hyphenated mass spectrometry experiments is given in figure  <dig>  an approach often used to correct retention time drifts in practice is a linear correction calculated based on deviations from internal standards  <cit> .
this approach has several limitations  <cit> .
for example, addition of internal standards adds new chemicals to the sample, and chromatographic retention time drifts are not linear .
the problem of retention time correction is similar in gc-ms and lc-ms small molecule profiling experiments.
there are two schools of thought on how to address this: one is to align entire chromatogram profiles prior to peak detection   <cit> , and the other is to perform peak detection first, and then align extracted signal peaks to correct for retention time drifts   <cit> .
in either approach one can rely on the time domain data only, or include highly selective information from the m/z data domain .
both peak matching and profile alignment methods have been used in the context of gc-ms data.
jonsson and co-authors have developed a strategy for rapid comparison of gc-ms metabolic profiles, based on the division of a chromatogram into time windows  <cit> .
to correct the retention time drifts they relied on finding the maximum covariance between the chromatograms  <cit> .
this is a profile alignment method that uses the time domain data only .
to be effective this method requires that chromatographic profiles to be aligned are similar to one another, as was the case in the analysis of leaf plant extracts where the main purpose of the alignment was to facilitate setting of time domain windows  <cit> .
a different alignment approach was used in the analysis of gc-ms data obtained from the profiling of tomato volatiles, but the algorithm was not described in detail  <cit> .
the peak matching approach is an alternative to the profile alignment that has received a considerable attention in gc-ms  <cit> .
johnson et al.
matched gc-ms peaks by retention time within a pre-defined time window  <cit> .
although this approach was shown to be reasonably effective in the gc-ms analysis of diesel fuels, much remains to be desired for applications in biomedical research.
for example, it is unclear how to choose the target-chromatogram to which other chromatograms will be aligned; the choice of the cut-off window is arbitrary; and the proposed method of grouping the peaks depends on the order in which the grouping is performed.
duran and co-workers proposed a clustering procedure which groups peaks starting from the minimum retention time  <cit> .
this approach is symmetrical with respect to all experiments and therefore alleviates the need for an arbitrary choice of a target chromatogram.
however, the proposed clustering depends on the peak minimum retention time and the arbitrary retention time window  <cit> .
we have attempted to improve on the peak clustering idea by using hierarchical clustering  <cit> .
however, applications of this method have shown that results are rather sensitive to the quality of input data, especially for large retention time drifts.
in summary, the body of work on peak matching suggests that accurate peak alignment is unlikely to be achieved by relying on retention time data only.
the most accurate retention time correction is likely to be achieved when complete chromatogram data matrices are utilized.
such methods have been applied to lc-ms  <cit>  and ce-ms  <cit>  metabolic profiling data.
the main drawback of any approach that works with entire chromatogram data matrices is the large amount of  noise data that must be handled, which dramatically increases computational costs.
our preliminary calculations showed that progressive alignment of chromatogram matrices aimed to avoid the choice of a "target" data set is computationally prohibitive.
furthermore, it is an open question whether the computational costs can be justified by the potential increase in accuracy compared to peak matching methods, when peak matching is based on both retention times and mass spectra.
the most advanced approaches for correction of retention time drifts have been developed on lc-ms and ce-ms data  <cit> .
to our knowledge the peak matching involving mass spectra has not been applied to gc-ms data, except in an approach proposed for a systematic identification of conserved metabolites  <cit> .
this approach aims specifically at identification of conserved metabolites across experiments, and its peak matching is implicitly serving as input for a motif discovery algorithm  <cit> .
here we present an approach for peak matching that relies on both peak retention times and mass spectra, capable of accurate alignment of peak lists from a large number of replicate gc-ms experiments.
we use dynamic programming to arrive at the optimal solution to the global alignment problem.
dynamic programming was previously used for the alignment of chromatogram data matrices  <cit> , but not in peak matching.
the proposed approach uses a similarity function which balances effectively similarity in peak retention times with the similarity in mass spectra, mimicking the way an experienced human operator performs peak matching.
the proposed algorithm is modelled after the heuristic solution for multiple sequence alignment  <cit> , and relies on progressive alignment to match an arbitrary number of data sets.
we apply this approach to gc-ms metabolic profiling data acquired on wild-type and mutant leishmania mexicana parasites.
in the absence of a suitable metric and an accepted benchmark for the peak alignment algorithms, we quantify absolute errors relative to manually derived "true" answer.
we show that  the proposed method performed close to the accuracy of the manually curated alignments by an expert operator;  the results are not sensitive to the input parameters, suggesting that the proposed method is robust.
RESULTS
the input for the peak alignment procedure consists of two or more peak lists obtained from hyphenated mass spectrometry experiments .
these peak lists may be derived from replicate analyses of the same sample , or replicate analyses of different samples .
each experiment is represented by a single and unique peak list.
in the most general case, a peak list could be understood as a list of peak objects, where each peak object is characterized with one or more attributes.
in the work described here, a peak was characterized with a unique peak id, the retention time at the peak apex, and the mass spectrum at the peak apex.
henceforth, we assume that a peak list consists of peaks ordered by their retention time.
consider a peak list la that contains peaks p <dig> p <dig> ...,pna
mathtype@mtef@5@5@+=feaafiart1ev1aqatcvaufkttlearuwrp9mdh5mbpbiqv92aaexatlxbi9gbaebbnrfifhhdyfgasaach8aky=wiffydh8gipec8eeeu0xxdbba9frfj0=oqffea0dxdd9vqai=hguq8kuc9pgc9s8qqaq=dirpe0xb9q8qilsfr0=vr0=vr0dc8meaabaqaciaacagaaeqabaqabegadaaakeaacqwgwbacdawgaawcbagaegymaedabeaakiabcycasiabdchawnaabaaaleaacqaiyagmaeqaaogaeiilawiaeiola4iaeiola4iaeiola4iaeiilawiaemicaa3aasbaasqaaiabd6gaunaabaaameaacqwgbbqqaeqaaawcbeaaaaa@3b56@.
in this case the retention time of the peak p <dig> is greater than that of p <dig>  the retention time of the peak p <dig> is greater than that of p <dig>  and so on.
alignment of two peak lists
consider two peak lists la = [p <dig> p <dig> ...,pna
mathtype@mtef@5@5@+=feaafiart1ev1aqatcvaufkttlearuwrp9mdh5mbpbiqv92aaexatlxbi9gbaebbnrfifhhdyfgasaach8aky=wiffydh8gipec8eeeu0xxdbba9frfj0=oqffea0dxdd9vqai=hguq8kuc9pgc9s8qqaq=dirpe0xb9q8qilsfr0=vr0=vr0dc8meaabaqaciaacagaaeqabaqabegadaaakeaacqwgwbacdawgaawcbagaegymaedabeaakiabcycasiabdchawnaabaaaleaacqaiyagmaeqaaogaeiilawiaeiola4iaeiola4iaeiola4iaeiilawiaemicaa3aasbaasqaaiabd6gaunaabaaameaacqwgbbqqaeqaaawcbeaaaaa@3b56@] and lb = [q <dig> q <dig> ...,qnb
mathtype@mtef@5@5@+=feaafiart1ev1aqatcvaufkttlearuwrp9mdh5mbpbiqv92aaexatlxbi9gbaebbnrfifhhdyfgasaach8aky=wiffydh8gipec8eeeu0xxdbba9frfj0=oqffea0dxdd9vqai=hguq8kuc9pgc9s8qqaq=dirpe0xb9q8qilsfr0=vr0=vr0dc8meaabaqaciaacagaaeqabaqabegadaaakeaacqwgxbqcdawgaawcbagaegymaedabeaakiabcycasiabdghaxnaabaaaleaacqaiyagmaeqaaogaeiilawiaeiola4iaeiola4iaeiola4iaeiilawiaemycae3aasbaasqaaiabd6gaunaabaaameaacqwgcbgqaeqaaawcbeaaaaa@3b5e@] which contain a total number of na and nb peaks, respectively.
the alignment of the peak lists la and lb refers to the establishment of a one-to-one correspondence between the peaks from the two lists, with the possibility that any peak from one list has no matching peak in the other list.
the alignment between the peak lists la and lb could be represented as a list of peak pairs, where pairing implies peak-to-peak matching.
for example,
where p <dig> is matched with q <dig>  p <dig> is matched with q <dig>  and so on.
the peak p <dig> from the list la does not have a matching peak in the lb list.
the number of elements in the above list will depend on the optimal alignment, but cannot be less than the larger of a and b, and cannot exceed a+b.
for brevity, we refer to the alignment between peak lists la and lb as la:lb.
it is apparent from the above that the alignment of two peak lists closely resembles the problem of pairwise sequence alignment.
the situation for p <dig> in equation  <cit>  corresponds to matching a sequence letter to a gap.
furthermore, the analogy can be extended even further if one considers that the peak list is an ordered sequence of peaks.
the variations in peak retention times arise from various non-linear effects during the separation stage, such as uneven flow of the carrier phase in the gc or lc column.
such perturbations may affect absolute peak retention times and may shift portions of the chromatogram in a non-linear manner  <cit> , but normally do not change the order of peaks in terms of their retention times.
the analogy with pairwise sequence alignment implies that dynamic programming could be applied to find the optimal alignment of two peak lists, provided that a suitable scoring scheme can be devised.
the scoring scheme for peak alignment
in sequence alignment, the cost function for matching two residue letters is obtained from a pre-computed substitution matrix.
in the case of peak lists the cost function should reflect similarity between two peaks .
since the peak mass-spectrum is a key identifier of a particular peak, the peak similarity function should depend heavily on the similarity in the mass spectra.
we propose the following peak similarity function p, which gives the similarity between the peaks i and j:
p=s⋅exp⁡22d2)
mathtype@mtef@5@5@+=feaafiart1ev1aaatcvaufkttlearuwrp9mdh5mbpbiqv92aaexatlxbi9gbaebbnrfifhhdyfgasaach8aky=wiffydh8gipec8eeeu0xxdbba9frfj0=oqffea0dxdd9vqai=hguq8kuc9pgc9s8qqaq=dirpe0xb9q8qilsfr0=vr0=vr0dc8meaabaqaciaacagaaeqabaqabegadaaakeaacqwgqbaucqggoaakcqwgpbqacqggsaalcqwgqbgacqggpaqkcqgh9aqpcqwgtbwucqggoaakcqwgpbqacqggsaalcqwgqbgacqggpaqkcqghfly1cygglbqzcqgg4baecqggwbacdaqadaqaaiabgkhitmaalaaabagaeiikagiaemidaq3aasbaasqaaiabdmgapbqabagccqghsislcqwg0baddawgaawcbagaemoaaogabeaakiabcmcapmaacaaaleqabagaegomaidaaagcbagaegomaijaemiraq0aawbaasqabeaacqaiyagmaaaaaagccagloagaayzkaaaaaa@509c@
in the above equation s is the similarity between the mass spectra of the peaks i and j, ti and tj are retention times of peaks i and j, and d is the retention time tolerance parameter which determines the importance of retention times to the overall peak similarity score.
the function s can be any function that returns a measure of the similarity in m/z ions detected in mass spectra of the peaks i and j. in our test implementation, s was calculated as the cosine of the angle between the two mass spectra vectors .
this resulted in values between  <dig> and 1: when the two mass spectra are identical s =  <dig>  and when they are completely dissimilar s =  <dig>
the second term in the equation  <cit>  modulates the similarity in mass spectra.
when two peaks have identical retention times  this term equals one, and the peak similarity reduces to the mass spectra similarity  = s).
when the retention times of the two peaks differ, then exp <  <dig>  and p < s. the greater the retention time difference the peak similarity p is more reduced relative to the mass spectra similarity s. the extent of this reduction depends on the relationship between the difference  and the parameter d. when  >> d then exp will be close to zero and peak similarity will be close to zero  = 0), even if mass spectra are identical  = 1).
the peak similarity function gives the "cost" of matching any two peaks.
in addition to this, the dynamic programming algorithm requires a gap penalty to be defined.
in sequence alignment gaps are treated with the affine gap function, designed to penalize gaps and to favor the extension of existing gaps over the creation of new gaps.
in peak alignment favoring gap extensions is not physically justified, therefore, we set the gap penalty to a fixed number .
with the above definition of p  the meaningful range of g is between  <dig> and  <dig>  a low value of g would favor the insertion of gaps even when peaks are originating from the same chemical compound; a high value of g would favour the alignment of peaks that are actually different.
with the above definitions for the peak similarity function and the choice of gap penalty it is possible to deploy dynamic programming to find the global solution to the problem of optimal alignment of two peak lists.
a standard dynamic programming procedure involves the following steps:  initialization of a two dimensional score matrix whose rows are indexed with the peaks of one peak list and columns are indexed with the peaks of the other peak list;  filling the cells of the score matrix based on the peak similarity function and possibly the gap penalty;  the best alignment between two peak lists is deduced from the traceback on the score matrix.
we note that the pairwise alignment of two peak lists is analogous to the problem of global sequence alignment  <cit> .
an example pairwise alignment is shown in figure  <dig>  figure  <dig> shows tic segments between  <dig> s and  <dig> s for two gc-ms profiling experiments of l. mexicana promastigotes harvested in logarithmic and stationary growth phases, respectively.
peak finding has resulted in fourteen peaks in each segment as shown in figure  <dig>  which also shows the peak matching after the alignment.
figure  <dig> shows different score matrices and the traceback used to deduce the optimal alignment.
alignment of two alignments
consider an alignment between two internally fixed alignments: one consisting of n peak lists  and the other consisting of m peak lists .
in order to find the best alignment between two such alignments with two-dimensional dynamic programming the scoring scheme must be extended.
let the n-alignment contain k peak positions and the m-alignment contain l peak positions.
in this case the score matrix may have rows indexed by the peak positions of the n-alignment, and columns indexed by the peak positions of the m-alignment, resulting in a two dimensional table with k rows and l columns.
during the dynamic programming procedure the cell  of this table is filled with the score w calculated for the i-th position of the n-alignment and the j-th position of the m-alignment, possibly modified by the gap penalty g. alternative definitions of w are possible.
in our test implementation w was calculated as the average similarity between the peaks in the i-th position of the m-alignment and j-th position of the n-alignment.
for example, if the position i of the n-alignment contained peaks pi <dig>  pi <dig> ... pin and the position j or the m-alignment contained peaks qj <dig>  qj <dig> ... qjm then:
w=∑a=1n∑b=1mp∑a=1n∑b=1mi
mathtype@mtef@5@5@+=feaafiart1ev1aaatcvaufkttlearuwrp9mdh5mbpbiqv92aaexatlxbi9gbaebbnrfifhhdyfgasaach8aky=wiffydh8gipec8eeeu0xxdbba9frfj0=oqffea0dxdd9vqai=hguq8kuc9pgc9s8qqaq=dirpe0xb9q8qilsfr0=vr0=vr0dc8meaabaqaciaacagaaeqabaqabegadaaakeaacqwgxbwvcqggoaakcqwgpbqacqggsaalcqwgqbgacqggpaqkcqgh9aqpdawcaaqaamaaqahabawaaabcaeaacqwgqbaucqggoaakcqwgwbacdawgaawcbagaemyaakmaemyyaegabeaakiabcycasiabdghaxnaabaaaleaacqwgqbgacqwgibgyaeqaaogaeiykakcaleaacqwgibgycqgh9aqpcqaixaqmaeaacqwgnbqta0gaeyyeiuoaasqaaiabdggahjabg2da9iabigdaxaqaaiabd6eaobqdcqghris5aagcbawaaabcaeaadaaewbqaaiabdmeajjabcufabjabdcfaqjabcicaoiabdchawnaabaaaleaacqwgpbqacqwghbqyaeqaaogaeiilawiaemycae3aasbaasqaaiabdqgaqjabdkgaibqabagccqggpaqkcqgh+agpcqaiwaamcqggdbqxasqaaiabdkgaijabg2da9iabigdaxaqaaiabd2eanbqdcqghris5aawcbagaemyyaemaeyypa0jaegymaedabagaemota4eaniabgghildaaaaaa@6d14@
where i is the indicator function and p is given by equation  <cit> .
here we extend the definition of the peak similarity function to include scoring of a peak with a gap, which is always zero  = p = 0).
therefore, it is possible that the denominator is less than nm, since some of the terms in equation  <cit>  may be zero due to involvement of gaps.
consider the simple case, an alignment between the alignment la:lb given by the equation  <cit>  and a single peak list lc = [r <dig> r <dig> ...,rnc
mathtype@mtef@5@5@+=feaafiart1ev1aqatcvaufkttlearuwrp9mdh5mbpbiqv92aaexatlxbi9gbaebbnrfifhhdyfgasaach8aky=wiffydh8gipec8eeeu0xxdbba9frfj0=oqffea0dxdd9vqai=hguq8kuc9pgc9s8qqaq=dirpe0xb9q8qilsfr0=vr0=vr0dc8meaabaqaciaacagaaeqabaqabegadaaakeaacqwgybgcdawgaawcbagaegymaedabeaakiabcycasiabdkhaynaabaaaleaacqaiyagmaeqaaogaeiilawiaeiola4iaeiola4iaeiola4iaeiilawiaemocai3aasbaasqaaiabd6gaunaabaaameaacqwgdbwqaeqaaawcbeaaaaa@3b66@].
we note that the alignment la:lb is a 2-alignment, and the peak list lc could be viewed as 1-alignment.
according to equation  <cit> , the similarity function between the first position in the alignment given by equation  <cit>  ) and the first peak from the list lc  will be calculated as:
w,r1)=12+p)
mathtype@mtef@5@5@+=feaafiart1ev1aaatcvaufkttlearuwrp9mdh5mbpbiqv92aaexatlxbi9gbaebbnrfifhhdyfgasaach8aky=wiffydh8gipec8eeeu0xxdbba9frfj0=oqffea0dxdd9vqai=hguq8kuc9pgc9s8qqaq=dirpe0xb9q8qilsfr0=vr0=vr0dc8meaabaqaciaacagaaeqabaqabegadaaakeaacqwgxbwvcqggoaakcqggoaakcqwgwbacdawgaawcbagaegymaedabeaakiabcycasiabdghaxnaabaaaleaacqaixaqmaeqaaogaeiykakiaeiilawiaemocai3aasbaasqaaiabigdaxaqabagccqggpaqkcqgh9aqpdawcaaqaaiabigdaxaqaaiabikdayaaadaqadaqaaiabdcfaqjabcicaoiabdchawnaabaaaleaacqaixaqmaeqaaogaeiilawiaemocai3aasbaasqaaiabigdaxaqabagccqggpaqkcqghrawkcqwgqbaucqggoaakcqwgxbqcdawgaawcbagaegymaedabeaakiabcycasiabdkhaynaabaaaleaacqaixaqmaeqaaogaeiykakcacagloagaayzkaaaaaa@51d9@
the similarity function between the third position of the alignment la:lb and the first peak from the list lc is w) = p since p =  <dig>  in the case of n =  <dig> and m =  <dig>  the alignment reduces to a simple pairwise alignment discussed above.
it is useful to devise a measure of how good one alignment is relative to another comparable alignment.
given an alignment between an n-alignment and m-alignment we calculate a total alignment score t as follows:
t=∑kzk
mathtype@mtef@5@5@+=feaafiart1ev1aaatcvaufkttlearuwrp9mdh5mbpbiqv92aaexatlxbi9gbaebbnrfifhhdyfgasaach8aky=wiffydh8gipec8eeeu0xxdbba9frfj0=oqffea0dxdd9vqai=hguq8kuc9pgc9s8qqaq=dirpe0xb9q8qilsfr0=vr0=vr0dc8meaabaqaciaacagaaeqabaqabegadaaakeaacqwgubavcqgh9aqpdaaeqbqaaiabdqfaanaabaaaleaacqwgrbwaaeqaaaqaaiabdugarbqab0gaeyyeiuoaaaa@3522@
where zk is the alignment score for the position k in the alignment, and the summation is over all positions in the alignment.
the value of zk depends on whether the gap was inserted in the k-th position of the alignment or not.
if the gap was inserted either in the n- or m-alignment then zk = -g. if the gap was not inserted then zk equals w given by the equation  <cit> , where i is the position from the n-alignment and j is the position from the m-alignment that are aligned to one another to result in the k position of the final -alignment.
alignment of an arbitrary number of peak lists
consider the alignment of u peak lists la, lb, lc,... where the peak list la contains a total of na peaks, the list lb contains a total of nb peaks, the list lc contains a total of nc peaks, and so on.
the overall goal of the alignment process is to align the peak lists la, lb, lc,... to obtain the alignment la:lb:lc:... this alignment can be represented as a table or a matrix with u rows, each corresponding to one peak list.
the exact number of columns in the alignment table will depend on the optimal alignment, but must be equal or greater than the maximum of na, nb, nc,...
although it is possible to devise an exact dynamic programming solution for a multi-dimensional alignment, this quickly leads to a computationally intractable problem  <cit> .
therefore we modelled our solution after the progressive multiple sequence alignment  <cit> , with changes to accommodate the unique requirements of peak alignment.
to find the best alignment of peak lists la, lb, lc,... we first calculate all possible pairwise alignments between the peak lists.
from all pairwise alignments the alignment score for each pair of peak lists is calculated .
in the next step, a dendrogram  tree is built which provides the similarity relationship between the peak lists.
a progressive pairwise alignment is performed following the branching order given by the guide tree.
in the first step the two most similar peak lists are selected and aligned, resulting in a 2-alignment.
the other peak lists are added gradually following the guide tree until all peak lists are exhausted.
within-state and between-state alignment
in the case of experiments performed on different cell states with more than one replicate experiment per cell state it is reasonable to align first replicate experiments performed on each cell state , and then to align the resulting alignments   <cit> .
this is because within each cell state one deals with true experimental replicates, and in the hypothetical case of perfect reproducibility all peaks will be observed in all experiments.
in experiments performed on different cell states, such as wild-type and mutant cells, some metabolites may be missing in one state relative to another, and the expectation that all peaks observed in one state will be present in the other state is no longer valid.
consider an alignment of three cell states , mutant- <dig> , and mutant- <dig> ), each having eight replicate experiments.
in the first step, within-state alignments are performed resulting in three 8-alignments .
to solve the order of between-state alignment all possible pairwise alignments between wt, m <dig>  and m <dig> alignments are created, the total alignment scores are calculated, and another guide tree is built.
the between-state alignment is built progressively from wt, m <dig>  and m <dig> alignments following the guide tree to result in the final 24-alignment wt:m1:m <dig>
in practice, the reproducibility in peak retention times of experiments performed on the same cell state is often better compared to experiments performed on different cell states.
therefore, for optimal alignment involving different cell states it may be useful to use different parameters for retention time tolerance  and gap penalty .
we denote these parameters dw, gw for within-state alignment and db, gb for between-state alignment.
testing
metabolite profiling studies were performed on different cultivated stages of the human parasite, leishmania mexicana.
comparisons were also made between wild type parasites and a mutant cell line lacking three major glucose transporters  <cit> .
polar metabolites were analyzed by gc-ms and peak lists generated manually or by using the proposed alignment method to assess the accuracy of the alignment and the sensitivity of the latter approach to input parameters such as the gap penalty and the retention time tolerance.
within-state alignment of the wild-type cells profiling experiments
eight replicate extracts of l.mexicana wild-type cells were analyzed by gc-ms and peaks were manually pre-processed and aligned.
in this way a correct peak alignment table was constructed from  <dig>  signal peaks from all eight replicate experiments.
the manual analysis showed  <dig> unique metabolites, and the final alignment table contained  <dig>  fields arranged in  <dig> columns  and  <dig> rows .
to assess the accuracy of the proposed approach a series of alignments was constructed by applying dynamic programming alignment with different input parameters.
the resulting alignment tables were compared to the correct alignment table and analyzed for errors.
two types of errors were observed : peak mixing  and metabolite splitting .
in peak mixing errors one or more peaks are shifted to a different metabolite row to take a position of a missing peak.
figure  <dig> shows the simplest case of one metabolite being shifted from metabolite- <dig> to a metabolite- <dig> row.
in practice mixing can involve more than two metabolite rows.
in metabolite splitting, one or more peaks are moved to create an extra metabolite row ).
as a consequence of the removal of spurious metabolites  most artificially created metabolite rows due to metabolite splitting will be discarded.
the only exception would be metabolites with all eight peaks present, subject to the splitting that has resulted in two metabolite rows with exactly four peaks per row.
comparison of the obtained peak alignment tables with the ideal alignment table allowed counting of errors.
in the case of a simple peak mixing error ) two metabolites are affected, resulting in an error count of two.
if three metabolites were affected by peak mixing three errors were counted.
in the case of a metabolite splitting error one or more metabolites may be affected.
a similar picture was observed for a number of errors as a function of the retention time tolerance .
small values of d favor metabolite splitting.
this is because for small d any subset of peaks with small but systematically different retention times  would appear as a different metabolite and would be moved into a different metabolite row.
however this effect was countered by the removal of spurious metabolites, and therefore a decrease in the total number of metabolites was observed for low d. large values of d diminished peak discrimination by retention times resulting in an increase in mixing errors , especially for the parts of the chromatogram which contained compounds with similar mass spectra.
alignment of replicate analyses of wild type and mutant metabolite extracts
these analyses were extended to replicate gc-ms chromatograms collected on wild-type and mutant cell states.
the input for the alignment consisted of peak lists from  <dig> experiments  with a total of  <dig>  signal peaks.
within-state alignment was performed with dw =  <dig>  s and gw =  <dig> , and resulted in  <dig> unique metabolites for the wild-type cells and  <dig> unique metabolites for the mutant cells.
for the between-states alignment we used the same gap penalty as for within-state alignment , while the retention time penalty was set to db =  <dig>  s, roughly the value that would allow matching of peaks in the case of large retention time shifts shown in figure  <dig>  in practice the retention time tolerance can be estimated from the largest retention time shifts between experiments .
for peaks  <dig> s apart the peak similarity will equal  <dig>  times the similarity in their mass spectra, if d =  <dig>  s .
a summary of parameters obtained for replicate analyses  of polar extracts from wild type and mutant  parasites, processed using the peak alignment method.
shown is the number of experimental replicates for each cell state, the average number of peak per replicate experiment, and the number of unique metabolites after the within-state peak alignment with dw =  <dig>  s and gw =  <dig> .
the complete alignment of wild-type and glucose transporter mutant experiments resulted in a total of  <dig> unique metabolites.
the correct alignment table involving all  <dig> experiments was also compiled manually.
a total of three errors were found in the within-state alignment of the wild-type experiments, and two errors were found in the within-state alignment of the mutant experiments.
a comparison with the correct alignment table showed that incorrect between-state alignment affected a total of ten metabolites.
this involved a segment of five misaligned metabolite rows between  <dig>  and  <dig>  minutes that had a prominent but anomalous feature at m/z =  <dig> that had created an effect of artificially similar mass spectra.
it would be possible to remedy errors of this type with a more stringent retention time tolerance.
discussion and
CONCLUSIONS
gc-ms is a robust and sensitive platform for the profiling of certain metabolite classes  <cit> .
due to experimental limitations inherent in all chromatographic separations, slight drifts are observed in gc-ms elution times between experiments  <cit> .
these drifts are particularly problematic for non-targeted metabolic profiling studies, which aim to analyze all detectable analytes within multiple experiments  <cit> .
there are two schools of thought regarding how to address the retention time correction in hyphenated mass spectrometry .
algorithms that rely on time domain data only  ignore highly pertinent information contained in the m/z dimension.
accumulated evidence suggests that effective retention time correction cannot be achieved based on retention time only, regardless of whether the approach involves peak matching or profile alignment  <cit> .
profile alignment approaches that use the full chromatogram data matrices are expected to be the most accurate .
these approaches, however, come at a high cost, both in terms of complexity and computational costs.
for example, bylund and co-authors used correlation optimised warping  <cit> , while baran and co-authors used dynamic time warping with explicitly specified time shifts  <cit> .
in both cases, an arbitrarily chosen "target" chromatogram was used to align all other chromatograms in a pairwise fashion, with the chromatogram data matrices segmented to facilitate the alignment  <cit> .
this raises several difficulties.
for example, it is unclear how the choice of the target chromatogram may affect the final alignment.
in principle, a more objective alignment of chromatogram data matrices could be achieved by calculating a similarity tree  <cit> .
this, however, must involve all possible pairwise alignments, which is likely to be computationally expensive.
furthermore, in the reported examples the chromatogram segmenting was based on strategic or node positions influenced by user chosen parameters  <cit> , or a "representative" set of peaks  <cit> .
this in turn raises the question of how the segmenting method might affect the final alignment.
finally, these approaches handle a large amount of uninformative noise data, since only a small portion of the full chromatogram data matrix is informative signal.
peak matching algorithms that use both time domain data and mass spectra are particularly promising, and have been applied to both lc-ms  <cit>  and more recently to gc-ms data  <cit> .
the input for these algorithms are signal peaks extracted from full chromatogram data matrices.
since the majority of uninformative data is discarded in the peak detection step, these methods operate on a vastly reduced data set while retaining highly selective information contained in the mass spectra.
here we propose an approach that falls into this category, and uses signal peak "objects" which are signals extracted from the chromatogram data matrix.
a peak object may be characterized with several attributes including peak retention time , peak mass spectrum , experiment/cell state information, a unique peak id, and so on.
the result of an experiment is a list of peak objects, henceforth referred to as a peak list.
from this viewpoint the peak matching problem is reduced to the alignment of peaks between multiple peak lists.
if we assume that the elution order of peaks is conserved , this problem shows resemblance to extensively studied problem of multiple sequence alignment  <cit> .
in order to cope with rapidly escalating computational costs of an exact, multidimensional dynamic programming solution, efficient algorithms were developed for multiple sequence alignment  <cit> .
we have adapted this approach to the problem of peak alignment in multiple gc-ms experiments.
the method proposed here uses both peak retention times and mass spectra, and relies on dynamic programming to find the optimal solution to the global alignment problem.
any peak matching method that uses both similarity in retention times and mass spectra similarity depends on a balance between the two, and devising an approach that balances this correctly poses a considerable challenge.
for example, it is possible to incorporate mass spectra similarity into the total peak similarity score used in progressive hierarchical clustering  <cit> , but it is unclear how to weight the relative contributions of retention time and mass spectra.
the problem here is that progressive clustering relies on a single cutoff of the dendrogram tree to delineate peak clusters , while the retention times drifts are highly non-linear .
in the work of styczynski et al, the peak matching approach used to find conserved metabolites in gc-ms metabolic profiling experiments incorporated both the similarities in mass spectra and peak retention times  <cit> .
however, in the demonstration of this approach the retention time similarity was taken into account only coarsely, with an elution similarity threshold of  <dig> min  <cit> .
when two metabolites have distinct mass spectra, the retention time information can be neglected altogether and correct peak matching can still be achieved.
however, for metabolites that elute in close proximity to one another, and give similar fragmentation patterns, the information provided by retention times is critical for a correct matching.
therefore, we would expect the method of styczynski and co-authors to have difficulty when metabolites with similar fragmentation patterns elute in close proximity, as demonstrated by their inability to resolve isoleucine and leucine in the test data set  <cit> .
we propose the peak similarity function that incorporates the similarity between peak mass spectra modulated by the similarity in peak retention times .
this function is governed by two parameters: the gap penalty function  and the retention time tolerance .
the first parameter  determines how similar mass spectra must be for peaks to be considered to represent the same metabolite; the second parameter  is related to expected drifts in retention times between experiments.
for example, if retention times in a particular set of experiments are highly reproducible, decreasing the retention time tolerance will enable this information to be leveraged for increased accuracy in the peak alignment.
to achieve the alignment of multiple peak lists, we rely on progressive alignment based on a similarity tree.
the similarity tree is calculated from pairwise alignments, and the global alignment is built progressively, starting from the two most similar peak lists, and joining other peak lists in a process guided by the similarity tree  <cit> .
when several cell states with multiple replicate experiments per state are analyzed, within each cell state one deals with true experimental replicates, while in experiments performed on different cell states some metabolites may be missing altogether in one state relative to another.
to accommodate for this complexity, we first perform a within-state alignment, followed by the between-state alignment built by aligning the within-state alignments.
in the case of more than two sets of replicate experiments, a similarity tree is built based on pairwise similarities between fixed within-state alignments, and then the alignments themselves are aligned progressively following the similarity tree.
therefore multiple guide trees are built, one for each set of replicate experiments to facilitate within-state alignment.
an additional guide tree may be built to facilitate between-state alignment if more than two states are present.
several methods for peak matching based on both retention times and mass spectra  have been described recently  <cit> .
of these only the approach of styczynski and co-authors was developed on gc-ms data  <cit> , while the software packages mzmine  <cit>  and xcms  <cit>  were developed on lc-ms data.
in our experience the latter software packages tend to overinterpret gc-ms data, assigning a greater number of peaks than expected .
nevertheless, the alignment algorithms implemented in mzmine and xcms are relevant and we briefly review them here.
mzmine uses a simple alignment method to build the peak alignment table: one peak at a time is taken and an attempt is made to match it to an existing row of the peak alignment table.
if no rows match a new row is created  <cit> .
a secondary peak detection method is used to fill the gaps in the resulting alignment table  <cit> .
we expect this approach to exhibit limitations similar to those observed in hierarchical clustering  <cit> , and discussed above.
xcms incorporates one of the most advanced peak matching algorithms for metabolite profiling data described to date  <cit> .
in this approach the distribution of peaks along the time domain by using the kernel density estimator is calculated, and regions where many peaks have similar retention times are identified  <cit> .
from this, a fixed time interval that determines each group of peaks is deduced  <cit> .
in practice, the retention time drifts are distributed in a highly irregular fashion, and a fixed time interval is unlikely to be able to capture peak groups correctly.
this is suggested by observed peak collisions, where more than one peak from the same experiment is joined into a single group  <cit> .
the same problem was encountered in other peak matching methods  <cit> , and requires additional, empirical intervention, such as "collision resolution"  <cit>  or "tie-breaking" in xcms  <cit> .
the approach we propose inherently prevents peak collisions.
furthermore, it does not rely on any fixed intervals to group peaks, nor does it rely on any assumptions about the distribution of peaks across the samples.
it is of interest to compare the method proposed here to the approach for constructing signal maps, described recently in lc-ms proteomics experiments  <cit> .
underlying the calculation of signal maps is the method for optimal alignment of chromatogram data matrices, that can be classified as belonging to branch  <dig> in figure  <dig>  these authors used the needleman-wunsch algorithm to align full chromatogram data matrices obtained from lc-ms proteomics experiments  <cit> .
they also used minimum spanning tree, or progressive merging of pairwise alignments into a consensus run, to produce a global signal map  <cit> .
apart from the overt difference in that we focus on extracted signals rather than using the full chromatogram data matrices, there are several important yet more subtle differences between the two methods.
first, in contrast to the method of  <cit>  the score function proposed here incorporates both similarities in retention times and mass spectra.
second, in constructing signal maps from peptide mass spectra prakash and co-workers allow for multiple mass spectra in one experiment to correspond to a single mass spectrum in the other experiment  <cit> .
since we are aligning peak objects rather than the raw signal, our approach inherently allows only one-to-one peak matching, and we consider explicitly the question of gaps .
both of these features are critical for the ability to achieve the alignment of signal peaks in gc-ms. similarly as in the approach of  <cit> , we rely on the two-dimensional formulation of the global sequence alignment problem.
however, during progressive alignment of individual experiments we do not merge individual runs into a "consensus" run, because this has a potential to degrade signal if two unrelated signal peaks are merged.
rather, our approach is based on the generalized solution for the alignment of two alignments, i.e.
an n- and m-alignment.
this has an additional benefit to be directly extensible to the alignment of pre-computed alignments representing replicates of different cell states , and allows one to tackle the problem of an arbitrary number of cell states with the same conceptual framework and finite computational resources.
we note that the modification proposed for the calculation of mass spectra similarity  <cit> , and results from other proteomics studies  <cit> , could be used in the method proposed here.
it would be useful to compare more directly the performance and accuracy of the approach proposed here to the approaches for peak matching described previously.
unfortunately, this is currently not feasible for two reasons.
firstly, a standard data set which could be used as a benchmark does not exist.
furthermore, it is difficult to create such a data set ad hoc.
most other alignment methods of interest, such as methods implemented in software packages mzmine  <cit>  or xcms  <cit> , are embedded in the multi-step processing pipelines, and the input to peak matching is generated directly from the output of package-specific peak detection.
secondly, a suitable metric to quantify differences between two methods does not exist.
this is particularly problematic, because in even the simplest case the resulting alignment table may involve hundreds of peak entries, and it is not clear how to represent and quantify the differences between two such tables.
the development of a suitable metric to compare two peak matching methods is likely to require a separate research effort.
to circumvent this we have performed a detailed analysis of absolute error and compiled error statistics relative to the "correct" alignment table created manually .
the error analysis performed on experimental data consisting of eight replicate gc-ms experiments collected on leishmania parasites with ~ <dig> peaks per experiment showed that, for near optimal parameters, < <dig> metabolites were affected by misalignment errors.
this approaches the accuracy achieved in a manual alignment, which required tens of man-hours for the tested data set.
the alignment accuracy was not overly sensitive to empirical parameters for a wide range of values , suggesting that the method is robust.
to address the problem of a benchmark data set, we provide our test data set in the supplementary material .
this includes input peak lists, raw chromatogram data matrices, and alignment tables, including those produced for optimal parameters, as well as the "correct" alignment table prepared manually.
the main drawback of the proposed approach is that it operates on a set of signal peaks obtained from peak detection pre-processing.
automated peak detection remains a challenge  <cit> , and any errors introduced during peak detection  will propagate through to the alignment tables.
this is inherent in all peak matching methods, and could be viewed as an advantage as well.
focusing on signal peaks results in a greatly reduced data set which contains the vast majority of interesting signal, and allows one to leverage this information for downstream processing  <cit> , in addition to significantly reducing computational costs required for downstream processing.

 metabolomics refers to an all-inclusive profiling of low-molecular weight metabolites with an implicit aim to interpret results in the context of the organism's genome and its global metabolic network. the term metabolic profiling is used to denote either targeted or non-targeted profiling of small molecules in biological samples. a targeted analysis focuses on specific, a priori known compounds, and therefore only parts of the chromatogram data matrix generated by the instrument may be considered relevant. in a non-targeted approach all detectable signals are analyzed, and the aim of such analysis is to achieve as wide coverage of metabolites as permitted by a particular experimental technique. a non-targeted metabolic profiling is an essential component of metabolomics, together with bioinformatics approaches for data analysis, interpretation, and integration. in recent years metabolic profiling is increasingly being used in studies of microbial metabolism, biomarker discovery, toxicology, nutrition, and integrated systems biology. hyphenated mass spectrometry approaches, in particular gas chromatography-mass spectrometry and liquid chromatography-mass spectrometry, are often used for metabolic profiling because of their inherent robustness, sensitivity, and large dynamic range. gc-ms is particularly well suited for studies of low polarity metabolites with high sensitivity and specificity. the processing of gc-ms data is based on the detection of chromatogram signal peaks, a step performed either with proprietary software or with freely available software such as amdis. the net result of peak detection is a set of signal peaks that represent components present in the sample. metabolic profiling experiments are relatively rapid, and typically multiple replicates per sample state are recorded to facilitate robust statistical analyses. in order to compare multiple samples, one needs to account for retention time drifts inherent in chromatographic separations. the retention time drifts arise because of instrument imperfections, column variations, and sample matrix effects. a review of the literature shows that there is a pressing need for better algorithms for retention time correction in gc-ms small molecule profiling experiments. a summary of approaches used in the past for correcting retention time drifts in hyphenated mass spectrometry experiments is given in figure an approach often used to correct retention time drifts in practice is a linear correction calculated based on deviations from internal standards. this approach has several limitations. for example, addition of internal standards adds new chemicals to the sample, and chromatographic retention time drifts are not linear. the problem of retention time correction is similar in gc-ms and lc-ms small molecule profiling experiments. there are two schools of thought on how to address this: one is to align entire chromatogram profiles prior to peak detection, and the other is to perform peak detection first, and then align extracted signal peaks to correct for retention time drifts. in either approach one can rely on the time domain data only, or include highly selective information from the m/z data domain. both peak matching and profile alignment methods have been used in the context of gc-ms data. jonsson and co-authors have developed a strategy for rapid comparison of gc-ms metabolic profiles, based on the division of a chromatogram into time windows. to correct the retention time drifts they relied on finding the maximum covariance between the chromatograms. this is a profile alignment method that uses the time domain data only. to be effective this method requires that chromatographic profiles to be aligned are similar to one another, as was the case in the analysis of leaf plant extracts where the main purpose of the alignment was to facilitate setting of time domain windows. a different alignment approach was used in the analysis of gc-ms data obtained from the profiling of tomato volatiles, but the algorithm was not described in detail. the peak matching approach is an alternative to the profile alignment that has received a considerable attention in gc-ms. johnson et al. matched gc-ms peaks by retention time within a pre-defined time window. although this approach was shown to be reasonably effective in the gc-ms analysis of diesel fuels, much remains to be desired for applications in biomedical research. for example, it is unclear how to choose the target-chromatogram to which other chromatograms will be aligned; the choice of the cut-off window is arbitrary; and the proposed method of grouping the peaks depends on the order in which the grouping is performed. duran and co-workers proposed a clustering procedure which groups peaks starting from the minimum retention time. this approach is symmetrical with respect to all experiments and therefore alleviates the need for an arbitrary choice of a target chromatogram. however, the proposed clustering depends on the peak minimum retention time and the arbitrary retention time window. we have attempted to improve on the peak clustering idea by using hierarchical clustering. however, applications of this method have shown that results are rather sensitive to the quality of input data, especially for large retention time drifts. in summary, the body of work on peak matching suggests that accurate peak alignment is unlikely to be achieved by relying on retention time data only. the most accurate retention time correction is likely to be achieved when complete chromatogram data matrices are utilized. such methods have been applied to lc-ms and ce-ms metabolic profiling data. the main drawback of any approach that works with entire chromatogram data matrices is the large amount of noise data that must be handled, which dramatically increases computational costs. our preliminary calculations showed that progressive alignment of chromatogram matrices aimed to avoid the choice of a "target" data set is computationally prohibitive. furthermore, it is an open question whether the computational costs can be justified by the potential increase in accuracy compared to peak matching methods, when peak matching is based on both retention times and mass spectra. the most advanced approaches for correction of retention time drifts have been developed on lc-ms and ce-ms data. to our knowledge the peak matching involving mass spectra has not been applied to gc-ms data, except in an approach proposed for a systematic identification of conserved metabolites. this approach aims specifically at identification of conserved metabolites across experiments, and its peak matching is implicitly serving as input for a motif discovery algorithm. here we present an approach for peak matching that relies on both peak retention times and mass spectra, capable of accurate alignment of peak lists from a large number of replicate gc-ms experiments. we use dynamic programming to arrive at the optimal solution to the global alignment problem. dynamic programming was previously used for the alignment of chromatogram data matrices, but not in peak matching. the proposed approach uses a similarity function which balances effectively similarity in peak retention times with the similarity in mass spectra, mimicking the way an experienced human operator performs peak matching. the proposed algorithm is modelled after the heuristic solution for multiple sequence alignment, and relies on progressive alignment to match an arbitrary number of data sets. we apply this approach to gc-ms metabolic profiling data acquired on wild-type and mutant leishmania mexicana parasites. in the absence of a suitable metric and an accepted benchmark for the peak alignment algorithms, we quantify absolute errors relative to manually derived "true" answer. we show that the proposed method performed close to the accuracy of the manually curated alignments by an expert operator; the results are not sensitive to the input parameters, suggesting that the proposed method is robust.  the input for the peak alignment procedure consists of two or more peak lists obtained from hyphenated mass spectrometry experiments. these peak lists may be derived from replicate analyses of the same sample, or replicate analyses of different samples. each experiment is represented by a single and unique peak list. in the most general case, a peak list could be understood as a list of peak objects, where each peak object is characterized with one or more attributes. in the work described here, a peak was characterized with a unique peak id, the retention time at the peak apex, and the mass spectrum at the peak apex. henceforth, we assume that a peak list consists of peaks ordered by their retention time. consider a peak list la that contains peaks p p...,pna mathtype@mtef@5@5@+=feaafiart1ev1aqatcvaufkttlearuwrp9mdh5mbpbiqv92aaexatlxbi9gbaebbnrfifhhdyfgasaach8aky=wiffydh8gipec8eeeu0xxdbba9frfj0=oqffea0dxdd9vqai=hguq8kuc9pgc9s8qqaq=dirpe0xb9q8qilsfr0=vr0=vr0dc8meaabaqaciaacagaaeqabaqabegadaaakeaacqwgwbacdawgaawcbagaegymaedabeaakiabcycasiabdchawnaabaaaleaacqaiyagmaeqaaogaeiilawiaeiola4iaeiola4iaeiola4iaeiilawiaemicaa3aasbaasqaaiabd6gaunaabaaameaacqwgbbqqaeqaaawcbeaaaaa@3b56@. in this case the retention time of the peak p is greater than that of p the retention time of the peak p is greater than that of p and so on. alignment of two peak lists consider two peak lists la = [p p...,pna mathtype@mtef@5@5@+=feaafiart1ev1aqatcvaufkttlearuwrp9mdh5mbpbiqv92aaexatlxbi9gbaebbnrfifhhdyfgasaach8aky=wiffydh8gipec8eeeu0xxdbba9frfj0=oqffea0dxdd9vqai=hguq8kuc9pgc9s8qqaq=dirpe0xb9q8qilsfr0=vr0=vr0dc8meaabaqaciaacagaaeqabaqabegadaaakeaacqwgwbacdawgaawcbagaegymaedabeaakiabcycasiabdchawnaabaaaleaacqaiyagmaeqaaogaeiilawiaeiola4iaeiola4iaeiola4iaeiilawiaemicaa3aasbaasqaaiabd6gaunaabaaameaacqwgbbqqaeqaaawcbeaaaaa@3b56@] and lb = [q q...,qnb mathtype@mtef@5@5@+=feaafiart1ev1aqatcvaufkttlearuwrp9mdh5mbpbiqv92aaexatlxbi9gbaebbnrfifhhdyfgasaach8aky=wiffydh8gipec8eeeu0xxdbba9frfj0=oqffea0dxdd9vqai=hguq8kuc9pgc9s8qqaq=dirpe0xb9q8qilsfr0=vr0=vr0dc8meaabaqaciaacagaaeqabaqabegadaaakeaacqwgxbqcdawgaawcbagaegymaedabeaakiabcycasiabdghaxnaabaaaleaacqaiyagmaeqaaogaeiilawiaeiola4iaeiola4iaeiola4iaeiilawiaemycae3aasbaasqaaiabd6gaunaabaaameaacqwgcbgqaeqaaawcbeaaaaa@3b5e@] which contain a total number of na and nb peaks, respectively. the alignment of the peak lists la and lb refers to the establishment of a one-to-one correspondence between the peaks from the two lists, with the possibility that any peak from one list has no matching peak in the other list. the alignment between the peak lists la and lb could be represented as a list of peak pairs, where pairing implies peak-to-peak matching. for example, where p is matched with q p is matched with q and so on. the peak p from the list la does not have a matching peak in the lb list. the number of elements in the above list will depend on the optimal alignment, but cannot be less than the larger of a and b, and cannot exceed a+b. for brevity, we refer to the alignment between peak lists la and lb as la:lb. it is apparent from the above that the alignment of two peak lists closely resembles the problem of pairwise sequence alignment. the situation for p in equation corresponds to matching a sequence letter to a gap. furthermore, the analogy can be extended even further if one considers that the peak list is an ordered sequence of peaks. the variations in peak retention times arise from various non-linear effects during the separation stage, such as uneven flow of the carrier phase in the gc or lc column. such perturbations may affect absolute peak retention times and may shift portions of the chromatogram in a non-linear manner, but normally do not change the order of peaks in terms of their retention times. the analogy with pairwise sequence alignment implies that dynamic programming could be applied to find the optimal alignment of two peak lists, provided that a suitable scoring scheme can be devised. the scoring scheme for peak alignment in sequence alignment, the cost function for matching two residue letters is obtained from a pre-computed substitution matrix. in the case of peak lists the cost function should reflect similarity between two peaks. since the peak mass-spectrum is a key identifier of a particular peak, the peak similarity function should depend heavily on the similarity in the mass spectra. we propose the following peak similarity function p, which gives the similarity between the peaks i and j: p=s⋅exp⁡22d2) mathtype@mtef@5@5@+=feaafiart1ev1aaatcvaufkttlearuwrp9mdh5mbpbiqv92aaexatlxbi9gbaebbnrfifhhdyfgasaach8aky=wiffydh8gipec8eeeu0xxdbba9frfj0=oqffea0dxdd9vqai=hguq8kuc9pgc9s8qqaq=dirpe0xb9q8qilsfr0=vr0=vr0dc8meaabaqaciaacagaaeqabaqabegadaaakeaacqwgqbaucqggoaakcqwgpbqacqggsaalcqwgqbgacqggpaqkcqgh9aqpcqwgtbwucqggoaakcqwgpbqacqggsaalcqwgqbgacqggpaqkcqghfly1cygglbqzcqgg4baecqggwbacdaqadaqaaiabgkhitmaalaaabagaeiikagiaemidaq3aasbaasqaaiabdmgapbqabagccqghsislcqwg0baddawgaawcbagaemoaaogabeaakiabcmcapmaacaaaleqabagaegomaidaaagcbagaegomaijaemiraq0aawbaasqabeaacqaiyagmaaaaaagccagloagaayzkaaaaaa@509c@ in the above equation s is the similarity between the mass spectra of the peaks i and j, ti and tj are retention times of peaks i and j, and d is the retention time tolerance parameter which determines the importance of retention times to the overall peak similarity score. the function s can be any function that returns a measure of the similarity in m/z ions detected in mass spectra of the peaks i and j. in our test implementation, s was calculated as the cosine of the angle between the two mass spectra vectors. this resulted in values between and 1: when the two mass spectra are identical s = and when they are completely dissimilar s = the second term in the equation modulates the similarity in mass spectra. when two peaks have identical retention times this term equals one, and the peak similarity reduces to the mass spectra similarity = s). when the retention times of the two peaks differ, then exp < and p < s. the greater the retention time difference the peak similarity p is more reduced relative to the mass spectra similarity s. the extent of this reduction depends on the relationship between the difference and the parameter d. when >> d then exp will be close to zero and peak similarity will be close to zero = 0), even if mass spectra are identical = 1). the peak similarity function gives the "cost" of matching any two peaks. in addition to this, the dynamic programming algorithm requires a gap penalty to be defined. in sequence alignment gaps are treated with the affine gap function, designed to penalize gaps and to favor the extension of existing gaps over the creation of new gaps. in peak alignment favoring gap extensions is not physically justified, therefore, we set the gap penalty to a fixed number. with the above definition of p the meaningful range of g is between and a low value of g would favor the insertion of gaps even when peaks are originating from the same chemical compound; a high value of g would favour the alignment of peaks that are actually different. with the above definitions for the peak similarity function and the choice of gap penalty it is possible to deploy dynamic programming to find the global solution to the problem of optimal alignment of two peak lists. a standard dynamic programming procedure involves the following steps: initialization of a two dimensional score matrix whose rows are indexed with the peaks of one peak list and columns are indexed with the peaks of the other peak list; filling the cells of the score matrix based on the peak similarity function and possibly the gap penalty; the best alignment between two peak lists is deduced from the traceback on the score matrix. we note that the pairwise alignment of two peak lists is analogous to the problem of global sequence alignment. an example pairwise alignment is shown in figure figure shows tic segments between s and s for two gc-ms profiling experiments of l. mexicana promastigotes harvested in logarithmic and stationary growth phases, respectively. peak finding has resulted in fourteen peaks in each segment as shown in figure which also shows the peak matching after the alignment. figure shows different score matrices and the traceback used to deduce the optimal alignment. alignment of two alignments consider an alignment between two internally fixed alignments: one consisting of n peak lists and the other consisting of m peak lists. in order to find the best alignment between two such alignments with two-dimensional dynamic programming the scoring scheme must be extended. let the n-alignment contain k peak positions and the m-alignment contain l peak positions. in this case the score matrix may have rows indexed by the peak positions of the n-alignment, and columns indexed by the peak positions of the m-alignment, resulting in a two dimensional table with k rows and l columns. during the dynamic programming procedure the cell of this table is filled with the score w calculated for the i-th position of the n-alignment and the j-th position of the m-alignment, possibly modified by the gap penalty g. alternative definitions of w are possible. in our test implementation w was calculated as the average similarity between the peaks in the i-th position of the m-alignment and j-th position of the n-alignment. for example, if the position i of the n-alignment contained peaks pi pi... pin and the position j or the m-alignment contained peaks qj qj... qjm then: w=∑a=1n∑b=1mp∑a=1n∑b=1mi mathtype@mtef@5@5@+=feaafiart1ev1aaatcvaufkttlearuwrp9mdh5mbpbiqv92aaexatlxbi9gbaebbnrfifhhdyfgasaach8aky=wiffydh8gipec8eeeu0xxdbba9frfj0=oqffea0dxdd9vqai=hguq8kuc9pgc9s8qqaq=dirpe0xb9q8qilsfr0=vr0=vr0dc8meaabaqaciaacagaaeqabaqabegadaaakeaacqwgxbwvcqggoaakcqwgpbqacqggsaalcqwgqbgacqggpaqkcqgh9aqpdawcaaqaamaaqahabawaaabcaeaacqwgqbaucqggoaakcqwgwbacdawgaawcbagaemyaakmaemyyaegabeaakiabcycasiabdghaxnaabaaaleaacqwgqbgacqwgibgyaeqaaogaeiykakcaleaacqwgibgycqgh9aqpcqaixaqmaeaacqwgnbqta0gaeyyeiuoaasqaaiabdggahjabg2da9iabigdaxaqaaiabd6eaobqdcqghris5aagcbawaaabcaeaadaaewbqaaiabdmeajjabcufabjabdcfaqjabcicaoiabdchawnaabaaaleaacqwgpbqacqwghbqyaeqaaogaeiilawiaemycae3aasbaasqaaiabdqgaqjabdkgaibqabagccqggpaqkcqgh+agpcqaiwaamcqggdbqxasqaaiabdkgaijabg2da9iabigdaxaqaaiabd2eanbqdcqghris5aawcbagaemyyaemaeyypa0jaegymaedabagaemota4eaniabgghildaaaaaa@6d14@ where i is the indicator function and p is given by equation. here we extend the definition of the peak similarity function to include scoring of a peak with a gap, which is always zero = p = 0). therefore, it is possible that the denominator is less than nm, since some of the terms in equation may be zero due to involvement of gaps. consider the simple case, an alignment between the alignment la:lb given by the equation and a single peak list lc = [r r...,rnc mathtype@mtef@5@5@+=feaafiart1ev1aqatcvaufkttlearuwrp9mdh5mbpbiqv92aaexatlxbi9gbaebbnrfifhhdyfgasaach8aky=wiffydh8gipec8eeeu0xxdbba9frfj0=oqffea0dxdd9vqai=hguq8kuc9pgc9s8qqaq=dirpe0xb9q8qilsfr0=vr0=vr0dc8meaabaqaciaacagaaeqabaqabegadaaakeaacqwgybgcdawgaawcbagaegymaedabeaakiabcycasiabdkhaynaabaaaleaacqaiyagmaeqaaogaeiilawiaeiola4iaeiola4iaeiola4iaeiilawiaemocai3aasbaasqaaiabd6gaunaabaaameaacqwgdbwqaeqaaawcbeaaaaa@3b66@]. we note that the alignment la:lb is a 2-alignment, and the peak list lc could be viewed as 1-alignment. according to equation, the similarity function between the first position in the alignment given by equation ) and the first peak from the list lc will be calculated as: w,r1)=12+p) mathtype@mtef@5@5@+=feaafiart1ev1aaatcvaufkttlearuwrp9mdh5mbpbiqv92aaexatlxbi9gbaebbnrfifhhdyfgasaach8aky=wiffydh8gipec8eeeu0xxdbba9frfj0=oqffea0dxdd9vqai=hguq8kuc9pgc9s8qqaq=dirpe0xb9q8qilsfr0=vr0=vr0dc8meaabaqaciaacagaaeqabaqabegadaaakeaacqwgxbwvcqggoaakcqggoaakcqwgwbacdawgaawcbagaegymaedabeaakiabcycasiabdghaxnaabaaaleaacqaixaqmaeqaaogaeiykakiaeiilawiaemocai3aasbaasqaaiabigdaxaqabagccqggpaqkcqgh9aqpdawcaaqaaiabigdaxaqaaiabikdayaaadaqadaqaaiabdcfaqjabcicaoiabdchawnaabaaaleaacqaixaqmaeqaaogaeiilawiaemocai3aasbaasqaaiabigdaxaqabagccqggpaqkcqghrawkcqwgqbaucqggoaakcqwgxbqcdawgaawcbagaegymaedabeaakiabcycasiabdkhaynaabaaaleaacqaixaqmaeqaaogaeiykakcacagloagaayzkaaaaaa@51d9@ the similarity function between the third position of the alignment la:lb and the first peak from the list lc is w) = p since p = in the case of n = and m = the alignment reduces to a simple pairwise alignment discussed above. it is useful to devise a measure of how good one alignment is relative to another comparable alignment. given an alignment between an n-alignment and m-alignment we calculate a total alignment score t as follows: t=∑kzk mathtype@mtef@5@5@+=feaafiart1ev1aaatcvaufkttlearuwrp9mdh5mbpbiqv92aaexatlxbi9gbaebbnrfifhhdyfgasaach8aky=wiffydh8gipec8eeeu0xxdbba9frfj0=oqffea0dxdd9vqai=hguq8kuc9pgc9s8qqaq=dirpe0xb9q8qilsfr0=vr0=vr0dc8meaabaqaciaacagaaeqabaqabegadaaakeaacqwgubavcqgh9aqpdaaeqbqaaiabdqfaanaabaaaleaacqwgrbwaaeqaaaqaaiabdugarbqab0gaeyyeiuoaaaa@3522@ where zk is the alignment score for the position k in the alignment, and the summation is over all positions in the alignment. the value of zk depends on whether the gap was inserted in the k-th position of the alignment or not. if the gap was inserted either in the n- or m-alignment then zk = -g. if the gap was not inserted then zk equals w given by the equation, where i is the position from the n-alignment and j is the position from the m-alignment that are aligned to one another to result in the k position of the final -alignment. alignment of an arbitrary number of peak lists consider the alignment of u peak lists la, lb, lc,... where the peak list la contains a total of na peaks, the list lb contains a total of nb peaks, the list lc contains a total of nc peaks, and so on. the overall goal of the alignment process is to align the peak lists la, lb, lc,... to obtain the alignment la:lb:lc:... this alignment can be represented as a table or a matrix with u rows, each corresponding to one peak list. the exact number of columns in the alignment table will depend on the optimal alignment, but must be equal or greater than the maximum of na, nb, nc,... although it is possible to devise an exact dynamic programming solution for a multi-dimensional alignment, this quickly leads to a computationally intractable problem. therefore we modelled our solution after the progressive multiple sequence alignment, with changes to accommodate the unique requirements of peak alignment. to find the best alignment of peak lists la, lb, lc,... we first calculate all possible pairwise alignments between the peak lists. from all pairwise alignments the alignment score for each pair of peak lists is calculated. in the next step, a dendrogram tree is built which provides the similarity relationship between the peak lists. a progressive pairwise alignment is performed following the branching order given by the guide tree. in the first step the two most similar peak lists are selected and aligned, resulting in a 2-alignment. the other peak lists are added gradually following the guide tree until all peak lists are exhausted. within-state and between-state alignment in the case of experiments performed on different cell states with more than one replicate experiment per cell state it is reasonable to align first replicate experiments performed on each cell state, and then to align the resulting alignments. this is because within each cell state one deals with true experimental replicates, and in the hypothetical case of perfect reproducibility all peaks will be observed in all experiments. in experiments performed on different cell states, such as wild-type and mutant cells, some metabolites may be missing in one state relative to another, and the expectation that all peaks observed in one state will be present in the other state is no longer valid. consider an alignment of three cell states, mutant-, and mutant- ), each having eight replicate experiments. in the first step, within-state alignments are performed resulting in three 8-alignments. to solve the order of between-state alignment all possible pairwise alignments between wt, m and m alignments are created, the total alignment scores are calculated, and another guide tree is built. the between-state alignment is built progressively from wt, m and m alignments following the guide tree to result in the final 24-alignment wt:m1:m in practice, the reproducibility in peak retention times of experiments performed on the same cell state is often better compared to experiments performed on different cell states. therefore, for optimal alignment involving different cell states it may be useful to use different parameters for retention time tolerance and gap penalty. we denote these parameters dw, gw for within-state alignment and db, gb for between-state alignment. testing metabolite profiling studies were performed on different cultivated stages of the human parasite, leishmania mexicana. comparisons were also made between wild type parasites and a mutant cell line lacking three major glucose transporters. polar metabolites were analyzed by gc-ms and peak lists generated manually or by using the proposed alignment method to assess the accuracy of the alignment and the sensitivity of the latter approach to input parameters such as the gap penalty and the retention time tolerance. within-state alignment of the wild-type cells profiling experiments eight replicate extracts of l.mexicana wild-type cells were analyzed by gc-ms and peaks were manually pre-processed and aligned. in this way a correct peak alignment table was constructed from signal peaks from all eight replicate experiments. the manual analysis showed unique metabolites, and the final alignment table contained fields arranged in columns and rows. to assess the accuracy of the proposed approach a series of alignments was constructed by applying dynamic programming alignment with different input parameters. the resulting alignment tables were compared to the correct alignment table and analyzed for errors. two types of errors were observed: peak mixing and metabolite splitting. in peak mixing errors one or more peaks are shifted to a different metabolite row to take a position of a missing peak. figure shows the simplest case of one metabolite being shifted from metabolite- to a metabolite- row. in practice mixing can involve more than two metabolite rows. in metabolite splitting, one or more peaks are moved to create an extra metabolite row ). as a consequence of the removal of spurious metabolites most artificially created metabolite rows due to metabolite splitting will be discarded. the only exception would be metabolites with all eight peaks present, subject to the splitting that has resulted in two metabolite rows with exactly four peaks per row. comparison of the obtained peak alignment tables with the ideal alignment table allowed counting of errors. in the case of a simple peak mixing error ) two metabolites are affected, resulting in an error count of two. if three metabolites were affected by peak mixing three errors were counted. in the case of a metabolite splitting error one or more metabolites may be affected. a similar picture was observed for a number of errors as a function of the retention time tolerance. small values of d favor metabolite splitting. this is because for small d any subset of peaks with small but systematically different retention times would appear as a different metabolite and would be moved into a different metabolite row. however this effect was countered by the removal of spurious metabolites, and therefore a decrease in the total number of metabolites was observed for low d. large values of d diminished peak discrimination by retention times resulting in an increase in mixing errors, especially for the parts of the chromatogram which contained compounds with similar mass spectra. alignment of replicate analyses of wild type and mutant metabolite extracts these analyses were extended to replicate gc-ms chromatograms collected on wild-type and mutant cell states. the input for the alignment consisted of peak lists from experiments with a total of signal peaks. within-state alignment was performed with dw = s and gw =, and resulted in unique metabolites for the wild-type cells and unique metabolites for the mutant cells. for the between-states alignment we used the same gap penalty as for within-state alignment, while the retention time penalty was set to db = s, roughly the value that would allow matching of peaks in the case of large retention time shifts shown in figure in practice the retention time tolerance can be estimated from the largest retention time shifts between experiments. for peaks s apart the peak similarity will equal times the similarity in their mass spectra, if d = s. a summary of parameters obtained for replicate analyses of polar extracts from wild type and mutant parasites, processed using the peak alignment method. shown is the number of experimental replicates for each cell state, the average number of peak per replicate experiment, and the number of unique metabolites after the within-state peak alignment with dw = s and gw =. the complete alignment of wild-type and glucose transporter mutant experiments resulted in a total of unique metabolites. the correct alignment table involving all experiments was also compiled manually. a total of three errors were found in the within-state alignment of the wild-type experiments, and two errors were found in the within-state alignment of the mutant experiments. a comparison with the correct alignment table showed that incorrect between-state alignment affected a total of ten metabolites. this involved a segment of five misaligned metabolite rows between and minutes that had a prominent but anomalous feature at m/z = that had created an effect of artificially similar mass spectra. it would be possible to remedy errors of this type with a more stringent retention time tolerance. discussion and  gc-ms is a robust and sensitive platform for the profiling of certain metabolite classes. due to experimental limitations inherent in all chromatographic separations, slight drifts are observed in gc-ms elution times between experiments. these drifts are particularly problematic for non-targeted metabolic profiling studies, which aim to analyze all detectable analytes within multiple experiments. there are two schools of thought regarding how to address the retention time correction in hyphenated mass spectrometry. algorithms that rely on time domain data only ignore highly pertinent information contained in the m/z dimension. accumulated evidence suggests that effective retention time correction cannot be achieved based on retention time only, regardless of whether the approach involves peak matching or profile alignment. profile alignment approaches that use the full chromatogram data matrices are expected to be the most accurate. these approaches, however, come at a high cost, both in terms of complexity and computational costs. for example, bylund and co-authors used correlation optimised warping, while baran and co-authors used dynamic time warping with explicitly specified time shifts. in both cases, an arbitrarily chosen "target" chromatogram was used to align all other chromatograms in a pairwise fashion, with the chromatogram data matrices segmented to facilitate the alignment. this raises several difficulties. for example, it is unclear how the choice of the target chromatogram may affect the final alignment. in principle, a more objective alignment of chromatogram data matrices could be achieved by calculating a similarity tree. this, however, must involve all possible pairwise alignments, which is likely to be computationally expensive. furthermore, in the reported examples the chromatogram segmenting was based on strategic or node positions influenced by user chosen parameters, or a "representative" set of peaks. this in turn raises the question of how the segmenting method might affect the final alignment. finally, these approaches handle a large amount of uninformative noise data, since only a small portion of the full chromatogram data matrix is informative signal. peak matching algorithms that use both time domain data and mass spectra are particularly promising, and have been applied to both lc-ms and more recently to gc-ms data. the input for these algorithms are signal peaks extracted from full chromatogram data matrices. since the majority of uninformative data is discarded in the peak detection step, these methods operate on a vastly reduced data set while retaining highly selective information contained in the mass spectra. here we propose an approach that falls into this category, and uses signal peak "objects" which are signals extracted from the chromatogram data matrix. a peak object may be characterized with several attributes including peak retention time, peak mass spectrum, experiment/cell state information, a unique peak id, and so on. the result of an experiment is a list of peak objects, henceforth referred to as a peak list. from this viewpoint the peak matching problem is reduced to the alignment of peaks between multiple peak lists. if we assume that the elution order of peaks is conserved, this problem shows resemblance to extensively studied problem of multiple sequence alignment. in order to cope with rapidly escalating computational costs of an exact, multidimensional dynamic programming solution, efficient algorithms were developed for multiple sequence alignment. we have adapted this approach to the problem of peak alignment in multiple gc-ms experiments. the method proposed here uses both peak retention times and mass spectra, and relies on dynamic programming to find the optimal solution to the global alignment problem. any peak matching method that uses both similarity in retention times and mass spectra similarity depends on a balance between the two, and devising an approach that balances this correctly poses a considerable challenge. for example, it is possible to incorporate mass spectra similarity into the total peak similarity score used in progressive hierarchical clustering, but it is unclear how to weight the relative contributions of retention time and mass spectra. the problem here is that progressive clustering relies on a single cutoff of the dendrogram tree to delineate peak clusters, while the retention times drifts are highly non-linear. in the work of styczynski et al, the peak matching approach used to find conserved metabolites in gc-ms metabolic profiling experiments incorporated both the similarities in mass spectra and peak retention times. however, in the demonstration of this approach the retention time similarity was taken into account only coarsely, with an elution similarity threshold of min. when two metabolites have distinct mass spectra, the retention time information can be neglected altogether and correct peak matching can still be achieved. however, for metabolites that elute in close proximity to one another, and give similar fragmentation patterns, the information provided by retention times is critical for a correct matching. therefore, we would expect the method of styczynski and co-authors to have difficulty when metabolites with similar fragmentation patterns elute in close proximity, as demonstrated by their inability to resolve isoleucine and leucine in the test data set. we propose the peak similarity function that incorporates the similarity between peak mass spectra modulated by the similarity in peak retention times. this function is governed by two parameters: the gap penalty function and the retention time tolerance. the first parameter determines how similar mass spectra must be for peaks to be considered to represent the same metabolite; the second parameter is related to expected drifts in retention times between experiments. for example, if retention times in a particular set of experiments are highly reproducible, decreasing the retention time tolerance will enable this information to be leveraged for increased accuracy in the peak alignment. to achieve the alignment of multiple peak lists, we rely on progressive alignment based on a similarity tree. the similarity tree is calculated from pairwise alignments, and the global alignment is built progressively, starting from the two most similar peak lists, and joining other peak lists in a process guided by the similarity tree. when several cell states with multiple replicate experiments per state are analyzed, within each cell state one deals with true experimental replicates, while in experiments performed on different cell states some metabolites may be missing altogether in one state relative to another. to accommodate for this complexity, we first perform a within-state alignment, followed by the between-state alignment built by aligning the within-state alignments. in the case of more than two sets of replicate experiments, a similarity tree is built based on pairwise similarities between fixed within-state alignments, and then the alignments themselves are aligned progressively following the similarity tree. therefore multiple guide trees are built, one for each set of replicate experiments to facilitate within-state alignment. an additional guide tree may be built to facilitate between-state alignment if more than two states are present. several methods for peak matching based on both retention times and mass spectra have been described recently. of these only the approach of styczynski and co-authors was developed on gc-ms data, while the software packages mzmine and xcms were developed on lc-ms data. in our experience the latter software packages tend to overinterpret gc-ms data, assigning a greater number of peaks than expected. nevertheless, the alignment algorithms implemented in mzmine and xcms are relevant and we briefly review them here. mzmine uses a simple alignment method to build the peak alignment table: one peak at a time is taken and an attempt is made to match it to an existing row of the peak alignment table. if no rows match a new row is created. a secondary peak detection method is used to fill the gaps in the resulting alignment table. we expect this approach to exhibit limitations similar to those observed in hierarchical clustering, and discussed above. xcms incorporates one of the most advanced peak matching algorithms for metabolite profiling data described to date. in this approach the distribution of peaks along the time domain by using the kernel density estimator is calculated, and regions where many peaks have similar retention times are identified. from this, a fixed time interval that determines each group of peaks is deduced. in practice, the retention time drifts are distributed in a highly irregular fashion, and a fixed time interval is unlikely to be able to capture peak groups correctly. this is suggested by observed peak collisions, where more than one peak from the same experiment is joined into a single group. the same problem was encountered in other peak matching methods, and requires additional, empirical intervention, such as "collision resolution" or "tie-breaking" in xcms. the approach we propose inherently prevents peak collisions. furthermore, it does not rely on any fixed intervals to group peaks, nor does it rely on any assumptions about the distribution of peaks across the samples. it is of interest to compare the method proposed here to the approach for constructing signal maps, described recently in lc-ms proteomics experiments. underlying the calculation of signal maps is the method for optimal alignment of chromatogram data matrices, that can be classified as belonging to branch in figure these authors used the needleman-wunsch algorithm to align full chromatogram data matrices obtained from lc-ms proteomics experiments. they also used minimum spanning tree, or progressive merging of pairwise alignments into a consensus run, to produce a global signal map. apart from the overt difference in that we focus on extracted signals rather than using the full chromatogram data matrices, there are several important yet more subtle differences between the two methods. first, in contrast to the method of the score function proposed here incorporates both similarities in retention times and mass spectra. second, in constructing signal maps from peptide mass spectra prakash and co-workers allow for multiple mass spectra in one experiment to correspond to a single mass spectrum in the other experiment. since we are aligning peak objects rather than the raw signal, our approach inherently allows only one-to-one peak matching, and we consider explicitly the question of gaps. both of these features are critical for the ability to achieve the alignment of signal peaks in gc-ms. similarly as in the approach of, we rely on the two-dimensional formulation of the global sequence alignment problem. however, during progressive alignment of individual experiments we do not merge individual runs into a "consensus" run, because this has a potential to degrade signal if two unrelated signal peaks are merged. rather, our approach is based on the generalized solution for the alignment of two alignments, i.e. an n- and m-alignment. this has an additional benefit to be directly extensible to the alignment of pre-computed alignments representing replicates of different cell states, and allows one to tackle the problem of an arbitrary number of cell states with the same conceptual framework and finite computational resources. we note that the modification proposed for the calculation of mass spectra similarity, and results from other proteomics studies, could be used in the method proposed here. it would be useful to compare more directly the performance and accuracy of the approach proposed here to the approaches for peak matching described previously. unfortunately, this is currently not feasible for two reasons. firstly, a standard data set which could be used as a benchmark does not exist. furthermore, it is difficult to create such a data set ad hoc. most other alignment methods of interest, such as methods implemented in software packages mzmine or xcms, are embedded in the multi-step processing pipelines, and the input to peak matching is generated directly from the output of package-specific peak detection. secondly, a suitable metric to quantify differences between two methods does not exist. this is particularly problematic, because in even the simplest case the resulting alignment table may involve hundreds of peak entries, and it is not clear how to represent and quantify the differences between two such tables. the development of a suitable metric to compare two peak matching methods is likely to require a separate research effort. to circumvent this we have performed a detailed analysis of absolute error and compiled error statistics relative to the "correct" alignment table created manually. the error analysis performed on experimental data consisting of eight replicate gc-ms experiments collected on leishmania parasites with ~ peaks per experiment showed that, for near optimal parameters, < metabolites were affected by misalignment errors. this approaches the accuracy achieved in a manual alignment, which required tens of man-hours for the tested data set. the alignment accuracy was not overly sensitive to empirical parameters for a wide range of values, suggesting that the method is robust. to address the problem of a benchmark data set, we provide our test data set in the supplementary material. this includes input peak lists, raw chromatogram data matrices, and alignment tables, including those produced for optimal parameters, as well as the "correct" alignment table prepared manually. the main drawback of the proposed approach is that it operates on a set of signal peaks obtained from peak detection pre-processing. automated peak detection remains a challenge, and any errors introduced during peak detection will propagate through to the alignment tables. this is inherent in all peak matching methods, and could be viewed as an advantage as well. focusing on signal peaks results in a greatly reduced data set which contains the vast majority of interesting signal, and allows one to leverage this information for downstream processing, in addition to significantly reducing computational costs required for downstream processing. 
when two or more experiments are performed on different sample states and each consisting of multiple replicates, peak lists within each set of replicate experiments are aligned first, and subsequently the resulting alignments are aligned themselves. when more than two sets of replicate experiments are present, the between-state alignment also employs the guide tree. the alignment of more than two peak lists involves three steps: all possible pairs of peak lists are aligned, and similarity of each pair of peak lists is estimated; the guide tree is built based on the similarity between the peak lists; peak lists are progressively aligned starting with the two most similar peak lists, following the guide tree until all peak lists are exhausted. the proposed approach relies on both peak retention times and mass spectra. the proposed approach may offer significant advantages for processing of high-throughput metabolomics data, especially when large numbers of experimental replicates and multiple sample states are analyzed. when multiple samples are profiled, including replicates of the same sample and/or different sample states, one needs to account for retention time drifts between experiments. this can be achieved either by the alignment of chromatographic profiles prior to peak detection, or by matching signal peaks after they have been extracted from chromatogram data matrices. we propose a progressive method to match signal peaks across multiple gc-ms experiments based on dynamic programming. this approach can produce the optimal alignment between an arbitrary number of peak lists, and models explicitly within-state and between-state peak alignment. automated retention time correction is particularly important in non-targeted profiling studies. a new approach for matching signal peaks based on dynamic programming is presented. gas chromatography-mass spectrometry is a robust platform for the profiling of certain classes of small molecules in biological samples. we demonstrate the usefulness of this approach on gc-ms metabolic profiling experiments acquired on wild-type and mutant leishmania mexicana parasites. a sensitive peak similarity function is proposed to balance peak retention time and peak mass spectra similarities.
 gas chromatography-mass spectrometry is a robust platform for the profiling of certain classes of small molecules in biological samples. when multiple samples are profiled, including replicates of the same sample and/or different sample states, one needs to account for retention time drifts between experiments. this can be achieved either by the alignment of chromatographic profiles prior to peak detection, or by matching signal peaks after they have been extracted from chromatogram data matrices. automated retention time correction is particularly important in non-targeted profiling studies.  a new approach for matching signal peaks based on dynamic programming is presented. the proposed approach relies on both peak retention times and mass spectra. the alignment of more than two peak lists involves three steps: all possible pairs of peak lists are aligned, and similarity of each pair of peak lists is estimated; the guide tree is built based on the similarity between the peak lists; peak lists are progressively aligned starting with the two most similar peak lists, following the guide tree until all peak lists are exhausted. when two or more experiments are performed on different sample states and each consisting of multiple replicates, peak lists within each set of replicate experiments are aligned first, and subsequently the resulting alignments are aligned themselves. when more than two sets of replicate experiments are present, the between-state alignment also employs the guide tree. we demonstrate the usefulness of this approach on gc-ms metabolic profiling experiments acquired on wild-type and mutant leishmania mexicana parasites.  we propose a progressive method to match signal peaks across multiple gc-ms experiments based on dynamic programming. a sensitive peak similarity function is proposed to balance peak retention time and peak mass spectra similarities. this approach can produce the optimal alignment between an arbitrary number of peak lists, and models explicitly within-state and between-state peak alignment. the accuracy of the proposed method was close to the accuracy of manually-curated peak matching, which required tens of man-hours for the analyzed data sets. the proposed approach may offer significant advantages for processing of high-throughput metabolomics data, especially when large numbers of experimental replicates and multiple sample states are analyzed. 