A TCR-antigen complex affinity prediction algorithm based on contrastive learning

Through the TCR and antigen complex affinity prediction algorithm based on contrastive learning, the attention mechanism and the Transformer encoder are used to generate feature vectors, and the MHC encoder is combined to predict the combination of TCR and antigen, which solves the problem of predicting the combination of T cells and antigens in the existing technology. solve difficult problems, achieve high-accuracy and efficient experimental verification, and reduce manpower and material costs.

CN114822680BActive Publication Date: 2024-10-15NANJING TECH UNIV
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210172888.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-24
Publication Date
2024-10-15
Estimated Expiration
2042-02-24

AI Technical Summary

Technical Problem

In the fields of immunity and bioinformatics, predicting the binding of T cells to neoantigens has always been a challenge. Existing technical methods consume a lot of manpower and material resources, and deep learning models have limited performance in this regard.

Method used

Design an affinity prediction algorithm for TCR and antigen complexes based on contrastive learning. The TCR sequence is encoded through the attention mechanism and Transformer encoder, and the model is optimized using contrastive learning and normalized temperature-scale cross-entropy loss to generate feature vectors. And combined with MHC encoder to predict the binding of TCR to antigen.

Benefits of technology

It achieves high-accuracy prediction of affinity between TCR and antigen complexes, saves experimental costs, provides experimentalists with an efficient reference, and can demonstrate good prediction performance and robustness on multiple data sets.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114822680B_ABST
    Figure CN114822680B_ABST
Patent Text Reader

Abstract

The present invention discloses a TCR and antigen complex affinity prediction algorithm based on self-supervised contrastive learning, including two stages: pre-training and prediction: 1) In the contrastive learning pre-training stage, the TCR sequence is used as a training set, the attention weight of the amino acids of the TCR sequence is calculated, and a new TCR sequence is generated by masking some amino acids with a certain probability, and the two sequences are encoded by the Transformer encoder to generate vector representations (embeddings), and then the cosine similarity of the two sequences is calculated according to the contrastive learning framework, the loss is calculated by normalizing the temperature-scale cross entropy, and the loss function is optimized using the gradient descent algorithm. 2) In the downstream prediction stage, the operator inputs the TCR sequence to be tested and the antigen complex sequence into the trained Transformer encoder to obtain a vector representation, and the feature vectors are concatenated and input into the fully connected network to predict the affinity of the TCR and antigen complex.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of deep learning technology, and in particular to a method for predicting TCR and antigen complex affinity based on comparative learning. Background Art

[0002] Neoantigens play a crucial role in the process of T cell recognition of tumor cells, but only a very small number of neoantigens activate T cell immune responses. In the field of immunology and bioinformatics, predicting the binding of T cells to neoantigens has been a long-standing challenge.

[0003] However, verification through experimental methods requires a lot of manpower and material resources. Deep learning models have already performed well on the corresponding problems. In order to reduce the cost of experimental verification, we hope to design a model based on contrastive learning to predict the binding of TCR and antigen complex.

[0004] Therefore, the present invention proposes a TCR and antigen complex affinity prediction algorithm based on contrast learning. Summary of the invention

[0005] The purpose of the present invention is to solve the shortcomings of the prior art and propose a TCR and antigen complex affinity prediction algorithm based on comparative learning.

[0006] In order to achieve the above object, the present invention adopts the following technical solution: a TCR and antigen complex affinity prediction algorithm based on contrastive learning, comprising the following steps:

[0007] The operator uses the TCR sequence as a training set and puts it into the self-supervised model. It generates a batch of size N from the original sequence. The model uses the attention mechanism to encode each amino acid in each TCR sequence, and calculates the attention weight for each of them, and saves the weight using an array. During the training process, according to the attention weight, the desired amino acids with the highest attention weight are found by sorting.

[0008] Different masked TCR sequences are generated by modifying the masking method of the attention mechanism. The input TCR sequence and the generated masked TCR sequence are encoded through the transformer encoder. The original sequence and the masked sequence in each pair are encoded through a transformer encoder. The two encoders encoding each pair of sequences have shared weights and generate two vectors respectively.

