RefSelect: a reference sequence selection algorithm for planted (l, d) motif search

Background The planted (l, d) motif search (PMS) is an important yet challenging problem in computational biology. Pattern-driven PMS algorithms usually use k out of t input sequences as reference sequences to generate candidate motifs, and they can find all the (l, d) motifs in the input sequences. However, most of them simply take the first k sequences in the input as reference sequences without elaborate selection processes, and thus they may exhibit sharp fluctuations in running time, especially for large alphabets. Results In this paper, we build the reference sequence selection problem and propose a method named RefSelect to quickly solve it by evaluating the number of candidate motifs for the reference sequences. RefSelect can bring a practical time improvement of the state-of-the-art pattern-driven PMS algorithms. Experimental results show that RefSelect (1) makes the tested algorithms solve the PMS problem steadily in an efficient way, (2) particularly, makes them achieve a speedup of up to about 100× on the protein data, and (3) is also suitable for large data sets which contain hundreds or more sequences. Conclusions The proposed algorithm RefSelect can be used to solve the problem that many pattern-driven PMS algorithms present execution time instability. RefSelect requires a small amount of storage space and is capable of selecting reference sequences efficiently and effectively. Also, the parallel version of RefSelect is provided for handling large data sets.


Background
Motif discovery, as a main means to locate conserved fragments in biological sequences, is a fundamental problem in computational biology. The conserved fragments usually have special biological significance. For example, transcription factor binding sites in DNA sequences [1,2] play a key role in gene expression regulation and they usually range from 5 to 25 base pairs; short protein sequence signatures [3,4], which usually range from 10 to 36 residues, can be used in identifying potential interaction sites of proteins.
The planted (l, d) motif search (PMS) [5] is a famous formulation for motif discovery: given a data set D = {s 1 , s 2 , …, s t } with t n-length sequences over an alphabet Σ, q satisfying 0 < q ≤ t, and l and d satisfying 0 ≤ d < l < n, the goal is to find one or more l-length strings m such that m occurs in at least q sequences in D with up to d mismatches. The string m is called a (l, d) motif, and each occurrence of m is called a motif instance. Finding all (l, d) motifs present in the input sequences is NP-complete [6].
In the PMS problem, the value of q implies the corresponding sequence model of motif discovery (i.e., the distribution of motif occurrences in the input sequences). The usual sequence models include OOPS, ZOOPS and TCM [7], representing that each input sequence contains one occurrence, zero or one occurrence and zero or more occurrences, respectively. When q = t and 0 < q < t, the PMS problem corresponds to the OOPS and ZOOPS or TCM sequence models, respectively.
There have been numerous motif discovery algorithms [8,9]. They are either approximate or exact, based on whether the algorithm can always find all motifs or the optimum motif. The approximate algorithms usually adopt probability analysis and statistical methods. For instance, the two classical algorithms MEME [10] and Gibbs Sampling [11] identify motifs by using expectation maximization and Gibbs sampling techniques, respectively. In general, these approximate algorithms can solve the problem in a short time but cannot guarantee global optimum.
In this paper, we mainly focus on exact motif discovery algorithms, which can find all (l, d) motifs by traversing the whole search space. The main indicator to assess exact algorithms is time performance, and researchers usually compare exact algorithms on the challenging PMS problem instances, for which the expected number of random (l, d) motifs present in the sequences is more than 1 [12]. For the exact algorithms proposed in earlier years, such as WINNOWER [5], DPCFG [13] and RecMotif [14], their search space is composed of (nl + 1) t possible alignments of motif instances. In recent years, the exact algorithms verify all the l-length patterns in the O(|∑| l ) search space, and then output the patterns with motif property; we call them the pattern-driven PMS algorithms [15][16][17][18][19][20][21][22][23][24].
The pattern-driven PMS algorithms have better time performance than other exact algorithms so far in identifying both short motifs and long motifs with weak signal. Their basic idea is to generate candidate motifs by using several reference sequences in the input, and then verify each candidate motif one by one. Specifically, they generate candidate motifs by using all possible h-tuple T = (x 1 , x 2 … x h ) composed of h l-length strings coming from h distinct reference sequences. In existing pattern-driven PMS algorithms, h is 1 for PMSP [15] and PMSPrune [16]; h is 2 for StemFinder [17], PairMotif [18], qPMS7 [19] and TravStrR [20]; h is 3 for iTriplet [21] and PMS5 [22]; for PMS8 [23] and qPMS9 [24], h is greater than or equal to 3 and self-adaptive in dealing with different PMS problem instances. Moreover, these algorithms use k = tq + h reference sequences to generate candidate motifs, ensuring that there exists at least one h-tuple T so that each l-length string in T is a motif instance.
Although pattern-driven PMS algorithms outperform other exact algorithms, most of them use the first k sequences in the input as reference sequences, without considering the effect of different reference sequences on time performance. In this study we found that given a data set, different reference sequences may lead to quite different number of candidate motifs, especially for large alphabets. So, in dealing with different inputs with the same scale, the pattern-driven PMS algorithms may exhibit sharp fluctuations in running time. For instance, we randomly generate multiple groups of data sets with |∑| = 20, t = 20, q = 20 and n = 600 following the method described in the results and discussion section. When solving the (19,9) problem instance, qPMS7 sometimes consumes 6.1 minutes, but sometimes over 48 hours. Some other pattern-driven PMS algorithms like TravStrR and PMS8, suffer from the same problem (see Supplement 1 for more examples).
To solve this problem, we propose a method named RefSelect to quickly select reference sequences that generate a small number of candidate motifs. RefSelect can bring a practical time improvement of the state-of-theart pattern-driven PMS algorithms, without doing any modifications to them.

