Multiple sequence alignment (MSA) is a fundamental analysis method used in bioinformatics and many comparative genomic applications. Prior MSA acceleration attempts with reconfigurable computing have only addressed the first stage of progressive alignment and consequently exhibit performance limitations according to Amdahl's Law. This work is the first known to accelerate the third stage of progressive alignment on reconfigurable hardware.We reduce subgroups of aligned sequences into discrete profiles before they are pairwise aligned on the accelerator. Using an FPGA accelerator, an overall speedup of up to 150 has been demonstrated on a large data set when compared to a 2.4 GHz Core2 processor.http://dna.cs.byu.edu/msa/.Our parallel algorithm and architecture accelerates large-scale MSA with reconfigurable computing and allows researchers to solve the larger problems that confront biologists today. Program source is available from  Biologists and other researchers use multiple sequence alignment (MSA) as a fundamental analysis method to find similarities among nucleotide (DNA/RNA) or amino acid (protein) sequences. The compute time for an optimal MSA grows exponentially with respect to the number of sequences. Consequently, producing timely results on large problems requires more efficient algorithms and the use of parallel computing resources. Reconfigurable computing hardware, such as Field-Programmable Gate Arrays (FPGAs), provides one approach to the acceleration of biological sequence alignment. Other acceleration methods typically encounter scaling problems that arise from the overhead of inter-process communication and from the lack of parallelism. Reconfigurable computing allows a greater scale of parallelism using many fine-grained custom processing elements that have a low-overhead interconnect.The most common algorithm used to solve the MSA problem is progressive alignment -3. This Accelerator technology requires moving data from the host address space to the accelerator before computation. If the computation rate on the accelerator exceeds the communication rate with the host, performance will be limited. Ideally, the communication rate is at least equal to or greater than the computation rate. FPGAs are capable of handling parallel computations on many small integer data types; however, floating-point operations require more resources and consequently fewer operations fit within the same logic. Reducing complex profiles to a simpler integer form allows greater performance on the accelerator by lowering the needed communication rate and permitting more processing elements.In this work, a new method for accelerating the third stage is described that reduces subgroups of aligned sequences into discrete profiles before they are pairwise aligned on the accelerator. Our pairwise alignment algorithm  producesAlignment quality of the new method is assessed with the BRAliBase benchmark RNA alignment database  that conMost efforts to accelerate bio-sequence applications with hardware have focused solely on database searches and have employed a pairwise local comparison algorithm. Ramdas and Egan  discuss Without accelerating the most time consuming stages of progressive MSA, Amdahl's law  limits tMultiprocessor-SupercomputerMost attempts to accelerate MSA have been on shared-memory or distributed-memory systems using a coarse-grained parallel approach. Mikhailov et al.  shows a Cell BERecently, the Cell Broadband Engine has received attention as an accelerator for MSA. Vandierendonck et al.  have accGPUAnother popular acceleration technology is the general purpose graphics processing unit. Its commodity nature has sparked much interest outside of the graphics community as an acceleration engine. Liu et al.  acceleraFPGAReconfigurable computing approaches accelerate the first stage of MSA by computing pairwise alignments with a pipeline of processing elements (PEs). This linear systolic array operates with fine-grained parallelism along a wavefront of cells in the DP matrix. The ClustalW algorithm does not use the score obtained from a pairwise alignment directly. Instead, the number of identical characters in an alignment are used to compute the fractional identity. Oliver et al.  acceleraThe third stage of MSA pairwise aligns profiles in a similar way to sequences, but it must also work with the extra information in profiles. Each position of a profile designates a point in continuous profile space with a vector of character frequencies /D. Let L denote the number of lattice points on the interval  of each axis. Lattice points ε from the profile hyperplane. A ragged array with only the needed locations is used to implement the lookup table R.A near neighbor search finds a sample point that is close to the given continuous point, but not necessarily the closest point. This relaxation of proximity allows the search to proceed in deterministic time, and thereby keep up with the accelerated pairwise alignment. Search begins by scaling and truncating each nucleotide frequency to form a partially quantized point. Then these integral coordinates are used as indices into a lookup table ' = {A, C, "-"} is used so that the character frequencies correspond with the X, Y and Z axes of a depictable three-dimensional profile space.An example of discrete profile alignment is presented starting with two groups of aligned sequences. Profile formation, reduction, and pairwise alignment of the profiles are included in this example. A simplified alphabet Σs1, s2} and {s3, s4}, continuous profiles are calculated by counting the occurrence of characters in each column and dividing by the number of sequences to produce a vector of frequencies . Profile reduction proceeds by scaling each vector and truncating the values to form indices into the three-dimensional reduction table ARC,gap,. In this example, the scale factor is equivalent to the size of R in each dimension. Table lookup values, which are references to nearby sample points, are used for each position of the discrete profiles p1,2 and p3,4. Figure R. Less probable sample points are not removed in this instance. Figure p1,2 and p3,4 are aligned with a pairwise algorithm that returns the edit string E1,2,3,4 composed of the operations i e∈ {(Mis)Match, Insert, Delete}. This edit string also applies to the groups of sequences {s1, s2} and {s3, s4} because of the position correspondence between alignments and derived profiles.Figures The following components were incorporated into MUSCLE , an open• SSE accelerated sequence similarity algorithms for the first stage of MSA• A discrete profile alignment algorithm for the third stage of MSA• An FPGA accelerated pairwise alignment algorithm Corresponding code in MUSCLE was replaced with our highly-parallel code that uses SSE instructions and the FPGA accelerator. Discrete profile alignment replaced the float-based alignment used in each step of progressive alignment. Whenever two continuous profiles are aligned, discrete profiles are first computed and then aligned.Pairwise sequence alignment is a fundamental subcomponent of the discrete profile alignment algorithm. Sequences are aligned on the FPGA accelerator with a space-efficient dynamic programming algorithm and a traceback procedure. Given two sequences, the accelerator returns an edit string that describes an optimal alignment. This alignment functionality is incorporated into a C library that is called from the host platform.MUSCLE uses different methods to calculate sequence similarity in the first and second iterations. Both of these methods have been optimized with SSE instructions. The first method does not compare sequences directly, but instead compares two vectors that contain k-mer counts from corresponding sequences. These vectors are compared 16 elements at a time with SSE instructions to find the minimum values. The second method determines the percent identity of two aligned sequences by counting the number of matched symbols. To accelerate this method, SSE instructions compare 16 symbols from each sequence at once and increment corresponding counts in a vector register.Two versions of the modified MUSCLE are used for analysis. One version (MUDISC) implements our pairwise alignment in software on the host, while the other (MUFPGA) accelerates pairwise alignment on the FPGA. MUDISC is compared with other popular MSA programs such as ClustalW , Kalign Nucleotide adaptations  of the BA performance analysis uses a few large-scale, viral data sets that range in average length up to 167,043 nucleotides or contain up to 12,104 sequences. Overall program performance for MUSCLE, MUDISC, and MUFPGA is measured by the wall-clock time needed to align a data set and includes all three stages of progressive alignment. For accurate timing, the host processor's performance counters are used.The host platform consists of a desktop computer with 8 GB of DRAM and a 2.4 GHz Intel Core2 Duo processor running 64-bit Fedora 13 Linux as the operating system. All benchmark applications execute in a single thread and are compiled with gcc using -O3 optimization. An 8-lane PCI Express  add-in cAlignment quality with BRAliBase 2.1 is depicted in Figure A comparison of alignment quality with the MDSA reference sets is reported in Figure The average alignment quality of MUSCLE and MUDISC is shown in Table Program run times for MUSCLE, MUDISC, and MUFPGA are reported in Table Figure The discrete profile alignment algorithm presented here produces alignments with quality comparable to other leading MSA programs and enables the acceleration of progressive alignment. A speedup over 150 is demonstrated when discrete profile alignment is combined with an FPGA accelerator that uses a fine-grained parallel approach for the DP calculations of pairwise alignment. Previous coarse-grained approaches are limited by insufficient parallelism, particularly in the third stage of MSA. The discrete profile alignment algorithm in conjunction with a fast pairwise alignment algorithm advance the capabilities and performance of large-scale MSA. A key component of our method is a fast profile reduction algorithm on the host that can supply sequences at a rate comparable to the accelerator's input data rate. The reduction algorithm uses a near neighbor search in hyper-dimensional profile space to quantize profile positions at a rate up to 100 Mpos/s on a single core. Since this rate is sufficient to support the high-end performance of reconfigurable computing, other acceleration methods based on GPUs or SSE instructions may also be a viable option.Minimizing the time for sequence similarity calculations in Stage 1 is also important to achieve significant speedup, especially for data sets with large numbers of sequences. Using SSE instructions reduces the time for sequence similarity calculations by a factor of 30-80. Thousands of sequences can be aligned in a few minutes when Stage 1 is accelerated with SSE instructions and Stage 3 is accelerated with reconfigurable computing.Future work includes the extension of discrete profile alignment to support proteins that have a larger alphabet by adding more dimensions to profile space. Since proteins have an amino acid alphabet of 20 characters, instead of 4 like DNA, an alphabet compression scheme would be necessary to reduce the number of characters and the corresponding dimensionality of profile space to a practical number. Reducing the alphabet to six classes based on physico-chemical properties, as done in MAFFT, would only require 6 dimensions for the classes plus 1 for gaps.Another area of investigation is to apply the coarse-grained parallelism of cluster supercomputers and the fine-grained parallelism of reconfigurable computing to multiple sequence alignment. Since this work only uses a single core and one accelerator, a cluster with reconfigurable computing could provide an estimated 20-30x speedup beyond this work.SL conceived of the study, carried out the experiments, performed the comparative analysis and drafted the manuscript. QS supervised the research, participated in the design of the study and assisted in the manuscript preparation. All authors read and approved the final manuscript.


