Negative T cell selection on non-random peptides promotes robust self-nonself discrimination

Our adaptive immune system has the remarkable ability to distinguish previously unseen foreign peptides from harmless self. This self-foreign discrimination was long thought to arise from the silencing of self-reactive T cells during negative selection in the thymus, but recent data show that negative selection is far from complete. Here we ask how a repertoire containing many self-reactive T cells can nevertheless discriminate self from foreign. We address this question using realistic-scale computational models of the T cell repertoire. Our models show that moderate T cell cross-reactivity automatically skews the post-selection repertoire towards peptides that differ systematically from self. But even when no systematic differences between self and foreign exist, discrimination remains possible if the peptides presented in the thymus are chosen in a way that minimizes the co-occurrence of similar, redundant self peptides. Thus, our model predicts that negative selection on a well-chosen subset of self peptides biases the resulting repertoire towards better detection of both self-similar and -dissimilar pathogens. This effect would allow the immune system to "learn self by example", an ability shared with cognitive systems.

English Xhosa reacting TCRs/million (1) TCRs in the unbiased pre-selection repertoire (with all possible 27 6 ⇡400 million TCR motifs of 6 characters [a-z and _]) are deleted if their affinity for any of the training strings exceeds the functional response threshold t.
(2) Unseen English and Xhosa strings are exposed to the post-selection repertoire to find the number of remaining TCRs reacting to them (that is, TCRs with affinity t). (c) Reacting TCRs per million of unseen English and Xhosa strings, before and after negative selection on 500 English strings. Horizontal lines indicate medians. (d) Median and interquartile range of English-and Xhosa-reactivity after negative selection on English strings. (e) Percentage of Xhosa strings among the 10% of strings with the most reacting TCRs after negative selection on English strings (mean±standard deviation, SD, of 30 simulations). No discrimination should result in equal amounts (50%) of English and Xhosa strings in this top 10%. Throughout this figure, we tested 50 English and 50 Xhosa strings using an affinity threshold t = 3 for negative selection. strings for which it has an a nity of at least some threshold t, 68 which represents a functional response threshold rather than 69 a mere binding threshold. Crucially, reaction does not require 70 a perfect match between the string and TCR motif. Thus, our 71 TCRs are cross-reactive and react to multiple, related peptides. 72 In contrast to models based on binding energy (17, 18), the 73 "motif-based" recognition implemented in our model (Fig. 1A) 74 ensures that both peptides recognized by the same TCR and 75 TCRs recognizing the same peptide share sequence motifs -in 76 line with observations from TCR-specific peptide sets (19-21) 77 and peptide-specific TCR repertoires (22,23). 78 To test how well TCR repertoires could discriminate be- Xhosa than to English (Fig. 1C,D). 90 Given that peptides to which many TCRs react tend to elicit 91 stronger immune responses (24), it is important that these 92 most frequently recognized peptides are predominantly foreign. The 10% most frequently recognized strings in our simulation 94 were indeed predominantly Xhosa strings (Fig. 1E). The a nity 95 distribution of these TCR interactions was shifted towards 96 higher a nities for Xhosa, but only very slightly (Fig. S1A). For 97 sake of simplicity, we therefore focus only on the number of 98 reacting TCRs throughout this paper, rather than considering 99 di↵erent a nities separately. This choice to consider TCRs with 100 a broad range of a nities is supported by growing evidence 101 that also lower a nity TCRs are important contributors to 102 immune responses (25).

103
Discrimination success relies on moderate cross-reactiv-104 ity and sequence dissimilarity. These results confirm that our 105 AIS can easily distinguish English from Xhosa even after incom-106 plete negative selection. To investigate in more detail under 107 which conditions this discrimination arises, we analyzed which 108 TCRs were deleted during negative selection on English strings 109 (Fig. 2). TCRs reacting to "unseen" English strings (those absent 110 from the training set TCRs were exposed to during negative 111 selection) had a reduced survival compared to TCRs reacting 112 to Xhosa strings ( Fig. 2A). Because TCRs are only deleted when 113 they react to at least one string in the training set, this implies that strings eliciting reactions from the same TCRs tend to 115 represent the same language. To visualize this, we created 116 graphs in which each node represents a string, and two nodes 117 become connected neighbors when at least 5 TCRs per million 118 pre-selection TCRs react to both of them (Fig. 2B). Indeed, neigh-119 bor strings are largely from the same language (Fig. 2B, left), 120 which is quantified by the concordance, the average proportion 121 of neighbors from the same language. To show that the high 122 concordance (0.81) of English and Xhosa strings represents 123 intrinsic di↵erences between English and Xhosa strings, we 124 randomly divided English strings into two groups and con-125 structed a similar graph, which as expected has a concordance 126 of only 0.5 (Fig. 2B, right). This confirms that our TCRs can only 127 discriminate between two sets of strings that are intrinsically 128 di↵erent.

