<<

bioRxiv preprint doi: https://doi.org/10.1101/2021.06.04.447073; this version posted June 5, 2021. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license.

Modeling sequence-space exploration and emergence of epistatic signals in protein

Matteo Bisardi,1, 2 Juan Rodriguez-Rivas,2 Francesco Zamponi,1 and Martin Weigt2, ∗ 1Laboratoire de Physique de l’Ecole Normale Sup´erieure, ENS, Universit´ePSL, CNRS, Sorbonne Universit´e,Universit´ede Paris, F-75005 Paris, France 2Sorbonne Universit´e,CNRS, Institut de Biologie Paris Seine, Biologie Computationnelle et Quantitative LCQB, F-75005 Paris, France During their evolution, proteins explore sequence space via an interplay between random muta- tions and phenotypic selection. Here we build upon recent progress in reconstructing data-driven fitness landscapes for families of homologous proteins, to propose stochastic models of experimental protein evolution. These models predict quantitatively important features of experimentally evolved sequence libraries, like fitness distributions and position-specific mutational spectra. They also al- low us to efficiently simulate sequence libraries for a vast array of combinations of experimental parameters like sequence divergence, selection strength and library size. We showcase the potential of the approach in re-analyzing two recent experiments to determine protein structure from signals of emerging in experimental sequence libraries. To be detectable, these signals require sufficiently large and sufficiently diverged libraries. Our modeling framework offers a quantitative explanation for the variable success of recently published experiments. Furthermore, we can fore- cast the outcome of time- and resource-intensive evolution experiments, opening thereby a way to computationally optimize experimental protocols.

INTRODUCTION tural contact in the folded proteins, i.e. of residue pairs in direct physical in the three-dimensional In the course of evolution, biological sequences en- structure of the protein, even if possibly located at long coding proteins explore functional sequence space. The distance along the primary amino-acid sequence. Co- observable sequence variability between homologous se- evolutionary methods, in particular when used as input quences, i.e. sequences connected by common ancestry, for structurally supervised deep-learning methods like results from a delicate balance between and se- RaptorX [10], DeepMetaPSICOV [11], AlphaFold [12] lection. tend to randomize sequences, while or trRosetta [13], have recently induced a revolution in prunes most of those mutations hav- protein-structure prediction, reaching unprecedented ac- ing a deleterious effect on fitness. When analyzing large curacy in computationally predicted structures close to databases of homologous protein families [1], we there- the accuracy of experimentally determined structures. fore find sequences with as much as 70-80% different Hundreds of previously unknown protein structures have amino acids, but highly conserved functional and struc- been predicted this way [14]. tural properties. However, coevolutionary methods rely on the availabil- In turn, it is possible to search for statistical patterns ity of large alignments of homologous but diverged pro- in ensembles of homologous proteins [2], using tools bor- teins, since they rely on statistical signatures extracted rowed from statistical inference and unsupervised ma- from sequence variability [15]. Recently, two groups have chine learning, and to relate them to selective constraints independently asked the question, if experimentally gen- acting in these proteins. The most prominent signal erated sequences can be used instead of natural homologs is conservation; a position in a protein not (or rarely) for contact prediction [16, 17]. To this aim, they have changing over extended evolutionary time proposed and performed very similar experiments. First, scales, is likely to play an important role in the protein’s starting from a given wildtype sequence, they have it- function (e.g. active sites in ) or for the protein’s erated several rounds of alternating sequence diversifi- structural stability (e.g. residues buried in the protein cation via error-prone PCR (polymerase chain reaction) core). [18], and selection for functionality ( resistance A second type of statistical signal has received a lot for both experiments). In contrast to traditional directed of attention during the last decade [3–5]. The correlated evolution [19, 20], selection was very weak (low antibiotic usage of amino acids in pairs of residue positions can be concentrations), so proteins are not simply optimized for extracted via global statistical models like those used in function, but may diversify their sequences while main- Direct Coupling Analysis (DCA) [6, 7], Gremlin [8] or taining a certain level of functionality. After a certain PSICOV [9]. This signal of residue-residue coevolution number of rounds, the resulting sequence library was se- results from epistatic couplings between residues in struc- quenced, to provide the data for statistical learning. The resulting functional sequence libraries were quite diversified, with typical distances of 10-15% of the se- quence length from the wild-type protein used as a start- ∗ correspondence to: [email protected] ing point. This is much less than in natural protein bioRxiv preprint doi: https://doi.org/10.1101/2021.06.04.447073; this version posted June 5, 2021. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. 2 families, characterized typically by average distances of is inferred from multiple sequence alignments of natu- 70-80% between homologs. However, the simultaneous ral homologs of the experimentally studied wildtype [1], emergence of about 10-40 mutations, and the depth of i.e. from data unrelated to the experiment. As a first more than 104 − 105 sequences in the experimentally check of , we show that this landscape repre- evolved libraries, could make the detection of epistasis, sents well the mutational effects of single-residue substi- and thus contact prediction, possible [16, 17]. tutions when compared to a deep-mutational scanning Interestingly, both teams have run plmDCA [21], or experiment, and that the inclusion of epistatic couplings evCouplings based on plmDCA [22], on the data – with in the landscape model is essential for its accuracy. The very different results. While the contact signal in [16] was landscape can thus be used as a proxy for the protein’s quite weak, and mostly concentrated to nearby positions fitness landscape. along the sequence, [17] found a sufficiently good contact Next, we present a minimal model of evolutionary dy- prediction to enable the subsequent construction of an namics, very similar to but more quantitative than that accurate structural model. of [23]. In this model, mutations appear at the level of To understand the differences in results given the sim- the DNA sequence via single-nucleotide mutations, but ilarity in approaches, we have developed a modeling selection acts exclusively at the protein level, i.e. on the scheme, which allows us to simulate protein evolution amino-acid sequence translated from the DNA sequence, in a data-driven sequence landscape. Comparison of via the inferred sequence landscape. We will show that simulated and experimental data of both experiments sequences generated in silico by this model reproduce shows that our simulations reproduce quantitatively the quantitative features of the experimentally generated se- experimental observations. Furthermore, the simulation quences, like mutational profiles or the fitness distribu- scheme allows us to control important parameters of the tion. experiments, like the evolutionary distance from the wild- Subsequently, we explore the potential of the experi- type in the final evolved library, the sequencing depth of ments by performing simulations under variable condi- the library, or the strength of selection. We find that our tions for sequence divergence, sequencing depth, or se- model is able to explain the difference in contact predic- lection strength. This allows us to locate the two ex- tion between the two experiments in terms of sequence periments in an exhaustively scanned parameter space, divergence and sequencing depth. to understand the limitations of the experiments, and to The agreement between simulations and experiments propose schemes for overcoming current limitations. suggests that our modeling framework allows for a quan- titative analysis of important questions about protein evolution, like the mechanism underlying sequence space An epistatic data-driven sequence landscape exploration and the emergence of signatures of epista- captures mutational effects sis with sequence divergence, cf. also [23]. Beyond such basic questions in , our framework The basis of our approach is a computationally inferred has also the potential to help in optimizing experimen- sequence landscape, used as a proxy to quantify protein tal design. To give an example, our simulations predict fitness and selection acting on proteins. To obtain this that both experiments would have benefited from slightly landscape, we first use the Pfam protein-family database weaker selection, represented by slightly lower antibiotic [1] to extract a multiple sequence alignment (MSA) of concentrations, which would have enabled a faster explo- diverged homologs of the wildtype protein used in the ration of the neighborhood of the wildtype sequence and experiments. Both studies performed experiments with the occurrence of slightly more deleterious mutations, a member of the beta-lactamase family (PF13354), TEM- which have a better chance to be coupled by epistasis 1 in [16] and PSE-1 in [17]; the latter work also studied than the predominantly neutral mutations accepted at the acetyltransferase AAC6 (PF00583). The details of strong selection. Such predictions are very interesting, the MSA construction are given in Methods below; we since our computational approach is very efficient and find, e.g., a MSA of 18,334 beta-lactamase sequences. can be applied to thousands of protein families, while the experiments are very expensive in time and resources. The underlying idea of our work is to represent the Guiding them to increase the success probability may natural variability of this MSA via a generative statisti- therefore be an impactful strategy. For instance, our ap- cal model P (a1, ..., aL), with (a1, ..., aL) representing an proach can be used to explore different protocols, such as aligned amino-acid sequence, i.e. the ai are either one of alternating cycles of strong and weak selection. the 20 natural amino acids, or an alignment gap. Since data are limited, we need to assume some mathematical form for P (a1, ..., aL). Introducing

