Volume 8 Supplement 5
Simultaneous identification of long similar substrings in large sets of sequences
© Kleffe et al; licensee BioMed Central Ltd. 2007
Published: 24 May 2007
Sequence comparison faces new challenges today, with many complete genomes and large libraries of transcripts known. Gene annotation pipelines match these sequences in order to identify genes and their alternative splice forms. However, the software currently available cannot simultaneously compare sets of sequences as large as necessary especially if errors must be considered.
We therefore present a new algorithm for the identification of almost perfectly matching substrings in very large sets of sequences. Its implementation, called ClustDB, is considerably faster and can handle 16 times more data than VMATCH, the most memory efficient exact program known today. ClustDB simultaneously generates large sets of exactly matching substrings of a given minimum length as seeds for a novel method of match extension with errors. It generates alignments of maximum length with a considered maximum number of errors within each overlapping window of a given size. Such alignments are not optimal in the usual sense but faster to calculate and often more appropriate than traditional alignments for genomic sequence comparisons, EST and full-length cDNA matching, and genomic sequence assembly. The method is used to check the overlaps and to reveal possible assembly errors for 1377 Medicago truncatula BAC-size sequences published at http://www.medicago.org/genome/assembly_table.php?chr=1.
The program ClustDB proves that window alignment is an efficient way to find long sequence sections of homogenous alignment quality, as expected in case of random errors, and to detect systematic errors resulting from sequence contaminations. Such inserts are systematically overlooked in long alignments controlled by only tuning penalties for mismatches and gaps.
ClustDB is freely available for academic use.
More than 500 eukaryotic genome projects are on the way and will sooner or later generate hundreds of billion base pairs. The accurate annotation of genes in these many sequences is a challenging computational problem and impossible to complete by experimental methods alone. However, it is also estimated that about 50% of an organism's genes can be identified by strong sequence similarity to other organisms. The resulting sequence matching problems require simultaneous comparisons of large sets of sequences and are no longer efficiently handled by matching in turn each candidate sequence after the other as does BLAST and its various improvements including BLAT . Using suffix trees and suffix arrays, more efficient and exact methods of simultaneous sequence comparison exist. These methods quickly identify perfect matches of substrings. Their application is justified by the observation, that approximately identical sequences have exact common substrings which are often specific enough to identify sequence similarities of interest. Errors are rarely randomly distributed but cluster, leaving space for longer exact matches than expected from probability computations. Hence, by almost perfect sequence matching, we can easily locate BACs and shorter sequences on chromosomes, relate single ESTs to full-length cDNA and identify redundant and contaminated sequences. For instance, such methods quickly reveal large numbers of almost identical human ESTs stored in Genbank which cause largely increased multiple output of spliced alignment programs, genome browsers use to map ESTs on chromosomes. One of the largest subset counts 237 human ESTs which are not human transcripts but part of the E. coli vector AF058756 (Cloning vector pFR-Luc) used for sequence amplification. Sorek and Safer  describe various kinds of EST contamination which are all detectable by analyzing matching substrings. By statistical analysis of complete EST libraries these authors found 24,766 human ESTs which are likely contaminated by intergenic, intronic or repetitive DNA, and may have caused up to 9,575 incorrect gene predictions. By exact string matching Kurtz et al.  discovered a 190,014 bp repeat in the human chromosome 22 contig 8 caused by wrong sequence assembly that has been corrected. The Genbank sequence of Arabidopsis thaliana chromosome III still contains a 5,452 base pairs fraction of the cloning vector pBACe3.6 at position 13,754,155. Four overlapping repeats found in chromosome IV are caused by a nine-fold tandem repeat of 3,259 base pairs that needs careful investigation. Such facts are generally discovered by chance since existing methods for sequence matching cannot simultaneously compare sequence data as large as necessary. The suffix tree approach requires too much memory. Although the program MUMMER by Delcher et al.  is based on a more space efficient suffix tree implementation which is also used in REPFIND by Kurtz and Schleiermacher , it cannot deal with more than 120 MB of sequence at a time using even 2 GB of RAM. The next better program VMATCH by Abouelhoda et al.  uses an enhanced suffix array. Its recent version can handle at most 250 MB of sequence using the same amount of memory. Other methods by Burkhardt et al. , Höhl et al.  and Lefebvre et al , also require at least 8 bytes of memory for each base pair to compare. However, we will soon need programs which are able to compare more base pairs of sequence than there are bytes of RAM. One such program is ClustDB  based on a partitioned suffix array method. It needs less than four hours to simultaneously compare 3.3 GB of human ESTs using a PC with 2 GB of RAM. This program was further improved by a novel algorithm for match extension with errors which is the subject of this paper.
Results and discussion
Quality of window-alignment
Histogram of excess errors reported by ClustDB
1 error difference:
2 number of cases:
3 length (kbp):
ClustDB outperforms VMATCH in speed and sensitivity
We applied ClustDB to find redundant sequences in a smaller set of 997 finished Medicago BACs downloaded from the NCBI (September 15th, 2005) in order to identify overlapping sequences and sequences which are contained in others. Consideration of both strands yields 1994 sequences which add up to about 220 MB. Using M = 100, W = 20 and K = 5, ClustDB takes 11:37 minutes to identify 510 complete sequence matches, i.e. those which identify overlapping BACs and those contained in others. Much shorter run times are obtained for larger values of M. For M = 1000 ClustDB takes only 6:34 minutes to derive 465 complete matches admitting 5 errors in each window of size 20. Hence, 45 complete matches do not include an exact match of length 1000. The calculations were performed on a Pentium 4 PC with 2 GB of RAM and 2.6 GHz processor speed.
On the same computer, VMATCH takes 16:40 minutes to find only 116 exact complete matches for M = 100 or 16:10 minutes to find only 66 exact complete matches with M = 1000. In this program M is called seed string length. Admitting at most 10 errors – the maximal error count allowed in VMATCH – it takes 17:08 minutes to derive 348 complete matches for M = 100 and 16:23 minutes to find 236 complete matches for M = 1000. Furthermore the two sets of complete matches derived by ClustDB contain 414 and 381 complete matches with at most 10 errors. VMATCH should find all of these matches but fails. For technical reasons it considers the nucleotide 'n' to mismatch all other nucleotides including itself while ClustDB takes the biologically more correct point of view and considers the letter 'n' to match all other nucleotides and finds more matches this way. Hence, ClustDB outperforms VMATCH in speed and sensitivity.
Runtimes for different applications of ClustDB to 1377 Medicago BACs and their complementary sequences (324 MB of sequence)
Testing ClustDB on TIGR's current Medicago BAC assembly
The website http://medicago.org/genome/contigviewer_data offers 9 BAC assembly files named contig_lg0.dat to contig_lg8.dat. They contain 407 chains of sequences claimed to overlap by more than 1000 nucleotides for each junction. The total number of sequences in these chains is 1377 and they contain 969 overlapping sequence pairs which form our test set for ClustDB. Of these 969 sequence pairs 799 (82%) were confirmed by application of ClustDB to the 1377 BACs and their complementary sequences (324 MB) using parameters M = 100, W = 100, K = 30, the complete match option, and reporting only extended matches of length greater than 1000. Interestingly, these are in fact all correctly published overlaps of complete sequences as our following study shows.
ClustDB was applied to the remaining 170 pairs with the complete match option switched off. The overlapping property could not even partly be confirmed for five pairs CT971491/CT961056, AC171618*/AC160842*, AC147960/CR931732, AC153162*/AC159662* and AC158173*/AC140022. The asterisk denotes working draft sequences which are incomplete and consist of a number of unordered sequence sections which must be considered separate sequences for a meaningful application of ClustDB. TIGR claims no confidence in the results published for these sequences. The two pairs of complete sequences CT971491/CT961056 and AC147960/CR931732 were studied using BLAST and no significant local alignments longer than 300 bp were found. Trusting BLAST, we are convinced that these two cases are no real overlaps. In another 12 cases no match extended until one of both sequence ends. But in all these cases at least one and mostly both sequences were working draft sequences or had the tag "sequencing in progress" in their GenBank LOCUS fields. For the same reason we did not consider another 133 pairs of BACs.
Twenty pairs of finished Medicago truncatula BACs with obvious sequencing errors detected by ClustDB
In three other cases (type 2), ClustDB detects one match reaching from the start of the overlap to shortly before its end missing 236, 414 and 409 nucleotides, respectively. Again, almost all errors occur in the last alignment window and hence, the tails of the upstream BACs should be studied. The overlap claimed by TIGR for the sequence pair AC142394/AC147435 splits into two sections (type 3). One section of length 15702 aligns badly with 7893 errors (about 50%) and is followed by a section of length 85901 that aligns perfectly with only 5 errors. This places serious doubts on the correctness of both BACs.
Match quality of overlaps between the BACs shown in Figure 4
We proved window alignment an efficient way to find long sections of similar sequences. Compared with traditional alignment, it is faster to calculate, reveals sequence sections of homogenous alignment quality, just such as expected for random errors, and also detects local systematic errors like sequence contaminations. Such inserts are often overlooked by optimizing global scores for long alignments only tuning parameters like penalties for mismatches and gaps. The case depicted in Figure 2 has an excellent global alignment score and still shows a severe local sequence matching problem that is important to detect. However, not only the quality of individual alignments but also the speed of simultaneous comparison of large set of sequences makes ClustDB an indispensable tool for genomic sequence analysis.
We showed that ClustDB outperforms VMATCH in comparing BAC size sequences mainly caused by an inappropriate match extension method and the high memory consumption of the latter program. Application of the software BLAT to our data was stopped after several days of endless computation. Note that BAC assembly is just one application of ClustDB. Our alignment concept is also beneficial for mRNA to cDNA comparison in order to confirm exons, introns and alternative splice sites. Alignments used in such contexts should tolerate sufficiently spaced single errors in larger numbers than dense blocks of errors. The program GenomeFlicer by Mielordt et al.  admits at most 2 errors in a window of length 20 in order to confirm genes and to distinguish NAGNAG acceptor isoforms . We also expect that ClustDB helps to study highly repetitive genes, a problem described especially challenging by Check . We developed ClustDB to play a major role in future genome wide comparisons of genes and currently work on specialized program versions for EST- and full-length cDNA matching, genome wide detection of alternative splicing as well as distributed parallel processing .
The key concept used in ClustDB  is a linear space representation of all left maximal sets of common substrings of a given length M, called substring-clusters. A cluster of identical substrings is called left maximal if at least two identical substrings in this cluster are preceded by different letters. Other clusters of common substrings need not be considered for sequence matching. The members of each cluster are given by sets of triplets (c, s, p) with the same value of c, called cluster number, s denotes sequence number and p denotes start position of the substring within sequence s. These triplets are stored in linear space and are quickly derived in approximately linear time based on a novel count sort method performed on the place. Next they are used to efficiently list pairs of left maximal matching substrings, and to simultaneously extend such pairs to maximum length as shown in . Let us here describe how ClustDB further extends such pairs to both sides until a given number of errors K is exceeded in a window of given size W. This window approach easily detects similar sequences, sequences contained in others and pairs of sequences which overlap.
In the program ClustDB all string comparison is done using a long sequence formed by concatenation of all individual sequences separated by dot characters used as end-of-sequence symbols. Hence, pairs of matching substrings are internally represented by triplets (p1, p2, n) where p1 <p2 are the start positions in the concatenated sequence and n is the length of the match. In order to avoid unnecessary match extensions with mismatches, we alternatively present the maximally extended exact matches by triplets (p, o, n) with p = p1 and offset o = p2 - p1 > 0. Then, after grouping all triplets with the same offset and sorting each group in increasing order of p, a maximally extended match allowing mismatches but no gaps is prone to contain the next not yet extended exact match that needs not be considered. The result is a shorter list of maximally extended pairwise matches with mismatches represented by quadruplets (p, o, n, e). The new integer e is the number of mismatches and forms an upper bound for the edit distance. Such extended match has at most K mismatches within each internal window of size W. The two boundary windows have K + 1 errors or reach end-of-sequence symbols.
For match extension with gaps, we construct an as long as possible virtual alignment that contains the considered match and has the property that each internal alignment window of size W has at most K errors using edit distance. This alignment is never stored during computation. Instead we only store and calculate the vectors (p1, e1, p2, e2, e, a) where p1, e1 and p2, e2 are the start and end positions of the extended match. The integer a stands for the length of the virtual alignment including gap symbols and is necessary for the calculation of the numbers of gaps g1 = a - e1 + p1 - 1 in substring 1 and g2 = a - e2 + p2 - 1 in substring 2, respectively. The number of mismatches follows from m = e - g1 - g2. On request, complete printouts of alignments are generated from stored lists of gap positions relative to p1 and p2. Each match is first extended to the left, than to the right which we will describe in more detail.
Overwrite the last 2W positions of both work arrays with 2W sequence characters beginning in sequence positions y1 and y2, respectively, and calculate an optimal alignment of these substrings. The length of the alignment may be greater than 2W if it contains gaps. An example for W = 6 and K = 3 is given in Figure 5. It shows under step 1 the contents of both work arrays and the alignment stored.
Copy from the aligned sequences the first W characters including gap symbols to the work array positions W + 1 to 2W and identify the sequence positions of the last copied characters. Then, copy subsequent W characters directly from the sequences to completely fill up both work arrays. Hence, part of the alignment is ignored and the last W characters of both work arrays are not gap symbols.
Count beginning in position T = 1 for all sliding windows of size W the alignment errors displayed in the two work arrays, stop with the first window that has K errors and update x1, y1 and x2, y2 to describe the sequence positions of this window. It is the last window in case of Figure 5. For T <W + 1 match extension terminates with the result obtained in the previous iteration since match length is not improved.
Now T is at least W + 1. If the work arrays have gap symbols in positions greater than T - W or if T < 2W + 1, then we move the content of the window beginning in position T - W to the start positions of the work arrays, update x1, y1 and x2, y2 and proceed with step (1). Otherwise a gap-free alignment of length 2W starts in position W + 1. We perform match extension without admitting gaps until a window with K+1 mismatch errors is found and start all over again.
Obvious modifications apply in case an end-of-sequence symbol occurs in step (1) and terminates match extension.
This heuristic method is fast and was observed to produce near to optimum alignments for highly conserved sequences. The optimal alignment calculated in step (1) uses gap penalty 2 and mismatch penalty 1 in order to minimize internal gaps and does not penalize end gaps. We have not yet optimized the setting of alignment parameters, window size and maximum number of errors per window. Since optimal alignments of short DNA sequences are rarely unique, the result of our match extensions also depends on the particular alignments found. We therefore work on a first improvement of the algorithm that, if possible, studies alternative optimal alignments for a longest possible match extension. Two other ways of improvement are realigning short overlaps of extended matches and joining neighboured matches.
But in spite of considerable potential for improvement our method already provides a close upper bound for the optimal number of errors which is important information if the error count is small and the match is long. Our match extension method cannot lead to a correct optimal alignment by expanding an exact match that is not part of it. We therefore often observe different exact matches leading to the same extended match with different numbers of errors and report the match with the smallest number of errors. However, the gains in alignment quality were observed to be minor compared to match length and the time it takes to generate the same extended match multiple times. We therefore do not extend seed matches which are completely contained in earlier derived extended matches.
Modes of letter comparison
ClustDB initially searches for clusters of exactly matching substrings of minimal length M using a count sort method that ignores all nucleotide letters other than 'a', 'c', 'g', 't' or the corresponding capital letters. All other letters like 'n' or 'N' are considered to mismatch any nucleotide letter including itself. However, subsequent pairwise match extension with or without gaps uses the full GenBank nucleotide letter alphabet and operates in two modes. By default, nucleotide letters are considered to match if they represent non-disjoint sets of nucleotides (relaxed comparison). While this method of comparison generates nice results in many cases, it also often produces long pairwise matches extending into large runs of n-letters used to represent missing sections of sequences. By switching off relaxed comparison, ClustDB extends pairwise matches considering different letters to mismatch whatever they stand for, a single nucleotide or set of nucleotides. Another option even considers lower case letters to mismatch their corresponding capital letters which allows excluding sequence sections from comparison without loss of sequence information.
Low complexity sequence problems
A typical substring-cluster caused by low complexity sequence
Handling of complementary sequences
Many problems like contig assembly require a simultaneous comparison of N sequences and their complementary sequences as well. In such a case ClustDB is applied to 2N sequences numbered 1,...,N for the direct strand sequences and N + 1,...,2N for the complementary sequences so that the complement of sequence number i receives the number N + i. In such a case most left maximal clusters of common substrings have redundant counterparts formed by the corresponding complementary substrings found in complementary sequences. Both clusters collapse to one for self complementary substrings.
Pair wise matches are derived for each pair of sequences in turn. This allows to use a considerable reduction of the maximal number of sequence pairs we need to consider. There are at most N(N - 1)/2 different pairs of direct strand sequences. Similarly, a pair formed by a direct strand sequence S1 and a complementary sequence S2c produces the same matches as the pair formed by S1c and S2 so that only N (N - 1)/2 pairs formed by a direct strand sequence and a complementary strand sequence must be considered. Hence, the maximum number of sequence pairs to study is N(N - 1) and much less than N(2N - 1), the number of different pairs formed from 2N sequences.
Output of ClustDB
ClustDB outputs different tables depending on the option selected. We can ask for maximally extended exact matches, matches with mismatches, only, and matches with mismatches and gaps. It is also possible to set a lower bound for the length of extended matches. The program package VMATCH first introduced the complete match option. It reduces output to only those matches which prove a complete sequence to be contained in another. We extended this concept to also include matches that prove sequences to overlap. Hence, by our definition, a complete match extends to both sides until the end of at least one sequence. Each line of output starts with a match kind symbol that classifies 6 types of matches.
== sequence 1 matches sequences 2 completely
<< sequence 1 is contained in sequence 2
> sequence 1 extends sequence 2 downstream
- incomplete match
If required, ClustDB also stores on disc a list of gap positions for each extended match so that all window alignments are easy to reproduce. Part of a corresponding output is seen in Figure 1. By default, output is reduced to only those lines of the alignments which display errors, since for a typical application of ClustDB, the number of extended matches is large and many matches are very long. Requesting to see all complete alignments is only recommended for repeated runs of the program if there is a clear idea of the amount of output implied.
Availability of the software
ClustDB is freely available for academic use and can be downloaded from the link given below. The version is provided for the Linux operating system and has been tested on Redhat Linux 9.0. Other versions are available upon request.
We thank Dr. Uwe Schöneberg for carefully proof-reading this manuscript. Our work was supported by the Bundesministerium für Bildung und Forschung (BMBF).
This article has been published as part of BMC Bioinformatics Volume 8, Supplement 5, 2007: Articles selected from posters presented at the Tenth Annual International Conference on Research in Computational Biology. The full contents of the supplement are available online at http://www.biomedcentral.com/1471-2105/8?issue=S5.
- Kent W: BLAT-The BLAST-Like Alignment Tool. Genome Res 2002, 12(4):656–664. 10.1101/gr.229202. Article published online before March 2002PubMed CentralView ArticlePubMedGoogle Scholar
- Sorek R, Safer M: A novel algorithm for computational identification of contaminated EST libraries. Nucleic Acids Research 2003, 31(3):1067–1074. 10.1093/nar/gkg170PubMed CentralView ArticlePubMedGoogle Scholar
- Kurtz S, Choudhuri J, E O, Schleiermacher C, Stoye GRJ: REPuter: the manifold application of repeat analysis on a genomic scale. Nucleic Acids Research 2001, 29: 4633–4642. 10.1093/nar/29.22.4633PubMed CentralView ArticlePubMedGoogle Scholar
- Delcher A, Philippy A, J C, SL S: Fast algorithms for large scale genome alignment and comparison. Nucleic Acids Research 2002., 30(11):
- Kurtz S, Schleiermacher C: REPuter: fast computation of maximal repeats in complete genomes. Bioinformatics 1999, 15(5):426–427. 10.1093/bioinformatics/15.5.426View ArticlePubMedGoogle Scholar
- Abouelhoda M, S K, Ohlebusch E: Replacing Suffix Trees with Enhanced Suffix Arrays. Journal of Discrete Algorithms 2004, 2: 53–86. 10.1016/S1570-8667(03)00065-0View ArticleGoogle Scholar
- Burkhardt S, Crauser A, Farragina P, Lenhof H, Vingron M: q-gram based searching using a suffix array (quasar). Int Conf RECOMB, Lyon, April 1999 1999.Google Scholar
- Höhl M, Kurtz S, Ohlebush E: Efficient multiple genome alignment. Bioinformatics 2002, 18(Suppl 1):312–320.View ArticleGoogle Scholar
- Lefebvre A, Lecroq T, Dauchel H, Alexandre J: FORRepeats: detects repeats on entire chromosoms and between genomes. Bioinformatics 2003, 19(3):319–326. 10.1093/bioinformatics/btf843View ArticlePubMedGoogle Scholar
- Kleffe J, Möller F, Wittig B: ClustDB: A high-performance tool for large scale sequence matching. Proceedings of DEXA, Krakau, Sep 4–8, 2006 2006.Google Scholar
- Warburton PE, Giordano J, Cheung F, Gelfand Y, Benson G: Inverted repeat structure of the human genome: the X-chromosome contains a preponderance of large, highly homologous inverted repeats that contain testes genes. Genome Res 2004, 14: 1861–1869. 10.1101/gr.2542904PubMed CentralView ArticlePubMedGoogle Scholar
- Mielordt S, Grosse I, Kleffe J: Data structures for genome annotation, alternative splicing, and validation. Lecture Notes in Computer Science – Proceedings of DILS06, Hinxton July 20–22, 2006 2006.Google Scholar
- Hiller M, Huse K, Szafranski K, Jahn N, Hampe J, Schreiber S, Backofen R, Platzer M: Widespread occurrence of alternative splicing at NAGNAG acceptors contributes to proteom plasticity. Nature Genetics 2004, 36: 1255–1257. 10.1038/ng1469View ArticlePubMedGoogle Scholar
- Check E: Mix and match: the hunt for what makes us human. Nature 2006, 443(7):8–9. 10.1038/443008aView ArticlePubMedGoogle Scholar
- Hamborg T, Kleffe J: MPI-ClustDB: A fast String Matching Strategy Utilizing Parallel Computing. Lecture Notes in Informatics – Proceedings of GCB 2006, Tuebingen, September 20–22, 2006 2006.Google Scholar
This article is published under license to BioMed Central Ltd. This is an open access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.