Motivation: The genomic era in molecular biology has brought on a rapidly widening gap between the amount of sequence data and first-hand experimental characterization of proteins. Fortunately, the theory of evolution provides a simple solution: functional and structural information can be transferred between homologous proteins. Sequence similarity searching followed by k-nearest neighbor classification is the most widely used tool to predict the function or structure of anonymous gene products that come out of genome sequencing projects.Results: We present a novel word filter, suffix array neighborhood search (SANS), to identify protein sequence similarities in the range of 50–100% identity with sensitivity comparable to BLAST and 10 times the speed of USEARCH. In contrast to these previous approaches, the complexity of the search is proportional only to the length of the query sequence and independent of database size, enabling fast searching and functional annotation into the future despite rapidly expanding databases.Availability and implementation: The software is freely available to non-commercial users from our website http://ekhidna.biocenter.helsinki.fi/downloads/sans.Contact:liisa.holm@helsinki.fi. Neighbors are commonly determined by sequence comparison. Protein sequence databases have grown so large that retrieving the neighbors of a query sequence is prohibitive in the exact mode and takes 1–2 min using popular heuristics  = s and ISA[s] = l (Q) and protein pointers . Subscript Q refers to the query set, the database is without subscript. Using Python-like syntax, the sequence of the ith protein is the substring TXT[START[i]:START[I + 1]]. Suffix arrays  are created on the texts using the recursive sais-lite algorithm  isH matches with the highest SANS scores are output. We set W = H by default. Whether the best matching suffixes are lexically smaller or greater than the query suffix, at least H such matches will be included in the window.The SANS gives a positive score to those database proteins (sprot), which have the longest common prefixes with a query suffix. The score is accumulated over all suffixes of the query protein (qprot) as follows:k-mer n occurs in the protein x. |S| is the size of the alphabet. We note that the use of suffix arrays allows the user to freely set the word length parameter k.KSEARCH score is the dot product of the feature vectors F:Short tandem repeats can give rise to artificially high scores. We mask query suffixes which have the same character in positions  or positions . Masked suffixes are ignored and do not contribute to the SANS score or KSEARCH score.Q|). Treating the width of the window as a constant, the search step of SANS does O(|TXTQ|) lookups in the suffix array SA. The overall time complexity of the SANS algorithm is thus O(|TXT|+|TXTQ|). The KSEARCH algorithm checks all instances of k-mers in the database, and the number of these instances grows proportionally to the size of the database. The overall time complexity of the KSEARCH algorithm is thus O(|TXT| * |TXTQ|).Sais-lite is a light-weight suffix array construction algorithm that takes linear time and space . If a two hit is found, the algorithm tries to extend the alignment without gaps, resulting in a high-scoring segment pair (HSP). HSPs are scored using BLOSUM62 substitution scores. The query sequence is scanned for two hits from beginning to end. If an HSP is detected, the scan jumps to the end of the HSP. In other words, potential 3-mer seeds already within an HSP are not tested. When the end of the query sequence has been reached, all HSPs are sorted based on their scores. A compatible set is selected so that the HSPs form a sequential alignment. Gap penalties are not used. Greedy alignments can be generated optionally for the hits detected by the SANS or KSEARCH algorithms.Suffix arrays were computed using the recursive SAIS algorithm . The in-Traditionally, word filter heuristics are used to speed up database searches. The suffix array gives access to seed words of arbitrary length. We performed a comprehensive set of benchmark tests to evaluate both fixed size patterns and suffix array neighborhoods.The metagenome benchmark is chosen to represent new sequences not yet present in the database. When a mapping exists, the median identity between the metagenomic and the closest database proteins is ~50%. This is suitably challenging, as detecting exact matches is trivial and exact filters can be formulated for very high levels, i.e. > 90% of sequence identity .e-value <1 or eight ‘rejects’  rescoring hits according to an alignment score, (ii) varying the width of the window in SANS, (iii) hybrids combining the SANS and KSEARCH scores (sum performed best), (iv) a two-hit filter like that in BLAST and (v) distance-dependent id function (cf. Equation 2). The best method (SANS+greedy) took the top-2000 hits by SANS and rescored the hits by greedy alignment. In the 30–50% identity range this improved sensitivity to 63%, up 9% points from SANS. Rescoring KSEARCH hits generally brought but little improvements. In the low sequence identity range (<30–50%), all methods except BLAST miss a large fraction of true hits.Word filters are as sensitive as BLAST in the 50–100% regime of sequence identity . The besk = 6 and greedy alignment rescoring always improves performance  where W is the width of the suffix array neighborhood and N is size of the query set. Alignment is the rate-limiting step of many fast filters. The SANS score can be used for ranking hits without alignment. These advantageous properties make SANS the fastest word filter that we know. Concretely . The minimum requirement is one byte per amino acid. The current Uniprot database is ~8 Gb. The program runs comfortably on Uniprot with MEMORY set to 10–16 Gb. The ISAfeasible regime of 50–100% sequence identity,word filters are as sensitive as BLAST in the many variants of word filters perform about equally well in the feasible regime but SANS is the most robust to parameter variation,suffix array supports the fastest known word filter algorithm,<50% identity.methods incorporating explicit alignment are necessary We have investigated the use of word filters to speed up protein sequence database searches. The principal conclusions from our extensive benchmarking can be summarized as follows:k had a large effect on KSEARCH . Assuming that false positives hits generate a low random background, it may be possible to use SANS in its fastest, alignment-free mode to generate hit lists for assigning functions to new genomes.Modern function annotation tools are designed to make an optimal choice between conflicting candidates for function assignment. They take a ranked list of sequence neighbors as input, group neighbors with similar functional descriptions and calculate an aggregate weighted support for each candidate prediction outcome  which are all >50% identical to the query. The genome benchmark was purposely selected from a phylum with relatively few known sequences. There are phyla with hundreds of closely related strains and species sequenced, and in these cases the word filter could do all the work.Our benchmark gives a realistic picture of the challenges in metagenome or genome research. The following calculation suggests that putting a word filter in front of BLAST to eliminate ‘easy’ queries would significantly reduce the work load in genome annotation. One BLAST run against Uniprot takes 1 or 2 min. The default number of hits returned by BLAST is 250. In our bacterial genome benchmark, 53% of the queries produce at least 250 hits (ordered by