RESULTS 1 P (a , ..., a ) = exp {−E(a , ..., a )} , (1) 1 L Z 1 L The general procedure of our modeling approach is graphically illustrated in Fig. 1. In this section, we we write the ”statistical energy” E(a1, ..., aL), which is first describe the data-driven sequence landscape, which to be seen as a proxy for negative protein fitness [4, 25], bioRxiv preprint doi: https://doi.org/10.1101/2021.06.04.447073; this version posted June 5, 2021. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. 3

FIG. 1. Scheme of our evolutionary modeling approach: Starting from a wildtype sequence (red), we collect a large multiple-sequence alignment of naturally diverged homologs (blue), which are used to learn a generative landscape model using bmDCA [24]. Evolution is simulated as a Markov process in this landscape, leading to simulated, or in silico evolved mutant sequences. These sequences can be compared to the results of evolution experiments [16, 17] (green), to assess estimated protein fitness (so-called statistical energies, cf. below), mutational profiles, and DCA-based epistasis and contact prediction. The simulation scheme also allows for changing experimental control parameters like final sequence divergence, sequencing depth, and selection strength.

in the form used by DCA [5–7], non-trivial higher-order correlations and the clustered se- quence distribution. Note also that, in a different protein X X E(a1, ..., aL) = − hi(ai) − Jij(ai, aj) , (2) family (chorismate mutase, PF01817), the same model- i i

FIG. 2. Experimental and predicted mutational effects in TEM-1: Panel A shows the results of the deep-mutational scanning experiment of Firnberg et al. [29], as compared to the computational predictions using the epistatic Potts model (Panel B) and the non-epistatic profile model (Panel C). Panels A and B have a Spearman rank correlation of -0.77, showing that low energies correspond to high fitness. Panels A and C have a reduced Spearman correlation of -0.6 due to the absence of epistatic couplings in the profile model.