Problem description and notations
Reference sequence selection problem Given a data set D = {s 1 , s 2 , …, s t } over an alphabet Σ that contains t sequences of length n, the (l, d) problem instance (0 ≤ d < l < n) and the number of reference sequences k (1 < k < t) required by the pattern-driven PMS algorithms, the task is to select k reference sequences from D to form the reference sequence set D', such that when using D' the pattern-driven PMS algorithms can efficiently solve the (l, d) problem instance without sharp fluctuations in running time.
In the reference sequence selection problem the value of provided k should be greater than 1. If k is 1, it means that the candidate motifs will be generated from multiple single l-mers; in this case, no matter how we select a reference sequence, the number of generated candidate motifs is fixed. In fact, k is greater than 1 for all the efficient and recently proposed pattern-driven PMS algorithms.
We evaluate a reference sequence selection algorithm from two perspectives. One is the time performance. The time cost of the reference sequence selection algorithm should be as small as possible because it is a preprocessing for pattern-driven PMS algorithms. It will be meaningless if it costs too much time to select reference sequences. The other is validity, namely whether the reference sequence selection algorithm brings a good speedup for pattern-driven PMS algorithms. The speedup is the ratio of T 1 to T rs + T 2 , where T 1 is the running time of the pattern-driven PMS algorithms on the input sequences of original order, T rs is the running time of the reference sequence selection algorithm, and T 2 is the running time of the pattern-driven PMS algorithms on the input sequences of new order generated by the reference sequence selection algorithm. Table 1 summarizes the notations used in this paper. Notice that, a sequence specially refers to an n-length string in a data set, and an l-mer refers to a short string of length l (l < n).