Algorithms of sequence alignment are the key instruments for computer-assisted studies of biopolymers. Obviously, it is important to take into account the "quality" of the obtained alignments, i.e. how closely the algorithms manage to restore the "gold standard" alignment , which superimposes positions originating from the same position in the common ancestor of the compared sequences. As an approximation of the GS-alignment, a 3D-alignment is commonly used not quite reasonably. Among the currently used algorithms of a pair-wise alignment, the best quality is achieved by using the algorithm of optimal alignment based on affine penalties for deletions . Nevertheless, the expedience of using local or global versions of the algorithm has not been studied.Using model series of amino acid sequence pairs, we studied the relative "quality" of results produced by local and global alignments versus (1) the relative length of similar parts of the sequences (their "cores") and their nonhomologous parts, and (2) relative positions of the core regions in the compared sequences. We obtained numerical values of the average quality (measured as accuracy and confidence) of the global alignment method and the local alignment method for evolutionary distances between homologous sequence parts from 30 to 240 PAM and for the core length making from 10% to 70% of the total length of the sequences for all possible positions of homologous sequence parts relative to the centers of the sequences.We revealed criteria allowing to specify conditions of preferred applicability for the local and the global alignment algorithms depending on positions and relative lengths of the cores and nonhomologous parts of the sequences to be aligned. It was demonstrated that when the core part of one sequence was positioned above the core of the other sequence, the global algorithm was more stable at longer evolutionary distances and larger nonhomologous parts than the local algorithm. On the contrary, when the cores were positioned asymmetrically, the local algorithm was more stable at longer evolutionary distances and larger nonhomologous parts than the global algorithm. This opens a possibility for creation of a combined method allowing generation of more accurate alignments. This introduced an error in the results, which could not be estimated by the usual direct methods. We suggest using a comparison of artificially generated sequences to evaluate the quality of alignment algorithms, because the GS alignment for such sequences is known from the very beginning. A similar numerical experiment was described in ,18. HoweThe purpose of our work was to determine conditions of preferred applicability of the local and global versions of the algorithm for determination of optimal alignments with an affine penalty function for indels . ThereinOur task was to determine the relative quality of alignments obtained through the global and local algorithms versus the degree of homology of similar regions in the sequences (the "cores") and the length of nonhomologous regions at the ends of the sequences (the "consoles"). In particular, we tried to determine the application threshold for the global algorithm, i.e. the values of the above-mentioned parameters, which provided for the same or better quality of alignments by using the global algorithm in comparison to the quality of alignments by using the local algorithm .To carry out computer experiments we prepared 224 test sets, each set including 1000 sequence pairs ("test pairs"). All sets were prepared using the same technique, and different sets have different technique parameters (see below).A test sequence pair consists of two sequences generated independent of each other from a common initial sequence ("ancestor"), each of their compared sequences consisting of a homologous part ("core") and nonhomologous parts ("consoles") surrounding the core.The generation of test pairs is described in the next subsection. It has the following parameters:1) PAM is the measure of evolutional distance from the common ancestor to the sequence cores (see );r is the ratio of the total length of consoles to the length of the common ancestor of sequence cores ;2) c is the ratio of the absolute value of the difference between console lengths to their total length .3) To generate test sets with such parameters we used the following values:PAM = 30, 60, 120, 240 PAM;1) r = 10%, 20%, 50%, 100% , 200%;2) c = 0% (the consoles are of the same length), 10%, 20%, ... 100% (one console is missing).3) r and c values is explained in Figure Test sets were prepared for all possible combinations of the above parameters, i.e. in total 224 test sets were prepared (including sequence sets without consoles); the meaning of the The process of generation of a test sequence pair consists of the following stages:P of cores of test sequences;(i) Generation of a common ancestor K1 and K2 of test sequences in accord with the PAM value;(ii) Generation of cores r values;(iii) Estimation of the total length of consoles for each of the sequences in accord with the c value;(iv) Estimation of the length of each console in accord with the L1, R1 (the left and right consoles of the first sequence), L2, R2 (the left and right consoles of the second sequence);(v) Generation of consoles S1, S2:(vi) Construction of desired test sequences S0 and generated sequence S1 from it, whereas here we examine alignments of sequences S1 and S2 generated from the common ancestor sequence S0.To solve this task we used the following evolution model, which is a version of the evolution model used in our previous paper . Therein|w| is the length of a symbolic sequence w, i.e. |P| is the length of sequence P which is a common ancestor for cores of compared sequences):The ancestor sequence is generated as a random Bernoulli amino acid sequence of about 200 a.a., probabilities of selection of amino acids were taken as advised in . ConsoleGeneration of cores is described in subsection 2.1.3.K1 and K2 were constructed of an ancestor sequence P independently and according to the same procedure. The procedure consisted of two stages.Cores i (i from 1 to L+1) if there is an insertion before position i or a deletion beginning from this position i; position L+1 corresponds to the insertion at the sequence terminus. The probability of an indel at a given position was calculated by the formula:At the first stage, insertions and deletions were incorporated into the ancestor sequence. Let us say that there is an indel at position where PAM is the number characterizing the evolutional distance between the original and modified sequences .i, i = 1, ..., L+1, we determined by a random choice if there is an indel. Then we decided at random if an insertion or deletion appeared, the probability of the deletion was chosen to be 0.55. This value was determined empirically, provided that the total length of insertions and deletions was equal. When p(ins) = p(del) = 0.5 at the accepted procedure, the total length of insertions was greater than that of deletions. The length of an insertion or deletion was chosen at random from Zipfian distribution which, as stated in [i to the sequence terminus  or the beginning of the deletion coincided with the already deleted position, the attempt was ignored. Ignored was also the insertion if its beginning coincided with the elongation of the earlier made insertion or deletion. Thus, we prevented insertions and deletions, whose length was not equal to the value obtained from the preset distribution.For each position tated in , is indePAM1 [PAM. Table PAM.At the second stage, point mutations were inserted in the obtained sequence. At this, mutations were naturally inserted only in the remaining sites of the original sequence. A cycle of inserting mutations consisted in the following. A substitution is made in every position with certain probability, the probability of origin of a new symbol in this position being determined by the probability matrix PAM1 . This cyThe letter composition of insertions was generated analogous to original sequences. It should be noted that contrary to the scheme used in , in thisPAM parameter, used traditionally for characterizing the evolutional distance, is second-scheme-oriented, but since the parameter is universal, nothing prevents its use for estimating the distance between descendants of a common ancestor.In the above procedure, test pairs of sequences are generated according to the "descendant1-descendant2" scheme (i.e. two descendants of a common ancestor are compared) rather than by the "ancestor-descendant" scheme (the ancestor sequence is compared to its descendant). The first scheme in a better way models a comparison of real sequences. However the PAM correspond to the ratio of the test sequences generated according to the "descendant1-descendant2" scheme. The table has two data blocks ("ancestor-descendant" and "descendant1-descendant2"). The first block is of two columns each characterizing reference alignment (see subsection 2.3) of the ancestor sequence and the core generated from it in the course of the process described in subsection 2.1. Column "%id" lists average percentage of column-coincidences among all columns describing letter comparison. Column "%indel" describes the percentage of column-indels among columns of reference alignment. The "descendant1-descendant2" block has four columns. Columns "%id" and "%indel" have the same meaning as in the "ancestor-descendant" block, though they denote reference alignment of two descendants of a common ancestor. Columns PAM(%id)and PAM(%indel) list PAM values at which corresponding characteristics could be obtained for "ancestor-descendant" pairs. The table shows that from the point of view of %id, the use of a diverging scheme is equivalent to the use of a sequential scheme at a twice higher PAM value. Nonetheless the number of indels for the "descendant1-descendant2" scheme with parameter PAM is essentially higher than for the "ancestor-descendant" scheme with parameter 2·PAM.Table Alignment of generated sequences was performed using two variations of the Smith-Waterman algorithm - the global and local ones. For global alignment the substitution weight matrix PAM250 and gap-open and gap-extension penalties 14 and 2 were used; for local alignment the Gonnet250 matrix and penalties 10 and 0.5 were used. Such parameter values were chosen on the base of the preliminary computer experiments ,17 whichPrior to the tests with sequences of variable homology along the sequence, we investigated the dependence of the quality of the alignment on the applied substitution matrix and gap-open and gap-extension penalties. For this purpose the following numerical experiment was held.Test sets including 1000 pairs of sequences each were generated according to the "sequential" scheme of evolution with average distances between ancestors and descendants of 60, 100, 200, 300 PAM .PAM250). As we observed, the high homologous proteins (id > 45%) can be successfully aligned, using a matrices designed for large evolutionary distances. At the same time, attempts to align low homologous proteins, using a matrix designed for shorter distances, significantly deteriorate the results, signifying mismatch of algorithmic and reference alignments.Pairs of sequences of each test set were aligned by global version of Smith-Waterman algorithm using two matrices: "native" (i.e. the PAM matrix corresponding to the evolutionary distance between sequences) and PAM250. Values of the measures of similarity (2.4) of algorithmic alignments via the reference alignments derived from "native" matrix and the PAM250 matrix, are practically the same . A practical conclusion of this finding, obviously, is that if the evolutionary distance between the sequences is unknown, the evolutionary distance corresponding to applied matrix, should be certainly greater than expected distance between the sequences.This is confirmed by a more complete numerical experiment. For this aim, each pair of sequences of all test sets were aligned using matrices PAM60, PAM100, PAM200, and PAM300. Gap-open and gap-extension penalties ranged from 10 to 20 and from 1 to 5, respectively . The algorithmic alignment of sequences with consoles is shown in Figure We are fascinated how close the alignments obtained by the program are to the reference alignments, i.e. alignments with aligned positions generated from the same position of the ancestor sequence. To assess the closeness , we have used Accuracy and Confidence measures described elsewhere -16. It sNumber of columns without deletions in the reference alignment:Number of columns without deletions in the algorithmic alignment:Number of common columns without deletions:Accuracy:Confidence:We have analyzed the dependence of the quality (i.e. accuracy and confidence) of the global and local alignments of console sequences versus the following values: (1) the evolutional distance between homologous fragments of sequences ("cores"); (2) the console length; and (3) console asymmetry ("shifted cores").c = 0) and at all PAM and r values analyzed (see subsection 2.1.1). It is seen that when the evolutional distance PAM and the console length r grow, the accuracy and confidence values decrease. In this case, with the same evolutional distance and console length, the accuracy and confidence values of the global alignment are somewhat higher than those of the local alignment, this difference increasing with the growth of the evolutional distance. For example, at an evolutional distance of 240 PAM the accuracy of the global alignment is by 18.6% higher than that of the local alignment, whereas the confidence is only 16.2% higher.Table Thus, at a symmetrical position of the consoles, the global algorithm has higher resistance to the increase of evolutional distance and console length than the local algorithm.c (see the definition of c in subsection 2.1.1). So, at the evolutional distance of 30PAM, the total length of consoles 100% of the core length and the increase of console asymmetry from 80% to 90%, the accuracy and confidence drop from 85% to 51%. At the total length of consoles 200% and an increase of console asymmetry from 50% to 60%, a much sharper decrease in the accuracy and confidence takes place (from 73% to 6%).In contrast, if homologous regions of aligned sequences are shifted in opposite directions from the center of sequences, both the accuracy and confidence of the global alignment decrease remarkably . This iWhen the evolutional distance between homologous regions of sequences continues to increase, this tendency becomes more pronounced. Thus, when the evolutional distance is 60 PAM, the total console length is 100% and the core shift changes from 50% to 70%, the accuracy value decreases from 87% to 30%, and the confidence value decreases from 85% to 29%. When the evolutional distance is 120 PAM, the total console length is 50% and the core shift changes from 40% to 60%, the accuracy value decreases from 67% to 38%, and the confidence value decreases from 64% to 36%. When the evolutional distance is 240 PAM and the console length is 50%, the accuracy and confidence values begin to decrease at a shift of 10%.So, an increase in the evolutional distance between homologous regions of sequences causes a noticeable decrease in the quality of global alignment, a considerable decrease of the quality of global alignment taking place at a decreasing length of consoles and a diminishing shift of the core from the center of sequences.The entire records of the dependence of accuracy and confidence values on the three parameters are given in Additional File It is essential that at all considered values of PAM, length and asymmetry of consoles, there is no remarkable decrease in the quality of local alignment. In other words, in case of asymmetrical consoles, the local algorithm is more resistant to the increase in evolutional distance and console length than the global algorithm.threshold value of the three parameters: extent of core homology, total length of consoles and asymmetry of consoles. Prior to this value, the quality of the global alignment is higher than that of the local alignment, but above this value the global alignment quality decreases sharply, whereas the local alignment quality remains the same.Thus, we can conclude that there exists some c changes from 0 to 100% , the accuracy and confidence of global alignments decrease. In this case the decrease is sharp in a relatively narrow (~ 20%) range of c values; this range will be called the slope zone. In this section we will demonstrate how to predict theoretically where this area is. It will be accepted that the substitution weight matrix and gap penalties are fixed (see subsection 2.3).The plots in Figure P be a pair of test sequences, Lker(P) be the average length of cores of these sequences, Score (P) be the weight of reference alignment of cores for the considered set. The density of cores alignment for pair P will be the relation:Let ker Dand ker Lwe will denote mean values: Dker(P) and Lker(P), respectively, for the sequences in the set under discussion.Let us consider one of the sets of test sequences described in subsection 2.1. Using Lcon = r·Lker be the length of consoles, Dcon be the total average relation ofalignment weights of two independent random sequences of equal length to the sequence length, c be the asymmetry of consoles (see the designations in subsection 2.1). Then the mean weight Scoreglob of the reference alignment of a pair of test sequences generated by the scheme given in subsection 2.1 with the pairs Lker, PAM, r, and c is determined by the following equation:Then let GOP and GEP are gap-open and gap-extension penalties.where c, we will get an equation for the dependence of the mean weight of reference alignments Scoreglob versus the asymmetry of sequences c. Let us analyze the relationBy fixing all members in equation (2), except the asymmetry values glob Dvalue will be called the mean density of reference alignments. Similarly, the mean density of random alignments rand Dwill be the relation of the mean weight of optimal alignment of two independent random sequences to the length of these sequences (see the details in subsection 3.4).of the mean weight of reference alignments to the mean length of test sequences in a corresponding set. The c which is the root of equationComputer experiments . In other words, it is impossible to restore the reference alignment if its weight does not  differ from the alignment weight of random sequences. Using the kerL, PAM, r values, the above stated allows us to roughly determine the range of asymmetry values c at which the quality of global alignment decreases. the ratio of the total length of consoles to the length of the common ancestor of sequence cores r = 20, 50, 100%; 3) the ratio of the absolute value of the difference between console lengths to their total length c = 0, 30, 50, 70%.A comparison test was carried out on thirteen sets of 1,000 pairs of sequences each with the following parameters (2.1.1): 1) evolutionary distance from a common ancestor to the sequence cores http://deepc2.psi.iastate.edu/aat/gap3/), with matrix PAM250, and gap-open and gap-extension penalties equal to 14 and 2 and constant penalty for each difference block equal to 40. The results of comparison are shown in Table We used the GAP3 program available online .As for comparison with global Needleman-Wunsch alignments, in the case without consoles the GAP3 alignments have a much lower Accuracy and a slightly higher Confidence. For symmetric consoles simultaneously with increase in their length , this tendency is reduced and becomes less prominent. It was mentioned above that as a result of the displacement of the cores of aligned sequences in the opposite direction from the center, the reliability of the global alignment is markedly reduced. However, a local alignment has no such a tendency. As shown, at the evolutionary distance of 120PAM, the GAP3 alignment is not only resistant to displacement, but also resistant to increasing the length of nonhomologous consoles.The study has revealed regularities allowing for defining more exactly the areas of effective application of every algorithm: when consoles are positioned symmetrically, the global algorithm is more resistant to increasing evolutional distance and console length than the local algorithm (about 10% accuracy and about 8% confidence at 120PAM and up to 20% accuracy and confidence at 240PAM); quite the opposite, when consoles are asymmetrical, the local algorithm is more resistant to increasing evolutional distance and console length than the global algorithm. The boundary of the global algorithm preference is determined roughly by the value of asymmetrical position of homologous fragments of sequences (cores) at which the reference alignment density is almost equal to the density of random sequence alignment. The mean divergence of 5 ÷ 10%, which is typical both of accuracy and confidence of global and local alignments at a symmetrical position of cores, preconditions the developing of a combined method for making a more reliable alignment.The authors declare that they have no competing interests.VOP performed all computations, participated in planning the research and wrote the manuscript. MAR and VGT designed the study and contributed to the manuscript. All authors fulfilled the analysis of the results, read and approved the final manuscript.Substitution matrix and gap-open and gap-extension penalties test for optimal global alignment. Accuracy and Confidence values for global alignments versus the following: (1) evolutional distance between sequences (PAM); (2) substitution matrix; (3) gap open and gap extension penalties .Click here for filePAM, r, and c)Dependence of accuracy and confidence values on three parameters  evolutional distance between homologous fragments of sequences (PAM); (2) console length (r); (3) console asymmetry .Click here for file


