Tcr epitope binding prediction method and apparatus, system, storage medium
By combining domain embedding and hybrid expert models, this prediction method addresses the issues of uneven distribution and long-tailed samples in TCR-epitope binding prediction, achieving stable and accurate predictions under complex immune data. It is suitable for neoantigen screening and immunotherapy decision support.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU INSTITUTE OF MEDICAL SCIENCES CHINESE ACADEMY OF SCIENCES
- Filing Date
- 2026-04-28
- Publication Date
- 2026-07-21
Smart Images

Figure CN122436010A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of bioinformatics technology, specifically relating to a TCR epitope binding prediction method, device, system, and storage medium, applicable to applications such as tumor neoantigen screening, immunotherapy decision support, and immune sequence analysis. Background Technology
[0002] Currently, deep learning-based methods for predicting T-cell receptor (TCR) and epitope binding typically use TCR and epitope sequences as inputs and predict whether specific binding occurs between them through neural network models. These methods have been widely applied in immune recognition research and neoantigen screening.
[0003] 1. A TCR-epitope binding prediction method based on deep neural networks These methods typically employ deep learning architectures such as convolutional neural networks, recurrent neural networks, or Transformers to encode features from TCR sequences and epitope sequences. The encoded feature vectors are then input into fully connected networks or classifiers, outputting binary classification or combination probability results. Some methods combine large-scale protein sequence pre-trained models to vectorize the input sequences, thereby enhancing feature representation capabilities.
[0004] The methods described above can automatically learn latent patterns in sequences to some extent, and have better predictive performance than traditional machine learning methods based on human-made features. However, these methods generally employ a single model structure and a uniform decision path, and their predictive performance tends to decline significantly when faced with highly imbalanced epitope distributions, a high proportion of long-tailed samples, or differences between the distribution of test samples and the training set.
[0005] 2. Improved deep learning methods that incorporate attention mechanisms or interaction modeling To enhance the modeling ability of the interaction between TCR and epitope, some existing technologies introduce self-attention or cross-attention mechanisms into deep learning frameworks to model the correspondence between TCR sequences and epitope sequences, thereby improving the model's ability to focus on key sites or local interactions.
[0006] While these methods improve the fineness of feature representation to some extent, they still rely on a single network or expert model for prediction and fail to explicitly distinguish the differences in statistical distribution and feature space between different epitopes or samples. Therefore, they still suffer from insufficient generalization ability in scenarios where epitopes are unseen or low-frequency epitopes are present.
[0007] 3. Joint modeling methods based on multi-source data or phased training In addition, some existing technologies attempt to utilize multiple immune-related data sources, such as jointly modeling peptide-MHC binding data with TCR-related data, or adopting strategies such as phased training and transfer learning to improve the overall predictive ability of the model.
[0008] However, these methods tend to focus on how data is used during the training phase. They usually use a uniform prediction model in the model structure and inference phases, and do not dynamically adjust the model's decision path according to the characteristics of the input samples or the distribution of the data during the prediction process. Therefore, they are difficult to fully adapt to complex, diverse and unevenly distributed TCR-epitope data. Summary of the Invention
[0009] To address the problems existing in the prior art, this invention provides a TCR epitope binding prediction method, device, system, and storage medium, which solves the problems of unstable prediction performance in scenarios with uneven epitope distribution, long-tailed samples, and no epitopes, as well as the lack of adaptive ability of the model to sample distribution differences in existing T cell receptor (TCR) and epitope binding prediction methods.
[0010] To achieve the above objectives, the present invention provides the following solution: A TCR epitope binding prediction method includes: S1: Obtain epitope characterization; S2: Obtain TCR characterization; S3: Interaction between TCR and epitope features; S4: Construct domain embeddings based on epitope features; S5: TCR epitope binding prediction based on hybrid experts with domain embedding.
[0011] Preferably, in step S1, an epitope and epitope-related short peptide dataset is constructed, and feature characterization learning is performed on the input epitope sequence to obtain an epitope embedding vector for subsequent TCR-epitope binding prediction.
[0012] Preferably, in step S2, feature extraction is performed on the TCR sequence to obtain a vectorized representation of the TCR.
[0013] Preferably, in step S3, bidirectional cross-attention is used to exchange site-level information between TCR sequence-level features and epitope sequence-level features, and the interaction results are fused into a joint representation. .
[0014] Preferably, in step S4, a domain embedding representation is constructed based on the clustering structure of the epitope embedding space. This is used to represent the distribution area to which the input sample belongs and its relative proximity to each known domain.
[0015] Preferably, in step S5, a domain-aware hybrid expert model is constructed to predict whether TCR is combined with epitopes; wherein, the hybrid expert model includes There are at least one expert in the known domain and at least one expert in the unknown domain, denoted as the total number of experts. Each expert can use a multilayer perceptron, residual feedforward network, or equivalent structure to achieve this.
[0016] The present invention also provides a TCR epitope binding prediction device, comprising: The first processing module is used to obtain epitope representations; The second processing module is used to obtain TCR characterization; The third processing module is used for the interaction between TCR and epitope features; The fourth processing module is used to construct domain embeddings based on epitope features; The fifth processing module is used for TCR epitope binding prediction based on domain embedding-based hybrid experts.
[0017] The present invention also provides a TCR epitope binding prediction system, comprising: a memory and a processor, wherein the memory stores a computer program executed by the processor, and the computer program executes a TCR epitope binding prediction method when executed by the processor.
[0018] The present invention also provides a storage medium storing a computer program that executes a TCR epitope binding prediction method during runtime.
[0019] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. Employ TCR-epitope combination prediction, which can explicitly characterize the differences in different epitopes or sample feature domains, to mitigate the impact of uneven distribution of training data on model prediction performance; 2. By adopting predictions that incorporate domain embedding representations, the model can perceive the feature domain or distribution type to which the sample belongs during training and inference, thereby improving its adaptability to complex immune data; 3. A prediction architecture based on a Mixture of Experts model is adopted, which enables different expert models to collaboratively model different types of TCR-epitope samples, thereby improving the overall prediction performance; 4. Employ predictions that include an expert mechanism for unknown domains to enhance the model's prediction stability and generalization ability in scenarios with unseen or low-frequency epitopes; 5. By using a multi-loss joint training strategy to optimize predictions, the robustness and accuracy of the model in diverse immune distribution scenarios are improved without significantly increasing model complexity. 6. It is applicable to large-scale TCR-epitope data and has good scalability for prediction, to meet the practical needs of neoantigen screening and immune-related applications.
[0020] Through the above technical solution, the present invention can achieve more stable and accurate binding prediction under complex, heterogeneous and unevenly distributed TCR-epitope data conditions. Attached Figure Description
[0021] To more clearly illustrate the technical solution of the present invention, the drawings used in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart of the TCR epitope binding prediction method according to an embodiment of the present invention; Figure 2 Flowchart for obtaining tabletop embedding; Figure 3 This is a comparison of the embodiments of the present invention with existing methods on a test set. Detailed Implementation
[0023] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0024] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0025] Example 1 like Figure 1 As shown, this invention provides a TCR epitope binding prediction method, comprising: S1: Obtain epitope characterization; S2: Obtain TCR characterization; S3: Interaction between TCR and epitope features; S4: Construct domain embeddings based on epitope features; S5: Hybrid expert prediction based on domain embedding.
[0026] The above steps together constitute the technical process necessary to achieve the purpose of this invention, and its overall framework is as follows: Figure 1 As shown, S4 and S5 are the core steps that distinguish them from existing technologies.
[0027] In one embodiment of the present invention, in step S1, an epitope and epitope-related short peptide dataset is constructed, and feature characterization learning is performed on the input epitope sequence to obtain an epitope embedding vector for subsequent TCR-epitope binding prediction.
[0028] S1.1 Epitope Sequence Data Sources and Dataset Construction S1.1.1 Data Source. The source of the table position sequence may include one or more of the following public databases or projects: IEDB, VDJdb, McPAS-TCR, ImmuneCODE, TSNAdb 2.0, etc.
[0029] In one implementation, epitope or peptide sequence fields are extracted from the aforementioned data source; when multiple synonymous fields exist, epitope sequence fields are selected according to a preset priority, and one or more metadata from the antigen, species, detection type, document number, and sample number associated with them are retained to form an original epitope set.
[0030] S1.1.2 Length and Type Filtering. The original epitope set is filtered, retaining only epitope sequences with a length of 8-25 amino acids that meet the definition of a linear peptide, and removing entries containing non-standard characters, not meeting the definition of a linear peptide, or incomplete records; duplicate records from the same source are merged according to epitope sequence.
[0031] S1.1.3 Cleaning and Normalization. The epitope sequences are converted to uppercase, and spaces, separators, and other non-amino acid characters are removed. Characters such as B, J, O, U, X, and Z, which are not among the 20 standard amino acids, can be uniformly replaced with unknown markers. Alternatively, the corresponding sequence can be removed; duplicates of completely identical repeating epitope sequences can be removed to obtain the target epitope set.
[0032] in, This represents the total number of table position sequences in the target table position set. Indicates the first Epitope sequence.
[0033] S1.2 Epitope Sequence Encoding and Tensor Quantization Representation Given a sequence of table positions: in, This indicates the first position in the sequence of positions. One amino acid character, This indicates the length of the epitope sequence.
[0034] Construct a table segmenter whose vocabulary includes padding symbols. 20 standard amino acids, labeled A, C, D, E, F, G, H, I, K, L, M, N, P, Q, R, S, T, V, W, Y, and unknown symbols. Through word segmentation encoding function Mapping each amino acid character to its corresponding discrete identifier yields the token representation of the epitope sequence: in, Indicates the first The token number corresponding to each amino acid character. This represents the token encoding result of the table position sequence.
[0035] To adapt to batch training or inference, epitope sequences of different lengths are uniformly padded to a preset maximum length. Batch token matrix: , Indicates batch size. Indicates the first The epitope sequence at position The token number at the location; when the original sequence length is less than Fill the remaining positions with .
[0036] Simultaneously construct a mask matrix corresponding to the token matrix: ,when When corresponding to actual amino acid characters, ;when Corresponding fill symbol hour, This is used to mask the influence of the fill position in subsequent calculations.
[0037] S1.3 Construction and Training of Episode Encoding Model In one implementation, autoencoders, convolutional residual networks, weight binding, and masked cross-entropy are common techniques in the field. This invention combines these techniques with the task of fixed-length embedding and extraction of short peptide epitopes, and adapts variable-length epitope sequences of 8-25 amino acids through BLOSUM62 prior embedding and masked pooling mechanisms, thereby obtaining stable epitope characterization.
[0038] In a preferred embodiment, a tabletop autoencoder model is constructed, which includes at least an embedding layer, an encoder, a bottleneck layer, a decoder, and an output layer.
[0039] S1.3.1 Embedding Layer. Constructing the embedding matrix. In one implementation, the embedding matrix The matrix can be initialized using BLOSUM62 replacement and can be set to freeze or update depending on the training strategy. Map the token input to the embedding sequence: in, This indicates an embedded mapping function. Indicates the embedding dimension. Indicates the first The epitope sequence at position The corresponding continuous vector representation at that location.
[0040] S1.3.2 Encoder. The embedding representation is input to the encoder, and contextual modeling is performed on the table position sequence to obtain the sequence-level latent representation: in, Indicates the encoder network. Indicates the potential channel dimension. Indicates the position of the epitope sequence. The latent feature vector at the location. In one implementation, the encoder consists of a Conv1x1 projection layer and multiple one-dimensional convolutional residual blocks. Each convolutional residual block may contain batch normalization, GELU activation function, Dropout, and convolutional layers with different dilation coefficients to expand the receptive field.
[0041] S1.3.3 Bottleneck Layer and Table Position Embedding Vector. Channel compression is performed on the encoder output using 1x1 convolution, and masked average pooling is applied to the non-padded positions to obtain a fixed-length table position embedding vector: This represents the epitope embedding vector used for subsequent prediction. Indicates the position of the mask matrix The value of is used to accumulate the potential features corresponding to the actual amino acid positions, and the denominator is used to normalize the effective length, thereby reducing the influence of different epitope lengths on the embedding representation.
[0042] S1.3.4 Decoder and Output Layer. The latent representation is input to the decoder to recover sequence features and projected back to the vocabulary space: in, Indicates the decoder network, This represents the sequence representation after being recovered by the decoder. This represents the logits output of the vocabulary corresponding to each position. In one implementation, the output layer and the embedding matrix... Weight binding is performed to reduce the number of parameters and enhance the consistency of input and output representations.
[0043] S1.3.5 Training Objective Function. The epitope autoencoder model is trained by minimizing the cross-entropy reconstruction loss, which is computed only at non-filled positions: , This represents the training loss of the autoencoder model. This represents the total number of valid positions in the batch of samples. Indicates the first Sample at position The probability distribution of the vocabulary at that location This represents the actual token number at that position. By calculating the reconstruction error at non-padded positions, the interference of padding symbols on model training can be avoided.
[0044] After training, the encoder output is taken and pooled to obtain the table position embedding vector. This serves as the final feature representation of the epitope and is used as input for subsequent TCR-epitope combination prediction steps.
[0045] S1.4 Model Structure Diagram Figure 2 The flowchart for obtaining epitope embeddings can be represented as follows: Data sources such as IEDB, VDJdb, McPAS-TCR, ImmuneCODE, and TSNAdb 2.0 are used. After linear peptide screening, length screening (8-25), noise reduction, and deduplication, the data is input into a Tokenizer for padding and masking. Then, it sequentially passes through Embedding, Encoder, Bottleneck, Masked mean pooling, and LayerNorm to obtain the epitope embedding vector. During the training phase, the latent representation is further input into the Decoder and the output layer, and based on the reconstruction loss... Optimize the model.
[0046] S1.5 Replaceable Implementation It should be noted that using an autoencoder model to obtain epitope embeddings is a preferred implementation. Without departing from the overall concept of this invention, other deep learning representation models or feature extraction methods can also be used to obtain epitope embeddings. For example, this could involve directly outputting epitope vectors using only an encoder structure, or using contrastive learning, masked language model pre-training, protein language model-based epitope vectors, or embedding layers initialized with trainable embeddings, physicochemical property vectors, or substitution matrices. All of these substitutions should fall within the scope of technical solutions that perform representation learning on epitope sequences and output fixed-length embedding vectors for subsequent prediction.
[0047] In one embodiment of the present invention, in step S2, feature extraction is performed on the TCR sequence to obtain a vectorized representation of the TCR.
[0048] S2.1 TCR Sequence Input and Normalization For any input TCR sequence, denoted as: in, Indicates the first One amino acid character, This indicates the TCR sequence length. In a preferred embodiment, the TCR sequence is preferably the CDR3 sequence of the TCR.
[0049] In a preferred embodiment, ProstT5 and its corresponding tokenizer are used to preprocess the TCR sequence before encoding: the sequence is unified to uppercase, U, Z, O, and B are replaced with X, spaces are inserted between adjacent amino acid characters, and an AA2fold prefix is added before the sequence to obtain the ProstT5 input sequence. Then, the ProstT5 tokenizer is used to batch encode the preprocessed sequence, automatically adding special tokens and padding the longest sequence in the batch, resulting in the input token sequence and the initial attention mask: S2.2 ProstT5 Encoding and Special Token Removal The input token sequence and the initial attention mask are input into the ProstT5 encoder to obtain the sequence-level hidden representation: In one specific implementation, the last hidden state of the ProstT5 encoder is called as the context feature output of the TCR, and its expression is: In this example, the last dimension of the ProstT5 output hidden state represents the model's latent space dimension; in one implementation, this dimension can be 1024. After calculating the effective length based on the initial attention mask, the first prefix / special token and the last special token are removed, retaining only the embeddings corresponding to the amino acid tokens. When the sequence is too short and the end index is not greater than the start index, it is preferable to retain the embedding corresponding to at least one amino acid token, and then pad it again in the batch processing stage according to the maximum length of the current batch to construct the sequence mask after removing the special token.
[0050] S2.3 Pooling, Mapping, and Fixed-Length Representation Generation By performing intra-batch re-padding and masked average pooling on the sequence-level hidden representation after removing the prefix token and the tail special token, we obtain the global representation of TCR: Let the global vector be used as the TCR representation vector; when it is necessary to unify the dimension with subsequent modules, optional linear mapping and normalization can be performed further: in, and For learnable parameters, Presentation layer normalization operation. For implementations that directly use the ProstT5 output dimension, this can be directly adopted. Participate in subsequent interactions and predictions; for implementation methods requiring a unified dimension, the following approach can be adopted. As subsequent input. Preferably, Dropout, non-linear activation functions, or gating units can be set before and after the optional mapping to improve representation stability.
[0051] When fine-grained TCR-epitope interactions are required, the sequence-level hidden representation is also retained. This serves as input for the subsequent step S3, in order to compute cross-attention at the site level.
[0052] S2.4 Description of each structural component and function In this step, the word segmentation and embedding unit is used to map amino acid characters to discrete inputs that the model can process; the pre-trained protein language model is used to extract context-dependent features; the pooling unit is used to compress variable-length sequences into fixed-length vectors; and the linear mapping and normalization unit is used to ensure that TCR representations and epitope representations are located in a compatible feature space.
[0053] S2.5 Existing Technology Description and Alternative Implementations It should be noted that ProstT5, as a pre-trained protein language model, is an existing encoder technology that can be directly adopted in this field. This invention does not use ProstT5 itself as a distinguishing feature, but rather combines its output TCR representation with subsequent domain embedding construction, domain-aware routing, and hybrid expert prediction to form a complete combined prediction scheme. Without departing from the overall concept of this invention, other protein language models or equivalent sequence representation models can also be used to obtain TCR representations.
[0054] In one embodiment of the present invention, in step S3, bidirectional cross-attention is used to exchange site-level information between TCR sequence-level features and epitope sequence-level features, and the interaction results are fused into a joint representation. This is to enhance the ability to model the interaction between the two.
[0055] S3.1 Interactive Input and Feature Alignment To enable TCR features and epitope features to interact within the same subspace, TCR sequence-level feature matrices were obtained separately. and epitope sequence-level feature matrix And dimension alignment is performed through linear projection; in one specific implementation, if the table encoder only outputs a global vector Then, it can be constructed by first performing a linear mapping and then expanding along the sequence length. : in, and These represent the effective sequence lengths of the TCR and epitopes, respectively. and These represent the original feature dimensions on both sides. This represents the total dimension of the attention after alignment; in multi-head attention implementation, It can be decomposed into ,in Indicates the number of heads of attention. This indicates the dimension of a single-head feature. and It is a learnable projection matrix.
[0056] S3.2 Cross-attention from epitopes to TCR The bidirectional cross-attention module can preferably employ existing multi-head cross-attention structures in the field. Its basic idea is to first calculate the pairwise similarity between TCR sites and epitope sites, and then normalize along both the epitope and TCR dimensions to obtain the bidirectional aggregation result. Specifically, the first... The first TCR site and the second The query-key and value for each table position are: in, This is a masking item generated jointly by the TCR mask and the table position mask; when any position is padding, Take the minimum value to avoid invalid sites from participating in normalization. Indicates the first The TCR site from the first The attention weights for aggregated epitope information are based on the similarity between the two epitopes. The relative size of the corresponding epitopes at the same TCR site.
[0057] S3.3 Cross-attention from TCR to epitope Based on the same shared similarity matrix Then, normalize along the TCR sequence dimension to obtain the information of epitopes aggregated from the TCR: in, Indicates the first The epitope site from the first The attention weights for information received at each TCR site are based on the following values: The relative size of the weights at the same epitope site across all TCR sites. Therefore, the two sets of weights share the same similarity matrix. However, the normalization directions are different, thus characterizing "which epitope sites TCR focuses on" and "which TCR sites epitopes focus on" respectively.
[0058] in, and These represent the aligned feature matrices respectively. and The The and the first Individual point vectors. In terms of dimensions, The dimension is , and The number of loci is consistent. and Since the number of points is consistent, the above bidirectional attention formula is closed and correct in terms of dimension.
[0059] S3.4 Bidirectional Fusion and Joint Representation Generation The results of the bidirectional interaction are pooled separately and combined with the original features to construct a joint representation: in, This indicates that the pooling operation combined with the effective site mask can be implemented using mask average pooling, attention pooling, or equivalent methods. This represents vector concatenation. This represents element-wise multiplication. Represents the absolute value of each element. Representation layer normalization, and These are the parameters for the fusion layer. The joint representation... As a comprehensive characterization of the strength, complementarity, and differences in the interaction between TCR and epitope.
[0060] S3.5 Structural Components and Existing Technology Description From a structural perspective, this step includes at least a feature alignment unit, a similarity calculation unit, a mask normalization unit, a bidirectional value aggregation unit, and a fusion output unit; its construction process is as follows: Input and Perform dimensional alignment and calculate the site similarity matrix. Bidirectional aggregation results from TCR to epitope and from epitope to TCR were obtained, and then pooling and fusion were performed to generate... .
[0061] It should be noted that multi-head cross-attention, layer normalization, residual connections, and feedforward networks are all commonly used existing technologies in this field; the distinguishing feature of this invention lies not in the cross-attention module itself, but in the interaction results. With domain embedding We will jointly introduce subsequent domain-aware hybrid expert prediction.
[0062] In one embodiment of the present invention, in step S4, a domain embedding representation is constructed based on the clustering structure of the epitope embedding space. It is used to characterize the distribution area to which the input sample belongs and its relative proximity to each known domain.
[0063] Specifically, during the training phase, all epitope embedding vectors are collected. And an unsupervised clustering algorithm was used to partition it; among which, This represents the total number of training epitope samples involved in domain modeling. In a preferred embodiment, this can be obtained using K-means clustering, an existing unsupervised clustering method. Cluster centers: in, The number of fields is preset or verified. Indicates the first The center of each domain in the table embedding space. For any input table embedding Calculate its distance from each cluster center: The domain weights are based on the input table embedding. The pattern of relative distances from each cluster center: The smaller, the better. With the The closer the centers of the domains are and the more similar their distribution attributes are, the higher their corresponding weights will be. The larger; The larger the value, the weaker the representativeness of the domain for the current sample. Preferably, the weight of the tabletop in each domain is obtained through a soft allocation method: in, and ; This is a temperature parameter used to control the sharpness of the weight distribution. The smaller the value, the more concentrated the weight is in the nearest few domains; The larger the value, the more smoothly the weights are distributed across multiple similar domains.
[0064] Furthermore, for each domain Configure a learnable domain embedding vector The With cluster center They are related but their values do not have to be the same; Used to delineate the geometric center in the embedded space Used to carry trainable domain semantic representations in subsequent predictions, and to obtain the final domain embedding representation based on the weights: in, This is a domain embedding representation of the input sample, which comprehensively reflects the relative relationships between the sample and multiple known domains, and can be directly used as one of the inputs to the subsequent routing network. Because... From the embedding vectors of each domain The weighted combination means that the same sample can belong mainly to a certain main domain or simultaneously contain components from multiple neighboring domains.
[0065] In a preferred embodiment, the nearest center distance for each sample in the training set is... Statistical analysis is performed to determine the threshold of the unknown domain based on the mean and variance, quantiles, or validation set performance. and define the unknown domain indicator. for: in, It is an indicator function; when the condition is true... This indicates that the current table position falls outside the training distribution or is significantly far from any known domain; when the condition is not met... This indicates that the current epitope can still be characterized by a known domain system. You can take the preset high-resolution points of the nearest center distance distribution of the training samples, or take... Statistical thresholds in the form of, where and Let these represent the mean and standard deviation of the nearest center distance for the training samples, respectively. This is the threshold adjustment coefficient.
[0066] The unknown domain determination result can be used as an independent flag input to the subsequent routing network, or used to increase the minimum gating weight of the unknown domain expert, thereby improving the stability of the model in the unseen tabletop scenario; this mechanism is a preferred enhancement feature of the present invention, but it is not the only necessary condition.
[0067] As one embodiment of the present invention, in step S5, a domain-aware hybrid expert model is constructed to predict whether TCR is combined with epitopes.
[0068] The hybrid expert model includes There are at least one expert in the known domain and at least one expert in the unknown domain, denoted as the total number of experts. Each expert can use a multilayer perceptron, residual feedforward network, or equivalent structure to achieve this.
[0069] In a preferred embodiment, the hybrid expert model includes at least an input fusion unit, a routing network, a group of expert subnetworks, and an output aggregation unit. The input fusion unit is used to characterize the TCR. Epitope characterization TCR-epitope joint interaction representation Domain embedding and unknown domain indicator A unified input is formed; the routing network is used to generate expert gating weights; each expert subnetwork is used to learn the discriminant function under different distribution scenarios; the output aggregation unit is used to summarize the expert results and output the combination probability.
[0070] By concatenating the TCR representation, epitope representation, TCR-epitope joint interactive representation, domain embedding, and unknown domain indicator, we obtain the joint input representation: In one implementation, the routing network can be implemented using a two-layer feedforward neural network, first generating routing scores. Then, the initial gating weights for each expert are obtained through softmax: in, This represents a nonlinear activation function, preferably ReLU, SiLU, or GELU. A subnetwork of experts for input The processing can be expressed as: when When this happens, priority routing constraints can be applied to the gated components corresponding to the experts in the unknown domain to obtain the corrected gate weights g'. The correction can be achieved either by directly increasing the weights of the experts in the unknown domain or by setting a minimum threshold γ. The final output of the hybrid expert model can be expressed as: in, For unknown domain routing enhancement coefficients, Let be the basis vectors that take the value 1 only at the expert position in the unknown domain. This indicates that renormalization makes the sum of all gating weights equal to 1. Therefore, samples from the known domain are primarily processed by experts in the known domain, while samples from the unknown domain are explicitly guided to experts in the unknown domain or a combination of relevant experts, thus avoiding excessive interference from unknown samples to experts in the known domain.
[0071] It should be noted that softmax gating, feedforward expert subnetwork, top-k expert selection, and unknown domain-first routing can all be implemented using existing hybrid expert techniques in the field; the distinguishing feature of this invention lies in the embedding of domains. with unknown domain indicator Using these factors as the basis for routing, expert activation is directly controlled by the sample distribution attributes.
[0072] Input the hybrid expert output into the classification module to obtain the combined prediction result: in, and For classification layer parameters, This represents a Sigmoid or binary softmax mapping. During training, it can be optimized by minimizing the classification loss function. In a preferred embodiment, the model can further incorporate epitope autoencoder reconstruction loss. Losses from expert load balancing A joint optimization objective is formed to balance the quality of epitope representation and the stability of expert division of labor: in, This represents the tabletop autoencoding reconstruction loss. This indicates the expert load balancing loss. and These represent the weighting coefficients of the two auxiliary losses in the overall objective function, which can be determined through validation set parameter tuning or empirical settings.
[0073] This invention addresses the problem of unstable prediction performance of existing T cell receptor (TCR) and epitope binding prediction methods in cases of uneven epitope distribution, long-tailed samples, and scenarios where no epitopes are observed. It proposes a combined prediction method based on domain embedding and hybrid expert models, which achieves explicit modeling of sample distribution differences from the perspectives of model structure and inference mechanism.
[0074] This invention utilizes the clustering structure in the epitope embedding space to construct a domain embedding representation. By encoding the distribution attributes of epitopes in the feature space into learnable domain information, the model can perceive the distribution differences between different epitopes or samples during training and inference, fundamentally avoiding the excessive reliance on high-frequency samples in traditional unified feature representation methods. Therefore, this invention maintains more stable feature representation and prediction behavior when facing low-frequency epitopes and distributionally offset samples.
[0075] Building upon this foundation, this invention further introduces a hybrid expert model structure based on domain embedding. Through a routing mechanism, input samples are mapped to different expert sub-networks for processing. This allows the model to no longer rely on a single decision path, but rather adaptively select appropriate experts for prediction based on the feature domain attributes of the samples. This mechanism structurally enhances the model's ability to express heterogeneous immune data, effectively alleviating the problem of single models struggling to balance accuracy and generalization ability under complex distribution conditions.
[0076] Meanwhile, by setting up an unknown domain determination and corresponding expert mechanism, this invention provides a dedicated processing path for samples with no visible epitopes or far from the training distribution in principle, reducing the interference of out-of-distribution samples on the overall model prediction stability, thereby improving the robustness of the model in practical application scenarios.
[0077] Furthermore, this invention employs a multi-loss joint training strategy to collaboratively optimize the combination of prediction target and epitope representation learning, as well as expert load balancing constraints. This enables each expert subnetwork to form a complementary division of labor based on shared representations, avoiding expert degradation or load imbalance, and further improving the overall prediction performance and training stability of the model.
[0078] In summary, this invention effectively solves the technical problems of existing technologies in TCR-epitope binding prediction, which are difficult to handle long-tailed distributions, unseen epitopes, and complex immune data scenarios, by using domain embedding to represent sample distribution characteristics, hybrid expert models to achieve adaptive decision-making, and multi-objective joint optimization to ensure collaborative learning of the model. It significantly improves the accuracy, stability, and generalization ability of the prediction results and has good practical application value.
[0079] Example: 1. Experimental materials and data sources In this embodiment, the TCR-epitope binding dataset from the publicly available UnifyImmun method is used as the experimental data.
[0080] In the dataset, each sample includes at least the following information: (1) T cell receptor (TCR) sequence, specifically the amino acid sequence of the CDR3 region; (2) Epitope sequence; (3) Tag information on whether TCR binds to epitopes.
[0081] To verify the effectiveness of the present invention in complex immune distribution scenarios, the experimental dataset contains data subsets from multiple sources, which differ significantly in epitope types, sample frequencies, and distribution characteristics, thus constituting a prediction task with long-tailed distribution and distribution shift characteristics.
[0082] 2. Data Preprocessing Steps The following preprocessing operations are performed on the original dataset: (1) Remove illegal or incomplete amino acid characters from the sequence; (2) Perform length statistics and normalization on TCR sequences and epitope sequences; Finally, the processed data were obtained as follows: the training set had 206,689 samples, with 71,691 positive and 134,998 negative samples; the validation set had 51,673 samples, with 17,857 positive and 33,816 negative samples; the independent test set had 28,707 samples, with 10,018 positive and 18,689 negative samples; and the external test set had 97,043 samples, with 37,834 positive and 59,209 negative samples. The test set included epitope samples that did not appear or had low frequency during the training phase to verify the model's generalization ability.
[0083] 3. Epitope representation model training (corresponding to step S1) In this embodiment, a PepAE model is constructed to learn a low-dimensional latent representation of epitope sequences.
[0084] Specifically, the epitope sequence is input into the encoder network, which maps it to a latent representation space to obtain an epitope embedding vector; the decoder reconstructs the original epitope sequence based on this latent representation. The autoencoder model is trained by minimizing the reconstruction loss function.
[0085] After training, the encoder parameters are fixed, and its output latent vector is used as the epitope embedding representation in subsequent prediction tasks.
[0086] The purpose of this step is to learn the latent structural features of epitope sequences in an unsupervised manner, so that epitopes with similar sequence patterns or potential immune properties are closer together in the embedding space, thus providing a foundation for subsequent domain embedding construction.
[0087] 4. TCR characterization extraction (corresponding to step S2) For TCR sequences, the ProstT5 model and its corresponding tokenizer are preferably used as encoders in this embodiment. After loading, ProstT5 is set to inference mode and its parameters are frozen for outputting the context embedding of the TCR.
[0088] For each TCR sequence, the following preprocessing was performed: capitalization, replacing U, Z, O, and B with X, inserting spaces between adjacent amino acids, and adding the prefix "AA2fold" to the beginning of the sequence. The preprocessed sequence is encoded using the batch encoding interface of the ProstT5 tokenizer, with add_special_tokens=True and the longest sequence padding per batch set. This is then input into the ProstT5 encoder to obtain the last hidden state. The actual effective length is calculated based on the attention mask. The first prefix / special token and the last special token are removed, and only the embeddings corresponding to the amino acid tokens are retained. If the sequence is too short, it is preferable to retain the embedding corresponding to at least one amino acid token, and then padding is performed again in the batch processing stage according to the maximum length of the current batch. The sequence-level features after removing special tokens are subjected to masked average pooling to obtain a global representation; when a unified dimension is required, a fixed-length representation can be obtained through linear mapping and layer normalization. In one specific implementation, the ProstT5 output hidden dimension can be 1024; when site-level interactions are required, the sequence-level hidden matrix is retained. As input to step S3, the This serves as one of the fundamental features for subsequent fusion and routing calculations. It can be used as an optional input for dimension alignment. Since ProstT5 is used as a frozen pre-trained encoder in this embodiment, this step is a specific application of existing technology.
[0089] 5. TCR – Epitope Feature Interaction (corresponding to step S3) The obtained TCR sequence-level feature matrix With epitope sequence-level feature matrix Input a bidirectional cross-attention module; in one specific implementation, if the output of the position encoder is a global vector. Then, it can be constructed by first performing a linear mapping and then expanding along the sequence length. Then calculate the shared similarity matrix by location: in, This indicates the single-head attention dimension. and These represent the value vectors corresponding to the epitope site and the TCR site, respectively. The attention weights are normalized along the epitope length dimension. The attention weights are normalized along the length dimension of the TCR; both are calculated based on the same similarity matrix, only with different normalization directions, thus representing the processes of "TCR aggregating information from table positions" and "table positions aggregating information from TCR," respectively. The bidirectional interaction results are then masked, pooled, and fused to obtain joint features for subsequent prediction. in, This represents the pooling operation combined with the effective point mask. and These are the parameters for the fusion layer. This interaction module represents a preferred application of existing cross-attention techniques in the scenario of this invention. Its function is to output joint features that can be further utilized by domain-aware routing. In one specific implementation, the number of bidirectional cross-attention layers can be 1, the number of attention heads can be 8, and the dimension of each head can be 64.
[0090] 6. Construction of domain embedding based on clustering (corresponding to step S4) During the training phase, K-means clustering is performed on all epitope embedding vectors to obtain... Each cluster center is identified, and a learnable domain embedding table is simultaneously established. ;in, Used to describe the The geometric center of each domain, Used to describe the Learnable semantic representations of each domain in subsequent predictions.
[0091] in, Indicates input table embedding To the Cluster centers The squared Euclidean distance, This represents the corresponding soft-assignment weight. The weights are based on the relative magnitudes of the distances. The smaller the value, the better the relationship between the current sample and the first sample. The closer the domains are, the greater their weight. Used to control the sharpness of the weights. The domain embedding representation is constructed based on the soft-assigned weights and the domain embedding table: Further statistical analysis of the distribution of nearest center distances among training samples, with a threshold set as follows: ;when When this happens, the input sample is classified as an unknown domain sample, that is, let ,otherwise It also outputs an unknown flag for subsequent routing networks and unknown domain experts to use. Through this mechanism, domain embedding can characterize the positional relationship of input samples relative to the training distribution.
[0092] 7. Combined prediction based on hybrid expert models (corresponding to step S5) Construct a hybrid expert model that includes multiple expert sub-networks, preferably including There are one known domain expert and one unknown domain expert; each expert subnetwork can adopt a two-layer perceptron, a residual feedforward network or its equivalent structure, and the routing network preferably adopts a feedforward gated network.
[0093] Will , , , and unknown domain indicator splicing to form a unified input The data is then fed into the routing network to calculate the gating weights for each expert; the routing network first outputs the routing score. The expert weights are then obtained by softmax normalization: Each expert subnetwork provides predicted features or prediction results for the input samples, and its calculation process can be expressed as follows: For nonlinear activation functions such as ReLU, SiLU, or GELU: in, The gating weights are corrected for the unknown domain; when In such cases, priority routing or minimum gating constraints can be imposed on experts in the unknown domain to avoid excessive interference from unknown samples to experts in the known domain. Through this mechanism, the model can adaptively select prediction paths for samples with different distribution characteristics.
[0094] 8. Model Training and Optimization Strategies In this embodiment, a joint loss function is used to optimize the epitope encoding, interaction modeling, domain embedding construction, and hybrid expert prediction modules. The classification output can be represented as: in, The reconstruction loss for the epitope autoencoder model; This is the expert load balancing constraint loss, used to prevent routing from collapsing to a small number of experts in the long run. In one implementation, it can be defined as: in, Indicates the first The average gating weight of an expert in a batch; and ... In terms of training procedures, a pre-trained epitope autoencoder model can be used to obtain stable epitope embeddings, followed by joint training of steps S2-S5; alternatively, an end-to-end collaborative optimization approach can be adopted. Through joint optimization, the model can maintain prediction accuracy while avoiding expert degradation or over-reliance on a single expert.
[0095] To comprehensively evaluate the binary classification performance of the method of the present invention in scenarios with imbalanced positive and negative samples and distribution shift, this embodiment preferably uses AUPRC, AUROC and F1 as the main performance evaluation indicators.
[0096] Precision, recall, true positive rate, and false positive rate are defined as follows: Based on the above definitions, AUPRC and AUROC can be represented as follows: The F1 index can be defined as: In this model, TP, FP, TN, and FN represent true positives, false positives, true negatives, and false negatives, respectively; Precision represents precision, Recall represents recall, TPR represents true positive rate, and FPR represents false positive rate. AUPRC measures the area under the precision-recall curve and is suitable for evaluating the model's ability to identify positive classes in imbalanced class scenarios; AUROC measures the area under the ROC curve and reflects the model's overall ranking and discriminative ability; F1 score comprehensively characterizes the balance between precision and recall.
[0097] 9. Experimental Results and Analysis Figure 3 The comparison results between embodiments of the present invention and existing methods on a test set are shown. Experimental results demonstrate that, compared to the comparative model that does not introduce domain embedding and hybrid expert structures, the method of the present invention exhibits significant advantages in the following aspects: (1) The predictive stability is significantly improved on low-frequency epitopes and samples without epitopes; (2) The performance fluctuation of the model across different subsets of data is significantly reduced; (3) In complex immune distribution scenarios, the overall prediction accuracy and generalization ability are effectively improved.
[0098] The above results verify the feasibility of the technical solution of the present invention and its effectiveness in solving the problems of long-tailed distribution and distribution shift.
[0099] 10. Summary of Examples As can be seen from the above embodiments, the TCR-epitope binding prediction method based on domain embedding and hybrid expert model proposed in this invention can operate stably in complex and heterogeneous immune data environments and achieve the expected technical effects, demonstrating good engineering feasibility and practical application value.
[0100] Example 2 The present invention also provides a TCR epitope binding prediction device, comprising: The first processing module is used to obtain epitope representations; The second processing module is used to obtain TCR characterization; The third processing module is used for the interaction between TCR and epitope features; The fourth processing module is used to construct a domain embedding based on epitope features according to the interaction results between TCR and epitope features; The fifth processing module is used for TCR epitope binding prediction based on domain embedding-based hybrid experts.
[0101] Example 3 The present invention also provides a TCR epitope binding prediction system, comprising: a memory and a processor, wherein the memory stores a computer program executed by the processor, and the computer program executes a TCR epitope binding prediction method when executed by the processor.
[0102] Example 4 The present invention also provides a storage medium storing a computer program that executes a TCR epitope binding prediction method during runtime.
[0103] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Various modifications and improvements made to the technical solutions of the present invention by those skilled in the art without departing from the spirit of the present invention should fall within the protection scope defined by the claims of the present invention.
Claims
1. A TCR epitope binding prediction method, characterized in that, include: S1: Obtain epitope characterization; S2: Obtain TCR characterization; S3: Interaction between TCR and epitope features; S4: Construct domain embeddings based on epitope features; S5: TCR epitope binding prediction based on hybrid experts with domain embedding.
2. The TCR epitope binding prediction method as described in claim 1, characterized in that, In step S1, an epitope and epitope-related short peptide dataset is constructed, and feature characterization learning is performed on the input epitope sequence to obtain an epitope embedding vector for subsequent TCR-epitope binding prediction.
3. The TCR epitope binding prediction method as described in claim 1, characterized in that, In step S2, feature extraction is performed on the TCR sequence to obtain a vectorized representation of the TCR.
4. The TCR epitope binding prediction method as described in claim 1, characterized in that, In step S3, bidirectional cross-attention is used to exchange site-level information between TCR sequence-level features and epitope sequence-level features, and the interaction results are fused into a joint representation. .
5. The TCR epitope binding prediction method as described in claim 1, characterized in that, In step S4, a domain embedding representation is constructed based on the clustering structure of the epitope embedding space. This is used to represent the distribution area to which the input sample belongs and its relative proximity to each known domain.
6. The TCR epitope binding prediction method as described in claim 1, characterized in that, In step S5, a domain-aware hybrid expert model is constructed to predict whether TCR is combined with epitopes; wherein, the hybrid expert model includes There are at least one expert in the known domain and at least one expert in the unknown domain, denoted as the total number of experts. Each expert can use a multilayer perceptron, residual feedforward network, or equivalent structure to achieve this.
7. A TCR epitope binding prediction device, characterized in that, include: The first processing module is used to obtain epitope representations; The second processing module is used to obtain TCR characterization; The third processing module is used for the interaction between TCR and epitope features; The fourth processing module is used to construct domain embeddings based on epitope features; The fifth processing module is used for TCR epitope binding prediction based on domain embedding-based hybrid experts.
8. A TCR epitope binding prediction system, characterized in that, include: A memory and a processor, wherein the memory stores a computer program executed by the processor, the computer program performing the TCR epitope binding prediction method as described in any one of claims 1-6 when executed by the processor.
9. A storage medium, characterized in that, The storage medium stores a computer program that, when executed, performs the TCR epitope binding prediction method as described in any one of claims 1-6.