Effective gene expression prediction from sequence by integrating long-range interactions
Effective gene expression prediction from sequence by integrating long-range interactions
1DeepMind, London, UK. 2Calico Life Sciences, South San Francisco, CA, USA. 3Google, Tokyo, Japan. 4These authors contributed equally: Vikram Agarwal, Daniel Visentin. ✉e-mail: avsec@google.com; pushmeet@google.com; drk@calicolabs.com
How noncoding DNA determines gene expression in different cell types is a major unsolved problem, and critical downstream applications in human genetics depend on improved solutions. Here, we report substantially improved gene expression prediction accuracy from DNA sequences through the use of a deep learning architecture, called Enformer, that is able to integrate information from long-range interactions (up to 100 kb away) in the genome. This improvement yielded more accurate variant effect predictions on gene expression for both natural genetic variants and saturation mutagenesis measured by massively parallel reporter assays. Furthermore, Enformer learned to predict enhancer–promoter interactions directly from the DNA sequence competitively with methods that take direct experimental data as input. We expect that these advances will enable more effective fine-mapping of human disease associations and provide a framework to interpret cis-regulatory evolution.
非编码 DNA 如何在不同细胞类型中决定基因表达,是一个尚未解决的重大问题;人类遗传学中的关键下游应用也有赖于更好的解决方案。这里,我们报告:借助一种名为 Enformer 的深度学习架构,从 DNA 序列预测基因表达的精度得到了明显提高;该架构能够整合基因组中最远约 100 kb 的长程相互作用信息。这一改进使自然遗传变异以及由大规模平行报告基因实验测量的饱和突变,在基因表达上的变异效应预测都更加准确。此外,Enformer 学会了直接从 DNA 序列预测增强子–启动子相互作用,其表现可与以直接实验数据为输入的方法竞争。我们预期,这些进展将有助于更有效地精细定位人类疾病关联,并为解释顺式调控进化提供框架。
Models that predict gene expression and chromatin states from DNA sequences hold the promise to better understand transcriptional regulation and how it is affected by the many noncoding genetic variants associated with human diseases and traits. These models complement population-based association studies, which are often limited to common variants and struggle to disentangle causality from association due to linkage disequilibrium (LD). Additionally, experimental validation of human genetic variants is laborious and limited to cell types or tissues that can be recapitulated in the laboratory, making it intractable to test all variants of interest in the relevant biological contexts. Although sequence-based computational models can in principle overcome these challenges, their accuracy is still limited1–4, making expression prediction from sequence a critical unsolved problem.
从 DNA 序列预测基因表达和染色质状态的模型,有望更好地理解转录调控,以及它如何受到许多与人类疾病和性状相关的非编码遗传变异的影响。这些模型是对基于群体的关联研究的补充:后者往往只覆盖常见变异,并因连锁不平衡(LD)而难以把因果与相关分开。此外,对人类遗传变异做实验验证费时费力,且局限于实验室能够重现的细胞类型或组织,因而无法在相关生物学情境中检验所有感兴趣的变异。基于序列的计算模型原则上可以克服这些困难,但其精度仍然有限1–4,使从序列预测表达成为一个关键的未解问题。
Deep convolutional neural networks (CNNs) achieve the current state of the art at predicting gene expression from DNA sequences for the human and mouse genomes1–4. However, to make predictions, these models are only able to consider sequence elements up to 20 kb away from the transcription start site (TSS) because the locality of convolutions limits information flow in the network between distal elements. Many well-studied regulatory elements, including enhancers, repressors, and insulators, can influence gene expression from far greater than 20 kb away5. Thus, increasing information flow between distal elements is a promising path to increase predictive accuracy.
深度卷积神经网络(CNN)在从人类和小鼠基因组的 DNA 序列预测基因表达上达到了当时的最先进水平1–4。不过,这些模型在做预测时,只能考虑距离转录起始位点(TSS)最多约 20 kb 的序列元件,因为卷积的局部性限制了网络中远端元件之间的信息流动。许多已被充分研究的调控元件,包括增强子、抑制子和绝缘子,可以从远大于 20 kb 的距离影响基因表达5。因此,增加远端元件之间的信息流动,是提高预测精度的一条有前景的路径。
In this work, we introduce a neural network architecture based on self-attention towards this goal. We frame the machine learning problem as predicting thousands of epigenetic and transcriptional datasets in a multitask setting across long DNA sequences. Training on most of the human and mouse genomes and testing on held out sequences, we observed improved correlation between predictions and measured data relative to previous state-of-the-art models without self-attention. We demonstrate more effective use of long-range information, as benchmarked by CRISPRi enhancer assays. The model also produces more accurate predictions of mutation effects, as measured by direct mutagenesis assays and population eQTL studies.
在这项工作中,我们引入一种基于自注意力的神经网络架构,以朝这一目标前进。我们把机器学习问题表述为:在较长的 DNA 序列上,以多任务方式预测数千个表观遗传和转录组学数据集。在人类和小鼠基因组的大部分序列上训练、在留出序列上测试,我们观察到,相对此前不含自注意力的最先进模型,预测与实测数据之间的相关有所提高。我们以 CRISPRi 增强子实验为基准,表明模型更有效地利用了长程信息。模型对突变效应的预测也更准确,这分别由直接诱变实验和群体 eQTL 研究来衡量。
Results
结果
Enformer improves gene expression prediction. We developed a new model architecture named Enformer (a portmanteau of enhancer and transformer) to predict gene expression and chromatin states in humans and mice from DNA sequences (Fig. 1a and Extended Data Fig. 1). Transformers are a class of deep learning models that have achieved substantial breakthroughs in natural language processing (NLP)6,7 and were also recently applied to model short DNA sequences8. They consist of attention layers that transform each position in the input sequence by computing a weighted sum across the representations of all other positions in the sequence. Attention weight between any two positions depends on the embeddings of their current representation vectors and the distance between them. This allows the model, for example, to refine the prediction at a TSS by gathering information from all relevant regions, such as enhancers regulating the gene. Since each position directly attends to all other positions in the sequence, they allow for a much better information flow between distal elements. By contrast, convolutional layers require many successive layers to reach distal elements due to their local receptive field. Using transformer layers allowed us to substantially increase the receptive field, reaching distal regulatory elements up to 100 kb away while still being able to effectively integrate their information. By contrast, previous state-of-the-art models Basenji2 or ExPecto only reach elements up to 20 kb away (Extended Data Fig. 1). This increase in the receptive field is important because it greatly expands the number of relevant enhancers seen by the model from 47% (<20 kb) to 84% (<100 kb) as estimated from the proportions of high-confidence enhancer–gene pairs9.
Enformer 提高了基因表达预测。 我们开发了一种名为 Enformer 的新模型架构(enhancer 与 transformer 的合成词),用于从 DNA 序列预测人类和小鼠的基因表达与染色质状态(图 1a 和扩展数据图 1)。Transformer 是一类深度学习模型,已在自然语言处理(NLP)中取得重大突破6,7,最近也被用于建模短 DNA 序列8。它们由注意力层组成:对输入序列中的每个位置,通过对序列中所有其他位置的表示做加权求和来变换该位置。任意两个位置之间的注意力权重取决于它们当前表示向量的嵌入以及二者之间的距离。这使模型例如可以汇集所有相关区域(如调控该基因的增强子)的信息,来改进 TSS 处的预测。由于每个位置直接对序列中所有其他位置做注意力,远端元件之间的信息流动要好得多。相比之下,卷积层因其局部感受野,需要很多连续层才能到达远端元件。使用 Transformer 层使我们能够大幅扩大感受野,达到最远约 100 kb 的远端调控元件,同时仍能有效整合它们的信息。相比之下,此前最先进的模型 Basenji2 或 ExPecto 只能达到约 20 kb 以内的元件(扩展数据图 1)。感受野的这一扩展很重要,因为它大大增加了模型所能见到的相关增强子数量:按高置信增强子–基因对的比例估计,从 47%(<20 kb)增加到 84%(<100 kb)9。
Enformer substantially outperformed the previous best model, Basenji2, for predicting RNA expression as measured by Cap Analysis Gene Expression10 (CAGE) at the TSS of human protein-coding genes, with the mean correlation increasing from 0.81 to 0.85 (Fig. 1b, left). This performance increase is twice as large as the performance increase between Basenji1 (ref. 3) and Basenji2 (ref. 2) and closes one-third of the gap to experimental-level accuracy, estimated at 0.94 (Extended Data Fig. 2). Gene expression predictions also better captured tissue- or cell-type specificity (Fig. 1b, right), including for closely related samples (Extended Data Fig. 3). The performance improvement was consistent across all four types of genome-wide tracks, including CAGE measuring transcriptional activity, histone modifications, TF binding, and DNA accessibility in various cell types and tissues for held-out chromosomes (Fig. 1c). The performance improvement was largest for CAGE, possibly because tissue-specific gene expression strongly depends on distal elements11. The improvement in prediction accuracy was also qualitatively evident when visualizing observed and predicted tracks of the genome (Fig. 1d). Enformer also yielded greater predictive accuracy than ExPecto1, a model trained to predict gene expression levels measured by RNA-seq, for both across-genes (0.850 versus 0.812 Spearman r) and across-tissues (0.451 versus 0.368 Spearman r) evaluation (Extended Data Fig. 4). These results confirm that the Enformer architecture advances prediction accuracy for both a broad range of epigenetic marks and gene expression from DNA sequence.
在预测人类蛋白质编码基因 TSS 处、由帽分析基因表达(Cap Analysis Gene Expression,CAGE)10 测量的 RNA 表达方面,Enformer 明显优于此前最好的模型 Basenji2,平均相关从 0.81 提高到 0.85(图 1b,左)。这一提升幅度是 Basenji1(文献 3)到 Basenji2(文献 2)提升幅度的两倍,并弥合了与实验水平精度(估计为 0.94)之间差距的三分之一(扩展数据图 2)。基因表达预测也更好地抓住了组织或细胞类型特异性(图 1b,右),包括在相近样本上(扩展数据图 3)。在留出染色体上,这一提升在全部四类全基因组轨道上都一致:测量转录活性的 CAGE、组蛋白修饰、转录因子结合,以及不同细胞类型和组织中的 DNA 可及性(图 1c)。提升在 CAGE 上最大,可能是因为组织特异的基因表达强烈依赖远端元件11。把基因组上观测轨道和预测轨道放在一起可视化时,精度提高在定性上也很明显(图 1d)。Enformer 的预测精度也高于 ExPecto1(该模型被训练用于预测由 RNA-seq 测量的基因表达水平):跨基因评价为 0.850 对 0.812(Spearman r),跨组织评价为 0.451 对 0.368(Spearman r)(扩展数据图 4)。这些结果证实,Enformer 架构从 DNA 序列出发,推进了对广泛表观遗传标记以及基因表达的预测精度。
To pinpoint the benefit of attention layers compared with the dilated convolutions used in Basenji2, we replaced attention layers with dilated convolutions and tuned the learning rate for optimal performance. Attention layers outperformed dilated convolutions across all model sizes, numbers of layers, and numbers of training data points (Extended Data Fig. 5a). The larger receptive field was indeed crucial, because we observed a large performance drop when restricting the receptive field of Enformer to that of Basenji2 by replacing global attention layers with local ones (Extended Data Fig. 5b). We note that increasing the number of parameters improved model performance, consistent with recent advances in NLP7. Enformer uses custom relative positional basis functions in the transformer layers to more easily distinguish between proximal and distal regulatory elements, and to distinguish positions upstream and downstream of the TSS. Both properties provided a noticeable performance improvement over the typically used relative basis functions and absolute positional encodings in the NLP literature (Extended Data Fig. 6a,b). Overall, these results confirm that attention layers are better suited than dilated convolutions for gene expression prediction.
为了明确注意力层相对 Basenji2 所用膨胀卷积的好处,我们用膨胀卷积替换注意力层,并调节学习率以获得最佳表现。在全部模型规模、层数和训练数据量上,注意力层都优于膨胀卷积(扩展数据图 5a)。更大的感受野确实很关键:当把全局注意力层换成局部注意力、从而把 Enformer 的感受野限制到与 Basenji2 相同时,我们观察到表现大幅下降(扩展数据图 5b)。我们注意到,增加参数量会提高模型表现,这与 NLP 中的近期进展一致7。Enformer 在 Transformer 层中使用定制的相对位置基函数,以便更容易区分近端和远端调控元件,并区分 TSS 上游和下游的位置。这两点相对 NLP 文献中通常使用的相对基函数和绝对位置编码,都带来了明显的表现提升(扩展数据图 6a,b)。总的来说,这些结果证实,对于基因表达预测,注意力层比膨胀卷积更合适。
Enformer attends to cell-type-specific enhancers. To better understand what sequence elements Enformer is utilizing when making predictions, we computed two different gene expression contribution scores — input gradients (gradient × input)12 and attention weights (Methods and Supplementary Fig. 1) — for several genes with CRISPRi-validated enhancers9,13. Contribution scores highlight the input sequences that are most predictive for the expression of a particular gene14,15. In silico mutagenesis and gradient × input are tissue- or cell-type-specific, since they are computed with respect to a particular output CAGE sample (for example, K562). By contrast, attention weights are internal to the model and are shared among all tissue and cell-type predictions. We inspected the contribution scores of several genes and observed that they correlated with histone H3 acetylated at K27 (H3K27ac) and highlighted not only local promoter regions, but also distal enhancers more than 20 kb away (Fig. 2a and Supplementary Figs. 2 and 3). By contrast, the contribution scores of Basenji2 were zero for sequences beyond 20 kb from the TSS due to the limited receptive field, thereby missing several enhancers. This example suggests that Enformer is indeed looking at biologically relevant regions, such as enhancers beyond 20 kb, when making predictions, and that gene expression contribution scores could be used to prioritize relevant enhancers.
Enformer 会关注细胞类型特异的增强子。 为更好地理解 Enformer 在做预测时利用了哪些序列元件,我们对若干带有经 CRISPRi 验证之增强子的基因9,13,计算了两种不同的基因表达贡献分数——输入梯度(梯度 × 输入)12 以及注意力权重(方法,以及补充图 1)。贡献分数标出对特定基因表达最具预测性的输入序列14,15。计算机模拟诱变和梯度 × 输入是组织或细胞类型特异的,因为它们相对于特定的输出 CAGE 样本(例如 K562)计算。相比之下,注意力权重是模型内部的,并在所有组织和细胞类型预测之间共享。我们检查了若干基因的贡献分数,观察到它们与 27 位乙酰化的组蛋白 H3(H3K27ac)相关,并且不仅标出了局部启动子区域,还标出了 20 kb 以外的远端增强子(图 2a 以及补充图 2 和 3)。相比之下,由于感受野有限,Basenji2 对距离 TSS 超过 20 kb 的序列贡献分数为零,从而漏掉了若干增强子。这个例子表明,Enformer 在做预测时确实在看生物学上相关的区域,例如 20 kb 以外的增强子,并且基因表达贡献分数可以用来优先排序相关增强子。
Linking candidate enhancers identified via biochemical annotations16 to target genes is an important and unsolved problem5. Computational models have historically produced low accuracy owing to the combination of noisy labels and class imbalance. To systematically evaluate the ability of contribution scores to pinpoint relevant enhancers for a particular gene, we compared several contribution scores across all tested enhancer–gene pairs in two large-scale CRISPRi studies performed on the K562 cell line9,13. In these experiments, CRISPRi was used to suppress the activity of more than 10,000 candidate enhancers and measure their effect on gene expression.
把通过生化注释识别出的候选增强子16 连接到靶基因,是一个重要且尚未解决的问题5。由于标签嘈杂和类别不平衡叠加在一起,计算模型历史上精度偏低。为系统评估贡献分数能否为特定基因精确定位相关增强子,我们在 K562 细胞系上两项大规模 CRISPRi 研究中9,13,对所有经过测试的增强子–基因对比较了若干种贡献分数。在这些实验里,CRISPRi 被用来抑制 10,000 多个候选增强子的活性,并测量它们对基因表达的影响。
Enformer contribution scores prioritized validated enhancer–gene pairs with higher accuracy than Basenji2 contribution scores or random scores across almost all relative distances and different types of contribution scores (Fig. 2b, Enformer versus Basenji2 versus Random). The performance of Enformer was comparable to, and in some cases even better than, the ABC score13, a state-of-the-art method recently proposed specifically for enhancer prioritization. This is remarkable because the ABC score relies on experimental data, such as a HiC-based interaction frequency and H3K27ac as input (Fig. 2b, blue versus green, and Extended Data Fig. 7a), whereas Enformer uses only DNA sequence as input and was never trained to explicitly locate enhancers. This allows Enformer to also be used for arbitrary sequence variations lacking experimental data. Cell-type-specific contribution scores yielded a higher prioritization performance than cell-type-agnostic ones, suggesting that the model was using different enhancer sequences in different cell types as expected (Extended Data Fig. 7c). Thus, Enformer contribution scores are an effective strategy to prioritize candidate enhancers in cell types used for model training.
在几乎所有相对距离以及不同类型的贡献分数上,Enformer 的贡献分数对经过验证的增强子–基因对的排序,都比 Basenji2 的贡献分数或随机分数更准确(图 2b,Enformer 对 Basenji2 对随机)。Enformer 的表现与 ABC 分数13 相当,在有些情况下甚至更好;ABC 分数是近期专门为增强子排序提出的先进方法。这一点很突出,因为 ABC 分数依赖实验数据作为输入,例如基于 Hi-C 的相互作用频率和 H3K27ac(图 2b,蓝对绿,以及扩展数据图 7a),而 Enformer 只用 DNA 序列作为输入,并且从未被明确训练去定位增强子。这使 Enformer 也可以用于缺乏实验数据的任意序列变异。细胞类型特异的贡献分数比细胞类型无关的贡献分数具有更高的排序表现,表明模型如预期那样在不同细胞类型中使用了不同的增强子序列(扩展数据图 7c)。因此,Enformer 贡献分数是在模型训练所用细胞类型中优先排序候选增强子的有效策略。
Next, we asked whether the model has learned about another important class of regulatory elements: insulator elements, which separate two topologically associating domains (TADs) and minimize enhancer–promoter crosstalk between the two. We inspected the attention matrices (which were more efficient to compute relative to input gradients owing to the many output targets) of sequences centered at TAD boundaries, and compared them with attention from sequences with no particular alignment. From the perspective of the query position, Enformer paid more attention to TAD boundaries than to random positions (vertical red stripe, Fig. 2c) and less attention to regions on the opposite side of the boundary (off-diagonal blue blocks, Fig. 2c), consistent with the biological observation of reduced inter-TAD interactions. Both of these two patterns were statistically significant across 1,500 tested sequences (Fig. 2d, “Across TAD” and “Key at TAD boundary”). One of the key motifs at TAD boundaries that the model used to make DNase and CAGE predictions was CTCF, which was found to be associated with both positive and negative contribution scores (Extended Data Fig. 8). Overall, these results suggest that the model has not only learned about the role of tissue-specific enhancers and promoters, but also about insulator elements and their role in inhibiting information flow between genomic compartments.
接下来,我们询问模型是否也学到了另一类重要的调控元件:绝缘子元件,它们分隔两个拓扑关联结构域(TAD),并尽量减少二者之间的增强子–启动子串扰。我们检查了以 TAD 边界为中心的序列的注意力矩阵(相对输入梯度,由于输出靶点很多,计算注意力矩阵更高效),并把它们与没有特定对齐的序列上的注意力做比较。从查询位置的角度看,Enformer 对 TAD 边界的注意力高于随机位置(竖直红带,图 2c),对边界另一侧区域的注意力则更低(对角以外的蓝色块,图 2c),这与 TAD 之间相互作用减弱的生物学观察一致。这两种模式在 1,500 条测试序列上都具有统计显著性(图 2d,“跨 TAD”和“键在 TAD 边界”)。模型用于做出 DNase 和 CAGE 预测的、TAD 边界处的关键基序之一是 CTCF,它与正、负贡献分数都有关联(扩展数据图 8)。总的来说,这些结果表明,模型不仅学到了组织特异增强子和启动子的作用,也学到了绝缘子元件及其在抑制基因组区室之间信息流动中的作用。
Fig. 1 | Enformer improves gene expression prediction in held-out genes by using a larger receptive field. a, Enformer is trained to predict human and mouse genomic tracks at 128-bp resolution from 200 kb of input DNA sequence. By using transformer modules instead of dilated convolutions, it achieves a five times larger receptive field able to detect sequence elements 100 kb away, compared with 20 kb for Basenji2 (ref. 2) or ExPecto1 (Extended Data Fig. 1). b, Enformer outperforms Basenji2 in gene expression prediction from sequence both across genes and across CAGE experiments for protein-coding genes. Test set performance was measured by Pearson correlation of CAGE gene expression (log(1 + x) transformed) computed across genes for each CAGE experiment (left) or across CAGE experiments for each test gene stratified by the observed expression variance across experiments (right). Average performance for each model is shown in the corners. Bootstrapped s.d. of these estimates is 0.004 for “Across genes”. Gene expression values were obtained by summing up the observed or predicted CAGE read counts at all unique TSS locations of the gene. Values for each CAGE experiment were standardized to have zero mean and variance of 1 across genes. c, Enformer consistently outperforms Basenji2 across all 4 assay types (columns) as measured by Pearson correlation computed across all 128-bp binned genomic positions in the human test set for 5,313 predicted tracks (points). Both models were trained and evaluated on the same dataset. Enformer performance was significantly higher across all plots in b and c (paired Wilcoxon P < 10−38). d, Representative example of observed and predicted genomic tracks (log10 scale) at CD44 gene locus located in the test-set region with high disagreement between Enformer and Basenji2 predictions (Methods). For each experiment, all three tracks share the same y axis.
图 1 | Enformer 借助更大的感受野,提高了在留出基因上的基因表达预测。a,Enformer 被训练为从 200 kb 的输入 DNA 序列,以 128 bp 分辨率预测人类和小鼠的基因组轨道。通过用 Transformer 模块替代膨胀卷积,它获得了大五倍的感受野,能够探测 100 kb 以外的序列元件,而 Basenji2(文献 2)或 ExPecto1 为 20 kb(扩展数据图 1)。b,在蛋白质编码基因上,无论是跨基因还是跨 CAGE 实验,Enformer 从序列预测基因表达都优于 Basenji2。测试集表现用 CAGE 基因表达(经 log(1 + x) 变换)的 Pearson 相关衡量:对每个 CAGE 实验跨基因计算(左),或对每个测试基因跨 CAGE 实验计算,并按观测到的跨实验表达方差分层(右)。各模型的平均表现标在角上。这些估计的自助法标准差在“跨基因”上为 0.004。基因表达值由该基因全部独特 TSS 位置上观测或预测的 CAGE 读段计数求和得到。每个 CAGE 实验的值都标准化为跨基因均值为 0、方差为 1。c,在全部 4 种实验类型(列)上,Enformer 都一致优于 Basenji2,衡量标准是在人类测试集全部 128 bp 分箱基因组位置上、对 5,313 条预测轨道(点)计算的 Pearson 相关。两个模型在同一数据集上训练和评估。在 b 和 c 的所有图中,Enformer 的表现都显著更高(配对 Wilcoxon P < 10−38)。d,CD44 基因位点上观测与预测基因组轨道(log10 尺度)的代表性例子;该位点位于测试集中 Enformer 与 Basenji2 预测分歧较大的区域(方法)。对每个实验,三条轨道共用同一 y 轴。
Fig. 2 | Enformer attends to cell-type-specific enhancers, enabling enhancer prioritization. a, HNRNPA1 locus showing: predicted CAGE expression in K562; measured H3K27ac highlighting active enhancers; candidate (light gray) and CRISPRi-validated enhancers (dark gray) exhibiting significant HNRNPA1 expression changes from Fulco et al.13; Enformer attention weight averaged across all layers and heads for a query placed at the main TSS of HNRNPA1 gene (position 0); and gradient × input12 contribution scores computed with regard to the K562 CAGE track at the main TSS position for Enformer and Basenji2. b, Enhancer–gene pair classification performance (CRISPRi-validated versus nonvalidated candidate enhancers), stratified by relative distance, as measured by auPRC on two CRISPRi datasets9,13 for different methods, models, and contribution scores (Methods). ABC score* (H3K27ac/distance) denotes the approximate version of the ABC score13 lacking Hi-C data, which exhibits similar performance (Extended Data Fig. 7a). Colored bars depict the median auPRC, and error bars show the 25th and 75th percentiles obtained by sampling 80% of enhancer–gene pairs 100 times without replacement. The auPRC metric is sensitive to class imbalance, which differs between the two datasets (1:10 for Gasperini9 and 1:4 for Fulco13). c, Average attention matrix difference of Enformer between 1,500 sequences centered at a topologically associating domain (TAD) boundary and 1,500 sequences from the validation set without any particular centering. Attention matrices were averaged across all layers, heads, and sequences. Red stripe in the center at key = 0 means that the model is attending more to the TAD boundary than by chance. Blue regions in off-diagonal quadrants mean that the model is attending less across the TAD boundary. d, Attention is significantly lower across TAD boundaries (center), significantly higher at TAD boundaries (right), and shows no significant difference within them (left), as compared with 1,500 random genomic sequences. Distributions show attention across all sequences in specific attention matrix parts shown in red. P values were computed with the two-sided Mann–Whitney U test. The box plots mark the median, upper and lower quartiles, and 1.5× interquartile range (whiskers); outliers are shown as points (n = 1,500 for each violin plot).
图 2 | Enformer 会关注细胞类型特异的增强子,从而能够对增强子做优先排序。a,HNRNPA1 位点显示:K562 中的预测 CAGE 表达;标出活性增强子的实测 H3K27ac;来自 Fulco 等人13、使 HNRNPA1 表达发生显著变化的候选增强子(浅灰)和经 CRISPRi 验证的增强子(深灰);把查询放在 HNRNPA1 基因主 TSS(位置 0)时,Enformer 在全部层和头上平均的注意力权重;以及相对于主 TSS 位置处 K562 CAGE 轨道、为 Enformer 和 Basenji2 计算的梯度 × 输入12 贡献分数。b,增强子–基因对分类表现(经 CRISPRi 验证对未验证的候选增强子),按相对距离分层,在两个 CRISPRi 数据集9,13 上用 auPRC 衡量不同方法、模型和贡献分数(方法)。ABC 分数*(H3K27ac/距离)表示缺少 Hi-C 数据的 ABC 分数近似版本13,其表现相近(扩展数据图 7a)。彩色条表示 auPRC 的中位数,误差棒表示通过无放回地抽样 80% 的增强子–基因对 100 次得到的第 25 和 75 百分位。auPRC 指标对类别不平衡敏感,而两个数据集的不平衡程度不同(Gasperini9 为 1:10,Fulco13 为 1:4)。c,Enformer 在 1,500 条以拓扑关联结构域(TAD)边界为中心的序列与 1,500 条验证集中无特定居中的序列之间的平均注意力矩阵差。注意力矩阵在全部层、头和序列上取平均。中心处键 = 0 的红带表示模型对 TAD 边界的注意力高于随机。对角以外象限中的蓝色区域表示模型跨越 TAD 边界的注意力更低。d,与 1,500 条随机基因组序列相比,跨越 TAD 边界的注意力显著更低(中),在 TAD 边界处显著更高(右),在边界之内则无显著差异(左)。分布显示红色标出的特定注意力矩阵部分在全部序列上的注意力。P 值用双侧 Mann–Whitney U 检验计算。箱线图标出中位数、上下四分位数以及 1.5 倍四分位距(须);离群点以点表示(每个小提琴图 n = 1,500)。
Enformer improves variant effect prediction on eQTL data. A central goal of this research is to predict the influence of genetic variants on cell-type-specific gene expression, in order to inform fine-mapping of the many thousands of noncoding associations with phenotypes of interest from genome-wide association studies (GWAS). Computational models that predict regulatory activity from DNA sequences can process distinct alleles and compare predictions to score genetic variants3,17–19. A successful model would be able to produce the results of a gene expression quantitative trait loci (eQTL) study without having to measure hundreds to thousands of individual gene expression profiles. Thus, we studied eQTLs discovered by the GTEx project across dozens of human tissues to validate model predictions20. The primary challenge of such validation is the influence of co-occurrences between variants (that is, linkage disequilibrium) in the profiled population, which transfers the causal eQTL’s effect to nearby co-occurring variants’ measurements. Signed linkage disequilibrium profile (SLDP) regression is a technique developed to measure the genome-wide statistical concordance between signed variant annotations (such as our model predictions) and GWAS summary statistics (such as GTEx eQTLs) while accounting for linkage disequilibrium (Methods)21. For 379 of 648 (59.4%) CAGE datasets, the maximum SLDP Z-score across GTEx tissues (representing the most likely closest sample match) increased for Enformer predictions relative to Basenji2. Enformer maximum Z-scores increased by greater than one s.d. for 228 CAGE datasets, relative to 46 decreased by one. The maximum Z-score increased on average from 6.3 to 6.9 (Fig. 3a). Note that we do not expect increased SLDP Z-scores for CAGE samples without a relevant GTEx tissue match. We observed a qualitative improvement in the tissue similarity of the top-ranked CAGE sample for GTEx tissues, exemplified by increased SLDP Z-scores for muscle samples to GTEx skeletal muscle and adipose samples for GTEx subcutaneous adipose tissue (Fig. 3b,c). We also found that Enformer variant effect predictions for DNase hypersensitivity had greater SLDP concordance with GTEx than an alternative method called DeepSEA Beluga, used in ExPecto1 (Extended Data Fig. 9). Thus, Enformer predictions for noncoding-variant activity appear to improve primarily for samples with similar cell-type composition, in line with our observations of improved tissue and cell-type specificity for held-out sequences.
Enformer 提高了在 eQTL 数据上的变异效应预测。 本研究的一个核心目标,是预测遗传变异对细胞类型特异基因表达的影响,以便为全基因组关联研究(GWAS)中成千上万与感兴趣表型相关的非编码关联做精细定位提供信息。从 DNA 序列预测调控活性的计算模型可以对不同等位基因分别处理,再比较预测结果来为遗传变异打分3,17–19。一个成功的模型应能在不必测量成百上千个单独基因表达谱的情况下,给出基因表达数量性状位点(eQTL)研究的结果。因此,我们用 GTEx 项目在数十种人类组织中发现的 eQTL 来验证模型预测20。这类验证的主要困难在于,所分析群体中变异之间的共现(也就是连锁不平衡)会把因果 eQTL 的效应转移到邻近共现变异的测量上。符号连锁不平衡谱(signed linkage disequilibrium profile,SLDP)回归是一种用于衡量带符号的变异注释(如我们的模型预测)与 GWAS 摘要统计(如 GTEx eQTL)之间全基因组统计一致性的技术,同时会考虑连锁不平衡(方法)21。在 648 个 CAGE 数据集中的 379 个(59.4%)上,跨 GTEx 组织的最大 SLDP Z 分数(代表最可能最接近的样本匹配)在 Enformer 预测上相对 Basenji2 有所提高。Enformer 的最大 Z 分数有 228 个 CAGE 数据集提高超过一个标准差,而下降一个标准差的只有 46 个。最大 Z 分数平均从 6.3 提高到 6.9(图 3a)。需要指出,对于没有相应 GTEx 组织匹配的 CAGE 样本,我们并不预期 SLDP Z 分数会提高。我们还观察到,对 GTEx 组织而言,排名最高的 CAGE 样本在组织相似性上有定性改善,例如肌肉样本对 GTEx 骨骼肌、脂肪样本对 GTEx 皮下脂肪组织的 SLDP Z 分数提高(图 3b,c)。我们还发现,Enformer 对 DNase 超敏的变异效应预测,与 GTEx 的 SLDP 一致性高于 ExPecto1 中使用的另一种方法 DeepSEA Beluga(扩展数据图 9)。因此,Enformer 对非编码变异活性的预测,似乎主要在细胞类型组成相近的样本上提高,这与我们在留出序列上看到的组织和细胞类型特异性改善相一致。
Although linkage disequilibrium generally results in GTEx eQTL associations that can be attributed only to a set of frequently co-occurring variants, the latest GTEx release includes many thousands of associations in loci with simple linkage patterns, which have been fine-mapped to a single high-probability causal variant22. To assess the utility of Enformer predictions for identifying causal variants, we defined a classification task for each tissue to discriminate likely causal variants (causal probability > 0.9, as determined by the population-based fine-mapping model SuSiE23) from likely spurious eQTLs (causal probability < 0.01), which were matched for the eGene when possible (Methods). We represented each variant by its prediction difference vector (that is, evaluating the reference minus alternative allele, summed across the sequence) for all 5,313 human datasets, and trained random forest classifiers. Enformer predictions enabled a more accurate classifier for 47 of 48 GTEx tissues (Fig. 3d), increasing the mean area under the receiver operating characteristic curve (auROC) from 0.729 to 0.747. This improvement was consistent across all distances from the TSS (Fig. 3e), suggesting that the model not only better represents variants likely overlapping long-range enhancers (enabled by the larger receptive field), but also more effectively parses promoters and short-range enhancers. The Enformer model was also more accurate at predicting the direction of expression change of these fine-mapped eQTLs than was Basenji2 (Extended Data Fig. 10).
尽管连锁不平衡通常使 GTEx eQTL 关联只能归到一组频繁共现的变异上,但最新的 GTEx 发布包含了数千个位于简单连锁模式位点、并已被精细定位到单个高概率因果变异的关联22。为评估 Enformer 预测对识别因果变异的用处,我们为每个组织定义了一项分类任务:把很可能是因果的变异(由基于群体的精细定位模型 SuSiE23 给出的因果概率 > 0.9)与很可能是虚假的 eQTL(因果概率 < 0.01)区分开,并在可能时按 eGene 做匹配(方法)。我们用全部 5,313 个人类数据集上的预测差向量(即计算参考等位基因减替代等位基因,再沿序列求和)来表示每个变异,并训练随机森林分类器。Enformer 的预测在 48 个 GTEx 组织中的 47 个上给出了更准确的分类器(图 3d),把受试者工作特征曲线下面积(auROC)的均值从 0.729 提高到 0.747。这一改进在距离 TSS 的所有距离上都一致(图 3e),表明模型不但更好地表示了很可能与长程增强子重叠的变异(这得益于更大的感受野),也更有效地解析了启动子和短程增强子。在预测这些精细定位 eQTL 的表达变化方向上,Enformer 也比 Basenji2 更准确(扩展数据图 10)。
One example variant where the Enformer eQTL probability prediction increased relative to Basenji2 is rs11644125, which lies within an intron ~35 kb downstream of the TSS of NLRC5, a gene involved in viral immunity and the cytokine response (Fig. 3f). The variant has been statistically fine-mapped as likely to cause changes in monocyte and lymphocyte blood cell counts24. According to GTEx, the minor allele T decreases gene expression of NLRC5 in whole blood relative to the major allele C. Enformer correctly predicts reduced NLRC5 expression from the upstream TSS in many relevant CAGE samples, including PBMCs. Using in silico mutagenesis of the local region (Methods), we observed that the variant rs11644125 modulates the known motif of the transcription factor SP1 (ref. 24). Enformer predictions suggest perturbed SP1 binding in hematopoietic cells that alters NLRC5 expression as a mechanism for these traits.
Enformer 相对 Basenji2 提高了 eQTL 概率预测的一个示例变异是 rs11644125,它位于 NLRC5 的 TSS 下游约 35 kb 的一个内含子中;NLRC5 是一个参与病毒免疫和细胞因子应答的基因(图 3f)。该变异在统计上已被精细定位为很可能引起单核细胞和淋巴细胞血细胞计数改变24。根据 GTEx,相对主要等位基因 C,次要等位基因 T 会降低全血中 NLRC5 的基因表达。Enformer 正确地预测了在许多相关 CAGE 样本(包括外周血单个核细胞)中,上游 TSS 处的 NLRC5 表达会降低。通过对局部区域做计算机模拟诱变(方法),我们观察到变异 rs11644125 会调控转录因子 SP1 的已知基序(文献 24)。Enformer 的预测提示,造血细胞中受扰动的 SP1 结合会改变 NLRC5 表达,并以此作为这些性状的机制。
Fig. 3 | Enformer improves variant effect prediction on eQTL data as measured by SLDP regression and fine-mapped variant classification. a, We computed genome-wide statistical concordance between variant effect predictions for individual CAGE datasets and GTEx eQTL summary statistics using SLDP21 across all variants in the 1000 Genomes dataset. Taking the GTEx tissue with max Z-score for each sample, Enformer predictions achieved greater Z-scores for 59.4% of samples, and 228 are greater by more than one s.d. (versus 46 for Basenji2). Each point represents one of the 638 CAGE samples. We used one-sided Binomial tests to compute the P values in the top row panels. b,c, Studying SLDP in skeletal muscle (b) and subcutaneous adipose (c) GTEx tissues indicated that biologically relevant CAGE datasets (shown in blue) improve between Basenji2 and Enformer. d, We trained random forest classifiers to discriminate between fine-mapped GTEx eQTLs and matched negative variants in each of 48 tissues (Methods). Features derived from Enformer enabled more accurate classifiers than Basenji2 features for 47 of 48 tissues. e, We computed auPRC for variants in four roughly equally sized TSS distance bins. Violin plots represent measures for the n = 48 tissues (white dots represent the median, thick bars the interquartile range, and thin bars the entire data range). Enformer improved accuracy at all distances (one-sided paired Wilcoxon P < 1 × 10–4). f, Enformer prediction for rs11644125 improved relative to Basenji2 (data not shown) by better capturing its influence on an NLRC5 TSS ~35 kb upstream. rs11644125 is associated with monocyte and lymphocyte counts in the UK BioBank and fine-mapped to >0.99 causal probability24. In silico mutagenesis of the region surrounding rs11644125 revealed an affected SP1 transcription factor motif39.
图 3 | 以 SLDP 回归和精细定位变异分类衡量,Enformer 提高了在 eQTL 数据上的变异效应预测。a,我们用 SLDP21 在 1000 Genomes 数据集的全部变异上,计算了各 CAGE 数据集的变异效应预测与 GTEx eQTL 摘要统计之间的全基因组统计一致性。对每个样本取最大 Z 分数所对应的 GTEx 组织,Enformer 预测在 59.4% 的样本上得到更高的 Z 分数,其中 228 个高出一个标准差以上(Basenji2 为 46 个)。每个点代表 638 个 CAGE 样本中的一个。顶行各图的 P 值用单侧二项式检验计算。b,c,在骨骼肌(b)和皮下脂肪(c)这两个 GTEx 组织中研究 SLDP,表明生物学上相关的 CAGE 数据集(蓝色)在 Basenji2 与 Enformer 之间有所改善。d,我们训练随机森林分类器,在 48 个组织的每一个中区分精细定位的 GTEx eQTL 与匹配的阴性变异(方法)。由 Enformer 导出的特征在 48 个组织中的 47 个上,比 Basenji2 特征给出了更准确的分类器。e,我们在四个大致等规模的 TSS 距离区间中计算变异的 auPRC。小提琴图表示 n = 48 个组织上的度量(白点为中位数,粗条为四分位距,细条为全部数据范围)。Enformer 在所有距离上都提高了精度(单侧配对 Wilcoxon P < 1 × 10–4)。f,Enformer 对 rs11644125 的预测相对 Basenji2 有所提高(数据未展示),因为它更好地抓住了该变异对上游约 35 kb 处一个 NLRC5 TSS 的影响。rs11644125 与英国生物银行中的单核细胞和淋巴细胞计数相关,并被精细定位到因果概率 >0.9924。对 rs11644125 周围区域的计算机模拟诱变显示,一个 SP1 转录因子基序受到影响39。
Enformer improves MPRA mutation effect prediction. Finally, we evaluated Enformer’s performance on a second, independent variant effect prediction task using a dataset in which massively parallel reporter assays (MPRAs) directly measured the functional effect of genetic variants through saturation mutagenesis of several enhancers and promoters in a variety of cell types25. We used the same training and test sets as the CAGI5 competition26, enabling us to directly benchmark Enformer’s performance relative to those of submissions from other groups. Methods derived from other groups deploy a heterogeneous set of approaches, ranging from the use of the deltaSVM strategy27, the CADD framework28, and regression models using features derived from a combination of conservation information and deep learning predictions from DeepBind29 and DeepSEA18 (Group 3, Group 5, and Group 7)26. For each variant, we evaluated its effect as the predicted difference between the reference and alternative allele, retrieving 5,313 features. Next, we compared two approaches: (1) we used these features to train a lasso regression model on the provided training set for each gene, and (2) we preselected a subset of features corresponding to cell-type-matched and cell-type-agnostic predictions of changes in CAGE and DNase, and generated a summary statistic of the features (that is, without additional training).
Enformer 提高了 MPRA 突变效应预测。 最后,我们在第二项独立的变异效应预测任务上评估 Enformer 的表现,所用数据集通过大规模平行报告基因实验(MPRA),对若干增强子和启动子在多种细胞类型中做饱和突变,直接测量遗传变异的功能效应25。我们使用与 CAGI5 竞赛26 相同的训练集和测试集,从而可以直接把 Enformer 的表现与其他组别的提交结果做基准比较。其他组别的方法采取了互不相同的途径,包括 deltaSVM 策略27、CADD 框架28,以及把保守性信息与 DeepBind29、DeepSEA18 的深度学习预测组合后作为特征的回归模型(第 3 组、第 5 组和第 7 组)26。对每个变异,我们把它的效应取为参考等位基因与替代等位基因的预测差,得到 5,313 个特征。接着我们比较了两种做法:(1)用这些特征在每个基因所提供的训练集上训练 lasso 回归模型;(2)预先选择对应于细胞类型匹配以及细胞类型无关的 CAGE 和 DNase 变化预测的特征子集,并生成这些特征的汇总统计(也就是不再额外训练)。
Evaluating these two approaches on each gene’s test set revealed that lasso regression with Enformer predictions as features had the best average correlation across all loci, among seven alternative submissions from the competition (Fig. 4a). Moreover, using the Enformer predictions directly as scores, without training, performed comparably to the lasso-trained model and also outperformed the other submissions. This includes the sequence-based predictor deltaSVM27, which was trained on independent DNase and histone H3 monomethylated at K4 (H3K4me1) data derived from matched cell types25. The lasso-trained Enformer exceeded the performance of Group 3, the winning team from CAGI5 (P = 0.002, paired, one-sided Mann–Whitney U test, Fig. 4b). Visualization of the predictions that required no additional training revealed that Enformer faithfully captured the effects of two out of four transcription-factor-binding sites for the LDLR locus (Fig. 4c). Enformer highlighted an additional binding site that had lower effect sizes, but still showed a significant difference. By contrast, deltaSVM successfully predicted only one binding site but missed the other three, overall exhibiting 50% reduced Pearson and Spearman correlations to the measured effects relative to Enformer. For this locus, cell-type-matched predictions mirrored cell-type-agnostic predictions, indicating that the binding sites which were detected likely corresponded to general transcription factors present in most cell types.
在每个基因的测试集上评估这两种做法后发现,以 Enformer 预测为特征的 lasso 回归,在全部位点上的平均相关是竞赛中七种对照提交里最好的(图 4a)。此外,把 Enformer 预测直接当作分数、不再训练,表现与经 lasso 训练的模型相当,并且也优于其他提交。这其中包括基于序列的预测器 deltaSVM27,它在来自匹配细胞类型的独立 DNase 以及 4 位单甲基化组蛋白 H3(H3K4me1)数据上训练25。经 lasso 训练的 Enformer 超过了 CAGI5 获胜队第 3 组的表现(P = 0.002,配对、单侧 Mann–Whitney U 检验,图 4b)。对无需额外训练的预测做可视化显示,Enformer 忠实地抓住了 LDLR 位点四个转录因子结合位点中两个的效应(图 4c)。Enformer 还标出了另一个效应较小、但仍有显著差异的结合位点。相比之下,deltaSVM 只成功预测了一个结合位点,漏掉了另外三个,总体上看,它与实测效应的 Pearson 和 Spearman 相关相对 Enformer 低了 50%。在该位点上,细胞类型匹配的预测与细胞类型无关的预测相一致,表明所检测到的结合位点很可能对应于大多数细胞类型中都存在的通用转录因子。
Fig. 4 | Enformer improves noncoding variant effect prediction as measured by saturation mutagenesis experiments. a, Correlation of variant effect predictions with experimental values, as measured by saturation mutagenesis MPRAs25, on test sets for 15 loci curated for the CAGI5 competition26. Shown above the horizontal break is the performance of five methods that required no additional fine-tuning on each locus; shown below is that of eight methods that were additionally trained on the CAGI5 training sets. b, Pearson correlations of each locus for predictions derived from the Enformer versus the winning team of the CAGI5 competition. Average performance for each model is shown in the corners. Enformer shows a significant performance improvement (P = 0.002, paired, one-sided Mann–Whitney U test). c, Example saturation mutagenesis data from the LDLR promoter locus. Shown in the top row is the reference sequence scaled to the mean effect size among all alternative mutations, with measured effect sizes of individual variants in the second row. Two of the four significant elements match known motifs39, and the two unknown motifs partially resemble the SP1 binding motif. Shown in the bottom two rows are the predictions on the full dataset using methods from a that required no additional fine-tuning.
图 4 | 以饱和突变实验衡量,Enformer 提高了非编码变异效应预测。a,在为 CAGI5 竞赛26 整理的 15 个位点的测试集上,变异效应预测与饱和突变 MPRA25 实测值的相关。水平分隔线之上是五种无需在各位点上额外微调的方法的表现;之下是另外在 CAGI5 训练集上训练过的八种方法的表现。b,由 Enformer 得到的预测与 CAGI5 竞赛获胜队在每个位点上的 Pearson 相关。各模型的平均表现标在角上。Enformer 表现出显著的性能提高(P = 0.002,配对、单侧 Mann–Whitney U 检验)。c,来自 LDLR 启动子位点的饱和突变数据示例。顶行是按全部替代突变平均效应大小缩放的参考序列,第二行是各个变异的实测效应大小。四个显著元件中有两个与已知基序匹配39,两个未知基序则部分类似于 SP1 结合基序。底部两行是用 a 中无需额外微调的方法在完整数据集上的预测。
Discussion
讨论
A long-standing problem in regulatory genomics is that of predicting gene expression purely from DNA sequence. With a novel transformer architecture, we have made a significant improvement by greatly expanding the receptive field and increasing the information flow between distal elements. In this way, the model can better capture biological phenomena such as enhancers regulating promoters despite a large DNA-sequence distance between the two. This led to a substantial performance increase in tissue- and cell-type-specific gene expression prediction correlation from 0.81 to 0.85, one-third of the way toward the experimental-level accuracy of 0.94 estimated from replicates.
调控基因组学中一个长期存在的问题,是单纯从 DNA 序列预测基因表达。借助一种新的 Transformer 架构,我们通过大幅扩大感受野、增加远端元件之间的信息流动,取得了显著改进。这样,模型就能更好地抓住增强子在与启动子相距较远时仍能调控启动子这类生物学现象。这使组织和细胞类型特异的基因表达预测相关从 0.81 大幅提高到 0.85,相当于向由重复实验估计的 0.94 实验水平精度走了三分之一。
This improvement in predictive accuracy translated to improved models for two key problems of biological relevance: enhancer–promoter prediction and noncoding variant effect prediction.
这一预测精度的提高,转化为在两个具有生物学意义的关键问题上的更好模型:增强子–启动子预测,以及非编码变异效应预测。
We observed that the model pays attention to enhancers and considers insulators when making gene expression predictions, suggesting that it has learned canonical distal regulation patterns. Using the Enformer model, we can more accurately predict whether a natural variant or CRISPR-perturbed enhancer will cause a notable expression change than can previous approaches. By relying solely on DNA sequences as input, Enformer has several advantages over alternative variant effect prediction methods: (1) unlike most methods25, it is capable of signed prediction of activating or repressive mutations; (2) by not relying explicitly on nucleotide conservation statistics, as the majority of tools do25, its predictions are not limited to conserved enhancers, which comprise a small proportion of all enhancers30; and (3) it can make predictions for arbitrary sequences, which enables the synthetic design of enhancers that are optimized to exhibit cell-type specificity31. Altogether, these advances and advantages open exciting avenues to study the expanding catalogs of genetic variants linked to disease and enhancer biology in development and evolution.
我们观察到,模型在做基因表达预测时会关注增强子,并会考虑绝缘子,表明它已学到典型的远端调控模式。使用 Enformer 模型,我们比以往方法更准确地预测一个自然变异或经 CRISPR 扰动的增强子是否会引起明显的表达变化。由于只把 DNA 序列作为输入,Enformer 相对其他变异效应预测方法有几项优点:(1)与大多数方法不同25,它能够对激活或抑制突变做带符号的预测;(2)它不像大多数工具那样显式依赖核苷酸保守性统计25,因此预测不局限于只占全部增强子一小部分的保守增强子30;(3)它可以对任意序列做预测,从而能够合成设计经过优化、以表现细胞类型特异性的增强子31。总的来说,这些进展和优点为研究与疾病相关、数量不断增长的遗传变异目录,以及发育和进化中的增强子生物学,开辟了值得期待的途径。
Several paths to further improve model accuracy appear promising. Machine-learning success depends on the training data, so increasing the resolution and quality of the target tracks15, and curating data from additional organisms2, would likely boost performance. Recent work demonstrated that the highly structured 3D DNA contacts, which greatly influence long-range gene regulation, are predictable from the underlying DNA sequence32,33. Artful combination of these models with our own could improve Enformer’s modeling of insulators and distal regulation. A limitation of the current approach is that we can model and predict only for cell types and assays in the training data and cannot generalize to new cell types or assays. Parallel research has begun to address this shortcoming via representation learning of cell types and assays and could make use of the Enformer architecture in the future34,35. The sensitivity of the model to genetic variants could be further improved by training upon the growing number of functional genomic datasets, such as those derived from CRISPR perturbations and massively parallel reporter assays. Currently, the small size of these datasets has limited their usage only to model evaluation. Finally, we anticipate that recent improvements in the computational efficiency36 of transformer models together with better hardware will allow us to further scale-up the models.
进一步提升模型精度看来有几条有前景的路径。机器学习的成败取决于训练数据,因此提高目标轨道的分辨率和质量15,以及整理更多物种的数据2,很可能会提高表现。近期工作表明,对长程基因调控影响很大的、高度结构化的三维 DNA 接触,可以从底层 DNA 序列预测出来32,33。把这些模型与我们的模型巧妙结合,可能改善 Enformer 对绝缘子和远端调控的建模。当前方法的一个局限是,我们只能对训练数据中的细胞类型和实验做建模和预测,无法泛化到新的细胞类型或实验。并行研究已开始通过细胞类型和实验的表示学习来应对这一不足,未来可以利用 Enformer 架构34,35。通过在数量不断增加的功能基因组数据集上训练,例如来自 CRISPR 扰动和大规模平行报告基因实验的数据,模型对遗传变异的敏感性还可以进一步提高。目前这些数据集规模较小,用途仅限于模型评估。最后,我们预期,Transformer 模型计算效率的近期改进36 加上更好的硬件,将使我们能够进一步扩大模型规模。
In the future, Enformer could be systematically applied to fine-map existing GWAS studies22, prioritize rare or de novo variants observed for rare disorders37,38, and impute regulatory activity across species to study cis-regulatory evolution2. To foster these downstream applications, we have made the pretrained Enformer model openly available along with code examples demonstrating its use. Furthermore, we have precomputed effect predictions for all frequent variants in the 1000 Genomes dataset and made them openly available. We hope that our model will stimulate an improved understanding of gene-regulatory architecture and facilitate the development of improved diagnostic tools for diseases of genetic origin.
未来,Enformer 可以被系统地用于精细定位已有的 GWAS 研究22,对罕见疾病中观测到的罕见或新生变异做优先排序37,38,以及跨物种填补调控活性以研究顺式调控进化2。为促进这些下游应用,我们已把预训练的 Enformer 模型连同演示其用法的代码示例公开提供。此外,我们还为 1000 Genomes 数据集中的全部频繁变异预先计算了效应预测,并公开提供。我们希望这一模型将推动对基因调控架构的更好理解,并有助于开发更完善的遗传性疾病诊断工具。
Online content
Any methods, additional references, Nature Research reporting summaries, source data, extended data, supplementary information, acknowledgements, peer review information; details of author contributions and competing interests; and statements of data and code availability are available at https://doi.org/10.1038/s41592-021-01252-x.
在线内容
任何方法、补充参考文献、Nature Research 报告摘要、源数据、扩展数据、补充信息、致谢、同行评审信息;作者贡献和竞争性利益的细节;以及数据和代码可用性声明,见 https://doi.org/10.1038/s41592-021-01252-x。
Received: 17 February 2021; Accepted: 27 July 2021; Published: xx xx xxxx
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
出版商说明 Springer Nature 对出版地图和机构隶属关系中的管辖权主张保持中立。
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/. © The Author(s) 2021
开放获取 本文按知识共享署名 4.0 国际许可协议授权,只要给出原作者和来源的适当署名、提供指向该知识共享许可的链接,并说明是否做了修改,即允许以任何媒介或格式使用、分享、改编、传播和复制。本文中的图片或其他第三方材料包含在本文的知识共享许可之内,除非在该材料的署名行中另有说明。若某材料未包含在本文的知识共享许可之内,且你的预定使用不为成文法所允许或超出允许的使用范围,则需要直接向版权持有人取得许可。要查看该许可副本,请访问 http://creativecommons.org/licenses/by/4.0/。© The Author(s) 2021
Methods
方法
Model architecture. The Enformer architecture consists of three parts: (1) 7 convolutional blocks with pooling, (2) 11 transformer blocks, and (3) a cropping layer followed by final pointwise convolutions branching into 2 organism-specific network heads (Extended Data Fig. 1). Enformer takes as input one-hot-encoded DNA sequence (A = [1,0,0,0], C = [0,1,0,0], G = [0,0,1,0], T = [0,0,0,1], N = [0,0,0,0]) of length 196,608 bp and predicts 5,313 genomic tracks for the human genome and 1,643 tracks for the mouse genome, each of length 896 corresponding to 114,688 bp aggregated into 128-bp bins. The convolutional blocks with pooling first reduce the spatial dimension from 196,608 bp to 1,536 so that each sequence position vector represents 128 bp (although the convolutions do observe nucleotides in the adjacent pooled regions). The transformer blocks then capture long-range interactions across the sequence. The cropping layer trims 320 positions on each side to avoid computing the loss on the far ends because these regions are disadvantaged because they can observe regulatory elements only on one side (toward the sequence center) and not the other (the region beyond the sequence boundaries). Finally, the two output heads predict organism-specific tracks. The Enformer architecture is similar to the state-of-the-art model Basenji2 (ref. 2). However, the following changes helped us improve and exceed its performance: Enformer uses transformer blocks instead of dilated convolutions, attention pooling instead of max pooling, twice as many channels, and 1.5 times longer input sequence (197 kb instead of 131 kb). The detailed model architecture, including the selected hyperparameters, is shown in Extended Data Fig. 1.
模型架构。 Enformer 架构由三部分组成:(1)7 个带池化的卷积块,(2)11 个 Transformer 块,以及(3)一个裁切层,随后是最终的逐点卷积,并分支为 2 个物种特异的网络头(扩展数据图 1)。Enformer 的输入是长度为 196,608 bp 的 one-hot 编码 DNA 序列(A = [1,0,0,0],C = [0,1,0,0],G = [0,0,1,0],T = [0,0,0,1],N = [0,0,0,0]),并预测人类基因组的 5,313 条基因组轨道和小鼠基因组的 1,643 条轨道,每条长度为 896,对应于聚合成 128 bp 箱的 114,688 bp。带池化的卷积块首先把空间维从 196,608 bp 降到 1,536,使每个序列位置向量代表 128 bp(尽管卷积仍会看到相邻池化区域中的核苷酸)。Transformer 块随后捕捉序列上的长程相互作用。裁切层在每一侧剪去 320 个位置,以避免在两端计算损失,因为这些区域处于不利地位:它们只能在一侧(朝向序列中心)看到调控元件,而不能在另一侧(序列边界以外的区域)看到。最后,两个输出头预测物种特异的轨道。Enformer 架构与最先进的模型 Basenji2(文献 2)相似。不过,以下改动帮助我们改进并超过了它的表现:Enformer 用 Transformer 块代替膨胀卷积,用注意力池化代替最大池化,通道数增加一倍,输入序列加长 1.5 倍(197 kb 而不是 131 kb)。包括所选超参数在内的详细模型架构见扩展数据图 1。
Attention pooling summarizes a contiguous chunk of the input sequence across positions for each of the channels and returns the output value as follows:
where indexes sequence position in the pooling window, which is weighted by the exponentiated dot product and is a matrix of learned weights. We apply attention pooling to contiguous chunks of the original input sequence using window size and stride of 2. We initialize to , where is the identity matrix to prioritize the larger value, making the operation similar to max pooling. This initialization gave slightly better performance than did random initialization or initialization with zeros, representing average pooling.
注意力池化对输入序列的一段连续块 ,在 个通道的每一个上跨 个位置做汇总,并返回输出值 ,如下:
其中 索引池化窗口中的序列位置,该位置由指数化点积 加权, 是学到的权重矩阵。我们对原始输入序列的连续块做注意力池化,窗口大小 ,步长为 2。我们把 初始化为 ,其中 是单位矩阵,以优先较大的值,使该操作类似于最大池化。这种初始化的表现略好于随机初始化,或初始化为零(相当于平均池化)。
We use multi-head attention (MHA) layers to share information across the sequence and model long-range interactions, such as those between promoters and enhancers. Each head has a separate set of weights , , and which transform the input sequence into queries , keys , and values . Queries represent the current information at each position and keys represent the information each position will be looking for to attend to. Their dot product plus the relative positional encodings forms the attention matrix, which is computed as , where the entry represents the amount of weight query at position puts on the key at position . Values represent the information that each position will propagate forward to positions that attend to it. Each single attention head computes its output as a weighted sum across all input positions. This allows each query position to use information across the whole sequence. The multiple heads compute with independent parameters, and we concatenate the outputs from each head to form the final layer output followed by a linear layer to combine them. Our layers used 8 heads, value size of 192, and key/query size of 64.
我们使用多头注意力(MHA)层在序列上共享信息,并建模长程相互作用,例如启动子与增强子之间的相互作用。每个头有一套单独的权重 、 和 ,把输入序列 变换为查询 、键 和值 。查询表示每个位置当前的信息,键表示每个位置将寻找以便加以关注的信息。它们的点积加上相对位置编码 构成注意力矩阵,计算为 ,其中元素 表示位置 的查询对位置 的键所赋予的权重。值表示每个位置将向前传播给关注它的那些位置的信息。每个单独的注意力头把它的输出计算为跨全部输入位置的加权和。这使每个查询位置都能使用整条序列上的信息。多个头用独立参数计算,我们把各头的输出拼接起来形成该层的最终输出,再经过一个线性层把它们组合。我们的层使用 8 个头,值大小为 192,键/查询大小为 64。
MHA applications in NLP typically operate directly on the input sequence, tokenized into words and embedded in a richer embedding space. The convolution tower preceding MHA in the Enformer model serves to perform an analogous operation of embedding nucleotide segments and contributes a compelling inductive bias for adjacent nucleotides to function together in motifs. We chose to compute at 128-bp resolution because it roughly represents a well-studied length of regulatory elements that contain several motifs and is an appropriate bin size at which to aggregate the experimental data to be predicted. Finer resolution has potential benefits when the data support it15, but would extend the sequence length entering the quadratic complexity MHA and make the model engineering intractable on currently available hardware.
NLP 中的 MHA 应用通常直接作用在被切成词并嵌入更丰富嵌入空间的输入序列上。Enformer 模型中位于 MHA 之前的卷积塔起到类似作用:对核苷酸片段做嵌入,并带来一种有说服力的归纳偏置,即相邻核苷酸在基序中共同起作用。我们选择在 128 bp 分辨率上计算,因为它大致代表了含有若干基序、且已被充分研究的调控元件长度,并且是汇总待预测实验数据的合适分箱大小。在数据支持时,更细的分辨率有潜在好处15,但会拉长进入二次复杂度 MHA 的序列长度,使模型工程在目前可用的硬件上难以进行。
To inject positional information, we add relative positional encodings40 to the attention term as formulated in the Transformer-XL paper41. Relative positional encodings provide a parameterized baseline for how actively two positions in the sequence should influence each other during the layer’s transformation as a function of their pairwise distance. Specifically, we use , where is a linear function of different relative basis functions , and and are the position-agnostic embeddings used to evaluate the preference for specific keys () or relative distances (). We use three different basis function classes for , as visualized in Extended Data Fig. 5b: exponential, central mask, and gamma. For each basis function, we use a symmetric and asymmetric version to introduce directionality. We use the same number of relative positional basis functions as the value size of MHA (192). The 192 basis functions are equally divided among the basis function classes and the symmetric versus asymmetric versions thereof. With 3 basis function classes, each basis function class provides 64 positional features (32 symmetric and 32 asymmetric). Dropout rates of 0.01 and 0.05 were used for positional encoding features and the final attention matrix respectively in MHA. All other dropout rates are annotated in Extended Data Fig. 1a.
为注入位置信息,我们按 Transformer-XL 论文41 的表述,把相对位置编码40 加到 注意力项上。相对位置编码提供了一个参数化的基线,说明序列中两个位置在该层变换中应如何随它们的成对距离而相互影响。具体而言,我们使用 ,其中 是不同相对基函数 的线性函数, 和 是与位置无关的嵌入,分别用来评估对特定键()或相对距离()的偏好。我们对 使用三类不同的基函数,如扩展数据图 5b 所示:指数、中心掩蔽和伽马。对每个基函数,我们使用对称的 以及不对称的 版本,以引入方向性。相对位置基函数的数目与 MHA 的值大小相同(192)。这 192 个基函数在各类基函数及其对称与不对称版本之间均分。在 3 类基函数下,每一类提供 64 个位置特征(32 个对称、32 个不对称)。在 MHA 中,位置编码特征和最终注意力矩阵的 dropout 率分别为 0.01 和 0.05。其余 dropout 率标注在扩展数据图 1a 中。
Model training and evaluation. Model training and evaluation was performed similarly as in Kelley (2020)2, with some modifications. First, we used a slightly modified homologous partitioning of the mouse (mm10) and human (hg38) genomes to avoid having highly similar sequences in the training and test sets. We started with the same set of 2,147 training, 110 validation, and 337 test regions of 1 Mb in the human genome as defined previously15, as well as the same set of 1,532 training, 65 validation, and 177 test 1 Mb regions in the mouse genome. Next, we further filtered the training and validation regions in the following way to make sure that there is no leakage from the training set to the validation and test sets across the two species. If a training region in one species was homologous to a validation or test region in the other, we removed that training region. If a validation region in one species was homologous to a test region in the other, we removed that validation region. To define homology between the 1-Mb regions, we constructed a bipartite graph, in which the vertices represent these regions. Next, we placed edges between 2 regions if they have >100 kb of aligning sequence in the hg38-mm10 syntenic net format alignment downloaded from the UCSC Genome Browser42. Finally, we partitioned connected components in the bipartite graph randomly into training, validation, and test sets.
模型训练与评估。 模型训练与评估的做法与 Kelley(2020)2 类似,但有若干修改。首先,我们对小鼠(mm10)和人类(hg38)基因组采用了略作修改的同源划分,以避免训练集和测试集中出现高度相似的序列。我们从先前定义的同一组人类基因组 2,147 个训练、110 个验证和 337 个测试 1 Mb 区域出发15,以及同一组小鼠基因组 1,532 个训练、65 个验证和 177 个测试 1 Mb 区域。随后,我们按如下方式进一步过滤训练和验证区域,以确保两个物种之间不会从训练集向验证集和测试集泄漏。如果一个物种中的某个训练区域与另一物种中的验证或测试区域同源,我们就去掉该训练区域。如果一个物种中的某个验证区域与另一物种中的测试区域同源,我们就去掉该验证区域。为定义这些 1 Mb 区域之间的同源性,我们构建了一个二分图,顶点代表这些区域。若两个区域在从 UCSC Genome Browser 下载的 hg38–mm10 同线性 net 格式比对中具有超过 100 kb 的比对序列42,我们就在它们之间连边。最后,我们把二分图中的连通分量随机划分到训练、验证和测试集。
The dataset contains 34,021 training, 2,213 validation, and 1,937 test sequences for the human genome, and 29,295 training, 2,209 validation, and 2,017 test sequences for the mouse genome. For the human genome, each example contains 2,131 transcription factor (TF) chromatin immunoprecipitation and sequencing (ChIP–seq), 1,860 histone modification ChIP–seq, 684 DNase-seq or ATAC-seq, and 638 CAGE tracks (total 5,313, Supplementary Table 2). For the mouse genome, each example contains 308 TF ChIP–seq, 750 histone modification ChIP–seq, 228 DNase-seq or ATAC-seq, and 357 CAGE tracks (total 1,643, Supplementary Table 3). We modified the Basenji2 dataset by extending the input sequence to 196,608 bp from the original 131,072 bp using the hg38 reference genome.
该数据集包含人类基因组的 34,021 条训练、2,213 条验证和 1,937 条测试序列,以及小鼠基因组的 29,295 条训练、2,209 条验证和 2,017 条测试序列。对人类基因组,每个样本包含 2,131 条转录因子(TF)染色质免疫沉淀测序(ChIP–seq)、1,860 条组蛋白修饰 ChIP–seq、684 条 DNase-seq 或 ATAC-seq,以及 638 条 CAGE 轨道(共计 5,313 条,补充表 2)。对小鼠基因组,每个样本包含 308 条 TF ChIP–seq、750 条组蛋白修饰 ChIP–seq、228 条 DNase-seq 或 ATAC-seq,以及 357 条 CAGE 轨道(共计 1,643 条,补充表 3)。我们用 hg38 参考基因组把 Basenji2 数据集的输入序列从原来的 131,072 bp 扩展到 196,608 bp。
To train a model simultaneously on human and mouse genomes, we alternated between a batch containing data from the human genome and the mouse genome. The main Enformer model with 1,536 channels was implemented in Sonnet v2, TensorFlow (v2.4.0), and was trained on 64 TPU v3 cores with batch size of 64 (1 per core) for 150,000 steps (approximately 3 days) using all-reduce gradient aggregation across the cores at every step. Batch normalization statistics were also aggregated across multiple replicas using 0.9 momentum. We used the Adam optimizer from Sonnet v2 (ref. 43) with a learning rate of 0.0005 and default settings for other hyperparameters: β1 = 0.9, β2 = 0.999, ε = 1 × 10–8. The optimal learning rate was discovered by grid search yielding the highest performance on the validation set. We linearly increased the learning rate from 0 to target value in the first 5,000 steps of training. We clipped gradients to a maximum global norm of 0.2. We used the same data augmentation as Basenji2 (ref. 2) during training by randomly shifting the input sequence by up to 3 bp and reverse-complementing the input sequence while reversing the targets. Finally, we fine-tuned the Enformer model on human data for 30,000 steps using a lower learning rate of 0.0001.
为在人类和小鼠基因组上同时训练模型,我们交替使用包含人类基因组数据和小鼠基因组数据的批次。主 Enformer 模型有 1,536 个通道,用 Sonnet v2、TensorFlow(v2.4.0)实现,并在 64 个 TPU v3 核心上以批次大小 64(每核 1 个)训练 150,000 步(约 3 天),每一步在各核心间做 all-reduce 梯度聚合。批归一化统计量也用 0.9 的动量跨多个副本聚合。我们使用 Sonnet v2 的 Adam 优化器(文献 43),学习率为 0.0005,其余超参数取默认设置:β1 = 0.9,β2 = 0.999,ε = 1 × 10–8。最优学习率由网格搜索得到,以使验证集上的表现最高。我们在训练的前 5,000 步把学习率从 0 线性升到目标值。我们将梯度裁剪到最大全局范数 0.2。训练期间我们采用与 Basenji2(文献 2)相同的数据增强:把输入序列随机平移最多 3 bp,并对输入序列做反向互补,同时反转目标。最后,我们用更低的学习率 0.0001,在人类数据上对 Enformer 模型微调 30,000 步。
We used the pretrained Basenji2 model for all main model comparisons and retrained an equivalent model for ablation and hyperparameter sweeps shown in Extended Data Fig. 5. In these comparative analyses, we used 768 channels (1/2 of the original Enformer model obtained by using a value size of 96 in MHA), 131 kb input sequence, and batch size 32 trained on 32 TPU v3 cores. We did not fine-tune these models on the human data. For models using dilated convolutions instead of transformer blocks, we used a higher learning rate of 0.02 without ramp up of the learning rate. As for Enformer, the optimal learning rate was discovered by grid search yielding the highest performance on the validation set. All models were trained for 500,000 steps while only storing the model with the highest Spearman correlation of CAGE TSS gene expression across genes averaged across experiments computed on the validation set every 1,000 steps.
我们在所有主要模型比较中使用预训练的 Basenji2 模型,并为扩展数据图 5 中所示的消融和超参数扫描重新训练了一个等价模型。在这些比较分析中,我们使用 768 个通道(原 Enformer 模型的 1/2,通过在 MHA 中把值大小设为 96 得到)、131 kb 输入序列,以及批次大小 32,在 32 个 TPU v3 核心上训练。我们没有在人类数据上微调这些模型。对使用膨胀卷积而非 Transformer 块的模型,我们使用更高的学习率 0.02,且不爬升学习率。与 Enformer 一样,最优学习率由网格搜索得到,以使验证集上的表现最高。所有模型均训练 500,000 步,但只保存每 1,000 步在验证集上计算、跨实验平均的、跨基因的 CAGE TSS 基因表达 Spearman 相关最高的那个模型。
We used the validation set for hyperparameter selection and the test set for Basenji2 comparison. We considered two evaluation metrics: (1) Pearson correlation computed across all 128-bp binned genomic positions in the validation/test set for each output track; and (2) Pearson correlation of CAGE gene expression values (log(1 + x)-transformed and standardized across genes for each experiment) of all protein-coding genes in the validation/test set computed either for each CAGE experiment across genes (main metric) or across CAGE experiments for each gene (shown in Fig. 1b). Observed and predicted gene expression values were obtained by summing up the observed/predicted CAGE read counts at all unique TSS locations of the gene. For each TSS location, we used the 128-bp bin overlapping the TSS as well as the two neighboring bins (3 bins in total). We used test–time augmentation during model evaluation: we averaged the predictions from 8 sequences randomly augmented the same way as during training (≤3 bp shifts and reverse-complementation). We only evaluated the performance of our model on the test set once to generate Fig. 1 and did not use the test set during model development.
我们用验证集做超参数选择,用测试集与 Basenji2 比较。我们考虑两项评估指标:(1)对每条输出轨道,在验证/测试集中全部 128 bp 分箱基因组位置上计算的 Pearson 相关;(2)验证/测试集中全部蛋白编码基因的 CAGE 基因表达值(先做 log(1 + x) 变换,再对每个实验跨基因标准化)的 Pearson 相关,既可以按每个 CAGE 实验跨基因计算(主指标),也可以按每个基因跨 CAGE 实验计算(见图 1b)。观测和预测的基因表达值,是把该基因全部独特 TSS 位置上的观测/预测 CAGE 读数相加得到的。对每个 TSS 位置,我们使用与 TSS 重叠的 128 bp 箱以及两侧相邻的两个箱(共 3 个箱)。模型评估时我们使用测试时增强:把 8 条按训练时相同方式随机增强的序列(不超过 3 bp 的平移以及反向互补)的预测取平均。我们只在测试集上评估了一次模型表现以生成图 1,在模型开发过程中没有使用测试集。
To select a representative example, we visualized the top 10 transcripts with highest discrepancy between Enformer and Basenji2 performance on the ‘Across CAGE experiments’ metric measuring tissue specificity for 33% of the most tissue-specific genes. We picked the sixth transcript in the list (ENST00000524922) because it cleanly showed differences across all three categories of genomic tracks (DNA accessibility, histone modifications, and gene expression).
为选择一个有代表性的例子,我们可视化了在衡量组织特异性的「跨 CAGE 实验」指标上,Enformer 与 Basenji2 表现差异最大的前 10 个转录本,该指标针对最组织特异的 33% 基因。我们选了列表中的第 6 个转录本(ENST00000524922),因为它在全部三类基因组轨道(DNA 可及性、组蛋白修饰和基因表达)上都清楚地显示出差异。
Enhancer prioritization. We obtained a set of enhancer–gene pairs tested using a CRISPRi assay perturbing the enhancer of interest while measuring the expression change of the gene in K562 cells from two studies: Gasperini et al.9 using scRNA-seq to measure expression changes, and Fulco et al.13 using Flow-FISH. We transformed the enhancer and gene coordinates from hg19 to hg38 using the UCSC liftOver web tool42. Each enhancer–gene pair contains a label denoting whether a significant expression change was induced after CRISPRi treatment. We denoted the set of all enhancers as ‘candidate’ enhancers and those that showed a change in expression as ‘validated’ enhancers. We evaluated different methods on their ability to classify or prioritize enhancer–gene pairs that exhibited a significant expression change using area under precision–recall curve (auPRC)13.
增强子优先级排序。 我们从两项研究中获得了一组用 CRISPRi 实验扰动目标增强子并在 K562 细胞中测量基因表达变化所检测的增强子–基因对:Gasperini 等9 用 scRNA-seq 测量表达变化,Fulco 等13 用 Flow-FISH。我们用 UCSC liftOver 网络工具把增强子和基因坐标从 hg19 转换到 hg38 42。每个增强子–基因对都有一个标签,标明 CRISPRi 处理后是否诱导了显著的表达变化。我们把全部增强子称为「候选」增强子,把显示出表达变化的称为「已验证」增强子。我们用精确率–召回率曲线下面积(auPRC)评估不同方法对表现出显著表达变化的增强子–基因对进行分类或优先级排序的能力13。
To prioritize enhancer–gene pairs with sequence-based models, we computed three different scores: gradient × input, attention, and in silico mutagenesis (ISM). For each enhancer–gene pair, we determined the major TSS of the gene by taking the highest predicted CAGE value in K562 using Enformer. We extracted the DNA sequence centered at the main TSS and computed the following different enhancer–gene scores:
为用基于序列的模型对增强子–基因对做优先级排序,我们计算了三种不同的分数:梯度 × 输入、注意力,以及计算机模拟诱变(ISM)。对每个增强子–基因对,我们用 Enformer 取 K562 中预测的最高 CAGE 值,以此确定该基因的主要 TSS。我们提取以该主 TSS 为中心的 DNA 序列,并计算如下不同的增强子–基因分数:
- Gradient × input: We computed the absolute value of the gradient of the CAGE targets (either using the K562-specific CAGE targets or all CAGE targets, Extended Data Fig. 7c) at the TSS with regard to the input reference sequence nucleotide. Note that since our input sequence is one-hot encoded, taking the input gradient of the nonzero channel (the reference nucleotide), is equivalent to computing gradient × input attributions12. We note that ‘CAGE at TSS’ always means summing the absolute gradient values from three adjacent bins, as is also done in gene-focused model evaluation. The three bins include the bin overlapping the TSS and one flanking bin on each side. The enhancer–gene score was obtained by summing the absolute gradient × input scores in the 2-kb window centered at the enhancer.
- Attention: We first averaged transformer attention matrices across all heads and layers. We extracted the row corresponding to the query index positioned at the TSS, so that keys correspond to different spatial positions and the attention values specify how much the model attended to these positions when making predictions for the TSS. We only computed this contribution score for Enformer. The enhancer–gene score was obtained by summing the attention scores in the 2-kb window centered at the enhancer.
- ISM: The in silico mutagenesis enhancer–gene score was computed by comparing K562 CAGE predictions at the TSS from the reference sequence with predictions from modified sequence where the 2-kb enhancer sequence was replaced by a random sequence: |f(modified) – f(reference)|.
- 梯度 × 输入:我们计算 TSS 处 CAGE 目标(或使用 K562 特异的 CAGE 目标,或使用全部 CAGE 目标,扩展数据图 7c)对输入参考序列核苷酸的梯度的绝对值。注意,由于我们的输入序列是 one-hot 编码的,取非零通道(即参考核苷酸)的输入梯度,等价于计算梯度 × 输入归因12。我们指出,「TSS 处的 CAGE」始终意味着把相邻三个箱的绝对梯度值相加,这与以基因为中心的模型评估做法相同。这三个箱包括与 TSS 重叠的箱以及两侧各一个侧翼箱。增强子–基因分数是把以增强子为中心的 2 kb 窗口内的绝对梯度 × 输入分数相加得到的。
- 注意力:我们首先把 Transformer 注意力矩阵在全部头和层上取平均。我们提取对应于定位在 TSS 的查询索引的那一行,从而使键对应不同的空间位置,注意力值则说明模型在为该 TSS 做预测时对这些位置给予了多少关注。我们只为 Enformer 计算了这一贡献分数。增强子–基因分数是把以增强子为中心的 2 kb 窗口内的注意力分数相加得到的。
- ISM:计算机模拟诱变的增强子–基因分数,是比较参考序列在 TSS 处的 K562 CAGE 预测,与把 2 kb 增强子序列替换为随机序列后的修改序列预测得到的:|f(修改) – f(参考)|。
To reproduce the ABC score introduced in Fulco et al.13, we obtained the BigWig of H3K27ac ChIP–seq data in K562 from ENCODE with file accession ENCFF779QTH and DNase with file accessions ENCFF413AHU and ENCFF936BDN. We summed the normalized reads from replicates. For each track and enhancer, we summed up the signal at the enhancer in a fixed window of 2 kb centered at the enhancer. This fixed and broader window yielded better performance compared to the variable window size of ~500 bp as used in the original ABC score (Extended Data Fig. 4a).
为复现 Fulco 等13 提出的 ABC 分数,我们从 ENCODE 获取了 K562 中 H3K27ac ChIP–seq 数据的 BigWig,文件登录号为 ENCFF779QTH,以及 DNase 的文件登录号 ENCFF413AHU 和 ENCFF936BDN。我们把各重复的归一化读数相加。对每条轨道和每个增强子,我们在以增强子为中心的固定 2 kb 窗口内把该增强子处的信号相加。与原来 ABC 分数所用的约 500 bp 可变窗口相比,这一固定且更宽的窗口给出了更好的表现(扩展数据图 4a)。
GTEx SLDP. We predicted the effect of a genetic variant on various annotations by computing a forward pass through the model using the reference and alternative alleles, subtracting their difference, and summing outputs across the sequence to obtain a signed score for each training dataset. We averaged scores computed using the forward and reverse complement sequence and small sequence shifts to the left and right. We computed scores for all 1000 Genomes SNPs. We used SLDP20 to estimate the functional correlation between these scores and GTEx v7a summary statistics for 48 tissues while accounting for population linkage disequilibrium structure (Supplementary Information).
GTEx SLDP。 我们用参考等位基因和替代等位基因分别对模型做一次前向传播,相减其差,再把输出沿序列求和,从而为每个训练数据集得到一个带符号的分数,以此预测遗传变异对各种注释的效应。我们把用正向和反向互补序列以及向左、向右的小幅序列平移计算出的分数取平均。我们对全部 1000 Genomes SNP 计算了分数。我们使用 SLDP20,在计入群体连锁不平衡结构的同时,估计这些分数与 48 个组织的 GTEx v7a 汇总统计量之间的功能相关(补充信息)。
Fine-mapped GTEx classification. To study specific eQTLs without needing to consider LD, we studied statistical fine-mapping of GTEx v8 using the SuSiE method20,23. We focused on variants with posterior inclusion probability (PIP) in a credible causal set >0.9, which ranged from a minimum of 166 variants for substantia nigra to 2,740 for tibial nerve. We arranged a classification task to discriminate between these positive causal variants and a matched set of negative variants. When available, we chose a negative variant matched to each causal variant from the set with PIP < 0.01 but |Z-score| > 4 tested for the same gene. When unavailable for the same gene, we chose from the set with PIP < 0.01 and |Z-score| > 6 genome-wide.
精细定位的 GTEx 分类。 为在不必考虑连锁不平衡的情况下研究特定 eQTL,我们用 SuSiE 方法研究了 GTEx v8 的统计精细定位20,23。我们关注可信因果集合中后验纳入概率(PIP)大于 0.9 的变异,其数目从黑质最少的 166 个变异到胫神经的 2,740 个不等。我们安排了一项分类任务,以区分这些阳性因果变异与一组匹配的阴性变异。在可用时,我们为每个因果变异从针对同一基因检测、PIP < 0.01 但 |Z 分数| > 4 的集合中选择一个匹配的阴性变异。若同一基因没有可用的,则从全基因组 PIP < 0.01 且 |Z 分数| > 6 的集合中选择。
To determine how informative different variant annotations are, we trained separate random forest classifiers for each tissue to distinguish causal from noncausal variants using eight-fold crossvalidation. We selected the default hyperparameters of the scikit-learn 0.22 implementation after finding negligible accuracy gains from modifying them44. However, owing to the large number of features derived from the training datasets, setting the maximum features considered per decision tree split to log2 of the total number of features greatly improved the computational efficiency. We fit 100 iterations of stochastic crossvalidation shuffling and random forest fitting to delineate a low-variance estimate of model accuracy. We performed statistical tests comparing two different model feature sets by comparing the 8 × 100 distinct test set auROCs.
为确定不同变异注释的信息量,我们为每个组织分别训练随机森林分类器,用八折交叉验证区分因果与非因果变异。在发现修改超参数带来的精度增益可以忽略后,我们选用了 scikit-learn 0.22 实现的默认超参数44。不过,由于从训练数据集得到的特征数量很大,把每棵决策树每次分裂所考虑的最大特征数设为特征总数的 log2,极大地提高了计算效率。我们拟合了 100 次随机交叉验证打乱和随机森林拟合,以得到模型精度的低方差估计。我们通过比较 8 × 100 个不同的测试集 auROC,对不同模型特征集做统计检验。
For signed GTEx analysis, we benchmarked model predictions on the basis of their ability to discriminate causal variants that increase versus decrease gene expression. In this analysis, we removed variants that affect gene expression in opposite directions for different cis-genes. We manually matched FANTOM5 CAGE sample descriptions to the GTEx tissues. We skipped cases with more than three possible matches. In cases with two or three possible matches, we chose the CAGE sample with the best average concordance between the Basenji2 and Enformer predictions. We computed auROC statistics by ranking causal variants by their signed prediction for that sample.
对于带符号的 GTEx 分析,我们根据模型预测区分增加与降低基因表达的因果变异的能力来做基准测试。在这项分析中,我们去掉了对不同顺式基因沿相反方向影响基因表达的变异。我们手工把 FANTOM5 CAGE 样本描述与 GTEx 组织相对应。超过三种可能匹配的情形我们跳过。在有两种或三种可能匹配时,我们选择 Basenji2 与 Enformer 预测平均一致性最好的那个 CAGE 样本。我们按该样本的带符号预测对因果变异排序,以此计算 auROC 统计量。
Benchmarking variant effect predictions on saturation mutagenesis data. We acquired training and test sets as well as the predictive accuracies of individual competition participants from the CAGI5 competition26 (M. Kircher, personal communication, https://genomeinterpretation.org/content/expression-variants). For each variant and locus, we evaluated its effect as the predicted difference between the reference and alternative allele summed in four flanking bins representing 512 bp, producing 5,313 features based on the human datasets. All CAGE features were log-transformed after adding a pseudocount of 1 prior to computing this difference. For each allele, we averaged predictions for the forward and reverse-complemented sequence. We scaled the features from the test set with scaling factors computed on the features from the training set, such that the training features had a mean of 0 and s.d. of 1. Following our previous work45, we then trained a lasso regression model for each locus using these features and the corresponding training set. The strength of the regularization was controlled by a single λ parameter, which was optimized using tenfold crossvalidation for each training set using the cv.glmnet function of the glmnet library in R.
在饱和诱变数据上对变异效应预测做基准测试。 我们从 CAGI5 竞赛26 获取了训练集和测试集,以及各参赛者的预测精度(M. Kircher,个人通讯,https://genomeinterpretation.org/content/expression-variants)。对每个变异和位点,我们把它的效应评估为参考等位基因与替代等位基因预测之差,并在代表 512 bp 的四个侧翼箱上求和,从而基于人类数据集产生 5,313 个特征。在计算该差之前,全部 CAGE 特征在加 1 的伪计数后做了对数变换。对每个等位基因,我们把正向和反向互补序列的预测取平均。我们用在训练集特征上算出的缩放因子来缩放测试集特征,使训练特征的均值为 0、标准差为 1。按我们先前的工作45,我们随后用这些特征和相应的训练集为每个位点训练一个套索回归模型。正则化强度由单一的 λ 参数控制,该参数对每个训练集用 R 中 glmnet 库的 cv.glmnet 函数经十折交叉验证优化。
For our training-free comparisons, we selected the subset of features corresponding to cell-type-matched and cell-type-agnostic predictions of changes in CAGE and DNase. For the cell-type-agnostic models, we used the subset of all 638 CAGE or 674 DNase features (Supplementary Table 2). For the cell-type-matched models, we additionally required the CAGE/DNase features to contain the following substrings: (1) ‘HepG2’ for F9, LDLR, and SORT1, (2) ‘K562’ for GP1BB, HBB, HBG1, and PKLR, and (3) ‘HEK293’ for HNF4A, MSMB, TERT (performed in HEK293T cells), and MYCrs6983267. For several loci, a perfectly matched DNase or CAGE sample did not exist. We therefore selected the most closely matched feature based on the following substrings: (1) ‘pancreas’ for ZFAND3, (2) ‘glioblastoma’ for TERT (performed in GBM cells), (3) ‘keratinocyte’ for IRF6, and (4) ‘SK-MEL’ for IRF4. For each locus, we extracted the features matching the aforementioned substrings, and used the first principal component (PC) of the indicated features as our summary statistic, inverting the sign of the PC if it was negatively correlated to the mean of the features.
对于无需训练的比较,我们选择了对应于细胞类型匹配和细胞类型无关的 CAGE 与 DNase 变化预测的特征子集。对细胞类型无关的模型,我们使用全部 638 个 CAGE 或 674 个 DNase 特征的子集(补充表 2)。对细胞类型匹配的模型,我们额外要求 CAGE/DNase 特征包含如下子串:(1)对 F9、LDLR 和 SORT1 为「HepG2」,(2)对 GP1BB、HBB、HBG1 和 PKLR 为「K562」,(3)对 HNF4A、MSMB、TERT(在 HEK293T 细胞中进行)和 MYCrs6983267 为「HEK293」。对若干位点,并不存在完全匹配的 DNase 或 CAGE 样本。因此我们根据如下子串选择最接近匹配的特征:(1)对 ZFAND3 为「pancreas」,(2)对 TERT(在 GBM 细胞中进行)为「glioblastoma」,(3)对 IRF6 为「keratinocyte」,(4)对 IRF4 为「SK-MEL」。对每个位点,我们提取与上述子串匹配的特征,并用所示特征的第一主成分(PC)作为汇总统计量;若该 PC 与特征均值负相关,则反转其符号。
Reporting Summary. Further information on research design is available in the Nature Research Reporting Summary linked to this article.
报告摘要。 关于研究设计的更多信息可见与本文关联的 Nature Research 报告摘要。
Data availability
Gene annotation was obtained from https://www.gencodegenes.org/ (v32). Basenji2 training, validation, and test data was obtained from https://console.cloud.google.com/storage/browser/basenji_barnyard/data. Processed CRISPRi data for Fulco et al 201913 was obtained from supplementary material and for Gasperini et al 20199 from GEO accession GSE120861. H3K27ac ChIP–seq data in K562 used for analysis in Fig. 2 was obtained from https://www.encodeproject.org/ with file accession ENCFF779QTH and DNase with file accessions ENCFF413AHU and ENCFF936BDN. TAD boundaries processed by Fudenberg et al 202032 were obtained from https://console.cloud.google.com/storage/browser/basenji_hic/insulation. Fine-mapped eQTLs are available from the supplementary material of Wang et al 202122 and the negative set from https://console.cloud.google.com/storage/browser/dm-enformer/data/gtex_fine. We acquired training and test sets as well as the predictive accuracies of individual competition participants from the CAGI5 competition26 (M. Kircher, personal communication, https://genomeinterpretation.org/content/expression-variants). For comparison to ExPecto, we used the provided data from https://github.com/FunctionLab/ExPecto/tree/master/resources.
数据可用性
基因注释来自 https://www.gencodegenes.org/(v32)。Basenji2 的训练、验证和测试数据来自 https://console.cloud.google.com/storage/browser/basenji_barnyard/data。Fulco 等 201913 的处理后 CRISPRi 数据来自补充材料,Gasperini 等 20199 的数据来自 GEO 登录号 GSE120861。图 2 分析所用的 K562 中 H3K27ac ChIP–seq 数据来自 https://www.encodeproject.org/,文件登录号为 ENCFF779QTH,DNase 的文件登录号为 ENCFF413AHU 和 ENCFF936BDN。Fudenberg 等 202032 处理后的 TAD 边界来自 https://console.cloud.google.com/storage/browser/basenji_hic/insulation。精细定位的 eQTL 可见 Wang 等 202122 的补充材料,阴性集合来自 https://console.cloud.google.com/storage/browser/dm-enformer/data/gtex_fine。我们从 CAGI5 竞赛26 获取了训练集和测试集以及各参赛者的预测精度(M. Kircher,个人通讯,https://genomeinterpretation.org/content/expression-variants)。为与 ExPecto 比较,我们使用了 https://github.com/FunctionLab/ExPecto/tree/master/resources 提供的数据。
Code availability
All components of our core algorithm, including the full model architecture and example code to train and evaluate the model are available under the open source Apache 2.0 license at the following URL: https://github.com/deepmind/deepmind-research/tree/master/enformer. The code is also archived at Zenodo https://doi.org/10.5281/zenodo.509837546. In addition, layer components of the model are now available in the existing Basenji repository for biological sequence deep learning at https://github.com/calico/basenji also under the open source Apache 2.0 license. Pre-trained Enformer model is available on TF-Hub so that users can easily run it on new data: https://tfhub.dev/deepmind/enformer/1. We also plan to release it in the Kipoi model repository47. We provide code examples (enformer-usage.ipynb) on how to use that model to score genetic variants. Finally, we provide variant effect predictions for all frequent variants in the 1000 genomes cohort (MAF>0.5% in any population) here, with an open creative-commons CC-BY 4.0 license. To make these predictions more accessible, we distilled the 5,313 features into 20 highly informative variant scores using PCA (Methods) to keep the released file sizes manageable (<1 GB in total for 10 M variants, instead of 100 GB) while retaining high predictive accuracy (GTEx fine-mapping classification auROC of 0.743 compared to 0.747 using all features).
代码可用性
我们核心算法的全部组件,包括完整模型架构以及训练和评估模型的示例代码,以开源 Apache 2.0 许可证在如下 URL 提供:https://github.com/deepmind/deepmind-research/tree/master/enformer。代码也在 Zenodo 存档:https://doi.org/10.5281/zenodo.509837546。此外,该模型的层组件现在也放在已有的生物学序列深度学习 Basenji 仓库中,地址为 https://github.com/calico/basenji,同样采用开源 Apache 2.0 许可证。预训练的 Enformer 模型可在 TF-Hub 上获取,以便用户易于在新数据上运行:https://tfhub.dev/deepmind/enformer/1。我们还计划把它发布到 Kipoi 模型仓库47。我们提供了代码示例(enformer-usage.ipynb),说明如何用该模型给遗传变异打分。最后,我们在此提供 1000 genomes 队列中全部常见变异(在任一群体中 MAF>0.5%)的变异效应预测,采用开放的知识共享 CC-BY 4.0 许可证。为使这些预测更易于获取,我们用主成分分析把 5,313 个特征提炼为 20 个信息量高的变异分数(方法),以使发布的文件大小可控(1,000 万个变异合计小于 1 GB,而不是 100 GB),同时保持较高的预测精度(GTEx 精细定位分类的 auROC 为 0.743,而使用全部特征时为 0.747)。
Extended Data Fig. 1 | Enformer model architecture and comparison to Basenji2. a) From left to right: Enformer model architecture, ‘dilated’ architecture used in ablation studies obtained by replacing the transformer part of the model with dilated convolutions, and Basenji2 (ref. 2). Output shapes (without batch dimensions) are shown as tuples on the right side of the blocks. The number of trainable parameters for different parts of Enformer are shown on the left side of the blocks. The two main hyperparameters of the model are the number of transformer/dilated layers, L, and the number of channels, C. All models have the same two output heads as shown on the Enformer at the bottom. The number of channels in the convolutional tower Ci was increased by a constant multiplication factor to reach C channels starting from C/2 (or 0.375*C for Basenji2) in 6 layers. For dilated layers, we increased the dilation rate Di by a factor of 1.5 at every layer (rounded to the nearest integer). b) Definition of different network blocks in terms of basic neural network layers. MHA denotes multi-headed attention using relative positional encodings with kq representing the number of key/query size, v representing the value size and h the number of heads. Number of relative positional basis functions is equal to value size v.
扩展数据图 1 | Enformer 模型架构及与 Basenji2 的比较。a)从左到右:Enformer 模型架构、消融研究中所用的「膨胀」架构(把模型的 Transformer 部分替换为膨胀卷积得到),以及 Basenji2(文献 2)。输出形状(不含批次维)以元组形式标在各块右侧。Enformer 不同部分的可训练参数数目标在各块左侧。模型的两个主要超参数是 Transformer/膨胀层数 L 和通道数 C。所有模型都有与底部 Enformer 所示相同的两个输出头。卷积塔中的通道数 Ci 以恒定乘法因子增加,在 6 层内从 C/2(Basenji2 则为 0.375*C)达到 C 个通道。对膨胀层,我们在每一层把膨胀率 Di 增加 1.5 倍(四舍五入到最近整数)。b)用基本神经网络层给出不同网络块的定义。MHA 表示使用相对位置编码的多头注意力,kq 表示键/查询大小,v 表示值大小,h 表示头数。相对位置基函数的数目等于值大小 v。
Extended Data Fig. 2 | Replicate level accuracy. a) Gene expression correlation (log(1+x) pearsonR) for each CAGE track across protein-coding genes comparing experimental-level accuracy computed in two ways (estimated and direct) to Enformer. For ‘Replicates direct’, CAGE replicate experiments were partitioned into two groups and compared against each other. For ‘Replicates estimated’, a predictive model was used to impute CAGE values of a particular track from all other tracks.
扩展数据图 2 | 重复实验水平的精度。a)每条 CAGE 轨道跨蛋白编码基因的基因表达相关(log(1+x) pearsonR),把以两种方式(估计和直接)计算的实验水平精度与 Enformer 相比较。对「重复直接」,CAGE 重复实验被分成两组并相互比较。对「重复估计」,用一个预测模型从全部其他轨道推断某一轨道的 CAGE 值。
Extended Data Fig. 3 | Predictive performance for treated samples. a) Groups of CAGE experiments where the biological samples were perturbed in different ways. b) Observed and predicted gene expression matrices (log(1+x) transformed) for CD14+ monocytes and genes in the held-out test set. The most prominent change in gene expression due to the lipopolysaccharide treatment was also captured by the Enformer model. Observed matrix was hierarchically clustered for both rows and columns. Enformer predicted heatmap follows the same row and column ordering as the observed matrix. c) Predictive performance in the test set for CAGE gene expression fold change for all within-group pairs from a (y-axis) compared to the observed gene expression correlation between two pairs (x-axis). Fold change of highly correlated CAGE samples is more difficult to predict. d) Enformer shows higher fold-change predictive performance compared to Basenji2.
扩展数据图 3 | 处理样本上的预测表现。a)生物样本以不同方式被扰动的各组 CAGE 实验。b)留出测试集中 CD14+ 单核细胞及基因的观测与预测基因表达矩阵(经 log(1+x) 变换)。脂多糖处理引起的最突出的基因表达变化也被 Enformer 模型捕捉到。观测矩阵对行和列都做了层次聚类。Enformer 预测热图沿用与观测矩阵相同的行、列次序。c)测试集中,对来自 a 的全部组内成对的 CAGE 基因表达倍数变化的预测表现(纵轴),与两对之间观测到的基因表达相关(横轴)相比较。高度相关的 CAGE 样本的倍数变化更难预测。d)与 Basenji2 相比,Enformer 显示出更高的倍数变化预测表现。
Extended Data Fig. 4 | Enformer predicts mRNA-seq more accurately than ExPecto. a) Test set predictive performance comparison of a linear model trained on top of Enformer CAGE predictions from the major TSS (y-axis) and ExPecto (x-axis) computed either across genes (first column) or across tissues (second column). Gene expression matrix was normalized across genes to have zero mean and unit variance for each tissue. Enformer was re-trained only on the human genome using the same training chromosomes for this comparison (Methods). b) Same as a), but using Enformer predictions averaged across all TSS of the gene. c) Observed versus Enformer-predicted gene expression values for all 990 test genes in 6 RNA-seq samples.
扩展数据图 4 | Enformer 对 mRNA-seq 的预测比 ExPecto 更准确。a)测试集预测表现比较:在来自主要 TSS 的 Enformer CAGE 预测之上训练的线性模型(纵轴)与 ExPecto(横轴),分别跨基因(第一列)或跨组织(第二列)计算。基因表达矩阵跨基因归一化,使每个组织均值为零、方差为一。为这次比较,Enformer 只用人类基因组、并使用相同的训练染色体重新训练(方法)。b)与 a)相同,但使用该基因全部 TSS 上平均的 Enformer 预测。c)全部 990 个测试基因在 6 个 RNA-seq 样本中的观测与 Enformer 预测基因表达值。
Extended Data Fig. 5 | Comparison to dilated convolutions. a) Enformer with original transformer layers (Extended Data Fig. 1a left) performs better than Enformer with dilated convolutions (Extended Data Fig. 1a center) across different model sizes and training dataset subsets as measured CAGE gene expression correlation in the validation set (same metric as in Fig. 1b across genes). At 15 dilated layers, the model starts to reach outside of the input sequence range (receptive field of 224,263 bp). Note that all the evaluations here are limited by TPU memory preventing you from using more layers or channels. b) Performance comparison to Basenji2 (left) and Enformer (right) to Enformer with the same receptive field (44 kb) as Basenji2 by either allowing a fixed attention radius of 16 across all layers where query can attend to at most 16 positions away (Enformer 769: Fixed radius: 16) or by exponentially increasing the respective field in the same way as the dilation rate in Basenji2. Enformer768 was trained with the same number of 768 channels and 131 kb input sequences as Basenji2, whereas Enformer uses two times more channels and 1.5 times longer sequence. Same evaluation metrics are shown as in Fig. 1.
扩展数据图 5 | 与膨胀卷积的比较。a)使用原来 Transformer 层的 Enformer(扩展数据图 1a 左)在不同模型大小和训练数据子集上,均优于使用膨胀卷积的 Enformer(扩展数据图 1a 中),以验证集上的 CAGE 基因表达相关衡量(与图 1b 中跨基因的同一指标)。到 15 层膨胀层时,模型开始超出输入序列范围(感受野为 224,263 bp)。注意,这里的全部评估都受 TPU 内存限制,无法使用更多层或通道。b)与 Basenji2(左)和 Enformer(右)相比较:使 Enformer 具有与 Basenji2 相同的感受野(44 kb),做法是要么在全部层上允许固定注意力半径 16,即查询最多只能关注 16 个位置以外(Enformer 769:固定半径:16),要么像 Basenji2 中的膨胀率那样指数增加相应的感受野。Enformer768 用与 Basenji2 相同的 768 个通道和 131 kb 输入序列训练,而 Enformer 使用两倍的通道和 1.5 倍长的序列。所示评估指标与图 1 相同。
Extended Data Fig. 6 | Custom relative positional encoding functions are required for good predictive performance. a) Relative positional encoding basis function options for the transformer model. Sine/cosine basis functions are frequently used in the NLP literature for both absolute or relative positional encodings. Enformer uses a concatenation of exponential, gamma and central_mask relative positional encodings. For each basis function, a symmetric f(|x|) and asymmetric sign(x) * f(|x|) basis function will be used to introduce directionality and thereby inform the model of what is upstream or downstream of the TSS. Each basis function is visualized with a different color. b) Validation set performance as measured by CAGE gene expression correlation across protein coding genes (top; same metric as in Fig. 1b across genes) or across all positions (bottom; same metric as displayed in Fig. 1c CAGE) for models trained with different classes of positional encoding functions in the transformer. Custom relative positional encodings show better performance than using standard sin/cos basis functions or using absolute positional encodings, likely because they can better capture the decreasing importance of enhancers with increased distance. Also, symmetric only (f(|x|) version shows much lower performance than using both, symmetric and asymmetric versions. All models use the same 96 total number of basis functions. Each positional encoding configuration was trained with multiple different random seeds. Red points denote runs with lower performance than the y-axis limits.
扩展数据图 6 | 良好的预测表现需要定制的相对位置编码函数。a)Transformer 模型的相对位置编码基函数选项。正弦/余弦基函数在 NLP 文献中常用于绝对或相对位置编码。Enformer 使用指数、伽马和 central_mask 相对位置编码的拼接。对每个基函数,将使用对称的 f(|x|) 和不对称的 sign(x) * f(|x|) 基函数以引入方向性,从而告知模型何为 TSS 的上游或下游。每个基函数用不同颜色可视化。b)验证集表现,以跨蛋白编码基因的 CAGE 基因表达相关(上;与图 1b 中跨基因的同一指标)或跨全部位置的相关(下;与图 1c 中 CAGE 所示的同一指标)衡量,对应在 Transformer 中用不同类位置编码函数训练的模型。定制相对位置编码的表现优于使用标准正弦/余弦基函数或使用绝对位置编码,这很可能是因为它们能更好地捕捉增强子重要性随距离增加而下降。此外,仅用对称的 f(|x|) 版本,表现远低于同时使用对称和不对称版本。所有模型使用相同的总共 96 个基函数。每种位置编码配置都用多个不同随机种子训练。红点表示表现低于纵轴范围下限的运行。
Extended Data Fig. 7 | Tissue-specific contribution scores are required for good enhancer-recall performance. a) Enhancer–gene ranking performance comparison of different ABC score versions, including the original score which uses DNase, H3K27ac, and Hi-C data. H3K27ac / distance is a good if not even slightly better proxy for the ABC score. The alternative versions use a fixed and 2 kb wide aggregation window whereas the original uses a dynamic peak width depending on the DNase peak width. b) Attention-based contribution score as a function of distance at all enhancer–gene pairs in both studied datasets. c) Contribution scores that are cell-type-specific (shown in green, achieved by computing the contribution scores w.r.t. cell-type-specific target variables) outperform cell-type agnostic contribution scores (shown in orange). Colored bars in a and c depict the median auPRC with error bars at the 25th and 75th percentile obtained by sampling 80% of enhancer–gene pairs 100 times without replacement.
扩展数据图 7 | 良好的增强子召回表现需要组织特异的贡献分数。a)不同 ABC 分数版本的增强子–基因排序表现比较,包括使用 DNase、H3K27ac 和 Hi-C 数据的原始分数。H3K27ac / 距离是 ABC 分数的一个很好的、甚至略优的替代。替代版本使用固定且宽 2 kb 的汇总窗口,而原始版本使用取决于 DNase 峰宽的动态峰宽。b)在两项所研究数据集的全部增强子–基因对上,基于注意力的贡献分数作为距离的函数。c)细胞类型特异的贡献分数(绿色所示,通过对细胞类型特异的目标变量计算贡献分数得到)优于细胞类型无关的贡献分数(橙色所示)。a 和 c 中的彩色条表示中位 auPRC,误差条为第 25 和第 75 百分位,通过对增强子–基因对的 80% 无放回抽样 100 次得到。
Extended Data Fig. 8 | TF-MoDISco motifs at TAD boundaries. a,b) Motifs obtained by TF-MoDISco from gradient × input DNase (a) or CAGE (b) contribution scores at 1,500 TAD boundaries. Motif title contains: TF name of the closest motif match from HOCOMOCO v11 database, metacluster and pattern id returned by TF-MoDISco, number of seqlets supporting the motifs, and Tomtom q-value for the closest motif match (lower means better match). For each motif, the information content of the position frequency matrix (PFM) is visualized for the database motif in the top row and for the actual TF-MoDISco motif in the second row. Third row for each motif shows the contribution weight matrix (CWM)15,47 which can be negative. Shown are the top 6 motifs for each contribution score sign with sufficiently close match to a known motif (q-value<1e-5) and support from at least 200 seqlets. Interestingly, the CTCF motif was discovered for both CAGE and DNase in both contribution score signs, suggesting that it can influence them in a positive or negative manner.
扩展数据图 8 | TAD 边界处的 TF-MoDISco 基序。a,b)由 TF-MoDISco 从 1,500 个 TAD 边界处的梯度 × 输入 DNase(a)或 CAGE(b)贡献分数得到的基序。基序标题包含:HOCOMOCO v11 数据库中最接近基序匹配的 TF 名称、TF-MoDISco 返回的元簇和模式编号、支持这些基序的 seqlet 数目,以及最接近基序匹配的 Tomtom q 值(越低表示匹配越好)。对每个基序,位置频率矩阵(PFM)的信息量在顶行可视化数据库基序,在第二行可视化实际的 TF-MoDISco 基序。每个基序的第三行显示贡献权重矩阵(CWM)15,47,该矩阵可以为负。所示为每种贡献分数符号下、与已知基序足够接近(q 值<1e-5)且至少有 200 个 seqlet 支持的前 6 个基序。有意思的是,CTCF 基序在 CAGE 和 DNase 的两种贡献分数符号下都被发现,表明它可以以正向或负向的方式影响它们。
Extended Data Fig. 9 | Enformer achieves greater and more specific SLDP concordance to GTEx than DeepSEA. To compare Enformer and DeepSEA Beluga (convolutional neural network used in ExPecto) variant effect predictions, we manually matched DNase datasets that both models were trained on, finding 100 confident matches. We computed genome-wide statistical concordance between variant effect predictions for these DNase datasets and GTEx eQTL summary statistics using SLDP across all variants in the 1000 genomes dataset. a) We scatter plotted all DNase sample and GTEx tissue z-scores for the DeepSEA and Enformer predictions, observing that the Enformer scores are greater for 60.8%. Each point corresponds to (DNase sample, GTEx tissue) pair. Only some (DNase sample, GTEx tissue) pairs are biologically well-matched, while the majority are. b) Since many DNase samples profile fibroblasts we specifically plotted all DNase sample z-scores for the GTEx fibroblast summary statistics. We colored the DNase fibroblast samples in red, revealing that they are the highest scoring and most improved in the Enformer model relative to DeepSEA. This suggests that Enformer variant effect predictions are more tissue specific, since one would expect to obtain the highest Z-score for these matched samples shown in red.
扩展数据图 9 | 与 DeepSEA 相比,Enformer 与 GTEx 的 SLDP 一致性更高也更特异。为比较 Enformer 与 DeepSEA Beluga(ExPecto 所用的卷积神经网络)的变异效应预测,我们手工匹配了两个模型都训练过的 DNase 数据集,找到 100 个有把握的匹配。我们用 SLDP,在 1000 genomes 数据集的全部变异上,计算这些 DNase 数据集的变异效应预测与 GTEx eQTL 汇总统计量之间的全基因组统计一致性。a)我们把 DeepSEA 和 Enformer 预测的全部 DNase 样本与 GTEx 组织 z 分数做散点图,观察到 Enformer 分数在 60.8% 的情形下更高。每个点对应一对(DNase 样本,GTEx 组织)。只有一部分(DNase 样本,GTEx 组织)对在生物学上匹配良好,而大多数是。b)由于许多 DNase 样本分析的是成纤维细胞,我们专门把全部 DNase 样本的 z 分数对 GTEx 成纤维细胞汇总统计量作图。我们把 DNase 成纤维细胞样本标成红色,显示它们在 Enformer 模型中相对于 DeepSEA 得分最高、改进也最大。这表明 Enformer 的变异效应预测更具组织特异性,因为人们会期望在这些红色所示的匹配样本上得到最高的 Z 分数。
Extended Data Fig. 10 | Enformer outperforms Basenji2 on eQTL sign prediction. For each of the GTEx tissues, we manually matched FANTOM5 CAGE sample descriptions to choose a single matched dataset (Methods). We then arranged a classification task to discriminate between fine-mapped causal eQTLs in which the minor allele increases gene expression versus eQTLs in which the minor allele decreases gene expression. We computed auROC statistics by ranking causal variants by their signed prediction for the corresponding sample. To consider the influence of variant distance to TSS, we compute auROC in four bins of roughly equal size. Across tissues and TSS distances, Enformer predictions usually achieve more accurate classification of eQTL sign than Basenji2 predictions. We display six example tissues with large numbers of fine-mapped eQTLs and with clear correspondence between CAGE and GTEx tissues. Violin plots show the auROC distribution of 100 bootstrap samples from the full set of variants. (The white dot represents the median, the thick gray bar in the center represents the 25%-75% percentile range and the thin line represents the entire data range.) Dashed lines represent the mean auROC over all distances. Both models struggle with variants beyond the promoter (TSS distance > 1,000), highlighting an important problem for future research.
扩展数据图 10 | Enformer 在 eQTL 符号预测上优于 Basenji2。对每个 GTEx 组织,我们手工匹配 FANTOM5 CAGE 样本描述,以选择一个匹配的数据集(方法)。随后我们安排了一项分类任务,以区分次要等位基因增加基因表达的精细定位因果 eQTL,与次要等位基因降低基因表达的 eQTL。我们按相应样本的带符号预测对因果变异排序,以此计算 auROC 统计量。为考虑变异到 TSS 的距离的影响,我们在四个大小大致相等的箱中计算 auROC。跨组织和 TSS 距离,Enformer 预测通常比 Basenji2 预测更准确地分类 eQTL 符号。我们展示了六个精细定位 eQTL 数目较多、且 CAGE 与 GTEx 组织对应关系清楚的示例组织。小提琴图显示从全部变异集合抽取的 100 次自助抽样的 auROC 分布。(白点表示中位数,中心粗灰条表示第 25%–75% 百分位范围,细线表示全部数据范围。)虚线表示跨全部距离的平均 auROC。两个模型在启动子以外的变异上(TSS 距离 > 1,000)都较困难,这凸显了未来研究的一个重要问题。
Acknowledgements
We thank M. Kircher (Berlin Institute of Health) for sharing saturation mutagenesis MPRA datasets and variant effect predictions with us as well as A. Pritzel, A. W. R. Nelson, A. Patterson, A. Obika, C. Meyer, D. Hassabis, M. Dunlop, N. Latysheva, N. Alic, S.-J. Dunn, S. Petersen, T. Niccoli, T. Sargeant, and T. Back for their contributions and support.
致谢
我们感谢 M. Kircher(Berlin Institute of Health)与我们分享饱和诱变 MPRA 数据集和变异效应预测,并感谢 A. Pritzel、A. W. R. Nelson、A. Patterson、A. Obika、C. Meyer、D. Hassabis、M. Dunlop、N. Latysheva、N. Alic、S.-J. Dunn、S. Petersen、T. Niccoli、T. Sargeant 和 T. Back 的贡献与支持。
Author contributions
Ž.A., J.R.L., D.R.K., and P.K. initiated the project. Ž.A., V.A., and D.R.K. conceived of the study and designed the analyses. Ž.A. designed the model with help from D.V., J.J., and P.K.. Ž.A., D.V., K.R.T., and Y.A. implemented the model. Ž.A. performed model performance analyses, A.G-B. and Ž.A. performed enhancer prioritization analysis, D.R.K. performed variant effect analysis on population genetic data, and V.A. performed variant effect analyses for MPRA data. J.R.L., J.J., P.K., and D.R.K. supervised the study. Ž.A., V.A., and D.R.K. prepared the manuscript with input from all authors. The authors received no specific external funding for this work.
作者贡献
Ž.A.、J.R.L.、D.R.K. 和 P.K. 发起了本项目。Ž.A.、V.A. 和 D.R.K. 构想了本研究并设计了分析。Ž.A. 在 D.V.、J.J. 和 P.K. 的帮助下设计了模型。Ž.A.、D.V.、K.R.T. 和 Y.A. 实现了模型。Ž.A. 进行了模型表现分析,A.G-B. 和 Ž.A. 进行了增强子优先级排序分析,D.R.K. 对群体遗传数据做了变异效应分析,V.A. 对 MPRA 数据做了变异效应分析。J.R.L.、J.J.、P.K. 和 D.R.K. 监督了本研究。Ž.A.、V.A. 和 D.R.K. 在全体作者意见基础上撰写了手稿。作者未为这项工作获得特定的外部资助。
Competing interests
Ž.A., A.G-B., K.R.T., Y.A., J.J., and P.K. are employed by DeepMind. V.A., and D.R.K. are employed by Calico Life Sciences. J.R.L. is employed by Google. The remaining authors declare no competing interests.
利益冲突
Ž.A.、A.G-B.、K.R.T.、Y.A.、J.J. 和 P.K. 受雇于 DeepMind。V.A. 和 D.R.K. 受雇于 Calico Life Sciences。J.R.L. 受雇于 Google。其余作者声明无利益冲突。
Additional information
Extended data is available for this paper at https://doi.org/10.1038/s41592-021-01252-x.
Supplementary information The online version contains supplementary material available at https://doi.org/10.1038/s41592-021-01252-x.
附加信息
本文的扩展数据可见 https://doi.org/10.1038/s41592-021-01252-x。
补充信息 在线版本包含补充材料,可见 https://doi.org/10.1038/s41592-021-01252-x。
Correspondence and requests for materials should be addressed to Žiga Avsec, Pushmeet Kohli or David R. Kelley.
Peer review information Nature Methods thanks Qiao Liu, Wing Hung Wong and the other, anonymous, reviewers for their contribution to the peer review of this work. Primary Handling editor: Lin Tang, in collaboration with the Nature Methods team.
同行评议信息 Nature Methods 感谢 Qiao Liu、Wing Hung Wong 以及其他匿名审稿人对本稿件同行评议的贡献。主要责任编辑:Lin Tang,并与 Nature Methods 编辑团队合作。
Reprints and permissions information is available at www.nature.com/reprints.
重印与许可信息可见 www.nature.com/reprints。
Nature Research Reporting Summary
Nature Research 报告摘要
本篇正式出版 PDF 含两页 Nature Research 报告摘要(该 24 页文件的第 23–24 页)。这两页以表格图形给出,PDF 中没有可提取的文字层;上图从该官方 PDF 裁出。
References
参考文献
[1] Zhou, J. et al. Deep learning sequence-based ab initio prediction of variant effects on expression and disease risk. Nat. Genet. 50, 1171–1179 (2018).
[2] Kelley, D. R. Cross-species regulatory sequence activity prediction. PLoS Comput. Biol. 16, e1008050 (2020).
[3] Kelley, D. R. et al. Sequential regulatory activity prediction across chromosomes with convolutional neural networks. Genome Res. 28, 739–750 (2018).
[4] Agarwal, V. & Shendure, J. Predicting mRNA abundance directly from genomic sequence using deep convolutional neural networks. Cell Rep. 31, 107663 (2020).
[5] Gasperini, M., Tome, J. M. & Shendure, J. Towards a comprehensive catalogue of validated and target-linked human enhancers. Nat. Rev. Genet. 21, 292–310 (2020).
[6] Vaswani, A. et al. Attention is all you need. in Advances in Neural Information Processing Systems 5998–6008 (2017).
[7] Brown, T. B. et al. Language models are few-shot learners. in Advances in Neural Information Processing Systems (2020).
[8] Ji, Y., Zhou, Z., Liu, H. & Davuluri, R. V. DNABERT: pre-trained bidirectional encoder representations from transformers model for DNA-language in genome. Bioinformatics https://doi.org/10.1093/bioinformatics/btab083 (2021).
[9] Gasperini, M. et al. A genome-wide framework for mapping gene regulation via cellular genetic screens. Cell 176, 377–390 (2019).
[10] FANTOM Consortium and the RIKEN PMI and CLST (DGT). A promoter-level mammalian expression atlas. Nature 507, 462–470 (2014).
[11] Heinz, S., Romanoski, C. E., Benner, C. & Glass, C. K. The selection and function of cell type-specific enhancers. Nat. Rev. Mol. Cell Biol. 16, 144–154 (2015).
[12] Shrikumar, A., Greenside, P. & Kundaje, A. Learning important features through propagating activation differences. in International Conference on Machine Learning 3145–3153 (PMLR, 2017).
[13] Fulco, C. P. et al. Activity-by-contact model of enhancer-promoter regulation from thousands of CRISPR perturbations. Nat. Genet. 51, 1664–1669 (2019).
[14] Eraslan, G., Avsec, Ž., Gagneur, J. & Theis, F. J. Deep learning: new computational modelling techniques for genomics. Nat. Rev. Genet. 20, 389–403 (2019).
[15] Avsec, Ž. et al. Base-resolution models of transcription-factor binding reveal soft motif syntax. Nat. Genet. https://doi.org/10.1038/s41588-021-00782-6 (2021).
[16] ENCODE Project Consortium et al. Expanded encyclopaedias of DNA elements in the human and mouse genomes. Nature 583, 699–710 (2020).
[17] Ghandi, M. et al. gkmSVM: an R package for gapped-kmer SVM. Bioinformatics 32, 2205–2207 (2016).
[18] Zhou, J. & Troyanskaya, O. G. Predicting effects of noncoding variants with deep learning–based sequence model. Nat. Methods 12, 931–934 (2015).
[19] Kelley, D. R., Snoek, J. & Rinn, J. L. Basset: learning the regulatory code of the accessible genome with deep convolutional neural networks. Genome Res. 26, 990–999 (2016).
[20] Consortium, T. G., The GTEx Consortium. The GTEx Consortium atlas of genetic regulatory effects across human tissues. Science 369, 1318–1330 (2020).
[21] Reshef, Y. A. et al. Detecting genome-wide directional effects of transcription factor binding on polygenic disease risk. Nat. Genet. 50, 1483–1493 (2018).
[22] Wang, Q. S. et al. Leveraging supervised learning for functionally informed fine-mapping of cis-eQTLs identifies an additional 20,913 putative causal eQTLs. Nat. Commun. 12, 3394 (2021).
[23] Wang, G., Sarkar, A., Carbonetto, P. & Stephens, M. A simple new approach to variable selection in regression, with application to genetic fine mapping. J. R. Stat. Soc. 82, 1273–1300 (2020).
[24] Weissbrod, O. et al. Functionally informed fine-mapping and polygenic localization of complex trait heritability. Nat. Genet. 52, 1355–1363 (2020).
[25] Kircher, M., Xiong, C., Martin, B. & Schubach, M. Saturation mutagenesis of twenty disease-associated regulatory elements at single base-pair resolution. Nature 10, 3583 (2019).
[26] Shigaki, D. et al. Integration of multiple epigenomic marks improves prediction of variant impact in saturation mutagenesis reporter assay. Hum. Mutat. 40, 1280–1291 (2019).
[27] Lee, D. et al. A method to predict the impact of regulatory variants from DNA sequence. Nat. Genet. 47, 955–961 (2015).
[28] Rentzsch, P., Witten, D., Cooper, G. M., Shendure, J. & Kircher, M. CADD: predicting the deleteriousness of variants throughout the human genome. Nucleic Acids Res. 47, D886–D894 (2019).
[29] Alipanahi, B., Delong, A., Weirauch, M. T. & Frey, B. J. Predicting the sequence specificities of DNA- and RNA-binding proteins by deep learning. Nat. Biotechnol. 33, 831–838 (2015).
[30] Villar, D. et al. Enhancer evolution across 20 mammalian species. Cell 160, 554 (2015).
[31] Linder, J. et al. A generative neural network for maximizing fitness and diversity of synthetic DNA and protein sequences. Cell Syst. 11, 49–62 (2020).
[32] Fudenberg, G., Kelley, D. R. & Pollard, K. S. Predicting 3D genome folding from DNA sequence with Akita. Nat. Methods 17, 1111–1117 (2020).
[33] Schwessinger, R. et al. DeepC: predicting 3D genome folding using megabase-scale transfer learning. Nat. Methods 17, 1118–1124 (2020).
[34] Schreiber, J., Durham, T., Bilmes, J. & Noble, W. S. Avocado: a multi-scale deep tensor factorization method learns a latent representation of the human epigenome. Genome Biol. 21, 81 (2020).
[35] Nair, S., Kim, D. S., Perricone, J. & Kundaje, A. Integrating regulatory DNA sequence and gene expression to predict genome-wide chromatin accessibility across cellular contexts. Bioinformatics 35, i108–i116 (2019).
[36] Tay, Y., Dehghani, M., Bahri, D. & Metzler, D. Efficient transformers: a survey. Preprint at https://arxiv.org/abs/2009.06732 (2020).
[37] Richter, F. et al. Genomic analyses implicate noncoding de novo variants in congenital heart disease. Nat. Genet. 52, 769–777 (2020).
[38] Zhou, J. et al. Whole-genome deep-learning analysis identifies contribution of noncoding mutations to autism risk. Nat. Genet. 51, 973–980 (2019).
[39] Gupta, S., Stamatoyannopoulos, J. A., Bailey, T. L. & Noble, W. Quantifying similarity between motifs. Genome Biology 8, R24 (2007).
[40] Shaw, P., Uszkoreit, J. & Vaswani, A. Self-attention with relative position representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers) 464–468 (2018).
[41] Dai, Z. et al. Transformer-XL: Attentive language models beyond a fixed-length context. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics 2978–2988 (2019).
[42] Kent, W. J. The Human Genome Browser at UCSC. Genome Research 12, 996–1006 (2002).
[43] Reynolds, M. et al. Open sourcing Sonnet — a new library for constructing neural networks. https://deepmind.com/blog/open-sourcing-sonnet (2017).
[44] Pedregosa, F. et al. Scikit-learn: machine learning in Python. J. Mach. Learn. Res. 12, 2825–2830 (2011).
[45] Klein, J. C. et al. A systematic evaluation of the design and context dependencies of massively parallel reporter assays. Nat. Methods 17, 1083–1091 (2020).
[46] Avsec, Žiga et al. Enformer (Version 3.0) (Zenodo, 2021); https://doi.org/10.5281/zenodo.5098375
[47] Avsec, Ž. et al. The Kipoi repository accelerates community exchange and reuse of predictive models for genomics. Nat. Biotechnol. 37, 592–600 (2019).