High throughput pyrosequencing (454 sequencing) is the major sequencing platform for producing long read high throughput data. While most other sequencing techniques produce reading errors mainly comparable with substitutions, pyrosequencing produce errors mainly comparable with gaps. These errors are less efficiently detected by most conventional alignment programs and may produce inaccurate alignments.We suggest a novel algorithm for calculating the optimal local alignment which utilises flowpeak information in order to improve alignment accuracy. Flowpeak information can be retained from a 454 sequencing run through interpretation of the binary SFF-file format. This novel algorithm has been implemented in a program named FAAST (Flow-space Assisted Alignment Search Tool).We present and discuss the results of simulations that show that FAAST, through the use of the novel algorithm, can gain several percentage points of accuracy compared to Smith-Waterman-Gotoh alignments, depending on the 454 data quality. Furthermore, through an efficient multi-thread aware implementation, FAAST is able to perform these high quality alignments at high speed.http://www.ifm.liu.se/bioinfo/The tool is available at  The nature of DNA sequencing has taken a dramatic turn in the last few years, most notably improved through the development and broad use of 2nd generation sequencing methods. The first 2nd generation sequencing method was 454 sequencing, introduced in 2005 with the GS20 sequencing machine which produced 20 million base-pairs (Mbp) per run . 454 seqIn 1970, the global sequence alignment was proposed and a computational method for solving it . The algnegative flow and consequently flows in which it is elongated are denoted as positive flows, i.e. flow peaks < 0.5 and ≥ 0.5, respectively [negative and three positive flows most likely produced by a "CCGT" 4-mer. Because the homopolymer length is estimated from the flowpeak value, homopolymer indels (insertion or deletion) is the most common type of reading error. To produce a substitution reading error, an undercall must be followed by an overcall, or vice versa [The traits of 454 data are different from those of other sequencing techniques, which occasionally cause problems for computer analysis software. To minimise the effect of sequencing error and maximise the efficiency of 454 sequencing, it is crucial to consider the particular characteristics of 454 data while computing alignments. 454 sequencing is a pyrosequencing method, where DNA fragments are associated with synthetic beads in picolitre sized reactor wells and sequenced in parallel. Nucleotide reagents for detection of thymine (T), adenine (A), cytosine (C) and guanine (G) are repeatedly cycled over the DNA template fragments while elongating the complementary strand . The intectively . For exace versa . At the ce versa . As a coRecently, to improve the alignment quality using 454 reads, an attempt was made to utilise the flowgram information through probabilistic flowgram matching . The dowThrough combining the ability to correct for homopolymer reading errors with sequence alignments, more accurate alignments of 454 data can be achieved. To address these problems, we suggest the use of flow-space assisted Smith-Waterman-Gotoh alignments, i.e. giving the local alignment algorithm the ability to correct for likely sequencing errors while computing the alignment. We implemented the flow-space assisted Smith-Waterman-Gotoh alignment algorithm in a C++ tool named FAAST (Flow-space Assisted Alignment Search Tool) and performed alignments using both regular Smith-Waterman-Gotoh alignments and FAAST.k = 0.25).By introducing the possibility to perform flow-peak correction, the 'degrees of freedom' for the maximum likelihood estimate increases, potentially producing untrue alignments. For example, if any flow-peak correction was allowed without penalty, any flowgram could match any sequence identically. Therefore, an extensive study of the effect of the flow-space assisted local alignment is needed. The model used for the Smith-Waterman-Gotoh alignment is match/mismatch score = 2/-3 and gap open/extended penalty 5/2, and the additional parameter (see Methods) for the flow-space assisted local alignment is program default (Staphylococcus epidermidis (NC_003969), see additional files. For each of these an additional 100 decoy sequences were generated, resulting in a database of 101 nucleotide sequences. The decoys were generated through introducing random SNPs corresponding to 92% identity. This small sequence set would represent the homologs found in an everyday database search.Three targets of 25, 50 and 100 nucleotides were randomly picked from the ethidium bromide resistance determinant of negative flows and a Normal distribution for positive flows of length n.Finally, query sequences were generated from the target sequence and the algorithms were assessed on their ability to recover the target sequence as the highest scoring alignment, thus find the 'correct' homology in a set of similar decoys. The query sequences were generated ranging from 100% down to 72% nucleotide identity (through introducing random SNPs) using no 454 data simulation (Plain) as well as using Flowsim  to simulk = 0  and k = 0.25  and to provide stable means each sub-test ran 10,000 times, see Figure The results were evaluated using FAAST with the homopolymer penalty regulating parameter at Salmonella enterica subsp. enterica serovar Typhi str. CT18. 100,000 Titanium reads averaging 521 bp were generated at an identity of 100% down to 95% using Flowsim [k = 0  and k = 0.25 , see Figure To further test the effect of the FAAST algorithm we evaluated the number of correctly aligned nucleotides in reads sampled from  Flowsim . The resAs a straightforward performance test, FAAST was compared to NCBI BLAST 2 and SSAHA2 in a moderate sized alignment task. The test consisted of the typical task of aligning a set of sequenced reads against a small database. The query set was made up of Giardia P15 reads , producehttp://www.ifm.liu.se/bioinfo/.The results of the alignment test are shown in table http://www.ifm.liu.se/bioinfo/. To facilitate searching with flow peak information, FAAST reads the SFF format (Standard Flowgram Format), which is used to pack 454 data. Furthermore, since the SFF format is a binary format that may be difficult to edit manually, a new format named FFASTA (Flowgram-FASTA) is supported. FFASTA is a FASTA-like format, but it expresses a flowgram for each entry instead of a nucleotide/amino acid sequence. In the FFASTA-format the flowgram is represented as an array of float values for each peak separated by white-space, just as the QUAL format for quality scores. FAAST is implemented with a wide range of parameters for adjusting indexing heuristics, the local alignment model, output-format etc. More information can be found in the FAAST documentation at http://www.ifm.liu.se/bioinfo/ (Under '454 Tools').In order to implement our algorithm, we have constructed an alignment search tool called FAAST (Flow-space Assisted Alignment Search Tool). FAAST is implemented as a C++ program and compatibility has been ensured using GNU GCC, Intel ICC 12.0 on Linux, but FAAST also compiles with minGW or Intel on the Windows platform. FAAST is an open source project and it is available both as pre-compiled Linux binaries and as source code at Due to the specific nature of pyrosequencing, mostly produced by 454 sequencing machines, regular Smith-Waterman-Gotoh alignments may be inadequate. A homopolymer reading error will introduce a gap in the alignment, which needs approximately 4-5 identities to be outweighed using typical alignment parameters. Thus, any homopolymer indel not flanked by a high enough number of identities will cause early termination of the alignment and/or erroneous alignments. By extending the model to allow the introduction of these gaps at a lower cost at points of homopolymer uncertainties, we show that alignment accuracy can be improved, see Figure Even though FAAST was developed to deal with homopolymer reading errors of 454 data, the FAAST algorithm may be applied to other pyrosequencing methods or any sequencing method or data where homopolymer reading errors occur, for example the Ion Torrent Technology. Furthermore, many bioinformatic algorithms and software are based upon or use to some extent Smith-Waterman, for which the FAAST algorithm could be utilised to better handle homopolymer reading errors.n number of k-mer hits along the same diagonal not spaced more than J nucleotides apart. Although SSAHA2 is much faster that FAAST in a single CPU context, FAAST utilizes the multi-core environment well and still completes the alignment task evaluated in reasonable time. FAAST also compares fairly well to BLAST and in general it would be possible to use the FAAST software for producing alignments with 454 data.While BLAST relies on query indexing, FAAST uses database indexing, as implemented in the SSAHA alignment search tool . This prFAAST provides the possibility to both identify potential homopolymer reading errors in pyroseqencing data as well as providing more accurate alignments with pyrosequencing data. FAAST does not only provide high quality alignments but it does so using reasonable computational resources. Therefore, we propose that FAAST could serve as a useful tool in the analysis of genomic and metagenomic data as well as analysis where correctly aligned bases are vital, such as SNP detection.The FAAST alignment algorithm is based on the Smith-Waterman-Gotoh algorithm. For a Smith-Waterman-Gotoh alignment using pyro-sequencing data, at least two maximum likelihood estimates are used. The first interprets the pyro-sequencing flowgram data into a nucleotide sequence and the second constitutes the actual alignment. By performing an alignment with flowpreak information, a single maximum likelihood estimate will be calculated, which eliminates error propagation from the first estimate to the second.i. jD, is calculated through equation 1 .The local alignment can be solved using dynamic programming where each cell score, d and q represent the two sequences aligned where i dand j qare position i and j in the respective sequence. The function s determines the score for aligning i dwith jq. Finally, i, j Edescribes the optimal score of each cell that ends with a gap in the sequence d and i, j Hdescribes the optimal score of each cell that ends with a gap in the sequence q. The two variables are calculated through i, j= Emax and i, j = Hmax where 0 Gis the minimum gap penalty and e Gis the gap extension penalty.The variables, i, j = Cmax. i. j Drepresents the Smith-Waterman-Gotoh score as defined in equation 1 and i. j Sis the optimal score of each cell given a homopolymer correction in , defined in equation 2.In the FAAST algorithm, calculations of each cell is substituted with i. j Sis limited to describing a homopolymer correction up to four nucleotides. j, n Pddescribes the 'down-calling' penalty for a query position j, where n is the number of bases by which the homopolymer is shortened. Accordingly, j, n Pudescribes the 'up-calling' penalty for a query position j where n is the number of bases by which the homopolymer is lengthened. However, Pu is only evaluated as non-infinite when i dis equal to jq. Consequently, corrections are not allowed when a corresponding database nucleotide that can be corrected against is not found. For example, the query sequence "TAAT" would potentially align to "TAAAT" with a homopolymer correction in A, while it could not be aligned against "TAACT".Here, Pd and Pu can be pre-calculated for a query sequence and the penalties are only set to non-infinite if j is the last position of a homopolymer and the penalties are smaller than the penalty for a corresponding normal gap. Since a longer homopolymer gap is more  penalised than a shorter , if i, j, n Pdis infinite, so is i, j, n+1 Pdand it does not need to be included in the calculation of i, jS. An example of a FAAST alignment is shown in Figure Both vectors f, the peak will be called as an n-homopolymer, where n is the rounded integer value of the flowpeak value. The deviation in flowpeak value required to call the peak as a m-homopolymer can be calculated given equation 3.Given a flowpeak value, P = α *m/nDev, where α is the proportionality constant. The homopolymer correction penalty, P, could alternatively be described relative to the minimum gap penalty 0 Gthrough 0 P = G*(m/nDev)/k and thus k describes at which relative flowpeak deviation, m/nDev, one would obtain a homopolymer penalty equal to the minimum gap penalty, thus also the maximum flowpeak correction allowed. The gain of specifying penalties through k is a gap-penalty agnostic parameter as well as a parameter that is easier for the users to understand. Notably, the use of k = 0 would revert the FAAST algorithm into Smith-Waterman-Gotoh as homopolymer penalties would be infinitely large and thus i, j = Di, jC. An example of homopolymer penalties in FAAST at various flowpeak value deviations for different n-mers is shown in Figure P, is in theory proportional to m Devand inversely proportional to k, while integer rounding and non-centred (non-integer) flow-peak values often make it non-linear.Homopolymer correction penalties are in FAAST proportional to this minimum flowpeak deviation, thus calculated through k-tuple can be requested. FAAST employs a direct and compact database indexing model where the occurrences of all valid k-tuples and the corresponding database position are noted, in the same way as in SSAHA [L. Each k-tuple of valid nucleotides  is then treated as an integer value of base 4 with the 4 nucleotides as alphabet. A second pointer list, P, of size 4k is allocated and populated so that P holds a pointer to L for each k-tuple of valid nucleotides. Finally, L and P are ordered so that each position of the list P points to the first occurrence of the corresponding k-tuple in L and the value of i P<i+1P. Consequently, the last occurrence of any k-tuple found at position, i, is retrieved through reading the first occurrence of the next k-tuple found in position, i + 1, in P.The first part of the search algorithm is composed of constructing a database index, by which the occurrence of any in SSAHA . All occk-tuples found in each query against the database-index, all positions at which the query and database share at least k nucleotides are found, denoted as a 'hit'. The 'hits' are subsequently sorted by diagonal and an alignment is generated if at least n hits are found on the same diagonal spaced less than J nucleotides apart. Finally, for the v top-scoring alignments, a re-alignment with complete trace is performed to enable full-alignment output. The default parameters of FAAST use k = 11, n = 2 and J = 50, thus requiring at least two 11-mer 'hits' spaced no more than 50 bp apart.Through matching all The authors declare that they have no competing interests.FL has designed the algorithm and implemented the FAAST software and written the manuscript. BP and BA have helped to design the study and draft the manuscript and have provided feedback on the algorithm. All authors read and approved the final manuscript.Evaluation of the effect of flow-space assisted local alignment. Scripts for running the evaluation test as well as all the binaries and results from the run included in the manuscript. See the enclosed README.txt for more information.Click here for fileEvaluating the performance of FAAST. Scripts for running the evaluation test as well as all the binaries and results from the run included in the manuscript. See the enclosed README.txt for more information.Click here for file