129
Our results indicate two key requirements for achieving self-  To illustrate the importance of cross-reactivity, we set the 135 a nity threshold in our model to t = 6, so that each TCR was 136 maximally specific and only reacted to the one string match-137 ing its binding motif perfectly (i.e., no cross-reactivity). The  concordance and the acquired level of discrimination (Fig. 2F).

162
This was a property of the tested languages rather than the 163 specific texts chosen, as our model could not discriminate 164 between English strings from di↵erent books (Fig. 2F). we modified our TCR model to accommodate 6-mer peptide 175 sequences rather than six-letter strings (Fig. 3A). Setting the 176 a nity threshold to an intermediate value of t = 4 in this model 177 allowed each TCR to react to roughly one in every 55,000 pep-178 tides (Fig. S2A) -a cross-reactivity level that reasonably matches 179 an experimental estimate of one in 30,000 (27). Furthermore, at 180 this level of cross-reactivity, peptides elicited reactions from 0 181 to 20 TCRs per million in our simulated repertoires (Fig. S2B), 182 in line with experimental data (28-31). These results suggest 183 that the cross-reactivity level of TCRs roughly matches that of 184 our model at t = 4, well within the "moderate" range allowing 185 discrimination between dissimilar strings (Fig. 2D,E).

186
To examine whether self-and foreign peptides are dissimilar 187 enough to allow self-foreign discrimination, we first predicted 188 MHC-I-binding peptides from the human proteome (32) and 189 used the residues 3-8 as MHC-bound self peptides in our model. 190 To obtain foreign sequences, we predicted MHC binders for 191 a variety of pathogens associated with T cell immunity: the 192 malaria parasite, the bacterium Listeria monocytogenes, and the 193 viruses ebola, hepatitis B, hepatitis C, human cytomegalovirus 194 (HCMV), human immunodeficiency virus (HIV), and vaccinia 195 (Table S1).

196
Graphs of self versus foreign peptides had strikingly low 197 concordances ( Fig. 3B)(Methods in SI Appendix), barely exceed-198 ing the control concordance observed between two random, 199 di↵erent sets of self peptides ("Self", negative control), and 200 lower than the concordance we had observed between modern 201 and medieval English. This was a property of the sequences 202 themselves rather than the chosen threshold t (Fig. S3A). In 203 a graph of all HIV peptides and their neighbors, the majority 204 of HIV peptides had many self neighbors whereas none of 205 | 3 . CC-BY 4.0 International license is made available under a The copyright holder for this preprint (which was not peer-reviewed) is the author/funder. It . https://doi.org/10.1101/403428 doi: bioRxiv preprint   3D) is included for comparison. Plots show self-HIV discrimination (left), and self-other self discrimination (right, where a random sample of self was assigned the label "foreign" before selection on training sets from the remaining "self" peptides). (c) Self-foreign discrimination for different pathogens after negative selection on 150,000 self peptides chosen randomly or with AA bias. See Fig. S6 for the full discrimination curves. Negative selection in panels b and c was performed with t = 4, and results were plotted as mean±SD of 30 simulations.