Overview of RefSelect
We introduce why and how to select reference sequences for the pattern-driven PMS algorithms. Let us consider the following two observations, which indicate how the Hamming distance between pairs of l-mers affects the number of candidate motifs. Examples and detailed discussion for the two observations are given in the results and discussion section. Observation 1. For two l-mers x and x', the smaller their Hamming distance d H (x, x'), the larger the number of their common candidate motifs |M d (x, x')|.
Observation 2. For a tuple T of h l-mers, when it contains pairs of l-mers with a relatively small Hamming distance, it generates a relatively large number of candidate motifs.
Based on the two observations, different reference sequences may lead to different number of candidate motifs. The pattern-driven PMS algorithms utilize all tuples of h l-mers in k (0 < h ≤ k) reference sequences to generate candidate motifs. Once there are relatively more pairs of l-mers with small Hamming distance in these h-tuples, more candidate motifs will be generated.
Since the time performance of pattern-driven PMS algorithms mainly depends on the number of generated candidate motifs, we should select the reference sequence set generating a small number of candidate motifs. For example, as shown in Fig. 1, assume the input sequence set D is {s 1 , s 2 , s 3 , s 4 } where each sequence has two l-mers and we select k = 3 reference sequences from D. In the figure, the thicker the dotted line, the more candidate motifs are generated by the associated two l-mers. Obviously, {s 2 , s 3 , s 4 } is the optimal reference sequence set.
Naturally, we select reference sequences by evaluating the number of generated candidate motifs, ensuring the selected reference sequences generate a small number of candidate motifs. When we evaluate the number of candidate motifs generated from a tuple T of h l-mers, it is difficult to directly compute the number of common candidate motifs shared by all the h l-mers in T, denoted by N 1 . An alternative way is to compute the sum of the number of common candidate motifs shared by each pair of l-mers in T, denoted by N 2 = Σ|M d (x i , x j )| for 1 ≤ i < j ≤ h. As shown in Fig. 5, N 1 and N 2 have the consistent tendency with the variation of the Hamming distance between the pairs of l-mers in T.
Furthermore, we use (1) and (2) to evaluate N r (D'), the number of candidate motifs generated from the reference sequence set D'. It is defined as the sum of the number of common candidate motifs shared by each pair of l-mers in D' (i.e., in every two sequences in D').
Our method of selecting reference sequences includes two steps. The first step is to compute the number of candidate motifs generated from every two sequences in D, in Table 1 Notations used in this paper Notation Explanation |x| The length of a string, the size of a set, or the number of elements in a matrix.

D, D'
D is the set of input sequences. D' is the set of reference sequences. D = {s 1 , s 2 , …, s t } and D' = {s r1 , s r2 , …, s rk }, satisfying D' ⊂ D. t The number of sequences in the input sequence set D, namely |D| = t. k The number of required reference sequences, namely |D'| = k.
n The length of each input sequence.
x ∈ l s The string x is an l-length substring of the sequence s. In other words, x is an l-mer in the sequence s.

s[i]
The ith character in the string s.

s[i…j]
A substring of the string s starting from the ith position to the jth position.
The Hamming distance between two strings x and x' of the same length.
The common candidate motifs of two l-mers x and x'.
The number of candidate motifs generated from the reference sequences set D', calculated by (1).
The number of candidate motifs generated from two sequences s i and s j , calculated by (2).
The minimum value between two integers i and j.
The similarity of two sequences s i and s j .
order to quickly evaluate the number of candidate motifs generated from the specified k reference sequences in the next step. The second step is to select k sequences from D to form the reference sequence set D' such that the number of candidate motifs generated from D' is as small as possible. In the following, we describe the two steps in detail.
Step 1: computing the number of candidate motifs We compute the number of candidate motifs generated from every two sequences s i and s j in D according to (2). For an l-mer x in s i and an l-mer x' in s j , the number of their common candidate motifs |M d (x, x')| depends on their Hamming distance d H (x, x') [18]. The details about how to compute |M d (x, x')| are described in [18]. In implementing RefSelect, we store the values of Thus, the core operation of (2) is to compute the Hamming distance between every two l-mers x ∈ l s i and x' ∈ l s j . For any two sequences of length n, we have O(n 2 ) pairs of l-mers. A simple method is to traverse all these pairs of l-mers; for each pair of l-mers x and x', the Hamming distance can be computed in O(l) time by comparing the characters We introduce a more efficient method to compute the Hamming distance between every pair of l-mers in s i and s j . We fill an n × n matrix M, where the element in row a (1 ≤ a ≤ n) and column where both a and b range from 0 to n. With the matrix M, we use (4) to compute the Hamming distance between a pair of l-mers str 1 ' and str 2 ', where str 1 ' = s i [al + 1…a] and str 2 ' = s j [bl + 1…b] are the l-mers at the position a (a ≥ l) of s i and the pos- Our method is mainly to fill the matrix M. That is, we need to compute n 2 elements one by one for any two nlength sequences s i and s j . In computing each element M[a, b] by (3) in O(1) time, we simultaneously compute the Hamming distance between the l-mer at position a (a ≥ l) of s i and that at position b (b ≥ l) of s j by (4) in O(1) time. Therefore, the time complexity of computing the Hamming distance for all pairs of l-mers in two sequences is reduced to O(n 2 ). An example of selecting reference sequences. In this example, we select three reference sequences from four input sequences. Each sequence contains two l-mers. A thick line indicates that more candidate motifs are generated by the associated two l-mers Step 2: selecting reference sequences After getting the number of candidate motifs generated from every two sequences in D, we can evaluate the number of candidate motifs generated from a set of reference sequences according to (1). In this section, we introduce how to select a set of reference sequences that generates a small number of candidate motifs.
First, let us consider the exhaustive search strategy. For the data set D consisting of t sequences, after evaluating the number of candidate motifs for every possible k sequences in D, the exhaustive search regards the k sequences corresponding to the minimum number of candidate motifs as the reference sequences. Its time complexity is as follows.
Obviously, the running time of the exhaustive search grows dramatically with the increase of the number of input sequences t and the number of selected reference sequences k. A simple experiment can show that the exhaustive search is too time-consuming for large input: we set |Σ| = 4, n = 200, q = t = 200 and k = t × 5 % = 10, and the running time of the exhaustive search exceeds one day on personal computers.
In order to quickly select reference sequences, we convert the problem to graph clustering. The t sequences in D are taken as t nodes in a graph. The similarity between two nodes s i and s j is related to the number of candidate motifs generated from s i and s j (i.e., N r (s i , s j )). We hope that the nodes corresponding to the reference sequences with small number of candidate motifs form a dense subgraph, and they belong to the same cluster after graph clustering. We use the MCL algorithm [25] to complete clustering, and set the inflation parameter as 1.8 following [26]. We describe the details involved in clustering as follows.