Rapidly evolving, indel-rich phylogenetic markers play a pivotal role in our understanding of the relationships at multiple levels of the tree of life. There is extensive evidence that indels provide conserved phylogenetic signal, however, the range of phylogenetic depths for which gaps retain tree signal has not been investigated in detail. Here we address this question using the fungal internal transcribed spacer (ITS), which is central in many phylogenetic studies, molecular ecology, detection and identification of pathogenic and non-pathogenic species. ITS is repeatedly criticized for indel-induced alignment problems and the lack of phylogenetic resolution above species level, although these have not been critically investigated. In this study, we examined whether the inclusion of gap characters in the analyses shifts the phylogenetic utility of ITS alignments towards earlier divergences. By re-analyzing 115 published fungal ITS alignments, we found that indels are slightly more conserved than nucleotide substitutions, and when included in phylogenetic analyses, improved the resolution and branch support of phylogenies across an array of taxonomic ranges and extended the resolving power of ITS towards earlier nodes of phylogenetic trees. Our results reconcile previous contradicting evidence for the effects of data exclusion: in the case of more sophisticated indel placement, the exclusion of indel-rich regions from the analyses results in a loss of tree resolution, whereas in the case of simpler alignment methods, the exclusion of gapped sites improves it. Although the empirical datasets do not provide to measure alignment accuracy objectively, our results for the ITS region are consistent with previous simulations studies alignment algorithms. We suggest that sophisticated alignment algorithms and the inclusion of indels make the ITS region and potentially other rapidly evolving indel-rich loci valuable sources of phylogenetic information, which can be exploited at multiple taxonomic levels. Phylogenetic markers with length mutations , introns, ribosomal RNA regions or non-coding sequences, are popular targets for many phylogenetic studies, because of appropriate variability and/or easy accessibility even from old herbarium specimens, yet the challenges in alignment and phylogenetic inference imposed by indels are not completely resolved. The evolution of indels and nucleotide substitutions share largely the same patterns, but the mechanisms generating indels are more diverse, including transcriptional slippage, the formation of hairpins, deletions, insertions, inversions and duplications It is widely accepted that the proportion of correctly inferred positional homologies is the most important determinant of the outcome of phylogenetic reconstruction A number of approaches have been proposed to handle indel-rich regions of alignments Internal transcribed spacers (ITS) of the nuclear ribosomal RNA cluster are the most frequently sequenced phylogenetic markers in fungi However, two major lines of criticism exist against the ITS locus of the nrDNA repeat. One is the difficulty of multiple alignment of ITS sequences of distantly related species In this study we set out to examine the impact of various indel handling approaches to the outcome of phylogenetic inference from fungal nrDNA ITS sequences. We test whether and how the incorporation of the phylogenetic information of gaps alters the resolution and branch support in Bayesian phylogenetic analyses. More specifically, based on previous studies of intron sequences, we hypothesize that the use of indel data extends the phylogenetic utility of ITS to include evolutionary divergences above the level of interspecific comparisons. Further, we investigate whether the inverse approach, the exclusion of “ambiguously aligned regions” in turn improves phylogenetic inference. All the before mentioned questions are explored using published fungal ITS datasets, across four alignment algorithms with different theoretical background and implicit assumptions.+F 1.058 +F we invoked the+F option to fix already inferred indels at their place and avoid another indel to be inferred in an overlapping position during the second recursion of the algorithm We collected published ITS alignments of fungi in the wide sense (including Oomycota) from major mycological journals and assembled the published ITS dataset by downloading the sequences from GenBank, the whole alignment from TreeBase, or requested the dataset from the authors of the studies. Datasets were checked for sequence quality and length, those containing poor quality or overly short sequences (<50% of the average length) were excluded. We also omitted sequences which have been uploaded to GenBank with the “ambiguously aligned” regions deleted, which would be reconstructed as biologically nonsense gaps in the alignments. Datasets were chosen to represent a wide range of fungal groups, covering all phyla and comprise several taxonomic ranges, from species- to phylum level. Two new datasets were also assembled . In one case, the Agaricales ITS dataset of Matheny et al We coded all indels in each alignment by means of the simple indel coding algorithm as implemented in FastGap Ambiguously aligned regions were identified by using GBlocks 0.91 To examine the impact of various gap treatments, we compared the resolution and nodal support of trees inferred when treating indels as missing data, recoding them as presence/absence characters or deleting gapped sites from the alignments. Thus, for each alignment (four for each dataset), we prepared three nexus input files for phylogenetic analyses, one from nucleotide data only, one from alignments with the ambiguously aligned sites excluded and the third from nucleotides combined with recoded indels . For the best scoring alignment algorithm, we performed a fourth set of analyses, in which trees were inferred from the indel matrix only.th generation. We used topological convergence as judged from the average standard deviation of split frequencies as a conservative measure of convergence of the MCMC analyses. Topological convergence was judged sufficient when the average standard deviation of split frequencies dropped below 0.01. The burn-in was set to three million generations, or established by inspecting convergence. Trees remaining after the exclusion of the burn-in phase were used to compute 50% majority rule consensus trees and Bayesian posterior probabilities (hereafter PP).We used the parallel version of MrBayes 3.1.2 m/(n-2) where m is the number of resolved nodes and n is the number of tips of the tree.We took two different approaches to characterize the effects of various treatments of indels in the phylogenetic analyses. First, as a crude measure of the amount and strength of phylogenetic signal, we calculated the resolution and the mean of the posterior probabilities of resolved nodes for each consensus tree. We observed that tree resolution and the mean of the PP-s are in a reciprocal relationship when there are weakly supported nodes in the phylogeny. This is because weakly supported nodes either collapse to polytomy or receive low PP values when get resolved. A polytomy does not contribute anything to the mean of the PP-s, but reduces resolution, whereas a resolved node with a low PP likely reduces the mean of PP-s but increases resolution. We overcame this problem by taking the product of the two measures. Resolution was calculated as To examine how different alignment algorithms and the inclusion of indels affect the phylogenetic signal at different taxonomic ranges, we plotted PP-s as a function of node depth (distance from the tips). We divided the range of node depths to 800 discrete categories and calculated the mean of the PP-s falling in each of the categories. Node depths were computed for each node as the mean of the path lengths leading from the node of interest to all of its descendant leaves. If ITS sequences lose informativeness above the species level, we expect the PP-s to decrease sharply toward higher node depth values. Further, if indels are more conserved than nucleotides, the inclusion of indels in the analyses is expected to add increasingly more to the posterior probabilities at higher evolutionary divergences. These analyses have been performed both for a collection of all resolved nodes and for those that are congruent (i.e. have the same set of descendants) on the pair of consensus trees inferred from nucleotide data and nucleotide plus indel data. A set of perl scripts written to perform the abovementioned analyses are available from the authors upon request.th set of analyses in which only gap data, recoded from PRANK+F alignments, were used. Some of the analyses failed to complete or converge significantly (i.e. average standard deviation of split frequencies not dropping below 0.01), these have been omitted from later comparisons.One hundred and fifteen datasets, spanning several taxonomic ranges (species to phylum level) and fungal groups  were collected and analyzed in this study. The classification, the approximate taxonomic range, the number of taxa and literature references are presented in +F produced the longest alignments  on average. This difference was caused by both the number of recovered indel events and the length of individual indels , while PRANKl indels , Fig. 1.l indels  under PR+F . Mean length of parsimony informative indels were rather uniform among ClustalW, MAFFT-X-INS-I and Probalign , whereas the mean length of parsimony uninformative indels in MAFFT-X-INS-I was outstanding: 11.76 versus 5.53 and 8.02 for ClustalW and Probalign. Interestingly, the number of parsimony-informative singleton gaps was greater in ClustalW and MAFFT-X-INS-I alignments than that of parsimony-uninformative indels, whereas Probalign and PRANK+F alignments showed an opposite pattern. On average, parsimony informative indels inferred by ClustalW, MAFFT-X-INS-I and Probalign were longer than parsimony uninformative ones  were analyzed, the distribution of tree support showed an even distribution over the range . We found that very low values correspond to indel-poor alignments, providing only a few characters to analyze.The impact of indel characters and the exclusion of ambiguously aligned sites on phylogeny reconstruction was measured by the difference in tree resolution and posterior probabilities they cause. To this end, we calculated the product of tree resolution and mean posterior probabilities for each dataset as a proxy for ‘tree support’. The inclusion of indels in the phylogenetic analyses shifted the distribution of tree support values considerably to higher values for ClustalW, Probalign and PRANKignments . On the +F alignments, respectively. Their distribution as a function of node depth is depicted on +F and Probalign alignments, where a regression analysis assuming linear decay of tree support as a function of evolutionary divergence suggests that the tempo of the breakdown of phylogenetic signal with increasing node depth is considerably slower when gaps are included in the analyses  more conserved than nucleotide substitutions in the ITS region. With the emerging interest in finding new sources of conserved phylogenetic information sparked by recent large scale phylogenetic The utilization of alignment gaps is promising for many phylogenetic markers, not only because it represents an additional source of information from the same sequenced loci, but also since length mutations may be more conserved than nucleotide changes +F). We believe that the explanation for this is that, since computerized methods use gap content per alignment column as a proxy for being ambiguously aligned, not the actual rate  of the given column, a greater portion of sites is excluded from more gapped (i.e. less condensed) alignments, which necessarily entails more properly aligned sites to be deleted also. Although our study was not designed to objectively benchmark alignment accuracy, simulation studies provide robust evidence for the accuracy of indel placement by various alignment algorithms A common strategy to by-pass alignment difficulties is to exclude “ambiguously aligned” regions from the analyses, either manually or using a computer program One evident limitation of our approach is that the trees inferred under various alignment methods and gap treatments cannot be validated against the “true tree”. However, pervasive conflict between nucleotide and indel data, which may in part be caused by abundant alignment noise, and could be detectable by poor convergence of MCMC analyses and/or expansive polytomies, has not been implicated by our results. Given the paucity of model-based phylogenetic software capable of handling binary data, formal testing of conflict between nucleotide and indel matrices is not possible. An intriguing future extension of this work would be to examine the extent and nature of conflict between different types of data from the same locus. Nevertheless, manual comparison of trees inferred from indel and nucleotide data for individual datasets could serve as a surrogate of formal conflict testing.In this study we used simple indel coding in silico analyses requiring multiple alignments, indel information could be exploited in pairwise comparisons conducted in certain species identification procedures and barcoding The internal transcribed region represents the most ubiquitously used sequence fragment for phylogenetic analysis, sequence-based species identification, including environmental sequencing and barcoding in fungi. Recently, the widespread application of pyrosequencing for the characterization of fungal communities multiplied the interest in ITS, which is also reflected by the number of available software tools and databases e.g. . It has Contrary to common belief, nuclear ribosomal internal transcribed spacers are useful for resolving phylogenetic relationships above species and genus level, when sophisticated alignment algorithms are employed and the indel data are involved in the phylogenetic reconstruction. Whether other analytical adjustments, e.g. partitioning the ITS locus into ITS1, 5.8S and ITS2 regions could further improve the precision of estimates remain to be tested. Nevertheless, we stress the need for accurate gap placement and indel coding in ITS alignments, in order to exploit as much of the phylogenetic information as possible. Due to the relentless progress in alignment estimation, the inference of biologically realistic indels is becoming increasingly plausible, which improves phylogenetic estimates drawn from rapidly evolving, indel-rich sequences. We believe that sophisticated alignment and indel handling strategies will paint a different picture on the phylogenetic utility of ITS and affect a number of analyses using ITS alignments; not only phylogeny reconstruction, but also other fields, such as species identification, environmental sequencing projects or barcoding and will facilitate a more insightful utilization of the marker that appears in more than two thirds of phylogenetic datasets, but has been perpetually criticized.Figure S1Probability density of indel length distributions observed under various alignment methods. Both parsimony informative and uninformative indels show a strongly left-skewed distribution, with the most abundant length category being single-residue indels. The right tail of the distributions (reaching its maximum at 2203 residues) have been truncated for better visualization.(DOCX)Click here for additional data file.Figure S2Posterior probability ratios of congruent nodes. Support values for relationships inferred both in analyses with and without the indel data are strongly biased towards those making use of indel characters .(DOCX)Click here for additional data file.Table S1Fungal ITS datasets analyzed in this study.(DOC)Click here for additional data file.Table S2Predicted decay rate of the phylogenetic signal under different alignment and gap treatment methods, as a function of increasing evolutionary divergence.(DOCX)Click here for additional data file.


