Regulatory motif discovery using PWMs and the architecture of eukaryotic core promoters

Kmer id : IdType length : int matches : int getId() : void length() : int numMatches() : int operator==(AbstractKmer&) : bool virtual charAt(int pos) : int virtual gapsAfter(int pos) : int virtual mutate(int pos, char c) : void virtual clone() : AbstractKmer* virtual toString() : string IdType isNumeric : bool val : union {uint64_t num, char* str} operator==(IdType&) : bool operator<(IdType&) : bool toString() : string SmallKmer charAt(int pos) : int gapsAfter(int pos) : int mutate(int pos, char c) : void clone() : SmallKmer* toString(): string UniversalKmer charAt(int pos) : int gapsAfter(int pos) : int mutate(int pos, char c) : void clone() : UniversalKmer* toString(): string Kmer p_pos : float p_set : float set_size : int seeds : list > kmer : AbstractKmer* getKmer() : AbstractKmer* setKmer(AbstractKmer*) : void operator==(Kmer&) : bool Match seq : int pos : int score : float operator==(Match&) : bool Figure 2.4. : Main data structures used for IUPAC k-mers within the XXmotif elongation phase. each k-mer should have a unique id for hashing. The SmallKmer implementation is optimized for speed and suitable only for k-mers up to a certain maximum length. It directly uses its id, a 64 bit integer, for representing a k-mer as a bit field: c bits represent a character s ∈ Γ followed by g bits designating the number of gaps after s. The maximum number n of match positions is determined by nc+ (n− 1)g ≤ 64. With the default values of c = 4 required for 10 IUPAC characters and g = 2, all motifs with at most eleven match positions separated by no more than three gaps between each position can be represented. By far the bigger part of motifs are compassed by these limits. The advantage of the SmallKmer implementation is that all access and mutation operations can be performed very efficiently by simple logical and bit shift operations. For exceptionally occurring motifs with more than eleven match positions, XXmotif switches to the UniversalKmer implementation which uses a list of an arbitrary number of character/gap pairs. The generality is payed for by loss of efficiency due to list traversal upon access. Since typically only very few motifs reach the required length during the XXmotif extension phase the UniversalKmer representation, this does not carry weight as a whole. 28 Chapter 2: Materials and Methods UniversalKmer uses the id field for storing a pointer to a string representation of itself. For building hashes of k-mers, our hash function decides from the isNumeric flag whether to compute a value based on the numerical value of the id field or based on the referenced string. As the number of match positions within the k-mer is stored directly in the class AbstractKmer, it is possible to use static casts to decide whether an AbstractKmer has to be considered as a SmallKmer or a UniversalKmer, making time consuming virtual function calls unnecessary. 2.3. 4. Merging phase Similar PWMs are merged in order to create a list of non-redundant motifs. First, all motifs are ranked by E-value, and, beginning with the motif having highest significance, similarity tests are performed. Therefore, all less significant motifs are compared to it, and, if similar enough, merged. Afterwards, this procedure is repeated for the second most significant motif, and so on. The criteria for these similarity tests are the following: 1. The divergence between the two PWMs calculated with a normalized Euclidian distance is smaller than 0.25 in an overlapping region of at least length six. This criterion is frequently used to assign a motif to be correctly found in diverse benchmarks (e. g., Gordân et al. (2010), Georgiev et al. (2010)):