Similarity measure
We design the similarity of two nodes (sequences) s i and s j based on N r (s i , s j ). Simultaneously, we consider the following two factors.
First, we further increase the effect of the pairs of l-mers in s i and s j with small Hamming distance on the total number of candidate motifs generated from s i and s j . By doing this, it is helpful for the clustering process to distinguish different reference sequence sets that lead to different number of candidate motifs. Specifically, we use (5) instead of (2) to evaluate the number of candidate motifs generated from two sequences s i and s j .
Second, we aim to put a set of sequences D' to the same cluster such that every two sequences s i and s j in D' generate a small number of candidate motifs. So, we should ensure that s i and s j have a larger similarity when they generate a smaller number of candidate motifs. Finally, we compute the similarity of s i and s j as follows:

Cluster refinement
The clustering process may produce more than one cluster, and there may not be exact k nodes in each cluster. We refine each obtained cluster C in order to get a set of k reference sequences. Then, we sort the sets of reference sequences and output the set with the highest score.
For the cluster C with only one node, we take it as an invalid cluster, since the node in C has a low similarity with other nodes. For the cluster C with two or more nodes, it corresponds to three cases: (a) there are exact k nodes in C; (b) there are more than k nodes in C; (c) there are less than k nodes in C. For Case (a), we can get the reference sequence set D' directly by using the k sequences in C. Next, we introduce how to refine C under Cases (b) and (c).
For Case (b), we use greedy strategy to select k sequences from C (|C| > k) to form D'. First, we initialize D' with {s a , s b } such that sim(s a , s b ) = max{sim(s i , s j )} for all s i , s j ∈ C and s i ≠ s j . Then, we repeatedly choose a node s r satisfying (7) from C − D' and add it to D' until |D'| = k.
For Case (c), we use the similar method to choose k − |C| nodes from D − C, and add them to C to form D'. First, D' is initialized with C. Then, we repeatedly choose a node s r satisfying (8) from D − D' and add it to D' until |D'| = k.