239
As a starting point, we based the optimization of the training 240 set on the peptide cluster structure as observed in Fig. 3C. The 241 large clusters in this graph contain many similar self peptides, 242 which can delete the same TCRs during negative selection 243 (Fig. 4A). Exchanging one such peptide for one of its neighbors 244 during selection thus has little e↵ect on the post-selection reper-245 toire -and presenting both has little added value. By contrast, 246 self peptides in smaller clusters are far less exchangeable (Fig. 4A): 247 their TCRs cannot be removed as easily by other peptides. Thus, 248 negative selection on randomly chosen training sets is ine -249 cient: these sets often contain several exchangeable peptides 250 that delete the same TCRs, while simultaneously missing many 251 non-exchangeable peptides and allowing the corresponding 252 self-reactive TCRs to escape. We therefore used combina-253 torial optimization techniques (Methods in SI Appendix) to 254 compute peptide combinations that deleted as many di↵erent 255 self-reactive TCRs as possible ("optimal" training sets, Fig. 4B). 256 As expected, these optimal training sets contained fewer ex-257 changeable peptides (Fig. 4C, where exchangeability equals the 258 number of self neighbors plus one). 259 We then tested whether these training sets optimized for 260 inducing tolerance could also establish self-foreign discrimination. 261 This is not guaranteed, as the latter requires not only the removal 262 of self-reactive TCRs, but also the preservation of foreign-263 reactivity. Nevertheless, our optimal training sets substantially 264 improved self-foreign discrimination (Fig. 4D). This seems to 265 be a consequence of the enrichment for low exchangeability 266 peptides (Fig. 4C), which are less likely to delete HIV-reactive 267 TCRs (Fig. 4E). Importantly, this discrimination still required 268 appropriate TCR cross-reactivity and was absent at t = 3 (Fig. S4). 269 From these results, we conclude that negative selection on a 270 representative set of self peptides can alleviate the problem 271 of self-foreign similarity, but only when TCRs are su ciently 272 4 | . CC-BY 4.0 International license is made available under a The copyright holder for this preprint (which was not peer-reviewed) is the author/funder. It . https://doi.org/10.1101/403428 doi: bioRxiv preprint specific.
Obviously, our optimal training sets are artificial, and bio-274 logical negative selection cannot calculate which self peptides 275 should be present in the thymus. We therefore investigated 276 how a representative set of self peptides might reasonably be 277 obtained during real negative selection. Analysis of our optimal 278 training sets revealed an enrichment for rare AAs compared to 279 the total set of self peptides (Fig. S5). Interestingly, peptides with 280 many rare AAs were typically less exchangeable (Fig. 5A). This 281 finding suggests that training sets enriched for rare AAs -simi-282 lar to our optimal sets -contain fewer exchangeable peptides, 283 and might thus result in better self-foreign discrimination.

284
To test this hypothesis, we again generated training sets  (Fig. 5B, left) and all other pathogens tested (Fig. 5C, S6).