A model of evolutionary dynamics reproduces • The experiments allow to vary selection strength. quantitative features of experimentally evolved For TEM-1 and PSE-1 this is done by modifying sequences the antibiotic concentration: the same mutation can be more or less strongly favored or suppressed. Evolution (natural and experimental) can be seen as a stochastic process in a sequence landscape, with ran- To include these factors into our evolutionary dom mutations and phenotypic selection modeled by our model, we introduce two important modifica- tions with respect to [23]: First, we model evo- statistical energy E(a1, ..., aL). A minimal model re- alizing this idea was recently proposed in [23]: a ran- lution at the level of the nucleotide sequence dom site i ∈ {1, ..., L} is selected, and an amino acid (n11, n12, n13, ..., ni1, ni2, ni3, ..., nL1, nL2, nL3) cod- ing for the amino-acid sequence (a , ..., a ), i.e. the b ∈ {A, C, ..., Y } is selected to substitute ai with a prob- 1 L ability proportional to exp{−∆E(a → b)}, with ∆E be- nucleotide triplet (ni1, ni2, ni3) codes for amino acid i 3 ing the statistical-energy difference between the mutated ai. For each possible codon (n1, n2, n3) ∈ {A, C, G, T } and the unmutated sequences. A non-accepted or syn- (with the exception of the stop codon), we introduce the set of amino acids A (n , n , n ) ⊂ {A, ..., Y }, onymous mutation is characterized by ai = b. Note that acc 1 2 3 deletions and insertions are currently not considered in which are accessible from (n1, n2, n3) by a single nu- our model. cleotide mutation. Possible substitutions for ai are now While this model can be used to explore the qualita- only selected from Aacc(ni1, ni2, ni3), and associated tive influence of epistasis on protein sequence evolution, to a single nucleotide change. Note that also ai is cf. [23], our analysis requires a more quantitative model in Aacc(ni1, ni2, ni3), accessible via any synonymous taking in particular two differences into account: mutation. Second, selection strength will be regulated by a new • Mutations happen at the nucleotide level. As a con- parameter β, having the form of an inverse tempera- sequence, not all amino acids are accessible from all ture β = 1/T in statistical physics, which modifies the amino acids via a single nucleotide mutation; and sequence probability to P ∼ exp{−βE}. The ”low- the set of accessible amino acids depends specifi- temperature” case β > 1 (T < 1) corresponds to in- cally on the used codon. creased selection (e.g. higher antibiotic concentration, or bioRxiv preprint doi: https://doi.org/10.1101/2021.06.04.447073; this version posted June 5, 2021. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. 5 ), in the limit β → ∞ (T → 0) only the is the number of substitutions along the entire amino- best possible amino acid in position i is accepted. The acid sequence, the energy also depends on the entire se- ”high-temperature” case β < 1 (T > 1) corresponds to quence. To increase our confidence in the quantitative decreased selection (e.g. lower antibiotic concentration); character of our evolutionary model, we compare in Fig. 4 the limit β → 0 (T → ∞) describes the case of mutation- the site- and amino-acid specific mutational frequencies. accumulation experiments without selection. To this end, we extract the quantities fi(a) describing This idea is implemented in the following three steps, the fraction of sequences in an MSA having amino acid which are performed recursively, cf. Methods for details: a in position i. Interestingly, also this refined measure of sequence diversity is very similar for simulated and 1. We randomly select a site i ∈ {1, ..., L} to experimental sequences; we observe a high correlation of be mutated, corresponding to the codon ni = 86%, cf. Fig. S4. These plots highlight the importance (ni1, ni2, ni3) and the amino acid ai. of working only with amino acid substitutions accessi- ble via single-nucleotide mutations: many amino acids 2. One of the accessible amino acids b ∈ Aacc(ni) show zero frequency in both plots due to inaccessibility. is selected to substitute ai with a probability The mutational spectrum predicted without considering P (b|a1, ..., ai−1, ai+1, ..., aL) ∝ exp{−β∆E(ai → the accessibility of amino acids is shown in supplemen- b)}. Due to the epistatic couplings in Eq. (2), this tary Fig. S4: we see that the mutational frequencies are probability depends explicitly on the sequence con- more homogeneously distributed, close-to-zero-frequency text (a1, ..., ai−1, ai+1, ..., aL). mutations become very rare as compared to the exper- imental sequences. The correlation goes down to 65% 3. One out of the possible codons for amino acid b, between simulated and experimental data in this case. which differ from n in a single nucleotide, is se- i Based on these observations, we conclude that our evo- lected uniformly at random. lutionary model, which combines mutations at the nu- The resulting nucleotide and amino-acid sequences re- cleotide level with selection at the amino-acid level, is main thus mutually consistent. able to reproduce well the statistical features of the ex- The proposed dynamics can be efficiently imple- perimental sequences. This conclusion is also confirmed, mented, and very large sequence libraries can be sim- when using TEM-1 and AAC6 as initial wildtype se- ulated over long times. To make these data compara- quences, cf. Figs. S5 and S6. ble to the libraries generated by experimental evolution, we need to adapt the simulation parameters: first, the number of mutational steps in our simulation is not di- In-silico sequence-space exploration, and the rectly related to the number of experimental generations emergence of epistatic signals (because error-prone PCR may introduce multiple mu- tations each round); we choose it to reach the same av- Having developed a quantitative model to simulate ex- erage number of substituted amino acids in the simu- perimental evolution, we are now able to explore evo- lated and experimental libraries. Second, the selection lutionary scenarios going well beyond those realized in strength β = 1/T has no evident relation to the antibi- the experiments. We can systematically analyze the in- otic concentration used in the experiment. We therefore fluence of the sequence divergence from wildtype, of the tune the value of β = 1/T such that the statistical en- sequenced library depth, and of the selection strength ergy E(a1, ..., aL) of the simulated and the experimental on the accuracy of coevolution-based contact prediction. sequences have the same linear slope as a function of the Each setting of these parameters would require long ex- number of substitutions. For the case of PSE-1, shown periments and would sometimes be inaccessible due to in Fig. 3, we find that T = 1.4 is a good value, cf. Panel the high number of experimental rounds or the depth of B, corresponding to low selection strength β = 1/T < 1. the sequenced library. Even if we adjust only average distance and slope, we Computationally this becomes straightforward al- find that also the overall distribution is well reproduced. though intensive: we have performed many runs of evolu- Similar observation for TEM-1 and AAC6 are shown in tionary simulations, each producing a MSA with specific supplementary Figs. S2 and S3. parameters, simulating the possible outcome of an evolu- Fig. 3C shows that for strong selection T = 0.05 tionary experiment, as represented in Fig. 5. Each square (β = 20) the sequence energy decreases with the num- in these plots corresponds to the average over five simula- ber of substitutions, corresponding to an increasing fit- tion runs. Depicted is the positive predictive value, which ness as expected in a directed-evolution scenario. Weak measures the fraction of true positive contact predictions selection, shown in Fig. 3D for T = 20 (β = 0.05), corre- within the first 100 contact predictions, cf. Methods for sponds to a sharp increase in statistical energy, and thus details. Due to the large number of contact predictions a loss in fitness, as to be expected by the accumulation to be performed, we used GaussDCA [32], a very fast, of predominantly deleterious random mutations. even if not the most accurate contact predictor. Panel Fig. 3A-B shows global measures comparing experi- A shows the plot for the selection strength used in the mental and simulated sequences: the Hamming distance experiments for PSE-1. The red zone corresponds to bioRxiv preprint doi: https://doi.org/10.1101/2021.06.04.447073; this version posted June 5, 2021. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. 6

FIG. 3. Statistical energy in dependence of sequence distance from wildtype: Panel A shows the statistical energies of the sequences from generation 20 in Stiffler et al., as a function of the Hamming distance (number of substituted amino acids) from the wildtype PSE-1. Panel B shows the same quantities for the simulated sequences, where selection strength T and the number of simulated evolutionary steps are adjusted to reproduce the average distance and the slope from Panel A. Panel C shows an example of strong selection (T  1) leading to optimized sequences having lower statistical energies / higher fitness. Panel D shows the case of very weak selection (T  1) resulting in random, mostly deleterious substitutions strongly increasing statistical energy.

bad contact predictions, being sometimes hardly better TEM-1 are highlighted, in the two panels of Fig. 5. For than random (PPV ∼ 0.13). It is found consistently for PSE-1, 20 rounds of evolution led to an average sequence small sequence libraries, and for sequence libraries of low distance of 27 amino-acid substitutions from wildtype, divergence from wildtype. It becomes evident that we and a sequenced library of 165,000 distinct sequences need to go to a sufficient number of simultaneous muta- [17]. Interestingly, this point is located slightly beyond tions to be able to detect at least a weak epistatic signal the boundary of emergence of coevolutionary signal. The between mutations, which can be used for contact pre- predicted average PPV of 0.65 is comparable to the 0.64 diction. However, this signal remains weak: we need obtained using the experimental MSA cf. Methods. much larger sequence libraries of at least about 50,000 This is in contrast to the TEM-1 experiment of [16], sequences to reach a reasonable contact prediction. How- cf. Fig. 5B: the experiment was performed for fewer ever, even for the largest and most diverged library we rounds, leading to less divergence from TEM-1, and the have studied, a PPV of only 0.7-0.8 is reached, which sequence library was less deeply sequenced. The result- remains below the contact prediction reached by using ing library, with an average Hamming distance of 18 the MSA of natural homologs, which was used before from TEM-1 and with 34431 unique sequences, is located for the inference of our sequence landscape. The latter slightly below the line of emergence of coevolution signal. reaches a PPV of 1.0 using GaussDCA. Panel B shows This observation provides a potential explanation for the the same observables for experiments starting with the observed reduced performance in contact prediction. TEM-1 sequence, the overall results are very similar to PSE-1, even if some quantitative details depend on the The AAC6 results show that reduced sequence diver- initial wildtype sequence. gence can, at least partly, be compensated by a strong increase in the number of sequences in the evolved MSA, The conditions of the experiments for PSE-1 and cf. Fig. S7. Even if having only an average Hamming dis- bioRxiv preprint doi: https://doi.org/10.1101/2021.06.04.447073; this version posted June 5, 2021. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. 7

FIG. 4. Position-specific amino-acid frequencies for experimental and simulated sequence libraries: Panel A shows the frequencies fi(a) of usage of amino acid a in site i in round 20 of experimental PSE-1 evolution, Panel B shows the same quantity for simulated evolution. The Spearman rank correlation between the two plots is 86%.

tance of about 8 substitutions, the large library of more dent: we can use our modeling to optimize experimental than 106 sequences allows for the detection of a weak evolution protocols, e.g., when we search for optimized contact-related signal. sequences but at a certain distance from a starting se- The results depend substantially on the strength of quence, or when we want to explore sequence space op- selection. Fig. S8 shows the extreme cases of very strong timally for contact prediction. In this case, we could, and very weak selection discussed before. Both show very e.g., optimize the selection strength. In the case of the bad contact prediction. An important difference becomes beta-lactamases studied in this article, Fig. 6 shows that visible when looking at the horizontal axes: all use the a slightly lower selection pressure (i.e. higher selection same number of simulated evolutionary steps. In the case temperature) would have led to even better contact pre- of strong selection, sequences stay closer to the wildtype, dictions. However, this potential increase is weak as com- since most mutations are deleterious and selected against, pared to the one, which can be reached by more diverged and they stay close to each other. So while being all sequences. functional, they do not accumulate sufficient sequence We see our model only as a starting point for more variability to provide a reliable epistatic signal. In the detailed evolutionary models. There is space for a sub- case of extremely weak selection, almost all mutations are stantial gain in accuracy: we can introduce biases in the acceptable. Sequences are found to diverge strongly from mutations introduced by error-prone PCR directly into the initial PSE-1 sequence, but the absence of selection the model [33, 34], the latter can be derived from data by causes also an absence of coevolution. analyzing synonymous mutations. Furthermore, we can introduce codon bias, the difference between transitions and transversions, the fact that error-prone PCR may DISCUSSION introduce simultaneously several mutations before selec- tion, or the emergence of phylogeny in cycles of mutation and selection. The aim of this work was to showcase the potential of evolutionary models in data-driven sequence landscapes. The modeling can also benefit from experimental feed- Recent progress in landscape modeling has led to ad- back. If sequence libraries would also be sequenced before vances in using sequence alignment to predict protein and after the selection step, we could establish a better structure, mutational effects and even to design non- correspondence between statistical energies and selection, natural but biologically functional sequences. Here we up to a gauge of statistical energies vs. antibiotic con- show that, equipped with a simple stochastic dynamics centrations. capturing the interplay between mutation and selection, However, the potential of such evolutionary models in these landscapes lead to models which are able to de- data-driven landscapes goes far beyond the application scribe in a quantitatively accurate way the results of evo- to experimental evolution. As is shown in [23], already lution experiments. the simplest non-trivial evolutionary model allows for il- The applications for experimental evolution are evi- luminating important consequences of epistasis in evolu- bioRxiv preprint doi: https://doi.org/10.1101/2021.06.04.447073; this version posted June 5, 2021. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. 8

FIG. 5. Accuracy of contact prediction as a function of sequence number and sequence divergence: Panel A shows the accuracy of contact prediction as a function of the average sequence divergence from wildtype PSE-1 and the depth of the sequenced library. The accuracy is measured via the positive predictive value (PPV), i.e., the fraction of true positive contact predictions in the first 100 DCA-predicted contacts, cf. Methods for details. The selection strength T = 1.4 corresponds to the experimental condition in [17]. The highlighted square indicates an average Hamming distance of about 27 and a sequence library of 165,000, as realized in [17]. Panel B shows the same quantities for wildtype TEM-1, and for the experimental conditions used in [16].

tion, like the site- and time-dependence of substitution Sequences from experimental evolution rates. We anticipate that the proposed modeling frame- work may capture many of these effects in a highly quan- We include in our analysis the sequence data coming titative way. from the experiments of in vitro evolution by [16] on TEM-1 and by [17] on PSE-1 and AAC6. The aligned amino-acid sequences from [16] were kindly provided by the authors prior to publication, and can also be found at METHODS http://laboratoriobiologia.sns.it/supplementary-mbe- 2019/. The raw sequencing reads are available at the Sequence data National Centre for Biotechnology Information Sequence bioRxiv preprint doi: https://doi.org/10.1101/2021.06.04.447073; this version posted June 5, 2021. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. 9

FIG. 6. Dependence of the contact-prediction accuracy on selection strength: We show the PPV (100 predicted contacts) of simulated MSAs at variable selection strength T (Panel A for PSE-1, Panel B for TEM-1), and for different sequence distances from the wildtype protein. We predict that, for the distances observed in the evolution experiments (27 for PSE-1, 18 for TEM-1), both experiments would have benefited from slightly lower anti-biotic concentrations.

Read Archive (SRA) with accession code PRJNA528665 Natural homologous sequences and preprocessing of the (http://www.ncbi.nlm.nih.gov/sra/PRJNA528665). training set Amino-acid sequences with more than 6 gaps were discarded as a quality control to remove sequences with The MSAs of natural homologous sequences of the two lower quality. considered protein families PF13354 (Beta-lactamase2) and PF00583 (Acetyltransf 1) were generated running the hmmsearch command from the HMMer software suite [17] ran two experiments using the PSE-1 beta- [35] on the UniProt database [36]. Insertions were re- lactamase and the AAC6 acetyltransferase as start- moved, and sequences with more than 10% gaps and du- ing wildtypes. Aligned sequencing reads from the plicated sequences were excluded to improve the quality last round of the two experiments can be found of the alignment. Any sequence closer than 80% to the at https://github.com/sanderlab/3Dseq. The raw se- wildtypes TEM-1, PSE-1, or AAC6 was excluded from quencing reads are available at the National Cen- the alignments to avoid the introduction of biases to- tre for Biotechnology Information Sequence Read wards these sequences in the bmDCA learning. The re- Archive (SRA) with accession code PRJNA578762 sulting MSAs included 18, 333 (43, 576) homologous and (http://www.ncbi.nlm.nih.gov/sra/PRJNA578762). non-identical aligned sequences of length 202 (117) for PF13354 (PF00583). Our models are built for the Pfam-annotated posi- These MSA were used to train two Potts models using tions using the corresponding Pfam domains PF13354 bmDCA [24] in the implementation of [37]. (Beta-lactamase2) and PF00583 (Acetyltransf 1). We re-aligned the wildtype sequence using the hmmalign Evolutionary model command from the HMMer software suite [35] and pro- file Hidden Markov Models (pHMM) downloaded from Pfam [1]. We then removed from the experimental MSA As already discussed in Results, our evolutionary all columns corresponding to non-matched states of the model combines mutations at the nucleotide level with se- wildtype sequence. lection at the level of aligned amino-acid sequences. We therefore need to specify both the nucleotide sequence n = (n11, n12, n13, ..., ni1, ni2, ni3, ..., nL1, nL2, nL3) and The resulting MSAs of experimentally evolved se- the resulting amino-acid sequence a = (a1, ..., aL), which quences have 202 sites and 165,855 sequences for PSE-1 is translated from n using the standard . (round 20), and 34,431 sequences for TEM-1 (generation Since we consider full-length aligned sequences of Pfam 12). For AAC6 we find 117 sites and 1,260,048 sequences domains, stop codons are not allowed in n. Furthermore, (round 8). we have to accommodate alignment gaps possibly exist- bioRxiv preprint doi: https://doi.org/10.1101/2021.06.04.447073; this version posted June 5, 2021. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. 10 ing in a: a gap in a is represented by a triplet of gaps in n. Simulated sequence data for contact prediction Gaps are not changed during our simulations, our model does consider only single-nucleotide substitutions, but no Our evolutionary algorithm has three input parame- insertions and no deletions. Note that the grey columns ters adding to the wildtype sequence and the statistical- in Figs. 4, S5, S6 correspond to gaps in the wildtype se- energy model: the number of sequences M, the number quence, which are conserved both in the experiment and NMC of steps of our evolutionary Markov chain model, in the model. and the selection temperature T . Given this triplet of As mentioned before, for each codon (n1, n2, n3) ∈ numbers it outputs a MSA obtained simulating evolution {A, C, G, T }3, we consider the set of amino acids for NMC iterations starting from the wildtype sequence, Aacc(n1, n2, n3) ⊂ {A, ..., Y }, which are accessible from repeating the sampling independently M times at tem- (n1, n2, n3) by a single nucleotide mutation. perature T = 1/β. Our simulation of sequence evolution proceeds by iter- For each wildtype sequence, we simulated the out- ating the following three steps defining a Markov chain come of different protein evolution experiments by scan- (MC) in the space of nucleotide sequences (note that, due ning these three input parameters within a range of in- to the degeneracy of the genetic code, the process is not terest. For MSA generated starting from TEM-1 or a Markov chain in amino-acid sequence space): PSE-1 (AAC6) we varied M in the range 100 − 165, 000 (500 − 1, 250, 000), N in the range 5-255 (4-120) and 1. A position i ∈ {1, ..., L} is chosen uniformly at ran- MC T in the range 0.05-20. dom along the amino-acid sequence, corresponding To save resources and time, given the computational to the codon n = (n , n , n ) and the amino acid i i1 i2 i3 cost of sampling, we opted for a scheme that would al- a . While a = ”−”, i.e. a gap is chosen, we repeat i i low us to reduce the number of independent MC chains the selection of the position i. needed to simulate evolution. For each temperature T , we run 165000 (1250000) independent Markov Chains for 2. Out of all accessible amino acids b ∈ Aacc(ni), we selected one using the conditional proba- TEM-1 and PSE-1 (AAC6) and printed MSAs at the de- sired number of MC steps until 255 (120) MC steps. The bility Pβ(b|a−i), which couples the amino acid MSAs with less sequences were obtained by randomly b explicitly to the sequence context a−i = subsampling without replacement from the MSA with (a1, ..., ai−1, ai+1, ..., aL): 165000 (1250000) sequences. To produce more statistics n P o we ran the same simulations 5 times. exp βhi(b)+ β j(6=i) Jij(b, aj) Pβ(b|a−i) = , (3) zi(a−i) Contact prediction with X n X o Contact prediction was performed using GaussDCA zi(a−i) = exp βhi(b)+ β Jij(b, aj) (4) [32] for all MSA, included, for coherence, the experimen- b∈Aacc(ni) j(6=i) tal ones. GaussDCA is the computationally most efficient implementation of DCA. Even if the contact prediction being a normalization constant. In difference to Z is slightly inferior to, e.g., plmDCA, this choice allowed in Eq. (1), it can be calculated efficiently by sum- for running DCA on a large number of combinations of ming over the less than 20 accessible amino acids. sampling time, sample size and selection strengths. 3. One out of the possible codons for amino acid b, The reweighting parameter was set to 0 for contact prediction of in silico MSAs, as this reduces computa- which differ from ni in a single nucleotide, is se- lected uniformly at random. tional time and is coherent with the independence of the simulated Markov chains. On the other hand, contact The new amino acid b substitutes ai in a, and the new prediction of experimental MSAs was performed setting codon ni in n. We thereby conserve the coherence be- the reweighing parameter to :auto to correct for possible tween nucleotide and amino-acid sequence. phylogenetic effects. Pseudocount was set to 0.6 (0.5) To simulate an entire MSA of M sequences, the process for PSE-1 and TEM-1 (AAC6) empirically, as we found is initiated M times in the wildtype reference sequence, it to be a good intermediate value for MSAs with very and M independent runs of the MC are performed. The different statistics. number of steps in these MCs is chosen such that the Intra-chain atomic distances for both fami- average Hamming distance of the generated amino-acid lies were obtained by running the single-protein sequences reaches a target number. Note that the Ham- mode of the code provided by Pfam ming distances may vary from MC to MC, since Aacc(ni) (https://doi.org/10.5281/zenodo.4080947), we used contains the case b = ai accessible via any synonymous the shortest distance between heavy atoms of the two mutations. The Hamming distance can therefore assume amino acids among all structures of the Protein Data any value between zero and the number of performed Bank (PDB) [38] listed in Pfam. Following standards in mutational steps. coevolutionary contact prediction, all pairs with distance bioRxiv preprint doi: https://doi.org/10.1101/2021.06.04.447073; this version posted June 5, 2021. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. 11 below 8A˚ and a minimum separation of 5 positions along useful discussions. This work was partially funded by the the sequence are kept as contacts for the calculation of EU H2020 Research and Innovation Programme MSCA- the PPV (positive predictive value). RISE-2016 under Grant Agreement No. 734439 InferNet, and by a grant from the Simons Foundation (#454955, Francesco Zamponi). ACKNOWLEDGMENTS

We are grateful to the authors of [16], who shared their data with us prior to publication, and in particular M. DATA AND CODE AVAILABILITY Fantini, A. Pastore and P. de los Rios for interesting dis- cussions about our first results. We also thank Anna The code for evolutionary simulations together with Paola Muntoni for contributing to the implementation sample notoebooks and data used in the article will be of bmDCA used in this work, and to Kai Shimagaki, made available on GitHub along with the publication of Jeanne Trinquier, Simona Cocco and Remi Monasson for the manuscript.

[1] J. Mistry, S. Chuguransky, L. Williams, M. Qureshi, [17] M. A. Stiffler, F. J. Poelwijk, K. P. Brock, R. R. Stein, G. A. Salazar, E. L. Sonnhammer, S. C. Tosatto, L. Pal- A. Riesselman, J. Teyra, S. S. Sidhu, D. S. Marks, N. P. adin, S. Raj, L. J. Richardson, et al., Nucleic Acids Re- Gauthier, and C. Sander, Cell Systems 10, 15 (2020). search 49, D412 (2021). [18] R. C. Cadwell and G. F. Joyce, Research 2, 28 [2] R. Durbin, S. R. Eddy, A. Krogh, and G. Mitchison, Bio- (1992). logical sequence analysis: probabilistic models of proteins [19] F. H. Arnold, Accounts of Chemical Research 31, 125 and nucleic acids (Cambridge University Press, 1998). (1998). [3] D. De Juan, F. Pazos, and A. Valencia, Nature Reviews [20] F. H. Arnold, Angewandte Chemie International Edition 14, 249 (2013). 57, 4143 (2018). [4] R. M. Levy, A. Haldane, and W. F. Flynn, Current [21] M. Ekeberg, C. L¨ovkvist,Y. Lan, M. Weigt, and E. Au- Opinion in Structural Biology 43, 55 (2017). rell, Physical Review E 87, 012707 (2013). [5] S. Cocco, C. Feinauer, M. Figliuzzi, R. Monasson, and [22] T. A. Hopf, A. G. Green, B. Schubert, S. Mers- M. Weigt, Reports on Progress in Physics 81, 032601 mann, C. P. Sch¨arfe,J. B. Ingraham, A. Toth-Petroczy, (2018). K. Brock, A. J. Riesselman, P. Palmedo, et al., Bioinfor- [6] M. Weigt, R. A. White, H. Szurmant, J. A. Hoch, and matics 35, 1582 (2019). T. Hwa, Proceedings of the National Academy of Sciences [23] J. A. de la Paz, C. M. Nartey, M. Yuvaraj, and F. Mor- 106, 67 (2009). cos, Proceedings of the National Academy of Sciences [7] F. Morcos, A. Pagnani, B. Lunt, A. Bertolino, D. S. 117, 5873 (2020). Marks, C. Sander, R. Zecchina, J. N. Onuchic, T. Hwa, [24] M. Figliuzzi, P. Barrat-Charlaix, and M. Weigt, Molec- and M. Weigt, Proceedings of the National Academy of ular Biology and Evolution 35, 1018 (2018). Sciences 108, E1293 (2011). [25] F. Morcos, N. P. Schafer, R. R. Cheng, J. N. Onuchic, [8] S. Balakrishnan, H. Kamisetty, J. G. Carbonell, S.-I. Lee, and P. G. Wolynes, Proceedings of the National Academy and C. J. Langmead, Proteins: Structure, Function, and of Sciences 111, 12408 (2014). Bioinformatics 79, 1061 (2011). [26] D. H. Ackley, G. E. Hinton, and T. J. Sejnowski, Cog- [9] D. T. Jones, D. W. Buchan, D. Cozzetto, and M. Pontil, nitive Science 9, 147 (1985). Bioinformatics 28, 184 (2012). [27] L. Sutto, S. Marsili, A. Valencia, and F. L. Gervasio, [10] J. Xu, Proceedings of the National Academy of Sciences Proceedings of the National Academy of Sciences 112, 116, 16856 (2019). 13567 (2015). [11] J. G. Greener, S. M. Kandathil, and D. T. Jones, Nature [28] W. P. Russ, M. Figliuzzi, C. Stocker, P. Barrat-Charlaix, Communications 10, 1 (2019). M. Socolich, P. Kast, D. Hilvert, R. Monasson, S. Cocco, [12] A. W. Senior, R. Evans, J. Jumper, J. Kirkpatrick, M. Weigt, et al., Science 369, 440 (2020). L. Sifre, T. Green, C. Qin, A. Z´ıdek,ˇ A. W. Nelson, [29] E. Firnberg, J. W. Labonte, J. J. Gray, and M. Oster- A. Bridgland, et al., Nature 577, 706 (2020). meier, and Evolution 31, 1581 (2014). [13] J. Yang, I. Anishchenko, H. Park, Z. Peng, S. Ovchin- [30] M. Figliuzzi, H. Jacquier, A. Schug, O. Tenaillon, and nikov, and D. Baker, Proceedings of the National M. Weigt, Molecular Biology and Evolution 33, 268 Academy of Sciences 117, 1496 (2020). (2016). [14] S. Ovchinnikov, H. Park, N. Varghese, P.-S. Huang, G. A. [31] T. A. Hopf, J. B. Ingraham, F. J. Poelwijk, C. P. Sch¨arfe, Pavlopoulos, D. E. Kim, H. Kamisetty, N. C. Kyrpides, M. Springer, C. Sander, and D. S. Marks, Nature and D. Baker, Science 355, 294 (2017). Biotechnology 35, 128 (2017). [15] A. Haldane and R. M. Levy, Physical Review E 99, [32] C. Baldassi, M. Zamparo, C. Feinauer, A. Procaccini, 032405 (2019). R. Zecchina, M. Weigt, and A. Pagnani, PloS One 9, [16] M. Fantini, S. Lisi, P. De Los Rios, A. Cattaneo, and e92721 (2014). A. Pastore, Molecular Biology and Evolution 37, 1179 [33] G. L. Moore and C. D. Maranas, Journal of Theoretical (2020). Biology 205, 483 (2000). bioRxiv preprint doi: https://doi.org/10.1101/2021.06.04.447073; this version posted June 5, 2021. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. 12

[34] L. Pritchard, D. Corne, D. Kell, J. Rowland, and M. Winson, Journal of Theoretical Biology 234, 497 (2005). [35] S. R. Eddy, PLoS Comput Biol 7, e1002195 (2011). [36] The UniProt Consortium, Nucleic Acids Research 49, D480 (2021). [37] P. Barrat-Charlaix, A. P. Muntoni, K. Shima- gaki, M. Weigt, and F. Zamponi, arXiv preprint arXiv:2011.11259 (2020). [38] S. K. Burley, C. Bhikadiya, C. Bi, S. Bittrich, L. Chen, G. V. Crichlow, C. H. Christie, K. Dalenberg, L. Di Costanzo, J. M. Duarte, et al., Nucleic Acids Re- search 49, D437 (2021). bioRxiv preprint doi: https://doi.org/10.1101/2021.06.04.447073; this version posted June 5, 2021. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. 13

SUPPORTING INFORMATION

FIG. S1. Predicted vs. experimentally measured mutational effects for TEM-1: Scatter plot of the data in Fig. 2. Panel A shows the experimental results of Ostermeier et al. vs. the DCA predictions using the epistatic Potts model, Panel B vs. the non-epistatic profile model. The Spearman rank correlations between experiments and predictions are displayed in the figures.

FIG. S2. Statistical energy in dependence of sequence distance from wildtype TEM-1: Panel A shows the statistical energies of the sequences from generation 12 in Fantini et al., in dependence of the Hamming distance (number of substituted amino acids) from the wildtype PSE-1. Panel B shows the same quantities for the simulated sequences, where selection strength T and the number of simulated evolutionary steps are adjusted to reproduce the average distance and the slope from Panel A. Panel C shows an example of strong selection (T  1) leading to optimized sequences having lower statistical energies / higher fitness. Panel D shows the case of very weak selection (T  1) resulting in random, mostly deleterious substitutions strongly increasing statistical energy. bioRxiv preprint doi: https://doi.org/10.1101/2021.06.04.447073; this version posted June 5, 2021. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. 14

FIG. S3. Statistical energy in dependence of sequence distance from wildtype AAC6: Panel A shows the statistical energies of the sequences from Stiffler et al., in dependence of the Hamming distance (number of substituted amino acids) from the wildtype PSE-1. Panel B shows the same quantities for the simulated sequences, where selection strength T and the number of simulated evolutionary steps are adjusted to reproduce the average distance and the slope from Panel A. Panel C shows an example of strong selection (T  1) leading to optimized sequences having lower statistical energies / higher fitness. Panel D shows the case of very weak selection (T  1) resulting in random, mostly deleterious substitutions strongly increasing statistical energy.

FIG. S4. Position specific amino-acid frequencies for experimental and simulated sequence libraries for PSE-1: Panel A shows the frequencies fi(a) of usage of amino acid a in site i for the simulated sequences without taking into account amino-acid accessibility. Panel B and C show scatter plots of these frequencies for the experimental data vs. simulated data. Panel B takes amino-acid accessibility into account, and shows a higher correlation than Panel C not taking accessibility into account. bioRxiv preprint doi: https://doi.org/10.1101/2021.06.04.447073; this version posted June 5, 2021. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. 15

FIG. S5. Position specific amino-acid frequencies for experimental and simulated sequence libraries: Panel A shows the frequencies fi(a) of usage of amino acid a in site i in round 12 of experimental TEM-1 evolution, Panel B shows the same quantity for simulated evolution. Both plots have a Spearman rank correlation of 79%.

FIG. S6. Position specific amino-acid frequencies for experimental and simulated sequence libraries: Panel A shows the frequencies fi(a) of usage of amino acid a in site i in the experimental AAC6 evolution, Panel B shows the same quantity for simulated evolution. Both plots have a Spearman rank correlation of 73%. bioRxiv preprint doi: https://doi.org/10.1101/2021.06.04.447073; this version posted June 5, 2021. The copyright holder for this preprint (which was not certified by peer review) is the author/funder, who has granted bioRxiv a license to display the preprint in perpetuity. It is made available under aCC-BY 4.0 International license. 16

FIG. S7. Accuracy of contact prediction in dependence of sequence number and sequence divergence: The figure shows the accuracy of contact prediction as a function of the average sequence divergence from wildtype AAC6 and the depth of the sequenced library, for selection strength T = 2. The accuracy is measured via the positive predictive value (PPV), i.e., the fraction of true positive contact predictions in the first 50 DCA-predicted contacts, cf. Methods for details. The highlighted square indicates an average Hamming distance of about 8 and a sequence library of 1,250,000, as realized in [17].

FIG. S8. Accuracy of contact prediction in dependence of sequence number and sequence divergence: The panels show, for the case of very strong selection (T = 0.05, Panel A) and very weak selection (T = 20, Panel B), the accuracy of contact prediction as a function of the average sequence divergence from wildtype PSE-1 and the depth of the sequenced library. The accuracy is measured via the positive predictive value (PPV), i.e., the fraction of true positive contact predictions in the first 100 DCA-predicted contacts, cf. Methods for details. The highlighted square indicates an average Hamming distance of about 27 and a sequence library of 165,000, as realized in [17].