Figures 3 and 4 show examples under
Case (b) with k = 3 and Case (c) with k = 4, respectively. Differences between the two cases are: in Case (b), we get D' by selecting reference sequences (nodes) from the sub-graph corresponding to the cluster C; while in Case (c), we get D' by selecting reference sequences (nodes) from the whole graph and adding them to C.
We describe how to refine a cluster C in Algorithm 1. Because the process that we select reference sequences by using greedy strategy is similar to the Prim algorithm for computing minimum spanning tree, the time complexity of Algorithm 1 is O(|C| 2 lg|C|) and O((t − |C|) 2 lg(t − |C|)) under Case (b) and Case (c), respectively.
After cluster refinement, if we obtain more than one reference sequence set D', we score each D' by (9), and then output the D' with the highest score.

Whole algorithm
This section gives the whole algorithm of RefSelect.
In line 1 of the pseudocode, we initialize D' with an empty set. Lines 2 to 5, corresponding to the first step of RefSelect, compute the similarity of any two nodes (sequences). The core operation of this step is to compute the Hamming distance from all l-mers in s i to all l-mers in s j in O(n 2 ) time, for any two sequences s i and s j in D. Therefore, the time complexity of this step is: Lines 6 to 10, corresponding to the second step of RefSelect, cluster the t sequences in D by using the MCL algorithm and refine each obtained cluster. The time complexity of clustering is O(t 3 ). The time complexity of refining clusters is negligible with respect to the time complexity of the first step. So, the time complexity of RefSelect is: In executing RefSelect, we need O(tn) space to store the input sequence set D, O(n 2 ) space to store the matrix M for computing Hamming distance, and O(t 2 ) space to store the similarity matrix of t input sequences. So, the space complexity of RefSelect is O(tn + n 2 + t 2 ).

Parallel implementation
To efficiently deal with large data sets, we can further accelerate RefSelect by using parallel processing. RefSelect consists of two steps, and we mainly use parallel processing for the first step. The reasons are (1) the first step is the bottleneck of the whole RefSelect algorithm in running time as shown in Table 6, and (2) the first step is easy to parallelize, because it repeatedly calculates the number of candidate motifs generated from two sequences s i and s j in D and each calculation is independent of the others.
We implement the parallel version of RefSelect by using OpenMP [27,28], which provides a flexible programming model for shared memory architectures and allows to add parallelism into serial codes easily by using one or several OpenMP directives. The pseudocode is shown in Algorithm 3, where we add an OpenMP "for" directive before the inner iterations of the first step to split parallel iteration spaces across threads. The reason why we add the directive before the inner iterations (line 4) rather than the outer iterations (line 2) is for the consideration of load balancing among threads. Note that, the number of inner iterations is not fixed for each outer iteration. If we add the directive before the outer iterations, the smaller the value of i, the more computational work will be needed by the thread processing the ith outer iteration.