293
Interestingly, this strategy also worked when we first set aside 294 a random sample of other self peptides as "foreign" before 295 selecting training sets from the remaining "self" peptides. In 296 this scenario, biased training sets still yielded substantial self-297 "foreign" discrimination, whereas random sets did not (Fig. 5B,   In fact, for the pathogens we considered, the similarity to self 311 was so high that it is hard to conceive how any self-foreign 312 discrimination could be achieved through negative selection on 313 random peptides. By contrast, a "smart" peptide presentation   (34, 35). 333 However, our results clearly show that it is not trivial for 334 negative selection to provide even a starting point for self-335 foreign discrimination. To do so, it must somehow overcome 336 the fundamental problem of similarity between self-and foreign 337 peptides.

338
Our finding that non-random peptide presentation is a 339 prerequisite for e cient self-foreign discrimination raises the 340 question how the thymus might obtain a preference for pre-341 senting low-exchangeability peptides. Although it remains 342 unclear exactly which and how many peptides a T cell sees 343 during selection, the importance of the thymic peptidome in 344 shaping the TCR repertoire is evident from the existence of spe-345 cialized antigen presenting cells, transcription factors such as 346 AIRE, and even special proteasomes controlling thymic peptide 347 presentation (36). We suggest that the biased presentation of 348 low-exchangeability peptides required for self-foreign discrimi-349 nation might arise from special binding preferences of thymic 350 antigen presentation proteins. As has already been shown for 351 the thymoproteasome during thymic positive selection (37, 38), 352 such binding preferences can enrich for specific subsets of self 353 peptides and thereby impact the ability of a TCR repertoire 354 to recognize self and foreign. While a bias for specific AAs 355 such as described in this paper would be one way to enrich 356 for low-exchangeability peptides, we do not exclude that other 357 binding preferences could have a similar impact on self-foreign 358 discrimination.

359
Notably, our imperfect selection accomplishes self-foreign 360 discrimination by also reducing the recognition of peptides the 361 T cell repertoire has not seen during selection. This capability 362 of the T cell repertoire to generalize beyond given examples is 363 a fundamental property of learning systems (39), and allows 364 the repertoire to perform a cognitive task: learning to distin-365 guish self from foreign. Even though this learning process 366 mechanistically di↵ers from learning by the central nervous 367 system, its high-level outcome is remarkably similar, and shares 368 many properties with "slow learning" systems as described in 369 psychology and neuroscience (40).

372
Data and code availability. All code used in this paper will be made 373 available at: www.github.com/ingewortel/negative-selection-2018. Data 374 will be made available on www.osf.io.

375
Simulation of negative selection. Our general simulation setup can 376 be outlined as follows:     Supporting Information (SI) 412 The SI Appendix contains Supporting Methods, Figs. S1 to S6, 413 and Table S1.   (Table S1). Potential HLA-A2:01 binders were predicted using 27 NetMHCPan (3) (version 3.0), focusing on peptides of 9 AAs. Using the NetMHCPan default settings, the 2% highest scoring 28 9-mers were defined as MHC-I binders. Of these, we selected the 6 residues at positions 3-8 to get the TCR-binding 6-mers, 29 and then removed duplicates to get unique 6-mers for each proteome (Table S1).  Training set selection. Training sets of n English strings were sampled randomly in each simulation. Training sets of n self 38 peptides were sampled from the total ≥260,000 human MHC-I binders in one of three ways: random, optimal, or biased 39 sampling (see below for the last two).

40
Optimal training peptide selection "Optimal" training sets were designed to remove as many self-reactive TCRs as possible. We 41 listed all self-reactive TCR binding motifs that would react to at least one of the ≥260,000 human MHC-I binders for a given 42 threshold t, and then selected combinations of minimal numbers of self peptides that would delete a maximal number of these 43 self-reactive TCR motifs. We could not find an exact solution to this combinatorial optimization problem, because there is 44 a nearly infinite number of ways to select n out of ≥260,000 self peptides -and it is not possible to assess the removal of 45 self-reactive TCRs for each of them. We therefore designed a "greedy" algorithm to find an approximative solution instead. 46 Briefly, we iteratively select the self peptides that remove the most remaining self-reactive TCRs by repeating two steps: 1. List the self-reactive TCR motifs that still remain in the repertoire; 48 2. Select the self peptide that deletes the most of these remaining self-reactive TCRs. If multiple self peptides delete an 49 equal number of remaining TCRs, we pick only those self peptides that do not overlap in the TCRs they delete. 50 We stop when all self-reactive TCRs are deleted. The result is an ordered list of self peptides, of which the top n epitopes 51 form an "optimal" training set of size n. For t = 3, an optimally chosen 12,025 self peptides (≥ 5% of all self peptides) could 52 already remove all self-reactive TCRs, whereas this required 130,407 self peptides (≥50% of all self peptides) at t = 4. For 53 simulations with optimal training sets larger than this number, random self peptides were added to the optimal combinations 54 to obtain the desired total number n.

Biased training peptide selection
To generate training sets biased for rare AAs, all self peptides were first assigned a score that 56 depended on their AA composition: with f aa,p the frequency within all self peptides of the AA at position p of the 6-mer peptide. These scores were then 59 transformed to a sampling probability P pep as follows:

Sequence recognition
To assess sequence recognition by the post-selection repertoire, we counted the number of post-selection TCRs reacting to each sequence with an a nity of at least the predefined a nity threshold t (the same threshold as used for 110 negative selection). Recognition was then reported in the number of reacting TCRs per million TCRs in the post-selection 111 repertoire. If the post-selection repertoire was empty, we set this number to a value of 0. Reported recognition values are 112 always from a single simulation.

Self-foreign discrimination
To assess self-foreign discrimination within a test set containing equal numbers of self and foreign 114 sequences across multiple simulations, the number of TCRs reacting to each sequence was counted as mentioned above. All 115 sequences were then ranked from high to low numbers of reacting TCRs to obtain the percentage of foreign sequences among 116 the 10% most frequently recognized sequences. When there were ties, we used the value of this percentage that would be 117 expected after random tie-breaking.

Affinity distribution
To compare TCR a nities between strings to which many TCRs react and strings with fewer reacting 119 TCRs, strings were ranked by number of reacting TCRs as described above and split into the top 10% of most-frequently 120 recognized strings and the remaining 90% of strings. For each string, we then counted the number of TCRs reacting to that 121 string with a specific a nity. For both groups, we then computed how many TCRs recognized a string in that group at a given 122 a nity, and report this as a percentage of all TCRs recognizing a string in that group.

TCR survival/deletion
To assess TCR survival during negative selection on training sets of increasing size, we first chose a test 124 set of self and/or foreign sequences, and listed all pre-selection TCRs whose a nity for these sequences was Ø t. We then 125 negatively selected our repertoires on training sets that did not contain any of these test sequences, and assessed the percentage

134
We did not perform frequentist statistical testing, since we can generate as many simulation runs as needed to ensure that 135 any interpreted di erences are not simply due to random chance. The copyright holder for this preprint (which was not peer-reviewed) is the author/funder. It . https://doi.org/10.1101/403428 doi: bioRxiv preprint