[0009] The vectors encoded by the two sequences are transformed through a series of nonlinear transformations to obtain vectors. The encoded vectors are used for downstream tasks to predict the binding of TCR and antigens; the vectors are model tuned through the idea of ​​contrastive learning, each encoded sequence is embedded in the vector, and the cosine similarity is first calculated. Contrastive learning uses a normalized temperature-scale cross entropy to calculate the loss. By continuously optimizing the model, the sequences in each batch are processed one by one, and the calculation result is taken as the negative of the logarithm to calculate the loss, which is the noise contrast estimation (NCE) loss.

[0010] According to this loss calculation method, the encoder and projection head representation are improved over time, and the obtained representation method will place similar sequences closer in space. Finally, an encoder for a TCR sequence is trained;

[0011] In the downstream task, the operator uses the trained TCR encoder to encode the TCR sequence and the given MHC encoder to encode. The input uses three columns of data, TCR sequence, antigen sequence, and HLA allele to combine the features of the two encodings as the input of the network;

[0012] The prediction network uses a multi-layer fully connected layer. The number of network layers is adjusted according to the results of model training. The loss function uses cross entropy loss. The experimentally verified data set is mismatched to generate negative samples. The encoding of the TCR sequence and antigen sequence is combined, and the feature encoding is input into the network for training to predict the binding of TCR and antigen.

[0013] The encoding module includes a TCR encoder module and an MHC encoder module.

[0014] The TCR encoder module includes an attention mechanism module and a transformer encoder module.

[0015] The prediction module includes a coding feature integration and a deep learning network prediction module.

[0016] The present invention has the following beneficial effects:

[0017] 1. This TCR-antigen complex affinity prediction method based on contrastive learning has trained the encoder of the TCR sequence, which is convenient for experimenters in related work to obtain the feature vector of the TCR sequence from our encoder through the method of transfer learning for calculation of any downstream task.

[0018] 2. This TCR and antigen complex affinity prediction method based on contrastive learning has extremely high accuracy in predicting affinity on multiple data sets, and can be used in related applications to provide a certain reference for experimenters, saving manpower and material resources and reducing experimental costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 The TCR encoder module of the present invention includes an attention mechanism module and a Transformer encoder module training step diagram;

[0020] Figure 2 Schematic diagram of the downstream task encoding feature integration and deep learning network prediction module described in the present invention.

[0021] Figure 3 The ACC curve obtained by the model calculation is verified on an experimental data set with 32044 samples.

[0022] Figure 4 The AUC curve obtained by the model calculation is verified on an experimental data set with 32044 samples.

[0023] Figure 5 The ACC curve obtained by the model calculation is verified on an experimental data set with 619 samples.

[0024] Figure 6 The AUC curve obtained by the model calculation is verified on an experimental data set with 619 samples. DETAILED DESCRIPTION

[0025] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.

[0026] Example

[0027] Reference Figure 1 , a TCR encoder training method for a TCR-antigen complex affinity prediction model based on contrastive learning, comprising the following steps:

[0028] S1: The operator uses the TCR sequence as a training set and puts it into the self-supervised model. Here, you can use the provided TCR sequence or the private TCR sequence as the training set and send it into the model to generate a batch of size N from the original sequence;

[0029] S2: The model uses the attention mechanism to encode each amino acid in each TCR sequence, calculates the attention weight for each of them, and saves the weight atten in an array;

[0030] S3: During the training process, according to the attention weight, find out each time when calculating, and reversely map the weight atten[] to get each amino acid corresponding to the weight, and find out the desired amino acids with the highest attention weight by sorting;

[0031] S4: Generate different masked TCR sequences by modifying the masking method of the attention mechanism, and form two views with the original input sequence for comparison. For a batch-size of N, 2N sequences will be obtained.

[0032] S5: The input TCR sequence and the generated masked TCR are encoded through a transformer encoder. The original sequence and the masked sequence in each pair are passed through a transformer encoder to obtain the encoded representation. The encoder used is general and can be replaced with other architectures. The two encoders encoding each pair of sequences have shared weights and generate two vectors respectively;

[0033] S6: The two sequence-encoded vectors are transformed through a series of Dense->Relu->Dense layers to apply nonlinear transformations, and then projected through the projection head to obtain vectors. The encoded vectors are used in downstream tasks to predict the binding of TCR and antigen;