Results and discussion
Analysis of effect of Hamming distance on candidate motif number First, we consider the case of two l-mers x and x', and analyze the effect of their Hamming distance d H (x, x') on the number of their common candidate motifs |M d (x, x')|. Tables 2 and 3 give the values of |M d (x, x')| with d H (x, x') varying from 0 to 2d under the DNA and protein data, respectively. In both tables, the values are obtained by using two challenging PMS problem instances. We can find that |M d (x, x')| increases with the decrease of d H (x, x') for both the DNA and protein data.
Second, we consider the case of h (h > 2) l-mers containing pairs of l-mers with different Hamming distance, and analyze the effect of Hamming distance on the number of common candidate motifs shared by the h l-mers. In our example, we set h as 3 and the three l-mers x 1 , x 2 and x 3 can form three pairs of l-mers; then, we fix d H (x 1 , x 2 ) = 2d − 2 and vary d H ' = (d H (x 1 , x 3 ) + d H (x 2 , x 3 ))/2 from 2d − 2 to 2d − 7. Figure 5(a) and (b) give the tendency of the number of common candidate motifs |M d (x 1 , x 2 , x 3 )| in contact with the decrease of d H ' on (19,7) problem instance for the DNA data and (19,9) problem instance for the protein data, respectively. The y-axis is in logscale. We can see that no matter for the DNA or protein data, |M d (x 1 , x 2 , x 3 )| increases with the decrease of d H '. In other words, when h (h > 2) l-mers contain some pairs of l-mers with a relatively small Hamming distance, they generate a relatively large number of candidate motifs. Also, the tendency of |M d '(x 1 , Fig. 5. Both |M d '(x 1 , x 2 , x 3 )| and |M d (x 1 , x 2 , x 3 )| increase with the decrease of d H ', namely they have the consistent tendency.
In addition, Tables 2 and 3 also give the probability that the Hamming distance between two random l-mers x and x' is i (0 ≤ i ≤ 2d), denoted by p i and calculated by      (10). As seen from the tables, p i decreases with the decrease of the Hamming distance i.
For two n-length sequences s i and s j , let E i denote the expected number of the pair of l-mers x ∈ l s i and x' ∈ l s j with d H (x, x') = i. It is calculated by (11). The bold values in Tables 2 and 3 indicate that E i is less than 1 in the case of n = 600.
Although they rarely occur in two sequences, some pairs of l-mers with E i < 1 are usually contained in the whole data set. The reasons are: first, the whole data set can form multiple pairs of sequences, which increases the probability of the occurrence of the pairs of l-mers with Hamming distance i; second, the conservation of motifs makes some highly similar motif instances form some pairs of l-mers with E i < 1.
From the tables, when E i is less than 1, the value of |M d (x, x')| is relatively large, especially for the protein data. Thus, the more pairs of l-mers with E i < 1 in the reference sequence set, the more candidate motifs generated by the algorithms.

Results on practical time improvement of PMS algorithms
In this section we check the validity of RefSelect as follows. First, we use RefSelect to select k reference sequences from the given t input sequences, and adjust the order of the t input sequences by preposing the k sequences; RefSelect is implemented in C++ and its running time is denoted by T rs . Second, we test pattern-driven PMS algorithms on the input sequences of original order and that of new order, obtaining the running time T 1 and T 2 , respectively. Finally, we compare T 1 with T rs + T 2 .
Three pattern-driven PMS algorithms qPMS7 [19], TravStrR [20] and PMS8 [23] are chosen to participate in the test. They are all newly proposed algorithms and outperform the previous exact algorithms on challenging instances. Notice that qPMS9 [24] is also a newly proposed PMS algorithm with good time performance; we do not choose it as a tested algorithm and related discussion is given in the applicability of RefSelect section. All the tested algorithms are executed on a 2.67 GHz single core and a 4 Gbyte Memory, except for PMS8, which is executed on a 16-core platform in solving the (21,10) and (23,11) instances of the protein data.
In the experiments, we generate data sets following [5]. First, we randomly generate t sequences of length n and a motif m of length l, and randomly choose q (0 < q ≤ t) out of the t sequences; then, for each of the q sequences, we generate a random motif instance m' that differs from m in at most d positions, and implant m' into a random position of the sequence. For each specific test instance, we generate five data sets to get an average result.
First, we fix t = 20, n = 600 and q = 20, and give in Tables 4  and 5 the results on challenging instances of the protein and DNA data, respectively. For qPMS7 and TravStrR, k is set as 2, while for PMS8 k is set dynamically under different (l, d) instances according to [23]. From this experiment, we find that: (1)The running time of RefSelect on each of these data sets is less than one second, which is nearly negligible and not listed in Tables 4 and 5.
(2)RefSelect can make the tested algorithms solve the PMS problem steadily in an efficient way. For example, for the (19,9) problem instance in Table 4, the minimum and maximum running time of qPMS7 are reduced to 140.00s and 287.00s from 820.00s and 37121.00s after using the reference sequences selected by RefSelect. (3)The speedup on the protein data is significantly larger than that on the DNA data. We give the explanation by using Tables 2 and 3. The fact that Pattern-driven PMS algorithms sometimes show poor performance is mainly caused by the pairs of lmers with E i < 1 in the reference sequences; these lmers can generate more candidate motifs. The larger the difference between the number of candidate motifs for E i < 1 and that for E i ≥ 1, the larger speedup can be achieved. As can be seen from Tables 2 and  3, the difference on the protein data (large alphabet) is significantly larger than that on the DNA data (small alphabet). (4)Larger speedup is achieved on larger (l, d) instances for the protein data. This can also be explained by E i . That is, as shown in Tables 2 and 3, the difference between the number of candidate motifs for E i < 1 and that for E i ≥ 1 increases with the increase of l and d.
Second, we discuss the case of q < t by fixing |Σ| = 20 (protein data), t = 20 and n = 600. In the above three algorithms, we only choose qPMS7 as the tested algorithm because PMS8 cannot solve the PMS problem with q < t and TravStrR usually quits unexpectedly in our test environment. We select tq + 2 reference sequences for qPMS7, and test it by using the same (l, d) instances with [19]. On the one hand, we set q as 15, and test qPMS7 on different (l, d) instances; as shown in Fig. 6(a), RefSelect makes qPMS7 perform better and the speedup increases with the increase of l and d. On the other hand, we fix (l, d) = (19,8) and test qPMS7 by varying q from 10 to 19; as shown in Fig. 6(b), RefSelect can effectively accelerate qPMS7 under different q.
Finally, we test the effect of the sequence length n on the speedup brought by RefSelect for existing algorithms. In the experiment, we fix |Σ| = 4 (DNA data) and q = t = 20, and vary n from 100 to 500; the tested algorithm is qPMS7 and PMS problem instances are (21,8) and (23,9). The results are shown in Fig. 7. Overall, the speedup increases with the decrease of n. This is because, according to (11) and Table 2, the smaller the value of n, the larger the difference between the number of candidate motifs for E i < 1 and that for E i ≥ 1.
The fact that RefSelect works better for short input sequences makes sense to motif discovery in next-generation or high-throughput sequencing data sets, such as ChIPchip [29] and ChIP-seq [30] data sets. These data sets have a better resolution for containing motifs than the traditional promoter sequences. For example, the length of each sequence in ChIP-seq data sets is usually 200 base pairs, while the length of a promoter sequence is about 1000 base pairs. Therefore, RefSelect can bring a better practical time improvement of the pattern-driven PMS algorithms on the ChIP-seq data sets than that on the traditional promoter sequences.

Assessment of RefSelect on large data sets
All experiments involved in the previous section focus on the data sets of small scale, namely the number of input sequences t is small. In recent years, with the rapid development of high-throughput technologies, which allows genome-wide identification of motifs, the data sets such as ChIP-seq [30] contain hundreds or more sequences. Thus, it is necessary to further assess the time performance and validity of RefSelect on large data sets. First, we make the following settings in the experiment: set the maximum value of t as 600, as the ChIPtailored version of MEME can effectively identify motifs by using 600 sequences randomly selected from the whole ChIP-seq data sets [31]; set k as 5 % × t, as most of the sequences in ChIP-seq data sets contain motif instances; set the sequence length n as 200, as the resolution that ChIP-seq sequences contain motifs is higher than that for traditional promoter sequences [9].
Since there is not an exact algorithm that can efficiently deal with large data sets, we assess the validity of RefSelect as follows. Let N original denote the number of candidate motifs generated from the first k sequences in the original input sequences, and N improved denote the number of candidate motifs generated from the k reference sequences selected by RefSelect. Then, we compute N original /N improved . A larger N original /N improved indicates more candidate motifs can be reduced.
On the above basis, we get the running time of RefSelect and N original /N improved on both the DNA and protein data sets, by varying t from 50 to 600. From the results shown in Table 6, we can find that: (1) RefSelect can quickly select reference sequences from these data sets, and its running time is independent of the alphabet size; (2) the running time of RefSelect increases with the number of input sequences t and exceeds one minute when tackling the task of t = 600; (3) RefSelect can still reduce the generated candidate motifs, especially for the protein data (large alphabet). Besides the running time of the whole RefSelect algorithm, we also list the running time of the first step of RefSelect, which shows Fig. 7 The effect of sequence length on the speedup for the DNA data. This figure shows the effect of sequence length on the speedup for the DNA data. We fix |Σ| = 4 and q = t = 20, and vary the sequence length n from 100 to 500. The tested algorithm is qPMS7 and PMS problem instances are (21,8) and (23,9) Fig. 6 The speedup brought by RefSelect for qPMS7 in the case of q < t. This figure shows the speedup brought by RefSelect for qPMS7 in the case of q < t. a we fix q = 15 and vary (l, d) from (11,4) to (21,9). b we fix (l, d) = (19,8) and vary q from 10 to 19 that the first step is the bottleneck of the whole RefSelect algorithm.
Second, we test the parallel version of RefSelect. It is pretty common that a ChIP-seq data sets contains more than one thousand sequences, and parallel processing is a good choice in this case. In the experiment, we use the protein data sets with k = 5 % × t and n = 200. We give the running time in Table 7 by varying t from 200 to 1600 and the number of threads from 1 to 8. We can find that the acceleration of RefSelect through parallel processing is obvious, and the speedup is almost linearly proportional to the number of threads.

Applicability of RefSelect
For the proper use of RefSelect, we summarize the applicability of RefSelect as follows.
(1)RefSelect can accelerate such pattern-driven PMS algorithms that use random or the first k ≥ 2 sequences in the input as reference sequences to generate candidate motifs. For the efficient and recently proposed PMS algorithms, RefSelect is applicable for qPMS7, TravStrR and PMS8, but not for qPMS9, which does not use fixed k reference sequences to obtain h-tuples.
(2)RefSelect can deal with large data sets containing hundreds or even more sequences. (3)The speedup brought by RefSelect for PMS algorithms is affected by the alphabet size. The larger the alphabet size, the larger the speedup. (4)The speedup brought by RefSelect for PMS algorithms is also affected by the sequence length n, which increases with the decrease of n. (5)RefSelect works better on the challenging instances with large l and d. For the challenging instances with small l and d, however, it is not necessary to use RefSelect, for they can be quickly solved by existing PMS algorithms.
Moreover, it is necessary to declare the following two points. First, the instability of the time performance is not reported in the previous literatures [19,20,23]. This is because we find that in their experimental data, the implanted motif instances differ from the motif in exact d positions. In this case, the probability of containing pairs of l-mers with E i < 1 in the reference sequences is small, and accordingly the number of generated candidate motifs is also small. But it should be pointed out that, in reality motif instances differ from the motif in at most d positions, which leads to the execution time instability for some of the existing algorithms.
Second, although RefSelect is not applicable for qPMS9, which can solve challenging instances with larger l and d than previous algorithms, our research is still valuable. The reason is that qPMS9 cannot be used as a substitute for other PMS algorithms; we found in the experiments that qPMS9 sometimes exits unexpectedly with an out of memory error. Particularly, this phenomenon becomes frequent in dealing with challenging PMS instances of large (l, d) such as (l, d) = (21, 10) and (23,11).

Conclusions
We build the reference sequence selection problem and propose a method named RefSelect to select reference  sequences for the pattern-driven PMS algorithms, in order to solve the problem that many pattern-driven PMS algorithms present execution time instability. RefSelect requires a small amount of storage space and is capable of selecting reference sequences efficiently and effectively. Also, the parallel version of RefSelect is provided for handling large data sets. For the state-of-the-art algorithms qPMS7, TravStrR and PMS8, RefSelect enables them steadily solve PMS problems in an efficient way without doing any modification to these algorithms. Our work in this paper only focuses on selecting reference sequences for the pattern-driven PMS algorithms. It is recommended that further research be undertaken in selecting reference sequences for the iterative optimization algorithms of finding motifs in large data sets. These algorithms, such as MEME-ChIP [31], usually randomly select hundreds of sequences from a large input to make motif discovery, with a low chance of discovering infrequent motifs [32]. Thus, elaborate selection of sequences may help them obtain more motif information.