We propose and validate a multivariate classification algorithm for characterizing changes in human intracranial electroencephalographic data (iEEG) after learning motor sequences. The algorithm is based on a Hidden Markov Model (HMM) that captures spatio-temporal properties of the iEEG at the level of single trials. Continuous intracranial iEEG was acquired during two sessions (one before and one after a night of sleep) in two patients with depth electrodes implanted in several brain areas. They performed a visuomotor sequence  using the fingers of their non-dominant hand. Our results show that the decoding algorithm correctly classified single iEEG trials from the trained sequence as belonging to either the initial training phase  or a later consolidated phase , whereas it failed to do so for trials belonging to a control condition (pseudo-random sequence). Accurate single-trial classification was achieved by taking advantage of the distributed pattern of neural activity. However, across all the contacts the hippocampus contributed most significantly to the classification accuracy for both patients, and one fronto-striatal contact for one patient. Together, these human intracranial findings demonstrate that a multivariate decoding approach can detect learning-related changes at the level of single-trial iEEG. Because it allows an unbiased identification of brain sites contributing to a behavioral effect  at the level of single subject, this approach could be usefully applied to assess the neural correlates of other complex cognitive functions in patients implanted with multiple electrodes. In intracranial electroencephalography studies in humans, the use of a very small subset of the data, i.e. highly localized recording sites, is preferred because it gets around the problem of variations in the patterns of surgical implantation across patients , we employed a decoding algorithm that classifies single-trial data by exploiting learning-related changes in distributed patterns of neural activity. We then estimated which electrodes mostly contributed to the discrimination power in order to identify brain regions implicated in learning-related changes. This approach is challenging because it aims at extracting distinctive features of neural activity during a complex cognitive paradigm at the single-trial level and with minimal The present results show that the proposed multivariate algorithm can track learning-related changes, provides consistent results in two distinct patients analyzed independently, and offers the possibility to estimate in an unbiased way which neural locations may critically contribute to motor sequence learning.Patients provided written informed consent to participate in this study, which was approved by the ethical committee of the Geneva University Hospitals.We tested epileptic patients who had depth-electrodes implanted in several brain regions for presurgical evaluation purposes. Here we report the findings in two patients, patient M.R.  and patient C.S.  who completed the experimental protocol without any major epileptic activity over the whole period of recording  The patients were tested during two sessions on two successive days, including one night of sleep between the sessions . On day We tested both patients while they underwent continuous long-term iEEG recordings. Electrophysiological activity was recorded over arrays of depth electrodes surgically implanted to identify the epilepsy focus. Intracranial EEG was recorded  using electrode arrays with 8 stainless contacts each , orthogonally implanted in several brain regions. Patient M.R. had 64 contacts (8 arrays), covering, bilaterally, the anterior and posterior hippocampal regions, the amygdala, and the fronto-orbital cortex. For patient C.S., a total of 88 contacts (11 arrays) covered anterior and posterior hippocampal regions, the amygdala, the frontal-caudate area, and the occipital cortex, bilaterally, as well as the right fronto-orbital cortex . For eacWe first analyzed iEEG data from all implanted regions using a classification method based on single-trial responses. This approach aims at classifying single trials of iEEG (epochs corresponding to single key presses) in the S-sequence as belonging to day 1 or to day 2. We then performed a localization procedure to detect which areas contributed significantly to the classification accuracy.We implemented a multivariate approach to investigate the consolidation of a sequential motor skill based on distributed brain signals. This method presents several advantages for the analysis of intracranial recordings with respect to classic average event-related potentials. First, it exploits single-trial measurement of a different duration therefore accounting for possible latency shifts in the electrophysiological response to similar stimuli and that are not time-locked to the visual cue or motor response. Second, it provides classification estimations for different conditions, whose accuracy can be tested statistically. Finally, by a recurrent procedure it allows to assess the contribution of each measurement site to the classification accuracy. The distinctive features of this method are particularly appropriate for the study of single-patients datasets, whose measurement quality can be affected to a different degree and at different site locations, making it difficult to statistically assess group-level effects. Moreover, in the context of intracranial data, the averaging of iEEG epochs rarely generates classical ERP components, thus preventing a straightforward use of the knowledge derived from scalp EEG studies. While it provides a stringent test for the classification of single-trial data together with an identification of anatomical sites for condition-dependent changes, this method also takes advantage of several single-trial features simultaneously, including signal amplitude and spatio-temporal pattern of activity , v2(tf),…,vN(tf)]  from the S-sequence. Each of these epochs comprises a set of voltage measurements M,vN(tf)] . The aim1,…, HQ } and {M1, M2,…, ML} 1,…, HQ }, called hidden states, represent a stochastic process whose evolution over time cannot be observed directly. The property of this process can only be inferred through the realizations of the variables {M1, M2,…, ML}, that is to say, in our case, the EEG signal recorded from several electrodes. The HMM is characterized by the initial state probability vector π of elements πi = P(H1 = i); the state transition matrix A, with aij = P(Htf = i|Htf–1 = j) and the set of emission probability density function B = {bi(Mtf) = p(Mtf|Htf = i)}, which is, in our case, modeled by a Gaussian mixture . The choice of a GMM for this probability density function is standard when HMM is applied to a continuous variable In an HMM, one considers a probabilistic model of two sets of random variables {Htf}, representing the instantaneous voltage measurement across the entire set of electrodes (tf} closest (on the basis of Euclidean distance) to each mean. We estimated the GMM parameters by an expectation-maximization algorithm for mixture of Gaussians http://www.cs.ubc.ca/~murphyk/Software/HMM/hmm.html).The first step of the algorithm is a GMM estimation of the set of voltage measurement for a given condition. Thus, the N-dimensional vectors {Mectrodes , were exectrodes . We initIn order to select the number of clusters Q providing the best classification between the trials on day 1 and day 2, we considered a range of possible values of Q between 3 and 8. We therefore obtained six HMM  for each of the two datasets and each of the patients.To select which HMM provided the best discrimination power between day 1 and day 2, we tested the models ten times. Each time, the S-sequence data was randomly divided into two parts: one training set, which was nine tenths of the data, and one testing set, which was the remaining one tenth. For each test, we computed a Receiver Operating Characteristic (ROC), whose underlying area provides an unbiased measure of the classification accuracy As an additional estimation of the quality of the trained model, we assessed the accuracy obtained for new test data by measuring the ratio of trials correctly classified and the total number of trials when keeping the same priors as those obtained during the training. Finally, to exclude that the discrimination power reached when classifying the S-sequence could trivially be due to shorter trial duration on day 2 compared to day 1, we performed a control test by classifying the two datasets based on the reaction times (RTs) only .We compared the ROC curve areas based on reaction times and those based on the HMM models using the ten estimations in the cross validation procedure . To further assess any possible relation between the estimated model accuracy and the RTs, we computed the Pearson correlation between the difference of the logarithm of the likelihoods of each of the two models  and the RTs on a trial-by-trial basis in the test dataset.We aimed at testing whether the classification performance was equally driven by all the recording sites across the available electrode arrays or whether some sites might contribute more to the classification. We therefore dropped in turn each of the available electrode arrays, one at a time, and in each of the two subjects separately, and we recomputed the HMM models and the corresponding classification accuracy. At this stage, we considered each couple of electrodes together because they can reflect correlated activity along the strip. For each of the electrode selections, we estimated the parameters providing the highest classification accuracy for the S-sequence as we did above. We then compared the resulting classification performance with that obtained previously when keeping all the contacts. The same analysis was carried out with the data from the C-sequence based on the models estimated in the structure sequence.target string. In this further test, we trained two set of new models for day 1 and day 2 taking into account the same number of initially chosen selected contacts (i.e. 16 for M.R. and 22 for C.S.) but replacing one contact within the target string with another contact in the same string. The goal was to test how robust is the drop in classification accuracy against the different choice of the electrodes along the strip and the critical contribution of each single contact while keeping the same number of total electrodes.A further analysis was carried out focusing on those couple of electrodes that produced a significant drop of the classification accuracy. In the following we refer to the string of contacts including this couple of electrodes as One important step of multivariate decoding in neuroimaging studies is the identification of the features that the classifier exploits for achieving a good classification performance. We therefore investigated which parameter(s) from the HMM models was most informative in classifying single-trials from day 1 and day 2 and what signal properties did the relevant parameter(s) reflect. For each patient, we considered the set of HMM models (one model for each training dataset) estimated during day 1 and day 2. We considered here only the selected values of hidden variables providing the best accuracy . We investigated which parameters , for each model was crucial for achieving a good classification performance. We ran an exhaustive analysis by considering all possible combinations for each set of parameters. For example for testing whether the means estimated from day 1 or day 2 were carrying critical information for classification performance, we swapped the values of the means of the first model with those of the second model considering all the possible permutation between the first and the second set. For each swap we assessed the accuracy and we evaluated whether there was a significant drop. The same analysis and the same tests for accuracy assessment (as described in the ‘Accuracy estimation’ section) were repeated for each set of parameters .Finally we aimed at finding a neurophysiological interpretability of the relevant parameters revealed by this procedure.For each patient, we first averaged the reaction times (RT) over the 8 key presses of each sequence in each block (i.e. 20 sequences in each block). Note that only hits were included in the analysis and that the patients made very few errors (incorrect key pressed or misses) in each block . The data were then subjected to an ANOVA with Day  and Blocks  as factors. Additional t-tests were performed whenever interactions were significant. Both patients showed a main effect of Day  = 4.89, p<0.05; patient C.S.: F = 15.72, p<0.001) due to the RTs being faster on the second than the first day  = 2.11, p<0.05; C.S. Day 1: 401 ms±38 ms, Day 2: 379 ms±42 ms, T(158) = 3.38, p<0.001). Critically, the analysis revealed a Day by Block interaction  = 3.62, p<0.05; C.S.: F = 2.72, p<0.05) due to greater performance improvement for the S-sequence blocks than the C-sequence blocks on day 2  = 2.21, p<0.05, C-sequence: 15 ms, T(38) = 0.72, p = 0.49; for C.S. S-sequence: 29 ms, T(118) = 5.16, p<0.001, C-sequence: −1 ms, T(38) = −0.07, p = 0.95). Consistent with previous studies For patient M.R., the best classification performance was obtained for Q = 3 on day 1 and Q = 4 on day 2. The ROC area was 0.80±0.07 .The accuracy for classifying the S-sequence was significantly (p<0.01) affected when we did not consider one electrode array in patient M.R. This array corresponded to left posterior hippocampus . We alsoWhen applying the same procedure on the data from the C-sequence, we found that, in both patients, many areas were associated with a significant drop in the accuracy when they were not included in the model estimation  but, criWe further analyzed how specific was the contribution of the hippocampus for classifying single trials belonging to the S-sequence. We estimated two new sets of models for day 1 and day 2 by considering all the initially chosen contacts (i.e. 16 for M.R. and 22 for C.S.) but replacing the one in the hippocampus (LPH1 and RAH1 for M.R. and C.S. respectively) with one external to the hippocampus within the same target string. For patient M.R., the ROC area dropped to 0.78±0.07 which was significantly lower than the area obtained using all the initially chosen contacts (p<0.05). For patient C.S., the ROC curve area dropped to 0.88±0.04, significantly lower than when including the hippocampus (p<0.05).We could conclude that for both patients within the string that included the hippocampus, the contact placed within the hippocampus was contributing more to the classification performance than other contacts on the same string. Note also that these effects were found for the hippocampal contacts in the hemisphere contralateral to the executing hand in both patients.We found that the values of the covariances were the most informative for discriminating day 1 and day 2 and that none of the other parameters did significantly impact the classification accuracy.The next step was to gain a better insight on the neurophysiological interpretability of the HMM models' parameters estimated during day 1 and day 2. As mentioned above , the HMM model can be used to characterize the sequence of voltage configuration across multiple sites of recordings. Specifically, we used this model to segment single trials into series of momentary states, i.e. stable voltage configurations . We therIntracranial EEG recordings in humans provide spatially-localized measurements of brain activity with a high temporal resolution. In this study, we proposed an HMM-based multivariate algorithm that takes advantage of the distributed neural signals measured by iEEG at multiple recording sites. Although this approach can in principle be used to characterize the neural correlates of any cognitive functions, in this study we show that it can be successfully applied to track a visuo-motor learning effect. This dataset included recordings from two subjects who performed the task before and after a night of sleep. Without the subjects being aware of it, the two sessions included both a structured sequence (S-sequence) and a pseudo-random control sequence (C-sequence). Behavioral results from both patients showed that motor performance improved selectively for the S-sequence after a delay that included one night of sleep. These results are similar to what has been shown with previous SRTT and motor learning studies in normal subjects Consistently with the behavioral results, we showed that a multivariate classification algorithm can accurately assign single-trial iEEG responses to either the initial training phase (day 1) or to the later consolidated phase (day 2), i.e. after sequence-specific improvement occurred. Importantly, this classification result relied on activity patterns selectively associated to the learning of the regularity of the 8-item sequence (S-sequence), as evidenced by the comparatively low classification accuracy obtained for single-trials from the C-sequence. In addition we found that the classification failed when applied to the single-trial reaction-times, thus indicating that the learning-related changes captured by the decoding algorithm cannot be trivially explained in terms of speeding of motor response. Finally, while the localization of these learning-related changes involved a distributed pattern of neural activity, we identified the hippocampus as providing a major contribution to the reliable classification of the trained sequence, independently in each patient, with an additional contribution from frontostriatal regions for the patient implanted with electrodes in these brain areas.Taken together, these results demonstrate the feasibility of the application of a multivariate approach for the analysis of learning-related changes in intracranial recordings in humans. This is mainly supported by the accurate performance of the classifier in tracking sequence learning at the level of single trials and by the highly consistent pattern of results obtained in the two patients analyzed independently. More specifically, independently in both patients (i) we could classify single trials based on distributed activity and only in relation to the S-sequence; (ii) the hippocampus provided the highest contribution to the classification accuracy compared to all the other sites; (iii) the distinct learning stages were paralleled by a difference in the average temporal duration of momentary neural states (see next section).The present study provides evidence of learning-related changes of intracranial electrical activity corresponding to single events  belonging to a visuomotor sequence. The analysis of the features used by the classifier showed that the discrimination between different stages of the learning process relies on differences of the spatio-temporal patterns of the raw signal in relation to the learning stage. Specifically we showed that responses to single visual cues can be represented as a sequence of ‘momentary states’, whose duration changed as a function of learning, i.e. when comparing day 1 to day 2.Indeed, this change in duration was observed only for trials belonging to the S-sequence, and critically related to the presence of the hippocampus in both subjects. The existence of short periods of stability of voltage configurations  is a well-established empirical observation at the level of the scalp electroencephalography Our results show that the underlying neural correlates of sequence learning is distributed within a large network, involving activities from multiple locations. However, in both subjects we found a significant drop in the performance only when activity recorded from the hippocampus  was not included in the classification. These results suggest a major contribution in sequence learning of these regions, among the multiple sites at which electrodes were implanted. A more general conclusion about the specific role of the hippocampus and fronto-striatal activities is that sequence learning may require a larger population of patients. At present, these results speak in favor of the feasibility of the proposed algorithm; first in relation to the high consistency of these results across the two patients analyzed independently; second because the role of the hippocampus in sequence learning is consistent with similar findings in associative processes, including the integration of temporally- or spatially-organized information a priori selection of the relevant neural sites or time-window of activity measurements. We complemented our approach by a localization procedure and showed that we can identify the regions contributing most to the performance of the classifier. Our results demonstrate that this methodological strategy is particularly adapted to test the effect of learning-related changes capturing task-related effects at the single-trial level, that are not time-locked to the visual cue or motor response, and do not require a fixed trial length.The present study demonstrates that the proposed multivariate decoding approach to single-trial iEEG datasets from individual patients offers an important methodological alternative to group studies of averaged data. Indeed, grouping iEEG data from different patients can be extremely challenging because the configuration of electrode placement varies across individuals and pathological conditions , and because iEEG data quality is often contaminated by artifacts at different recording sites. The restricted availability of such iEEG recordings is an additional factor motivating the development of methods that fully exploit individual patient datasets. Following a classification scheme, we made use of non-overlapping splits of the available data to validate differences in the temporal and spatial configuration of the signal. Such classification analysis exploits stimulus-related information extracted from distributed activity patterns  and avoids biases that may arise when hypotheses and inferential analyses are not independent The present findings could benefit from the simultaneous recording of scalp EEG which could allow a useful comparison with existing literature on the same topic Intracranial EEG recordings in humans provide a unique opportunity to investigate spatially localized neural activity with a high temporal resolution, in particular for deep regions that cannot be easily accessible to surface EEG recordings. These data can thus provide an intermediate level of observation linking animal cell-recording data and human neuroimaging findings. However, much like cell-recordings in animals, iEEG studies have a sparse distribution of recordings sites. In this study, we propose a multivariate decoding strategy to optimize the use of such distributed neural signals by allowing the full analysis of datasets from individual patients at the single-trial level and by offering an unbiased test for the contribution of individual electrodes to the observed effects.We thank Peter Dayan  for insightful theoretical and methodological comments. We also thank Laurent Spinelli for technical support and the patients for participating in the study.Material S1Sleep parameters. Description of the sleep parameters of the night between the two recordings for each of the two patients.(DOC)Click here for additional data file.Table S1Talairach coordinates of the implanted electrodes. List of the normalized Talaraich coordinates of the implanted electrodes for each of the two patients. We report here all those coordinates that were included in the multivariate decoding analysis.(DOC)Click here for additional data file.