[0034] S7: The vector is tuned through the idea of ​​contrastive learning. Each encoded sequence is embedded in the vector and the cosine similarity is calculated first:

[0035] τ is an adjustable parameter that can scale the input and expand the range of cosine similarity. Contrastive learning uses a normalized temperature-scaled cross entropy to calculate the loss. By continuously optimizing the model, the sequences in each batch are processed one by one, and the similarity probability of the two sequences is calculated using softmax. The softmax calculation method of the two sequences is the similarity of the pair of sequences divided by the sum of the similarities of the original sequence and each sequence in the batch. This calculation method is equivalent to masking the probability that the generated TCR sequence is most similar to the original sequence. The calculation result is taken as the negative of the logarithm to calculate the loss, which is the noise contrast estimation (NCE) loss.

[0036] Then swap the positions and calculate the loss for the same pair of sequences again:.

[0037] In this way, when batchsize=N, the loss of all pairs is calculated and their average is calculated:

[0038] According to this loss calculation method, the encoder and projection head representation are improved over time, and the obtained representation method will place similar sequences closer in space. Finally, an encoder for a TCR sequence is trained;

[0039] S8: According to Figure 2 ,In the downstream task, the operator uses the trained TCR encoder to encode the TCR sequence, and the given MHC encoder to encode, and the input uses three columns of data, TCR sequence, antigen sequence, and HLA alleles to combine the features of the two encodings,as the input of the network;

[0040] S9: The prediction network uses a multi-layer fully connected layer. The number of network layers can be adjusted according to the results of model training. The loss function uses cross entropy loss:

[0041] S10: The experimentally verified data set is mismatched to generate negative samples, the encoding of the TCR sequence and the antigen sequence are combined, the feature encoding is input into the network for training, and the binding of TCR and antigen is predicted.

[0042] The encoding module includes a TCR encoder module and an MHC encoder module.

[0043] The TCR encoder module includes an attention mechanism module and a transformer encoder module.

[0044] The prediction module includes a coding feature integration and a deep learning network prediction module.

[0045] In this embodiment, during the encoder training phase, the masking method can be modified. The default minimum attention weight masking method can be changed to the maximum attention weight masking method, or masking by proportion, etc. Similarly, the values ​​of k and v or the number of attention heads can be adjusted by modifying the setting parameters of the attention mechanism. The downstream task uses a three-layer fully connected layer as the prediction network, and the number of layers can be adjusted according to the specific data set. According to experimental verification, the prediction result of the three-layer network layer is currently the optimal solution.

[0046] In this embodiment, verification is performed on experimental data sets with sample numbers of 32044 and 619. In order to avoid affecting the model performance, these two data sets have no intersection with each other, and can achieve ACC=0.88, AUC=0.09 and ACC=0.96, AUC=0.97 respectively. From a statistical point of view, it can be shown that the method has reliable prediction performance and has good robustness to different data sets.

[0047] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.

Claims

1. A TCR-antigen complex affinity prediction algorithm based on contrastive learning, Features: The following steps are involved: S1: Use TCR CDR3 sequences in the training set as model input; S2: The attention-based encoding module encodes each amino acid in the TCR sequence and calculates the attention weight; S3: Generate different masked TCR sequences by modifying the attention weight probability masking method; S4: Input the original TCR sequence and the masked TCR sequence into the Transformer encoder for encoding to generate vector representations h of the two sequences i and h i ’ ; S5: vector h i and h i ’ The module is input into the self-supervised contrastive learning module, which uses the normalized temperature-scale cross entropy to calculate the contrastive loss and iteratively updates the parameters to minimize the contrastive loss to obtain the trained TCR encoder. S6: In the prediction task, the trained encoder is used to encode the TCR CDR3 sequence, and the publicly available MHC encoder is used to encode the antigen sequence. The features encoded by the two sequences are concatenated and used as the input of the prediction module. S7: The prediction network uses a multi-layer fully connected network to predict the binding of TCR and antigen.

Citation Information

Patent Citations

  • Method for predicting affinity of HLA type I molecule and polypeptide

    CN111105843A

  • Construction method and device of benign and malignant tumor identification model

    CN111276252A

  • Method for enhancing affinity and stability of antigen polypeptide

    CN111363026A

  • Attention-based neural network to predict peptide binding, presentation, and immunogenicity

    WO2022016125A1