The data set.

ChIP-seq experiments using antibodies for six different histone modifications, in five different cell types, were used to assess the predictability of histone modification from DNA motifs17,50. The six histone modifications are H3K4me1, H3K4me3, H3K27me3, H3K27ac and H3K36me3; and the five cell types are human embryonic stem cells (H1), trophoblast-like (TBL), neural progenitor cell (NPC), mesendoderm (ME) and mesenchymal cells (MSC). Each of the ChIP-seq experiments had at least two replicates, and input control samples are also provided. Mapped reads were made monoclonal using Homer20.

The IMR90 data obtained from the Human Epigenome Atlas (http://www.genboree.org/epigenomeatlas/) and was originally published in ref. 50. The data for the other seven cell types (A549, CD14+, GM12878, HeLa, HepG2, HUVEC and K562) were obtained from ENCODE (a complete list of files is available in Supplementary Data 2). These cell types were picked as they were all the ENCODE tier 1 and 2 cell types for which the six histone marks being considered were available. The ChIP-seq data used in the further analysis of YY1 were also obtained from ENCODE (a complete list of files is available in Supplementary Data 2).

The UCSC Known Gene51 and RefSeq52 gene models were downloaded from UCSC in June of 2012 and correspond to build hg18 of the human genome.

(G+C)-content correction in mapping reads and peak calling.

It has been shown that technical biases can influence ChIP-seq, resulting in a sequencing preference for (G+C)-rich fragments18,19. When considering the relationship between epigenome and DNA sequences, such biases could influence predictive performance. Thus, during our analysis, the G+C content of all read sets (ChIP and control) was normalized to the genome before peak calling. The G+C content bias removal was performed by Homer20, which started by extending the sequencing reads to their fragment length and calculating their G+C content. As the fragment length of individual reads is unknown, we use the median of the range of fragment lengths. The fragment length selection range was 180–400 bp, so we used a fragment length of 290 bp (ref. 50). Then the distribution of the fragments' G+C content is calculated for a ChIP-seq experiment. This is compared to the expected distribution, which is based on the distribution of G+C content across the entire genome. The normalization works by taking each range of G+C content and comparing the expected and observed distributions. If they do not match, the fragments are assigned fractional values to adjust for the difference. For example, if the sample is more G+C rich that expected, reads in (G+C)-rich regions will be reduced to a fractional value beneath 1. Homer uses the fractional read values during peak calling.

To identify regions that are enriched with a histone modification, we called two styles of peaks: tight and broad. The tight peaks are typically <1 kbp and best represent the tightly localized modifications (H3K27ac, H3K4me1 and H3K4me3). Tight peaks were called using the Homer program “findPeaks” with the style “histone”20. Homer identifies 500-bp peaks that significantly enriched with reads in comparison to input control. Then peaks within 1,000 bp of each other are stitched together to form a set of peaks with variable length. The broad peaks can be as long as 80 kbp and best represent modifications that form domains (H3K27me3, H3K36me3 and H3K9me3). Broad peaks were called using the Homer program “findPeaks” with the following options “-region -size 1000 -minDist 2500”. When Homer is run with these options, the initial sets of peaks are 1,000 bp wide, and peaks within 2,500 bp of each other are stitched together. Both styles of peaks were called for the domain-forming modifications, and the results were merged. Furthermore, to ensure only regions of high confidence are considered, we take the intersect (regions present in both sets) of two biological replicates as being our final set of high-confidence regions. The peaks were merged and intersect extraction was made with BedTools53.

Making the sets of sequences for the prediction of histone modification.

The 'single-mark' analysis compares regions that are enriched with an epigenomic modification to regions that do not possess any of the modifications being considered. The enriched regions, or foreground, were the high-confidence regions that were identified as the intersect of two or more replicates. To establish a background, we took all the continuous stretches in the genome that are 100% mappable but do not overlap with any of the histone modifications peaks. Regions of the genome are not 100%′ mappable if the DNA sequence is replicated elsewhere in the genome. This replication of DNA sequences reduces mappability, as it is a requirement of the mapping procedure that reads map uniquely. To measure regions′ mappability, we used a precomputed data set that considered 35-bp reads mapping uniquely within the human genome54. When considering overlap between 100% mappable regions and histone modification peaks, the union of all peaks was used rather than the high-confidence regions (the intersect of two or more replicates).

The 'mark-specific' analysis compares regions that are enriched with only one specific modification to regions that are enriched with any other modification but not the modification being considered. As both the foreground and background sequence sets harbor nucleosomes, it is the enrichment of a specific histone modification that is being predicted and not a sequences propensity to contain nucleosomes. To define the enriched regions, or foreground, we used high-confidence regions that were identified as the intersect of two or more replicates. Then foreground regions that overlap the high-confidence peaks of any other modifications were removed to produce the final foreground set. To establish the background set, the high-confidence peaks of all other modifications were merged, and then any region overlapping the union of peaks from the modification of interest were removed to give the final background set.

The 'typical background' analysis compares the high-confidence peaks of a modification to a background of regions that typically possess the modification, i.e., promoters for H3K4me3, H3K27ac, H3K27me3 and H3K4me1, and gene bodies for H3K36me3 and H3K9me3. In this comparison both the foreground and background sequence sets contain sequence features that are typical of the genomic regions enriched with the modification: for example, G+C islands in promoters for H3K4me3. Thus, it is the enrichment of a modification and not its typical genomic content that is being predicted. The enriched regions, or foreground, were the high-confidence regions that were identified as the intersect of two or more replicates. The background sets were taken from the promoter or gene-body regions in the UCSC knowngene.txt file. Promoters were extracted from −2,500 bp to +500 bp at all transcription start sites (TSSs). Any regions in the background set overlapping with a region in the foreground set were removed. For this, the union of all peaks was used rather than the high-confidence regions.

The 'cell type–specific' analysis predicts the origin of cell type–specific modification peaks. In this comparison both sets of sequences are enriched with the same histone modification but in a cell type–specific manner. For this purpose, we compared H1 to each of the other four cell types, as these were derived from H1. To compare two cell types, A and B, we first established the positive sets of sequences for cell type A by taking its set of high-confidence peaks, and we then subtracted from it the union of replicate of the same modification in cell type B. These were compared to a set that was made by reversing the roles of A and B. A caveat of this comparison is that different cell types introduce additional complexity and the identified motifs may be responsible for cell-type specificity but not necessarily related to histone modifications (see Supplementary Note).

Sequence-set balancing.

During sequence-set balancing (SSB), we adjusted the distributions of sequence G+C content and length in the foreground and background sequence sets so that they match. This procedure is crucial to avoid such differences from biasing the Random Forest predictions. To do this, we bin the sequences into a matrix that describes their length and G+C content (Supplementary Fig. 9). Length is measured to the nearest 100 bp, and G+C content is measured to the nearest 1%. Then the matrices that describe the foreground and background sets of sequences are compared. If the counts at a position in the two matrices are not equal, entries are randomly removed to make the counts equal. This was repeated for every entry in the matrices. At the end of the procedure, the counts in every position in the two matrices are equal.

De novo motif discovery.

To identify DNA motifs that are overrepresented within peak sequence, we used two de novo motif-finding programs: Homer20 and our own, Epigram (Supplementary Fig. 10a). To identify motifs with Homer, we used the program “findMotifsGenome.pl”. As Homer may miss some motifs, we developed a motif-finding algorithm to search for motifs in large numbers of long genomic regions, such as those regions covered by histone modifications. For example, Epigram was found to identify predictive motifs in 980,465 sequences with a mean length of 1,640 bp, whereas Homer crashes without producing any output. Epigram starts with identification of enriched 9-mers in the foreground and background. Similar 9-mers are merged to generate position-weight matrix (PWM) to represent a sequence motif.

1. Identification of enriched 9-mers. Epigram calculates the enrichment (EF) of 9-mers within the foreground (for example, peaks of histone modifications) in comparison to two backgrounds: (i) the entire genome (EF wg ) and (ii) the shuffled foreground sequences (EF sh ) that have the same G+C content as the foreground sequences (peaks)

The 9-mers that have both EF wg >1 and EF sh >1 are considered enriched and taken forward in the motif discovery process.

For a 9-mer to initiate a new motif, or PWM, it must have a combined enrichment factor, CEF, greater than an enrichment threshold ET (ET was set to 1.5 in this study), which determines the degree of enrichment a motif must have to be potentially discovered by Epigram. This level of enrichment is modest but is suitable for our purpose as it allows identification of 200–300 candidate motifs for the predicting epigenomic modifications. Furthermore, a feature selection procedure (described below) removes motifs with little predictive power to facilitate interpretation of the results

9-mers that have EF wg >1 and EF sh >1 but CEF <ET can be incorporated into an existing alignment but cannot be used to initiate an alignment.

2. Construction of motif PWMs. Each of the 9-mers that is taken forward is given a weight, W, that reflects its enrichment

where PP is the proportion of foreground sequences that possess at least one copy of the 9-mer. The top-weighted 9-mer is taken as a seed for motif construction, and all the enriched 9-mers, which differ from the seed 9-mer by one or two mismatches when perfectly aligned, are aligned to the seed 9-mer (Supplementary Fig. 10b). When a 9-mer alignment is converted into a PWM, the W scores weight the 9-mer contributes. Thus, the most enriched 9-mer would have the greatest influence on the PWM. PWMs are made only for alignments that contain five or more 9-mers.

3. Refinement of motif PWMs. The overall enrichment of a PWM is ensured by calculating the motif score, MS

MS is a weighted sum of all non-neutral 9-mers, NNN. The NNN are those that have a CEF >ET or CEF <1/ET. These cutoffs were used as they select the 9-mers that are over or underrepresented in the peaks at the ET being considered. For each PWM the summation of the NNN EF scores is weighted by MM, which is the best score of NNN evaluated by the PWM

Where P ij is the probability of the nucleotide at position i of NNN k in the PWM being evaluated. For a PWM to be taken forward, it must have an MS score greater than the ET.

4. Widening of the motif. The alignments are then widened by adding 9-mers. A new 9-mer is added to the alignment if it has 8 consecutive bases aligned to any 9-mer currently included in the alignment up to one mismatch and is offset by one position (Supplementary Fig. 10c). PWMs that are wider than a 9-mer have an MS calculated for each 9-mer fragment. Expansions that do not result in a decrease in MS in the existing 9-mer fragments, and where the expanded 9-mer fragment has an MS greater than ET, are accepted. Expansion will happen for a maximum for four rounds in either direction, i.e., the maximum possible length of a PWM is 17 bp. Only motifs that include 20 or more 9-mers are reported in the final output. Once a motif PWM is completed, then the process starts again with the next most enriched 9-mer being used as the seed. To prevent redundant motifs being produced, we use an enriched 9-mer in only one motif.

Note that each sequence is parsed only once by Epigram. For comparison, other methods, such as Homer20 and DREME55, work through an iterative procedure that masks the locations of identified motifs before the next motifs are identified. This means that Epigram is better enabled to identify motifs in some of the large sets of sequences being considered in this study owing to its efficiency. Epigram can be downloaded at http://wanglab.ucsd.edu/star/epigram/.

Selecting the most discriminative motifs while maintaining diversity of predictive motifs.

Owing to dual motif discovery strategy, the found motif sets could be redundant. To reduce such redundancy, we implemented a two-stage feature selection procedure. The first stage is a LASSO penalized logistic regression to classify the foreground and background using the motifs21. LASSO sets the coefficients of less informative motifs to 0. These motifs are then ignored during further analysis. To perform the LASSO we use the R function “cv.glmnet” from the package “glmnet”. To select the optimum parameters for the LASSO, we first run it on all the training data to obtain a lambda sequence. Lambda is the LASSO's regularization parameter, and the sequence represents the values that will be tested during each of the cross-validations. Then tenfold cross-validation is performed within the training data, during which the precomputed lambda sequence is used to train the LASSO model while ignoring one-tenth of the data. The average error at each lambda value is calculated using the combined set of results from the tenfold cross-validation. Finally, the value of lambda that gives the least-squares error is selected. The value of alpha is always kept at the default value, which is 1. This nested cross-validation avoids our models becoming over-fitted. The LASSO is performed by scanning the motifs against both foreground and background sets of sequences. The motifs are scored as S, which is the log odds between the motif and a background model

where w is the motif width, P k (x k ) and P b (x k ) are the probabilities of observing nucleotide x k at position k from the motif and the background distributions, respectively. The motifs are scored against every position in a sequence, and the best single score is recorded. The frequencies of single nucleotides in the human genome were used as a background model. The scores for each motif in both sets of sequences are input to LASSO. The set of motifs that are selected by LASSO are considered as our full set of motifs.

In the second stage, we further reduced the number of motifs by hierarchical clustering using the distance D between two motif matrices, a and b, as the metric56

D is the distance metric between two motifs that is normalized by the motif length, w, and adjusted by √2 to give the scores that are approximately proportional to the fraction of similarity, i.e., if D = 0.5 then the two motifs are approximately 50% the same. This adjustment makes the motif similarity values suitable for distance matrix construction, which is used during the hierarchical clustering of the motifs. As the optimal alignment of two motifs is not known, multiple alignments are measured and the minimum D is retained. All alignments are at least seven positions, or, when either motif is shorter than nine positions, by two positions fewer than the shortest motif. The distance between the motif reverse complements is also measured, and the shortest D is used for hierarchical clustering. Next the motif distance matrix is hierarchically clustered and cut multiple times, forming 20, 30, 40 ... 100 groups. Within each group only the motif with the best AUC was retained. The AUC for each motif was calculated according to the motif′s ability to discriminate the foreground and background sets of sequences in the training set using the motif score S and a variable cutoff. Then the Random Forest was used to evaluate the prediction performance of the subset of motifs. The lowest number of motifs whose AUC was greater than 95% of the full model's AUC was taken as the reduced model. If none of the tested motif subsets had an AUC >95% of the full model AUC, then the 100-motif subset was used. All feature selection was carried out using only the training data.

The Random Forest classifier.

We chose a Random Forest classifier to make our predictions, as they have been shown to be a powerful machine learning method57. The Random Forest model was constructed with 1,000 trees and using the square root of the total number of features at each split. The Weka implementation of the Random Forest was used58.

License and prerequisites.

The Epigram pipeline is available for Linux. It is open access and free for not-for-profit use. If a for-profit wishes to use it, a request must be submitted to the UCSD Technology Transfer Office. The pipeline requires R and the R package “glmnet”21 to be installed. We also recommend installing Homer20 so that two de novo motifs discovery methods can be used in combination.

Run times for the Epigram pipeline.

We ran the Epigram pipeline (with Epigram and Homer for motif discovery) on all H1 H3K4me3 peaks (15,229 peaks in total) compared to all 100% mappable regions of the genome that contain overlap any of the six core modifications (890,005 regions). Running the pipeline fully (with the model reduction stage) took 28 h and 20 min. This was reduced to 19 h and 10 min if the reduce stage was ignored. This was done on an Intel quad-core Xeon 2.53GHz and used less than 8 GB of RAM.

Quantitating prediction performance.

To measure the performance of a model, we first count true positives (TPs), true negatives (TNs), false positives (FPs) and false negatives (FNs). TPs are defined as modified regions that are predicted to possess a modification. TNs are defined as unmodified regions that are predicted to be unmodified. FPs are defined as unmodified regions that are predicted to be modified. FNs are modified regions that are predicted to be unmodified. We then determine accuracy as

We also use receiver operating characteristic (ROC) curve analysis to calculate the area under the curve (AUC). This is done by varying the number of Random Forest votes that are required to make a positive prediction.

Parameterizing the value of the enrichment threshold ET.

Throughout this work, Epigram's enrichment threshold, ET, was set to 1.5. To demonstrate the appropriateness of this value, we ran the Epigram pipeline on all H1 H3K4me3 peaks from chromosome 1 (1,515 peaks in total) compared to 100% mappable regions of the H1 genome chromosome 1 that do not overlap the peaks (68,616 regions in total). Homer was not used so that the effect of varying ET could be better judged. We ran the pipeline with three different values of ET: 1.75, 1.5 and 1.25. We recorded accuracy and AUC using in the full model. Varying ET did not have any significant effect on the results as all values of ET resulted in the same AUC (0.95). However, the accuracy was slightly higher when ET was 1.5 (89 vs. 88 with the other two values). Thus, ET remained set at 1.5 throughout this work.

Comparison-specific approaches to prediction.

Above we have outlined the general approach that we have taken to the prediction of epigenome from DNA motifs; however, each of the comparisons has its own particular specificities that we will outline here.

For the single-mark analysis, there are many more background sequences than foreground sequences. This means that during SSB, few foreground sequences will be lost but many background sequences will be lost. For example, during the single-mark analysis of H3K4me1 in H1, the pre-SSB foreground sequence count is 9,086 and the background sequence count is 890,005; but post-SSB, both counts are 9,086. This means that only 1.02% of the background sequences are included in the post-SSB set but all foreground sequences are included. For the purpose of de novo motif discovery, ∼1% of a set of sequences is not representative. Thus, for identifying motifs in the background set, the sequences that were removed from the background during SSB are used. As these sequences are never used for testing the Random Forest model, this does not violate the fivefold cross-validation assessment procedure. As Homer was unable to run on these very large sets of sequences, only Epigram was used at this stage.

For the mark-specific analysis and the cell type–specific analysis, the background sets of sequences are derived from histone peaks that do not overlap with the foreground set. Consequently, the proportion of foreground sequences removed during SSB is far greater in these two comparisons. For example, during the mark-specific analysis of H3K4me1 in H1, only 46% of the foreground sequences are retained in the post-SSB set. To allow the sequences that were removed during SSB to be tested by our model, we make an extension to our fivefold cross-validation procedure. For testing these sequences, a Random Forest is trained using motifs that were identified on the complete post-SSB set of sequences (Supplementary Fig. 1). Through this extension all the sequences that were in the original pre-SSB set are tested without ever using the same sequence in both training and testing.

During the typical background analysis, promoters or gene bodies are used as the background. For promoters, a 3-kbp-long region was taken around the TSS (from −2,500 bp to +500 bp). The gene bodies are the transcribed regions. In both cases, the length distribution of the background sequences differs considerably from the foreground sequences. Thus, many sequences are removed during standard SSB. To reduce this, we extended the standard SSB procedure by trimming the background sequences such that it allows removed sequences to be added back. To do this, the background sequences that have been removed but are longer than removed foreground sequences are trimmed to the length of a foreground sequence. Then G+C content of the trimmed sequences is measured. If it matches the foreground sequence, then the pair of sequences can be added back into the final post-SSB set. The background sequences are trimmed so that three different sections are considered: the 5′ end, the 3′ end and the middle. For example, when the 5′-end section is considered, the sequence is trimmed at its 3′ end.

During the mark-specific analysis, regions with only a single specific modification are compared to regions with any other modification. Thus, in this comparison the background sequence set for a particular modifications predication is a mixture of the foreground sets from other modification predictions. Rather than performing de novo motif prediction in the background sets, we select the motifs from other modification foreground sets to help the Random Forest better predict a sequence as belonging to the background set. To do this, we first identify a set of motifs in each of the modification foreground sets and perform the LASSO penalized logistic regression. Then all the selected motifs are combined into one set of motifs for that cell type, and LASSO is run again. Finally, the set of motifs that are selected in the second LASSO is used in the full model and then reduced to form the reduced model. To maintain variation in our fivefold cross-validation testing, the motifs from the same fold are combined with each other. For example, the six sets (one for each mark) that were produced in the first fold of the cross-validation are all combined and used in only the first fold of the cross-validation.

Data quality influences prediction performance.

We sought to better understand how the quality of the data and peak calls might be affecting the marks predictions performance. We plotted the normalized read counts (ChIP RPKM – input RPKM , where RPKM is the reads per kilobase per million mapped) from the peaks called for H1 mark-specific analysis and compared them to the normalized read counts in the background and the marks prediction performance (Supplementary Fig. 3). H3K4me3 has the highest enrichment of reads within its peaks. This strong of enrichment is probably a result of both biological and technical specificity: for example, the mark is very specific to promoters and the antibody is very specific to only this modification50. This quality of data and peaks is likely important for H3K4me3 being the best-performing modification in the two intercomparisons. The maximum normalized read count in the background of H3K4me1 is 7.3, whereas the second highest is 3.5. Moreover, the third quartile of H3K4me1 is 0.03, whereas it is 0 for all other marks. From manual inspection of the marks through the genome browser, it can be observed that H3K4me1 is more diffusive than the other nondomain modifications. The higher read-count levels in the background of H3K4me1 reduces the distinction between foreground and background, which is likely responsible for its reduced performance.

Comparison to known motifs and motif clustering.

To identify known motifs that match the de novo motifs, we ran Tomtom59,60. The minimum overlap was set as 5, and an E-value cutoff of 0.1 was used to define similarity. When Tomtom was run, a library of known motifs was constructed from the following five databases: Transfac61, Jaspar62, Uniprobe63, hPDI64 and Taipale42. When the library of known motifs was constructed, Jaspar motifs with IDs starting with “LM,” “PF,” “PH” or “PB” were excluded as the interacting partners of these motifs are unknown or because they were also present in Uniprobe.

To calculate motif-enrichment P values, a motif score cutoff was taken. Then the number of foreground and background sequences above this cutoff was counted. These counts where then combined with counts of total sizes of the foreground and background sequence sets to produce a 2 × 2 contingency table. Then Fisher's exact test was used to calculate a P value. For each motif, 1,000 cutoffs were used and the lowest P value was retained. The highest cutoff attempted was the motif score that resulted in at least 5% of the foreground sequences as being classified correctly. The lowest cutoff attempted was the motif score that resulted in at least 5% of the background sequences being classified at negative. The remaining 998 cutoffs were evenly spaced between the highest and lowest cutoffs.

The most significantly enriched motifs (Fisher's exact test P value < 1.0 × 10−20; 2,034 motifs) from the reduced sets were taken forward for further analysis. For organization of the motifs into groups, they were clustered as described in the motif-selection stage of the pipeline. The hierarchy was then cut to form 2. (N – 1) groups, where N is the total number of motifs. The number of groups with the greatest enrichment of known motifs within the groups was used in the final analysis. To determine this, we used the hypergeometric distribution to calculate a P value for the enrichment of each of the known motifs within the groups of de novo motifs. A known motif was counted as being within a de novo motif cluster if the Tomtom E-value was <0.1. The enrichment P value was calculated for each group the known motif matched, and the lowest was used in the overall calculation. A final P value was calculated by using Fisher's method to combine the P values from each of the known motifs. The number of groups with the lowest combined P value was used for the final grouping. The 2,034 motifs were organized into 589 groups with a combined log(P values) = −10,883.64. The groups of de novo motifs and the known motifs that they match can be viewed at http://wanglab.ucsd.edu/star/epigram/. The motif (PWM) with the greatest information content from each of the 589 groups is available in Supplementary Data 3.

When a group of de novo motifs is assigned to a known motif, great care must be taken, as there are many families for TFs that possess similar DNA-binding motifs. For example, many basic helix-loop-helix TFs (for example, MYC) bind at the E-box. Thus, if an E-box motif is found as being enriched, it cannot be taken as evidence as any individual E-box binding factor binding. To handle these situations, we annotated groups of de novo motifs with a label that describes the common binding properties rather than any individual member. However, in certain situations additional information such as literature and expression data can be used to increase the resolution of the de novo motif and known motif assignments. For example, in NPC a group of homeobox-containing motifs is identified as being predictive of H3K27ac. This group was labeled PAX6, which is a known master regulator of this lineage and is highly, and specifically, expressed in NPC. As our library of known motifs included motifs from nonhumans, we must take care to make sure that matches are of relevance to humans. To do this, the nonhuman protein sequence was compared to a database of human protein sequences using BLAST. If the protein matched a human protein with >40% sequence identity over its DNA-binding domain, then the assignment was accepted. Of the 589 groups, 117 could be reliably matched to a known motif recognized by a human factor or family of factors. Details of the de novo motif curation with known motifs are given in Supplementary Data 4.

We observed that motifs were enriched in the foreground (positively interplay) of a modification in one analysis were possibly also enriched in the background (negatively interplay) of the modification in another comparison (Supplementary Fig. 6). For example, motifs matching sequences involved in transcriptional regulation were enriched in the H3K36me3-marked regions in the single-mark analysis but also in the background (gene body) in the typical background analysis. This indicates that these motifs are associated with the genomic region but not with the modification per se. Thus, motifs were removed from future analysis if the group to which they belonged contained both positive and negative motifs for the modification. This resulted in the following number of groups ignored for each modification: H3K36me3 = 55, H3K27ac = 15, H3K9me3 = 11, H3K27me3 = 1 and H3K4me1 = 1.

Clustering motif groups by mark and cell-type specificity.

We wished to organize the identified motifs by their interplay with epigenomic modifications and cell types. We first organized the motifs by their interplay with modification by taking the de novo motifs from each group and summarizing the specificities as a vector of 1s and 0s. Each position in the vector represents whether the motif group was found to have interplay with a modification (1) or not (0). When doing this, we treated motif enrichment and depletion separately. Thus, the vector has a length of 14 as there are seven modifications but enrichment and depletion are treated separately. To cluster the motifs by the vectors, we created a distance matrix by taking the Manhattan distance between each vector. The distance matrix was then used to hierarchically cluster the motifs. The same procedure was used to cluster the motifs by cell-type specificities but using a vector of length 10 as there are five cell types but enrichment and depletion were treated separately.

For the heat maps in Figure 3a, gray is used to represent an absence (0 in the vector) of specificity, whereas specificity is represented by a bright nongray color. Different colors are used in each of the columns to make it easier for the reader.

Location analysis.

The peaks were split into ten equally sized bins, where the first and last bins represent the edges, and the fifth and sixth bin represents the center (Supplementary Fig. 8). Then we took a count of the motif occurrences within the bins for each set of modification peak sequence. As the peaks have no directionality, the bins from opposite positions but equal distance from the center are combined. For example, bin 1 and 10 are combined, and bin 2 and 9 are combined. This results in five bins where bin 1 is the edge and bin 5 is the center. The count in each bin is divided by the total count of the five bins to give the proportion of the counts in any one bin. If a motif has no binding preference, then one would expect all bins to score 0.2. If the score in the edge bin is 0.05 greater than either of the two middle bins, then a motif is categorized as 'edge'. Conversely, if either of the middle bins scores as 0.05 greater than the edge, then it is categorized as 'central'. Motifs that are neither edge nor peak are categorized as neutral. As an additional criterion, a χ2 test is used to measure the significance of the variation of the five bin scores. A P value of <1.0 × 10−10 is necessary for categorizing a motifs as being central or edge.

To make Figure 4a, we made a distance matrix by taking the Pearson correlation coefficient between the five bin scores of each of the motifs. This distance matrix was then used to cluster the motifs using Ward's hierarchical clustering method65.

To look at the relationship between the (G+C)-(A+T) hybrid motifs, H3K4me3 and TSSs, we identified a set of TSSs from RefSeq that overlapped H3K4me3 peaks in MSC and were at least 5 kbp from another TSS. We excluded TSSs that were within 5 kbp of another TSS, as we did not want signals from adjacent TSSs confusing the analysis. Furthermore, RefSeq genes were used instead of UCSC known genes as RefSeq represent a smaller and higher-confidence set of genes. This is advantageous as it provides a cleaner view of H3K4me3 signal in relation to motifs at TSSs. In total this identified 13,962 TSSs. We took a 4-kbp window around each TSS and split it into 200-bp bins. To look at the H3K4me3 signal in each of the bins, we counted the number of reads from the MSC H3K4me3 ChIP-seq in each of the bins. We combined both replicates to increase the overall resolution. We repeated this process using the input (control). Then the ChIP and input signals were normalized by the total read counts in each set to get an RPKM score. The final score for a bin was calculated by taking the log of the ratio between the chip and input RPKM values. When taking the log ratio a pseudocount of 0.05 was added to both scores to avoid division by very small numbers or 0. To create the motif profiles, we scanned the motifs against the TSS sequences. The score and location of the best match in each sequence were retained. Then, to get an overall profile, we totaled the scores in each of the bins. Next, each of the bin scores was divided by the sum of all bin scores and multiplied by 100. If a motif has no location preference then we would expect all bins to have a score of 5 (as we are considering 20 bins). Thus, to represent motif enrichment and depletion, we subtracted 5 from each of the bin scores.

When looking further into the relationship between YY1 and H3K9me3 in H1, we chose to focus on YY1 sites that were within 200 bp of an H3K9me3 peak star/end. This is different from what is shown in Figure 4a, in which edge bins correspond to the two-fifths of the H3K9me3 peaks that are closest to the start and end of its peaks. When taking a closer look at the relationship between YY1 and H3K9me3 peaks, we chose to consider within 200 bp from the end of H3K9me3 as it looks more specifically at the starts/ends of H3K9me3 peaks while allowing for some inaccuracy (brought about by noise in the assay) in the ChIP-seq peaks.

The YY1 and H3K9me3 examples shown in Figure 4f were picked from the 874 YY1 peaks that were within 200 bp of the start/end boundary of an H3K9me3 peak region (see Supplementary Note). To pick this subset of sites, we first ranked the sites by degree of difference in H3K9me3 levels between 1-kbp windows on either side of the YY1 motifs. Degree of difference was measured using a χ2 statistic that expects the levels to be the same on either side of the YY1 motif site. The four sites shown in Figure 4d were chosen manually from the top 50 ranked sites.

Comparison of YY1 peaks to other factors peaks.

To identify potential cofactors of YY1, we compared the ChIP-seq peaks of all the factors that were available in H1 from ENCODE (list of files available in Supplementary Data 2) to the two sets YY1 peaks: (i) those that overlap with an H3K4me3 peak but not an H3K9me3 peak (14,337 sites) and (ii) those that overlap with an H3K9me3 peak but not an H3K4me3 peak (624 sites). The overlap score was calculated as the proportion of the YY1 peaks that overlap the TF peak by at least 1 bp. This was done separately for H3K9me3 (column B) and H3K4me3 (column C). To identify the most differential TFs, the final ranking subtracted the H3K4me3 from the H3K9me3 score. If replicates of a TF were available, then the intersect of the two files was taken. Then the analysis was carried out using the intersect and each of the two replicates in isolation. The results of this analysis are given in Supplementary Data 1.

Motif disruption is correlated with H3K27ac variation between individuals.

To produce sets of predictive DNA motifs, we ran the Epigram pipeline on H3K27ac peaks from each of the 19 individuals43. As a background, mappable regions of the genome that did not overlap any H3K27ac peaks were used. The average full-model AUC was 0.87 with an average of 285 motifs. The set of motifs with the best prediction performance (AUC = 0.88) was used to correlate with H3K27ac in variable regions. The correlation of H3K27ac variation and motif disruption was conducted as previously described43. However, the genome sequences of four individuals from the San population could not be included, as the necessary genetic data could not be transferred in time for preparation of this manuscript. Therefore, only 15 individuals were used in the analysis. This discrepancy may have resulted in a reduced percentage of peaks being correlated with motif disruption as any peaks with variation that is specific to the San individuals is unlikely to be explained.

To aid comparison with Kasowski et al., we presented our results in the same way as they did (Fig. 5). Each of the rows corresponds to a motif, and each column corresponds to an H3K27ac peak. Only peaks that possess motif sites that are significantly distributed by at least one motif are shown. The rectangles are colored such that they represent the Spearman correlation coefficient between a motifs disruption and inter-individual variation in H3K27ac levels. The motifs are ordered such that the motif with the greatest number of significant correlations is at the top of the figure and the motif with the least is at the bottom. The peaks are sorted such that motifs that are associated with a greater number of peaks have their significantly associated peaks shown earlier as one reads the figure from left to right.

The motifs from the 20-motif model were compared to other sets of motifs using Tomtom. The known motif set was the same as was used in the section “Comparison to known motifs and motif clustering.” To identify matching motifs groups, we used Tomtom to compare them to the motifs that were predictive of H3K27ac in the single-mark analysis.