Tcr-pmhc complex multitask prediction system and method based on sequence and residue pair synergistic modeling
Patent Information
- Application Number
- CN202611163342.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-03
- Publication Date
- 2026-10-09
AI Technical Summary
[0007]针对不同免疫预测任务需要分别建模、TCR链信息完整度不一致的问题,本发明提供一种基于序列与残基对协同建模的TCR-pMHC复合物多任务预测系统及方法
[0054]本发明的有益效果:本发明采用结构化编码模块对肽、MHC伪序列及可选TCRα链、TCRβ链进行定长结构化编码;在同一生物链内聚合局部特征;交替更新一维序列状态与类型化二维残基对状态,将残基对的出向和入向聚合结果反馈至序列状态,并按任务标识调制两类状态;融合任务、全局、链级及链间交互表征,经任务专用预测头和任务路由输出pMHC呈递、pMHC免疫原性或TCR-pMHC特异性倾向。本发明支持完整、仅CDR3及链缺失输入共用张量接口。
Smart Images

Figure CN122889091A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a multi-task prediction system and method for TCR-pMHC complex based on sequence and residue pair co-modeling, belonging to the field of immunoinformatics technology. Background Technology
[0002] T cell receptors (TCRs) are crucial molecules for T cells to recognize antigens and trigger cellular immune responses. Antigen peptides are presented via the major histocompatibility complex (MHC) to form a peptide-MHC complex (pMHC). The TCR interacts with the pMHC surface through its complementarity-determining regions on its α and β chains. Whether a peptide can be effectively presented by the MHC, whether the presented pMHC is immunogenic, and whether a specific TCR can recognize the pMHC are several interconnected technical challenges in vaccine development, tumor neoantigen screening, and TCR-related immunotherapy.
[0003] Existing computational methods typically build separate models for each task. For example, one type of method predicts peptide-MHC binding or presentation based solely on peptide sequence and MHC allele information; another type predicts immunogenicity based on peptide-MHC features; and yet another type predicts TCR-pMHC specificity based on the CDR3 sequences of peptides, MHC, and TCRs. Training and deploying models separately for different tasks leads to repetitive feature representations, increased model maintenance costs, and difficulty in utilizing the shared biological information between presentation, immunogenicity, and TCR recognition.
[0004] Meanwhile, TCR data from different sources exhibit significant differences in information completeness. Some samples contain complete sequences of paired TCRα and TCRβ chains, while others contain only the TCRβ chain CDR3 sequence, and some presented or immunogenic samples lack TCR information altogether. Directly deleting samples with incomplete chain information would reduce usable data; simply filling in missing sequences could easily lead the model to treat the filled values as true amino acid features. Therefore, it is necessary to simultaneously express true residues, filled positions, unobserved positions, and the entire modality deletion state within the same input structure.
[0005] Furthermore, TCR-pMHC recognition is not a simple superposition of multiple independent sequence features. Peptide-MHC, peptide-TCRα, peptide-TCRβ, MHC-TCRα, MHC-TCRβ, and TCRα-TCRβ correspond to different interchain interactions. Using only global sequence attention or methods that pool each chain separately before splicing makes it difficult to explicitly preserve the types of different interchain relationships at the residue pair level, and also makes it difficult to use residue pair information to reverse-correct the one-dimensional sequence representation at each position.
[0006] For implementations that splice multiple biological chains into a long sequence, ordinary one-dimensional convolution may aggregate two originally non-adjacent chain segments across inter-chain separators, thus forming pseudo-local adjacency. If multi-task models only set multiple classification heads at the output end, while a shared backbone performs the same transformation on all tasks, the differences in attention given to peptide, MHC, and TCR information by different tasks cannot be fully fed back into the intermediate feature extraction process. Therefore, a TCR-pMHC complex prediction method is needed that can uniformly handle different input modalities, explicitly describe inter-chain residue pair relationships, and modulate the intermediate representation layer according to the prediction task. Summary of the Invention
[0007] To address the issues of requiring separate modeling for different immune prediction tasks and inconsistent TCR chain information completeness, this invention provides a multi-task prediction system and method for the TCR-pMHC complex based on sequence and residue pair co-modeling.
[0008] This invention provides a multi-task prediction system for the TCR-pMHC complex based on sequence and residue pair co-modeling, comprising:
[0009] The sample acquisition module is used to acquire TCR-pMHC complex samples, wherein the TCR-pMHC complex samples are configured with prediction task identifiers and corresponding task tags; the TCR-pMHC complex samples include peptide sequences, MHC pseudo-sequences and TCR chain information.
[0010] The structured coding module is used to perform fixed-length structured coding on TCR-pMHC complex samples to obtain structured coding features. The structured coding features include complex position sequence, position-level attribute features, chain segment grouping identifiers, residue pair type matrix, residue pair message mask, and real residue pair pooling mask.
[0011] The sequence feature processing module is used to combine the prediction task identifier, generate an initial one-dimensional sequence state based on positional attribute features, and perform local feature fusion of each biological chain in the initial one-dimensional sequence state according to the chain segment grouping identifier and the complex position sequence to obtain the fused one-dimensional sequence state.
[0012] The sequence-residue pair collaborative modeling module is used to update the fused one-dimensional sequence state by combining the residue pair type matrix and the residue pair message mask to obtain the updated one-dimensional sequence state; then, the two-dimensional residue pair state is obtained from the updated one-dimensional sequence state; the updating of the updated one-dimensional sequence state and the two-dimensional residue pair state are performed alternately until the end; during the updating of the updated one-dimensional sequence state and the two-dimensional residue pair state, the updated one-dimensional sequence state and the two-dimensional residue pair state are conditionally modulated according to the prediction task identifier.
[0013] The multi-scale characterization fusion module is used to extract task marker characterization, classification marker characterization, global complex characterization, and characterization of each biological chain from the modulated one-dimensional sequence state; perform relation type pooling on the modulated two-dimensional residue pair state according to the residue pair type matrix to obtain relation type characterization; perform real residue pair pooling on the modulated two-dimensional residue pair state according to the real residue pair pooling mask to obtain inter-chain interaction characterization; and concatenate and map the task marker characterization, classification marker characterization, global complex characterization, characterization of each biological chain, and inter-chain interaction characterization into a shared fusion characterization.
[0014] The multi-task prediction module is used to generate prediction values for each task based on shared fusion representation using multiple task-specific prediction heads, select the target task prediction value according to the prediction task identifier, and convert the target task prediction value into pMHC presentation tendency, pMHC immunogenicity tendency, or TCR-pMHC specific tendency.
[0015] During the training process of the multi-task prediction system, the network parameters of the corresponding modules are adjusted in conjunction with the task labels, and the trained multi-task prediction system is used to perform task prediction on the TCR-pMHC complex to be predicted.
[0016] According to the TCR-pMHC complex multi-task prediction system based on sequence and residue pair co-modeling of the present invention, for the sample acquisition module:
[0017] The TCR chain information includes TCRα chain information and TCRβ chain information;
[0018] The prediction task identifiers include pMHC presentation task identifiers, pMHC immunogenicity task identifiers, first TCR-pMHC specific task identifiers, and second TCR-pMHC specific task identifiers.
[0019] The prediction task identifier is determined based on the task field in the TCR-pMHC complex sample;
[0020] When no explicit prediction task identifier is provided and the service entry is TCR-pMHC specific prediction, if the TCRα chain is in a missing state and the TCRβ chain is in a CDR3-only sequence state or a complete sequence state, it is determined to be the first TCR-pMHC specific task identifier; otherwise, it is determined to be the second TCR-pMHC specific task identifier.
[0021] The TCRα chain information and TCRβ chain information each have one of the following states: complete sequence state, CDR3 sequence only state, and missing state.
[0022] According to the multi-task prediction system for TCR-pMHC complex based on sequence and residue pair co-modeling of the present invention, for the structured coding module:
[0023] The peptide sequence, MHC pseudo-sequence, TCRα chain information, and TCRβ chain information were encoded into position intervals of length 15, 34, 130, and 130, respectively.
[0024] The CDR3 sequence containing only TCR chain information is placed in a preset window consisting of the 78th to 109th positions of the corresponding TCR chain position interval, and the positions outside the preset window are marked as unobserved positions; the corresponding positions lacking TCR chain information are marked as modality missing positions; after the task marker, classification marker, each chain start marker, separator marker and end marker are involved in the encoding, a complex position sequence with a length of 319 is formed.
[0025] According to the multi-task prediction system for TCR-pMHC complex based on sequence-residue pair co-modeling of the present invention, for the sequence-residue pair co-modeling module:
[0026] The fused one-dimensional sequence state is updated using a pre-normalized multi-head self-attention and feedforward network; a sequence scaling vector and a sequence bias vector are generated from the task vector through a two-layer feedforward network; task-conditional sequence modulation is performed on the updated one-dimensional sequence state, including:
[0027] The sequence scaling vector and sequence bias vector are broadcast along the position dimension of the updated one-dimensional sequence state, and the attention effective position mask is broadcast along the feature dimension of the updated one-dimensional sequence state to obtain the modulated one-dimensional sequence state.
[0028] The task vector is obtained by inputting the predicted task identifier into the task embedding table.
[0029] According to the multi-task prediction system for TCR-pMHC complex based on sequence-residue pair co-modeling of the present invention, for the sequence-residue pair co-modeling module, the method for obtaining the two-dimensional residue pair state from the updated one-dimensional sequence state is as follows:
[0030] The updated one-dimensional sequence state is normalized, and the left projection, right projection, and gated projection of each residue in the normalized one-dimensional sequence state are calculated; the update amount of the residue pair at position i and position j is calculated. for:
[0031] ,
[0032] In the formula For normalization, The left projection of the residue at position i, For the right projection of the residue at position j, For the residue-gated projection at position i, For the residue-gated projection at position j, This serves as the type identifier for the residue pair corresponding to position i and position j. For a trainable residue pair type embedding table, The message mask for the residue pairs between positions i and j;
[0033] The current residue pair layer has generated a state. By performing residual accumulation, the updated residue pair layer state is obtained. :
[0034] ;
[0035] Based on the updated residue pair layer state After obtaining the attention-updated two-dimensional residue states at positions i and j, the updated two-dimensional residue pair states are obtained from the attention-updated two-dimensional residue states at positions i and j. Then perform a residue pair feedforward update to obtain the two-dimensional residue pair state after the feedforward update. ;
[0036] Generate residue pair scaling vectors and residue pair bias vectors from the task vectors; make the residue pair scaling vectors and residue pair bias vectors follow the two-dimensional residue pair states respectively. Broadcasting the dimensions of positions i and j yields the modulated two-dimensional residue pair state.
[0037] The TCR-pMHC complex multi-task prediction system based on sequence and residue pair co-modeling according to the present invention, specifically for the multi-scale characterization fusion module,
[0038] The modulated one-dimensional sequence state is subjected to masked attention pooling to obtain peptide characterization, MHC characterization, TCRα chain characterization, TCRβ chain characterization, and global complex characterization. The modulated two-dimensional residue pair state is then subjected to relation type pooling according to the residue pair type matrix to obtain six relation type characters: peptide-MHC, peptide-TCRα, peptide-TCRβ, MHC-TCRα, MHC-TCRβ, and TCRα-TCRβ. The modulated two-dimensional residue pair state is then pooled according to a real residue pair pooling mask covering the real residue pairs of peptide-MHC, peptide-TCRα, peptide-TCRβ, MHC-TCRα, and MHC-TCRβ to obtain the main interaction characterization. The auxiliary interaction characterization is obtained according to a real residue pair pooling mask covering the real residue pairs of TCRα-TCRβ.
[0039] The task-labeled representation, classification-labeled representation, global complex representation, four biological chain representations, six relation type representations, main interaction representation, and auxiliary interaction representation are concatenated and mapped into a shared fusion representation.
[0040] According to the TCR-pMHC complex multi-task prediction system based on sequence and residue pair co-modeling of the present invention, in the multi-task prediction module, the target task prediction value is converted into pMHC presentation tendency, pMHC immunogenicity tendency or TCR-pMHC specific tendency between 0 and 1 by the Sigmoid function.
[0041] The method for adjusting the network parameters of each module in conjunction with task tags in the TCR-pMHC complex multi-task prediction system based on sequence and residue pair co-modeling according to the present invention is as follows:
[0042] The task prediction value of the corresponding task-specific prediction head is selected based on the prediction task identifier of the TCR-pMHC complex sample;
[0043] Calculate the binary cross-entropy loss between the predicted task value and the corresponding task label;
[0044] The shared parameters, task conditional parameters, and task-specific prediction head parameters of the multi-task prediction system are updated through backpropagation until the preset stopping condition is met.
[0045] This invention also provides a multi-task prediction method for the TCR-pMHC complex based on sequence and residue pair co-modeling, including,
[0046] A TCR-pMHC complex sample is obtained, and the TCR-pMHC complex sample is configured with a prediction task identifier and a corresponding task tag; the TCR-pMHC complex sample includes peptide sequence, MHC pseudo sequence and TCR chain information;
[0047] Fixed-length structured encoding was performed on the TCR-pMHC complex sample to obtain structured encoding features; the structured encoding features include complex position sequence, position-level attribute features, chain segment grouping identifier, residue pair type matrix, residue pair message mask and real residue pair pooling mask.
[0048] Combining the prediction task identifier, an initial one-dimensional sequence state is generated based on the location-level attribute features. Then, according to the chain segment grouping identifier and the complex position sequence, the local features of each biological chain in the initial one-dimensional sequence state are fused to obtain the fused one-dimensional sequence state.
[0049] The state of the fused one-dimensional sequence is updated by combining the residue pair type matrix and the residue pair message mask to obtain the updated one-dimensional sequence state; then the two-dimensional residue pair state is obtained from the updated one-dimensional sequence state; the updated one-dimensional sequence state and the two-dimensional residue pair state are alternately updated until the end; during the update of the updated one-dimensional sequence state and the two-dimensional residue pair state, the updated one-dimensional sequence state and the two-dimensional residue pair state are conditionally modulated according to the prediction task identifier.
[0050] Task marker representation, classification marker representation, global complex representation, and biological chain representation are extracted from the modulated one-dimensional sequence state. Relationship type pooling is performed on the modulated two-dimensional residue pair state according to the residue pair type matrix to obtain the relationship type representation. Real residue pair pooling is performed on the modulated two-dimensional residue pair state according to the real residue pair pooling mask to obtain the inter-chain interaction representation. The task marker representation, classification marker representation, global complex representation, biological chain representation, and inter-chain interaction representation are concatenated and mapped into a shared fusion representation.
[0051] The multi-task prediction module uses multiple task-specific prediction heads to generate prediction values for each task based on shared fusion characterization. The target task prediction value is selected according to the prediction task identifier and converted into pMHC presentation tendency, pMHC immunogenicity tendency or TCR-pMHC specific tendency.
[0052] The network parameters of the multi-task prediction module were adjusted by combining task labels, and the trained multi-task prediction system was used to predict the TCR-pMHC complex to be predicted.
[0053] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the system described in any of the preceding claims.
[0054] The beneficial effects of this invention are as follows: This invention employs a structured coding module to perform fixed-length structured coding of peptides, MHC pseudo-sequences, and optional TCRα and TCRβ chains; it aggregates local features within the same biological chain; it alternately updates one-dimensional sequence states and categorized two-dimensional residue pair states, feeding back the outgoing and incoming aggregation results of residue pairs to the sequence state, and modulating the two types of states according to task identifiers; it integrates task, global, chain-level, and inter-chain interaction characterizations, and outputs pMHC presentation, pMHC immunogenicity, or TCR-pMHC specificity tendency via a task-specific prediction head and task routing. This invention supports a shared tensor interface for complete, CDR3-only, and chain-deleted inputs.
[0055] This invention relates to immunoinformatics and artificial intelligence biomedical technologies, which can be used for predicting peptide-MHC presentation tendency, peptide-MHC immunogenicity tendency, and the specific tendency of T cell receptors and peptide-MHC complexes.
[0056] This invention, by setting observation masks, modality masks, and explicit missing markers for complete TCR, CDR3-only, and TCR-deficient states respectively, can process samples with varying information completeness within a unified, fixed-length input structure. This reduces the need for setting multiple models or deleting samples due to inconsistent input fields. Furthermore, by constraining the neighborhood range of local convolutions through chain segment grouping identifiers, local features are aggregated only within the same biological chain, avoiding the formation of false adjacency relationships at cross-chain separation positions from a data processing perspective.
[0057] Two-dimensional residue pair states with inter-chain relationships are generated from one-dimensional sequence states, and the outgoing and incoming aggregation results of the two-dimensional residue pair states are fed back to the one-dimensional sequence states, enabling positional features and inter-chain interaction features to mutually correct each other in multiple update stages. By embedding tasks for initial state biasing, one-dimensional sequence fitting, and two-dimensional residue pair fitting, the presentation, immunogenicity, and TCR-specific tasks not only use different prediction heads at the output end, but also form feature modulation paths corresponding to the tasks within a shared backbone.
[0058] By simultaneously aggregating task markers, classification markers, global complexes, and single-strand and multi-strand interaction representations, a shared fusion representation is formed, consisting of position-level, chain-level, complex-level, and residue-pair-level information, avoiding reliance on a single classification marker or a single average pooling result. Through the combination of a shared backbone and task-specific prediction heads, multiple immune prediction outputs are provided within a single set of model parameters, facilitating the reuse of shared representations and a unified model deployment interface. Attached Figure Description
[0059] Figure 1 This is a flowchart of the TCR-pMHC complex multi-task prediction system based on sequence and residue pair co-modeling described in this invention.
[0060] Figure 2 This is a schematic diagram of the unified structural coding of the TCR-pMHC complex;
[0061] Figure 3 This is a schematic diagram of the collaborative modeling process between one-dimensional sequence states and two-dimensional residue pair states;
[0062] Figure 4 This is a schematic diagram of the task conditional modulation and multi-task prediction process;
[0063] Figure 5 This is a schematic diagram of the multi-scale characterization extraction and sharing fusion process;
[0064] Figure 6 This is a schematic diagram of the training process for the multi-task prediction module. Detailed Implementation
[0065] 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.
[0066] Specific Implementation Method 1: Combination Figures 1 to 6 As shown, the first aspect of the present invention provides a multi-task prediction system for TCR-pMHC complexes based on sequence and residue pair co-modeling, comprising,
[0067] The sample acquisition module is used to acquire TCR-pMHC complex samples, wherein the TCR-pMHC complex samples are configured with prediction task identifiers and corresponding task tags; the TCR-pMHC complex samples include peptide sequences, MHC pseudo-sequences and TCR chain information.
[0068] The structured coding module is used to perform fixed-length structured coding on TCR-pMHC complex samples to obtain structured coding features. The structured coding features include complex position sequence, position-level attribute features, position validity mask, chain segment grouping identifier, residue pair type matrix, residue pair message mask, and real residue pair pooling mask.
[0069] The sequence feature processing module is used to combine the prediction task identifier, generate an initial one-dimensional sequence state based on positional attribute features, and perform local feature fusion of each biological chain in the initial one-dimensional sequence state according to the chain segment grouping identifier and the complex position sequence to obtain the fused one-dimensional sequence state.
[0070] The sequence-residue pair collaborative modeling module is used to update the fused one-dimensional sequence state by combining the residue pair type matrix and the residue pair message mask to obtain the updated one-dimensional sequence state; then, the two-dimensional residue pair state is obtained from the updated one-dimensional sequence state; the updating of the updated one-dimensional sequence state and the two-dimensional residue pair state are performed alternately until the end. During the update process, the outward aggregation result and inward aggregation result of the two-dimensional residue pair state are fed back to the one-dimensional sequence state; during the updating of the updated one-dimensional sequence state and the two-dimensional residue pair state, the updated one-dimensional sequence state and the two-dimensional residue pair state are conditionally modulated according to the prediction task identifier.
[0071] Task-conditional modulation generates scaling and bias parameters from the task embedding corresponding to the predicted task identifier. These parameters are then used to linearly modulate the normalized one-dimensional sequence state and the two-dimensional residue pair state, respectively, enabling the predicted task information to participate in the formation of intermediate features.
[0072] In this embodiment, the peptide sequence is denoted as... MHC pseudo-sequences are denoted as TCRα chain is denoted as TCRβ chain is denoted as The prediction task identifier is denoted as... The one-dimensional sequence state is denoted as... Two-dimensional residue pairs are denoted as ,in To standardize the encoding length, For the sequence state dimension, For residue pairs, the state dimension is denoted as .
[0073] The multi-scale characterization fusion module is used to extract task marker characterization, classification marker characterization, global complex characterization, and characterization of each biological chain from the modulated one-dimensional sequence state; perform relation type pooling on the modulated two-dimensional residue pair state according to the residue pair type matrix to obtain relation type characterization; perform real residue pair pooling on the modulated two-dimensional residue pair state according to the real residue pair pooling mask to obtain inter-chain interaction characterization; and concatenate and map the task marker characterization, classification marker characterization, global complex characterization, characterization of each biological chain, and inter-chain interaction characterization into a shared fusion characterization.
[0074] The multi-task prediction module is used to generate prediction values for each task based on shared fusion representation using multiple task-specific prediction heads, select the target task prediction value according to the prediction task identifier, and convert the target task prediction value into pMHC presentation tendency, pMHC immunogenicity tendency, or TCR-pMHC specific tendency.
[0075] During the training process of the multi-task prediction system, the network parameters of the corresponding modules are adjusted in conjunction with the task labels, and the trained multi-task prediction system is used to perform task prediction on the TCR-pMHC complex to be predicted.
[0076] Furthermore, regarding the sample acquisition module:
[0077] The TCR chain information includes TCRα chain information and TCRβ chain information;
[0078] The prediction task identifiers include pMHC presentation task identifiers, pMHC immunogenicity task identifiers, first TCR-pMHC specific task identifiers, and second TCR-pMHC specific task identifiers.
[0079] The prediction task identifier is primarily determined based on the task field in the TCR-pMHC complex sample.
[0080] When no explicit prediction task identifier is provided and the service entry is TCR-pMHC specific prediction, if the TCRα chain is in a missing state and the TCRβ chain is in a CDR3-only sequence state or a complete sequence state, it is determined to be the first TCR-pMHC specific task identifier; otherwise, it is determined to be the second TCR-pMHC specific task identifier.
[0081] The TCRα chain information and TCRβ chain information each have one of the following states: complete sequence state, CDR3 sequence only state, and missing state.
[0082] The first TCR-pMHC-specific task corresponds to the input condition of TCRα chain deletion and TCRβ chain information availability; the second TCR-pMHC-specific task is specified by the explicit task field, or used as another specific orbital if the first TCR-pMHC-specific task is not met, and therefore does not necessarily require complete TCRα and TCRβ chains. Different prediction tasks share a sequence-residue pair co-modeling backbone and a shared fusion module, and each has an independent task-specific prediction head.
[0083] Combination Figure 2 As shown, for the structured coding module:
[0084] Fixed-length structured encoding places the peptide sequence, MHC pseudo-sequence, TCRα chain, and TCRβ chain in mutually separated, fixed positional intervals, and assigns a token identifier, amino acid identifier, biological chain identifier, functional region identifier, intra-chain relative position, filling state, modal state, and observation state to each position. For samples without a complete TCR sequence, the unobserved state and modal state are used to distinguish between cases where only CDR3 is visible and cases where the entire TCR chain is missing.
[0085] As an example: the peptide sequence, MHC pseudo-sequence, TCRα chain information, and TCRβ chain information are encoded into position intervals of length 15, 34, 130, and 130, respectively;
[0086] The CDR3 sequence containing only TCR chain information is placed in a preset window consisting of the 78th to 109th positions of the corresponding TCR chain position interval, and the positions outside the preset window are marked as unobserved positions; the corresponding positions lacking TCR chain information are marked as modality missing positions; after the task marker, classification marker, each chain start marker, separator marker and end marker are involved in the encoding, a complex position sequence with a length of 319 is formed.
[0087] The positional attribute features include token identifier, amino acid identifier, biological chain identifier, functional region identifier, relative position within the chain, filling state, and modal state; the positional validity mask includes the observation state;
[0088] The residue pair type matrix is used to distinguish interchain relationships such as peptide-MHC, peptide-TCRα, peptide-TCRβ, MHC-TCRα, MHC-TCRβ, and TCRα-TCRβ; the residue pair message mask enables the two-dimensional residue pair state to pass messages only between valid positions.
[0089] The residue pair types include peptide-MHC, peptide-TCRα, peptide-TCRβ, MHC-TCRα, MHC-TCRβ, TCRα-TCRβ, homopeptide, other types, and invalid types; the residue pair message mask only allows residue pair messages to be passed between positions that are in the visible state; the real residue pair pooling mask includes a main interactive pooling mask covering real residue pairs of peptide-MHC, peptide-TCRα, peptide-TCRβ, MHC-TCRα, and MHC-TCRβ, and an auxiliary interactive pooling mask covering real residue pairs of TCRα-TCRβ;
[0090] In the sequence feature processing module, the token embedding, amino acid embedding, biological chain embedding, functional region embedding, relative position embedding, filling state embedding, and modal state embedding corresponding to the positional attribute features are added together and then normalized and subjected to feedforward residual transformation to obtain the initial one-dimensional sequence state. The local feature aggregation adopts a learnable convolution kernel with an odd width and retains only the neighborhood contribution that has the same chain segment grouping identifier as the center position and is in the visible state. Among them, peptide, MHC, TCRα chain and TCRβ chain have different chain segment grouping identifiers from each other.
[0091] In this embodiment, the peptide sequence is composed of standard amino acid characters, and the character X is allowed to represent unknown amino acids. MHC information can be a 34-position MHC pseudo-sequence or an MHC allele name. When the input is an MHC allele name, the allele name is first standardized, and the corresponding 34-position pseudo-sequence is searched in the MHC allele-pseudo-sequence mapping table. For allele names containing three or four fields, the search can be backed up to two-field names if the exact key is not found. If a 34-position MHC pseudo-sequence cannot be obtained, the sample is marked as an invalid input and will not be included in the model prediction.
[0092] Both TCRα and TCRβ chain information can include the complete sequence, CDR1, CDR2, CDR3 sequences, V gene, J gene, and positional region tags. For inputs with complete TCR chains but lacking positional region tags, sequence annotation programs based on the IMGT numbering system can be used to obtain region tags such as FR1, CDR1, FR2, CDR2, FR3, CDR2.5, CDR3, and FR4. When external annotation is unavailable, unique matching can be performed on the complete sequence based on the input CDR1, CDR2, and CDR3 motifs, and the corresponding frame region tags can be filled in according to the positions between each complementarity-determining region.
[0093] The input states for each TCR chain are categorized into three types: complete sequence state, CDR3-only state, and missing state. The complete sequence state is used when the complete sequence exists; the CDR3-only state is used when the complete sequence does not exist but the CDR3 sequence does; and the missing state is used when neither exists. By retaining this input state, subsequent models can distinguish between three cases: the position being a filler position, the position being unobserved but the chain mode existing, and the entire chain mode not existing.
[0094] Identify the prediction task In this implementation, the identifiers are 1, 2, 3, or 4. Identifier 1 corresponds to pMHC presentation prediction, identifier 2 corresponds to pMHC immunogenicity prediction, identifier 3 corresponds to the first TCR-pMHC specific prediction track, and identifier 4 corresponds to the second TCR-pMHC specific prediction track. The prediction task identifier is preferentially obtained directly from the task field in the data record; when the task field is missing and the service type is TCR-pMHC specific prediction, if the TCRα chain state is missing and the TCRβ chain state is only CDR3 sequence or complete sequence, then it is identified as identifier 3; otherwise, it is identified as identifier 4. Therefore, identifier 4 represents the second specific prediction track, without requiring the input to have both a complete TCRα chain and a complete TCRβ chain. This routing rule is independent of the three-state encoding of the chain state: the task identifier determines the prediction head and task modulation path, and the chain state determines whether the corresponding position has been observed and whether the mode exists.
[0095] In this embodiment, the task type token and the prediction task identifier have different meanings. The task type token is a discrete token at the first position of the unified complex position sequence, used to indicate the higher-level task type such as presentation, immunogenicity, or specificity; the prediction task identifier... These are track numbers used for task embedding, sequence state modulation, residue pair state modulation, and prediction head routing. Samples corresponding to identifiers 3 and 4 can both use task-specific tokens, but they use different predicted task identifiers. Therefore, the task tag representation obtained by reading the first task type token is not equivalent to the task embedding that distinguishes between identifiers 3 and 4.
[0096] Combination Figure 2 As shown, the complex position sequence sequentially includes a task marker, a classification marker, a peptide chain initiation marker, a peptide sequence region, a separator marker, an MHC chain initiation marker, an MHC pseudo-sequence region, a separator marker, a TCRα chain initiation marker, a TCRα chain region, a separator marker, a TCRβ chain initiation marker, a TCRβ chain region, and an end marker. Its formation can be represented as follows:
[0097] ,
[0098] In the formula This is the position sequence of the complex. This is a task type token used to indicate higher-level task types such as presentation, immunogenicity, or TCR-pMHC specificity; it differs from the predicted trajectory identifier. ; As a classification token, its final sequence state is used to form a classification tag representation. For peptide sequence start tokens, This is a peptide region of length 15. A separator token between adjacent food chain segments. This is the MHC pseudo-sequence start token. The MHC interval is of length 34. The starting token for the TCRα chain. For a TCRα chain region of length 130, The starting token for the TCRβ chain. The TCRβ chain region is 130 units in length. This is the end token for the complex position sequence;
[0099] Therefore, the total length of the complex position sequence for:
[0100] ;
[0101] When the peptide sequence length is less than 15, a dedicated padding marker is added after the peptide sequence; the MHC pseudo-sequence length is fixed at 34; when the complete TCR chain length is less than 130, a dedicated padding marker is added to the end of the chain. For the CDR3 sequence-only state, the preset CDR3 window is positions 78 to 109 in the fixed TCR interval, a total of 32 positions. The CDR3 sequence is centered in this window, and positions outside the window are marked as unobserved. For the deletion state, all 130 positions corresponding to the TCR chain are marked as deletions, and the modality state is set to 0.
[0102] For the first in the complex position sequence For each location, establish a location-level attribute vector. :
[0103] ,
[0104] In the formula For token identification, For amino acid labeling, For food chain identification, For functional area identification, Relative position within the chain, For observation status, Modal state; additionally set filling state. Biological chain identifiers include at least specific locations, peptides, MHC, TCRα, and TCRβ. Functional region identifiers include at least chain initiation regions, filling regions, unobserved regions, unannotated regions, peptide N-terminal anchoring sites, peptide core regions, peptide exposed or raised regions, peptide C-terminal anchoring sites, MHC binding groove regions, and each framework region and complementarity-determining region of the TCR.
[0105] Peptide functional regions can be divided according to the actual peptide length. The first two residues near the N-terminus are marked as the N-terminal anchoring region, and the last two residues near the C-terminus are marked as the C-terminal anchoring region. When the peptide length is not less than 10, residues near the center can be marked as exposed or raised regions, and other intermediate positions are marked as peptide core regions. This region labeling is used to provide the model with positional priors related to the pMHC binding conformation, but does not require the input of a three-dimensional structure.
[0106] The position validity mask consists of an attention mask, an observation mask, a modality mask, and a filling mask. For ordinary residue positions, the attention mask is set to 1 only when the residue is unfilled, observed, and the modality exists. Task markers, classification markers, and chain start markers remain visible, enabling the model to identify task types and whether chains are missing. Each biological chain is assigned a segment grouping identifier, with peptides, MHC, TCRα, and TCRβ corresponding to different groups, and the separator marker corresponding to group 0.
[0107] Combination Figure 3 As shown, for the sequence-residue pair co-modeling module:
[0108] The fused one-dimensional sequence state is updated using a pre-normalized multi-head self-attention and feedforward network; a sequence scaling vector and a sequence bias vector are generated from the task vector through a two-layer feedforward network; task-conditional sequence modulation is performed on the updated one-dimensional sequence state, including:
[0109] The sequence scaling vector and sequence bias vector are broadcast along the position dimension of the updated one-dimensional sequence state, and the attention effective position mask is broadcast along the feature dimension of the updated one-dimensional sequence state to obtain the modulated one-dimensional sequence state.
[0110] The task vector is obtained by inputting the predicted task identifier into the task embedding table.
[0111] For the sequence-residue pair collaborative modeling module, the method for obtaining the two-dimensional residue pair state from the updated one-dimensional sequence state is as follows: Left projection, right projection, and gated projection are formed based on the one-dimensional sequence states at the i-th and j-th positions, respectively. The element-wise product of the left projection, right projection, and the gated projection at the i-th and j-th positions, along with the corresponding residue pair type embedding, is added to form the two-dimensional residue pair update amount at the i-th and j-th positions. Row attention and residue pair feedforward updates are performed along the second position dimension on the two-dimensional residue pair state. The outgoing and incoming two-dimensional residue pair states at each position are averaged according to the residue pair message mask. The outgoing and incoming aggregation results are projected onto the one-dimensional sequence state dimension and then residually fused with the corresponding one-dimensional sequence state.
[0112] The prediction task identifier is mapped to the task embedding. The task embedding generates scaling parameters and bias parameters for the one-dimensional sequence state and the two-dimensional residue pair state, respectively. The normalized one-dimensional sequence state and the two-dimensional residue pair state are subjected to task conditional modulation by characteristic linear modulation. The modulation result is superimposed onto the state before modulation in the form of residual.
[0113] Specifically, it includes:
[0114] For any position and location Residue pair types are defined based on their biological chain identifiers. :
[0115] ,
[0116] In the formula, the function The chain combination is mapped to peptide-MHC, peptide-TCRα, and peptide-MHC-TCRα. This mapping uses a symmetric definition for the chain combination, meaning that peptide-MHC and MHC-peptide belong to the same relation type. The residue pair message mask is denoted as... When position and location All are allowed to take a value of 1 when participating in message passing, otherwise take a value of 0. TCRβ, MHC-TCRα, MHC-TCRβ, TCRα-TCRβ, same-chain, other or invalid types. This is the food chain identifier at position i. This is the food chain identifier for position j;
[0117] Further construct the main interaction pooling mask and auxiliary interaction pooling mask The primary interactive pooling mask covers the true, observed, and unfilled residue pairs for peptide-MHC, peptide-TCRα, peptide-TCRβ, MHC-TCRα, and MHC-TCRβ, while the secondary interactive pooling mask covers the true, observed, and unfilled residue pairs for TCRα-TCRβ. The purpose of both masks is to aggregate the states of two-dimensional residue pairs; they do not indicate the existence of residue-by-residue contact tags, nor are they used as a basis for contact supervision loss.
[0118] For the first For each position, the token embedding, amino acid embedding, biological chain embedding, functional region embedding, relative position embedding, filling state embedding, and modal state embedding are obtained by looking up tables. After adding the embeddings, layer normalization and feedforward residual transformation are performed.
[0119] ,
[0120] ,
[0121] In the formula For position The initial comprehensive features are obtained by summing and normalizing various embeddings. For the token identifier embedding table, Convert to a vector. For the amino acid identifier embedding table, Convert to a vector. To embed the food chain identifier into the table, Convert to a vector. Embed a table to identify the functional area, and Convert to a vector. Embed a table for relative positions within the chain, and Convert to a vector. To populate the state embedding table, populate the state. Convert to a vector. To embed the modal state into a table, record the states of whether a mode exists. Convert to a vector. For position The initial one-dimensional sequence state formed after feedforward residual transformation , These are the first and second linear transformation matrices of the feedforward network, respectively. For activation function, , These are the bias vectors for the first and second linear transformations, respectively.
[0122] As an example, each embedding output dimension and sequence state dimension is... The intermediate dimension of the feedforward transform is 512, and the GELU activation function and a dropout probability of 0.05 are used.
[0123] Identify the prediction task Input the task embedding table to obtain the task vector When task conditionalization is enabled, the task vector is first linearly mapped and then added to all visible locations:
[0124] ,
[0125] In the formula For the first Attention mask at each position, This is the task vector projection matrix, used to embed the task corresponding to the prediction task identifier. The data is mapped to the sequence state dimension, and the resulting task features are added to each visible position. Thus, the same peptide, MHC, and TCR inputs can have different initial states under different prediction tasks.
[0126] Then, chain segment-aware local aggregation is performed. The convolution window width is assumed to be an odd number. The learnable kernel parameters are obtained by Softmax normalization. Regarding the position The local features are calculated as follows:
[0127] ,
[0128] ,
[0129] In the formula For position Local features within the local window, obtained by weighted aggregation of valid positions of the same chain segment. Relative offset within the window The corresponding normalized learnable weights, This is the width of the local aggregation window. For indicator functions, For segment grouping identifiers, To prevent positive numbers with a denominator of zero, For position The sequence state is obtained by residual fusion of the original sequence state and local features. A fusion network consisting of linear layers, GELU, dropout layers, and layer normalization;
[0130] As an example, Because only The position of the peptide chain ends and the MHC chain starts are involved in the calculation. Even if the peptide chain ends and the MHC chain starts are adjacent in the spliced sequence, local convolution information will not be mixed.
[0131] Combination Figure 3One-dimensional sequence state updates employ pre-normalized multi-head self-attention and a feedforward network. For the first... Layer sequence state Its update is as follows:
[0132] ,
[0133] ,
[0134] In the formula For the first Each sequence update layer takes a one-dimensional sequence state matrix as input, where each row corresponds to a feature at a given location. This is a multi-head self-attention operation used to enable effective positions to exchange and aggregate contextual information according to attention weights. For attention-effective location mask, , and This indicates the corresponding random deactivation operation.
[0135] A single attention head in multi-head self-attention can be represented as:
[0136] ,
[0137] In the formula For querying the matrix, The key matrix, For value matrices, For single-head dimension, To take a large negative number at an invalid position, thus blocking attention from the invalid position.
[0138] After the sequence state is updated, task conditional sequence adaptation is performed. This is based on the task vector. A sequence scaling vector is generated after two layers of feedforward network. and sequence bias vector :
[0139] ,
[0140] ,
[0141] In the formula A network for generating parameters for sequential tasks, used to determine the parameters based on task embeddings. Generate a scaling vector for the sequence state and bias vector , The output network for sequence adaptation is used to convert task-scaled and translated sequence features into residual updates.
[0142] The task scaling vector and task bias vector are broadcast along the position dimension. Broadcast along the feature dimension. This approach allows task information to be scaled and translated across the sequence features at each layer, rather than simply selecting the classification head at the final output.
[0143] The updated one-dimensional sequence state is normalized, and the left projection, right projection, and gated projection of each residue in the normalized one-dimensional sequence state are calculated.
[0144] ,
[0145] In the formula The left projection matrix, The right projection matrix, For the Sigmoid function, For gated projection matrix;
[0146] Calculate the update amount of the residue pair at position i and position j. for:
[0147] ,
[0148] In the formula For normalization, The left projection of the residue at position i, For the right projection of the residue at position j, For the residue-gated projection at position i, For the residue-gated projection at position j, This serves as the type identifier for the residue pair corresponding to position i and position j. For a trainable residue pair type embedding table, The message mask for the residue pairs between positions i and j; This indicates that the type identifier is obtained from the embedded table. The corresponding feature vectors are used to distinguish between peptide-MHC, peptide-TCRα, peptide-TCRβ, MHC-TCRα, MHC-TCRβ, TCRα-TCRβ, homoskeletal, other, and invalid types. In this embodiment, the embedding table includes 9 types, each type corresponding to a 32-dimensional vector.
[0149] If the current layer is the first residue pair layer, then ;
[0150] If the previous residue has already generated a state for the layer The current residue pair layer has already generated a state. By performing residual accumulation, the updated residue pair layer state is obtained. :
[0151] ;
[0152] Based on the updated residue pair layer state After obtaining the attention-updated two-dimensional residue states at positions i and j, the updated two-dimensional residue pair states are obtained from the attention-updated two-dimensional residue states at positions i and j. Then perform a residue pair feedforward update to obtain the two-dimensional residue pair state after the feedforward update. ;
[0153] Generate residue pair scaling vectors and residue pair bias vectors from the task vectors; then, make the residue pair scaling vectors and residue pair bias vectors follow the two-dimensional residue pair states respectively. Broadcasting the dimensions of positions i and j yields the modulated two-dimensional residue pair state.
[0154] As an example, residues are paired with state dimensions. The residue pair type vocabulary includes 9 types. (By...) By combining sequence projection with the model, the model can form different two-dimensional interactive representations when the same amino acid combination appears in different chain combinations.
[0155] Perform row attention updates on the state of the two-dimensional residue pairs. Fix the first position. Along the second position Calculate multi-head attention:
[0156] ,
[0157] In the formula To The updated state is obtained after performing multi-head attention and summing the residuals. To fix the first position Afterwards, by all The first of the composition Line residue pair state, For the second position The execution of multi-head attention operations;
[0158] Then, residue updates are performed on the feedforward residuals:
[0159] ,
[0160] In the formula This is a complete residue pair message mask matrix; position pairs are allowed to be 1 when transmitting a message, otherwise 0, and broadcast along the feature dimension. This is a residue-pair feedforward network used to perform nonlinear feature transformations on the state of each effective two-dimensional residue pair;
[0161] If a row has no valid residue pairs, a safe position can be temporarily reserved to complete the attention calculation, and then the output of that row can be set to zero, thereby avoiding Softmax from producing non-numerical results under full masked input.
[0162] The residue pair states are also subject to task-conditional modulation. A residue pair scaling vector is generated from the task vector. and bias vector :
[0163] ,
[0164] ,
[0165] In the formula A network for generating task parameters for residue pairs, used to determine the parameters based on the task embedding. Generate a scaling vector for the sequence state and bias vector , In order to carry out the prediction task The two-dimensional residue pair states after conditional modulation. This is a residue pair adaptation output network used to convert the modulated residue pair features into residual update values.
[0166] In the formula and Broadcast along two location dimensions. For presentation tasks, task conditionation can make the model focus on peptide-MHC relationships; for TCR-specific tasks, task conditionation can make the model readjust the interaction states involving TCRα and TCRβ within the same backbone.
[0167] The residue pair state is fed back to the sequence state. The mean value of outgoing residue pairs and the mean value of incoming residue pairs are calculated for each position:
[0168] ,
[0169] After projecting both onto the sequence state dimension, they are concatenated with the current position's sequence state:
[0170] ,
[0171] The sequence update, task-conditional sequence adaptation, residue pair update, task-conditional residue pair adaptation, and residue pair to sequence feedback constitute a collaborative modeling stage.
[0172] As an example, a total of 4 sequence update layers can be set up, with 1 residue pair update layer and 1 residue pair sequence feedback layer set up after the first 2 sequence update layers.
[0173] Furthermore, regarding the multi-scale representation fusion module,
[0174] The modulated one-dimensional sequence state is subjected to masked attention pooling to obtain peptide characterization, MHC characterization, TCRα chain characterization, TCRβ chain characterization, and global complex characterization. The modulated two-dimensional residue pair state is then subjected to relation type pooling according to the residue pair type matrix to obtain six relation type characters: peptide-MHC, peptide-TCRα, peptide-TCRβ, MHC-TCRα, MHC-TCRβ, and TCRα-TCRβ. The modulated two-dimensional residue pair state is then pooled according to a real residue pair pooling mask covering the real residue pairs of peptide-MHC, peptide-TCRα, peptide-TCRβ, MHC-TCRα, and MHC-TCRβ to obtain the main interaction characterization. The auxiliary interaction characterization is obtained according to a real residue pair pooling mask covering the real residue pairs of TCRα-TCRβ.
[0175] The task-labeled representation, classification-labeled representation, global complex representation, four biological chain representations, six relation type representations, main interaction representation, and auxiliary interaction representation are concatenated and mapped into a shared fusion representation.
[0176] Combination Figure 5 First, construct an effective mask for real residues. :
[0177] ,
[0178] For a given food chain The chain mask is Learnable attention pooling is applied to effective positions within the chain. Position score. and normalized weights for:
[0179] ,
[0180] ,
[0181] In the formula This is a trainable attention score vector;
[0182] The chain is characterized as follows:
[0183] ,
[0184] Peptide characterization calculations were performed separately. MHC characterization TCRα characterization and TCRβ characterization Using all real residues together as a mask, a global complex characterization is obtained. If a chain is missing, its actual residue mask is all 0, and the corresponding pooling result is a zero vector or a near-zero vector, thus preventing the missing marker from being treated as an actual chain residue in the pooling.
[0185] Task tag representation is obtained by reading the task tag position in the one-dimensional sequence state. The classification marker representation is obtained by reading the classification marker position. For two-dimensional residue pair states, relation type pooling is first performed based on the residue pair type:
[0186] ,
[0187] In the formula For residue pairs of type The relation type characterization obtained after mask averaging and linear projection of the two-dimensional state is as follows: For relation types The corresponding linear projection matrix;
[0188] In the formula Six relation type vectors are obtained by taking peptide-MHC, peptide-TCRα, peptide-TCRβ, MHC-TCRα, MHC-TCRβ, and TCRα-TCRβ respectively. The type indicator function in the formula selects its position according to the residue pair type matrix; the two-dimensional residue pair state has been multiplied by the residue pair message mask in each update stage, therefore, the state corresponding to the position where the message is transmitted is not allowed to remain zero. This relation type pooling uses a different pooling caliber than the actual residue pair pooling below.
[0189] Then based on the main interaction pooling mask and auxiliary interaction pooling mask Perform real residue pair pooling:
[0190]
[0191] In the formula The main interaction vector, The main interactive pooling projection matrix, As an auxiliary interaction vector, To assist in interactive pooling of the projection matrix;
[0192] The main interaction pooling mask and the auxiliary interaction pooling mask only cover real, observed, modally present, and unfilled residue pairs, thereby obtaining the main interaction vectors. and auxiliary interaction vectors .
[0193] The above 15 vectors are concatenated into a shared fusion input:
[0194] ,
[0195] When all vector dimensions are 256, the shared fusion input dimension is: The shared converged network employs a two-stage feedforward transform:
[0196] ,
[0197] The first stage maps the 3840-dimensional input to 512 dimensions, and the second stage maps it to 256 dimensions to obtain a shared fusion representation. .
[0198] In the multi-task prediction module, the target task prediction value is converted into a pMHC presentation tendency, pMHC immunogenicity tendency, or TCR-pMHC specific tendency between 0 and 1 using the Sigmoid function.
[0199] Combination Figure 4 , for the For each task, retrieve the task embedding corresponding to that task. This is then concatenated with the shared fusion representation and input into the task-specific prediction head:
[0200] ,
[0201] As an example, The dimension is 512, which is mapped sequentially to 256 dimensions, 128 dimensions, and 1 dimension to obtain scalar prediction values. The four task predictions are stacked as follows:
[0202] ,
[0203] The target prediction value for the current sample is obtained through task identifier routing:
[0204] .
[0205] For binary classification tasks, the sigmoid function can be used to convert the target prediction value into a prediction probability between 0 and 1:
[0206] ,
[0207] when hour, Indicates peptide-MHC presentation tendency; when hour, Indicates a tendency for pMHC immunogenicity; when hour, This indicates the specific tendency of the first TCR-pMHC-specific predicted orbital; when hour, This indicates the specific tendency of the second TCR-pMHC-specific predicted orbital. The task semantics of the tendency value are determined by the label paired with the corresponding task identifier during training and should not be directly compared across tasks. The output may also include all predictions for all four tasks, shared fusion representations, one-dimensional sequence states, and two-dimensional residue pair states for model interpretation, downstream sequencing, or further analysis.
[0208] The method for adjusting the network parameters of each module in conjunction with task tags is as follows:
[0209] The task prediction value of the corresponding task-specific prediction head is selected based on the prediction task identifier of the TCR-pMHC complex sample;
[0210] Calculate the binary cross-entropy loss between the predicted task value and the corresponding task label;
[0211] The shared parameters, task conditional parameters, and task-specific prediction head parameters of the multi-task prediction system are updated through backpropagation until the preset stopping condition is met.
[0212] As an example, we choose a token vocabulary size of 35, an amino acid vocabulary size of 24, a biological chain vocabulary size of 5, a functional region vocabulary size of 18, and a residue pair type vocabulary size of 9. Sequence state dimension. residues in the state dimension The sequence self-attention head number is 8, the sequence update layer number is 4, and the sequence feedforward hidden dimension is 1024; the residue pair row attention head number is 4, the residue pair update layer number is 2, and the residue pair feedforward expansion ratio is 2; the chain segment-aware local aggregation convolution kernel width is 5; the maximum relative position is 160; and the model dropout probability is 0.05.
[0213] The task embedding vocabulary size is 6, using numbers 1 to 4; the task embedding dimension is 256. The hidden dimension of the task conditional adapter is 256, and the shared fusion representation dimension is 256. With the above parameters, the total number of trainable parameters for the model is approximately 8,304,015. In practical use, the dimensions, number of layers, and number of attention heads can be adjusted proportionally according to the scale of the training data and computational resources.
[0214] Combination Figure 1 and Figure 6 As shown, to ensure that the output of the task-specific prediction head has corresponding technical meanings regarding presentation, immunogenicity, or specificity, model parameters are determined using training samples carrying prediction task identifiers and corresponding binary tags before the model is used for prediction. The training samples include at least peptide sequences, MHC pseudo-sequences, prediction task identifiers, binary tags, and optional TCRα and TCRβ chain information matching the task requirements.
[0215] A positive label for a presentation task indicates that the corresponding peptide is marked as positive under the presentation experiment associated with the MHC or under the prepared presentation annotation conditions, while a negative label indicates that it is marked as negative under the same labeling specification. A positive label for an immunogenicity task indicates that the corresponding pMHC is positive under the preset immune response experiment or under the prepared immune response annotation conditions, while a negative label indicates that it is negative under the same labeling specification. A positive label for a TCR-pMHC specificity task indicates that the corresponding TCR and pMHC are a positive pair, while a negative label indicates that the corresponding pair is an experimentally determined negative pair, or a pair constructed according to preset negative sample rules and not recorded as positive. Within a training batch, the label for each sample only supervises the task-specific prediction head routed by its prediction task identifier, and does not replace the label with the output of other task-specific prediction heads.
[0216] As an example, a binary cross-entropy loss is used for the target task output of each training sample:
[0217] ,
[0218] In the formula For batch size, For the first The label of each sample, This is the predicted value after routing based on the task identifier.
[0219] The model also outputs task classification values calculated using shared fusion representations. When it is necessary to enhance the separability of shared representations in a task, an optional task classification auxiliary loss can be added:
[0220] ,
[0221] The total loss is:
[0222] .
[0223] in, As an auxiliary loss weight. When Only the target task prediction loss is used. During training, forward computation is performed in batches, and backpropagation is performed based on the total loss to update the parameters of the multi-task prediction model. Training stops when the verification loss no longer decreases within a preset number of rounds, a preset number of training rounds is reached, or other preset stopping conditions are met, and the corresponding model parameters are saved. Batch size, optimizer type, learning rate, and number of training rounds can be determined based on the training data scale and computing resources.
[0224] During model inference, the random dropout layer is disabled, the samples to be predicted are encoded into a batch, a shared fusion representation is generated, and then the target predicted value is obtained. Since the output is a logit, the threshold can be determined based on validation data or actual application requirements.
[0225] Examples of processing under different input completeness levels:
[0226] In the first input scenario, the sample is used for pMHC presentation prediction, providing only the peptide sequence and MHC pseudo-sequence, without the TCRα and TCRβ chains. During encoding, the modal states of both the TCRα and TCRβ chains are set to 0, and the residue positions in the two TCR chain regions do not participate in sequence attention and residue pooling; the TCR chain start marker remains visible, enabling the model to recognize that the input does not contain a TCR modality. The task identifier is set to 1, and the output is generated by the pMHC presentation prediction head.
[0227] In the second input scenario, the sample is used for immunogenicity prediction, and can also be provided only with peptide sequences and MHC pseudo-sequences. The task identifier is set to 2. Although its input modality is the same as the presentation task, the task embedding is different. Therefore, the initial task bias, each sequence adapter, each residue pair adapter, and the final task-specific prediction head all adopt the parameter path corresponding to the immunogenicity task.
[0228] In the third input scenario, the sample only provides the peptide sequence, the MHC pseudo-sequence, and the TCRβ chain CDR3 sequence. The TCRβ chain CDR3 is placed in a preset CDR3 window, with both the observation state and modal state of the actual CDR3 residues set to 1. The observation state outside the window is set to 0, but the modal state remains 1. The TCRα chain is in a deleted state. The task identifier is set to 3. Thus, the model can distinguish between TCRβ chain CDR3 only and complete TCRβ chain deletion.
[0229] In the fourth input scenario, the explicit task field in the sample record specifies the second TCR-pMHC-specific predicted orbital, and the task identifier is set to 4. The sample can provide a complete TCRα and TCRβ chain, and region tags are obtained for each chain and encoded into fixed-length intervals. Chain-level attention pooling simultaneously generates TCRα and TCRβ representations. The two-dimensional residue pair state also includes TCRα-TCRβ auxiliary interaction representations and representations of the relationships between the two TCR chains and the peptide and MHC, respectively. It should be noted that the complete TCR input is one implementation of task identifier 4, but not a necessary condition for this task identifier at the data routing level.
[0230] The four input scenarios described above share the same 319-bit input structure and the same sequence-residue pair co-modeling backbone, eliminating the need to modify the model tensor interface for different levels of information completeness. Controlling the efficient computation path through position masks and task identifiers facilitates the reception of immune complex data from different sources within the same inference service.
[0231] Specific Implementation Method Two: Combination Figure 1As shown, another aspect of the present invention provides a multi-task prediction method for the TCR-pMHC complex based on sequence and residue pair co-modeling, including,
[0232] A TCR-pMHC complex sample is obtained, and the TCR-pMHC complex sample is configured with a prediction task identifier and a corresponding task tag; the TCR-pMHC complex sample includes peptide sequence, MHC pseudo sequence and TCR chain information;
[0233] Fixed-length structured encoding was performed on the TCR-pMHC complex sample to obtain structured encoding features; the structured encoding features include complex position sequence, position-level attribute features, chain segment grouping identifier, residue pair type matrix, residue pair message mask and real residue pair pooling mask.
[0234] Combining the prediction task identifier, an initial one-dimensional sequence state is generated based on the location-level attribute features. Then, according to the chain segment grouping identifier and the complex position sequence, the local features of each biological chain in the initial one-dimensional sequence state are fused to obtain the fused one-dimensional sequence state.
[0235] The state of the fused one-dimensional sequence is updated by combining the residue pair type matrix and the residue pair message mask to obtain the updated one-dimensional sequence state; then the two-dimensional residue pair state is obtained from the updated one-dimensional sequence state; the updated one-dimensional sequence state and the two-dimensional residue pair state are alternately updated until the end; during the update of the updated one-dimensional sequence state and the two-dimensional residue pair state, the updated one-dimensional sequence state and the two-dimensional residue pair state are conditionally modulated according to the prediction task identifier.
[0236] Task marker representation, classification marker representation, global complex representation, and biological chain representation are extracted from the modulated one-dimensional sequence state. Relationship type pooling is performed on the modulated two-dimensional residue pair state according to the residue pair type matrix to obtain the relationship type representation. Real residue pair pooling is performed on the modulated two-dimensional residue pair state according to the real residue pair pooling mask to obtain the inter-chain interaction representation. The task marker representation, classification marker representation, global complex representation, biological chain representation, and inter-chain interaction representation are concatenated and mapped into a shared fusion representation.
[0237] The multi-task prediction module uses multiple task-specific prediction heads to generate prediction values for each task based on shared fusion representation. The target task prediction value is selected according to the prediction task identifier and converted into pMHC presentation tendency, pMHC immunogenicity tendency or TCR-pMHC specific tendency.
[0238] The network parameters of the multi-task prediction module were adjusted by combining task labels, and the trained multi-task prediction system was used to predict the TCR-pMHC complex to be predicted.
[0239] In this embodiment, the sample includes peptide sequences, MHC pseudo-sequences or HLA alleles, TCRα chain information, TCRβ chain information, and prediction task identifiers. The amino acid characters and required fields in the sample are verified.
[0240] The method involves parsing MHC pseudo-sequences using structured encoding, determining TCR chain states, generating functional region labels, generating 319-position complex sequence, and constructing position-level attribute features, attention masks, observation masks, modality masks, padding masks, chain segment grouping identifiers, residue pair type matrices, residue pair message masks, main interaction pooling masks, and auxiliary interaction pooling masks.
[0241] Multi-class embedding summation, task bias injection, and chain segment-aware local feature aggregation are performed on the position-level attribute features to generate an initial one-dimensional sequence state.
[0242] Then, multi-layer sequence self-attention, sequence-to-residue pair update, residue pair row attention, residue pair feedforward update, task-conditional sequence adaptation, task-conditional residue pair adaptation, and bidirectional aggregation feedback from residue pairs to sequences are performed.
[0243] Then, the task label extraction, classification label extraction, global attention pooling, four biological chain attention pooling, six types of relationship pooling, and real residue pair pooling of main interaction and auxiliary interaction are performed, and the resulting 15 vectors are mapped to shared fusion representations.
[0244] Finally, the pMHC presentation prediction head, pMHC immunogenicity prediction head, first TCR-pMHC specific prediction head, and second TCR-pMHC specific prediction head are used to calculate the prediction values for the four tasks, and the target output is routed according to the prediction task identifier.
[0245] The specific implementation of this embodiment is similar to that of Specific Embodiment 1, and will not be described in detail.
[0246] Specific Implementation Method 3: This implementation method also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the system described in Specific Implementation Method 1.
[0247] The present invention may also include an electronic device, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that the processor executes the computer program to implement the method described in Specific Embodiment Two.
[0248] The prediction system described in Specific Implementation Method 1 can be deployed in an electronic device with a central processing unit or a graphics processing unit. The electronic device includes a processor, a memory, an input interface, and an output interface; the memory stores model parameters, a vocabulary, an HLA allele-MHC pseudo-sequence mapping table, and a computer program obtained through task label training; the processor sequentially calls each module to implement its corresponding function; the input interface receives sample data; and the output interface returns the target task prediction value, propensity value, and corresponding task type. The computer program can also be stored in a non-transitory computer-readable storage medium and executed when the processor reads it.
[0249] While the invention has been described herein with reference to specific embodiments, it should be understood that these embodiments are merely examples of the principles and applications of the invention. Therefore, it should be understood that many modifications can be made to the exemplary embodiments, and other arrangements can be designed without departing from the spirit and scope of the invention as defined by the appended claims. It should be understood that different dependent claims and features described herein can be combined in ways different from those described in the original claims. It is also understood that features described in conjunction with individual embodiments can be used in other described embodiments.
Claims
1. A multi-task prediction system for TCR-pMHC complexes based on sequence and residue pair co-modeling, characterized in that... include, The sample acquisition module is used to acquire TCR-pMHC complex samples, wherein the TCR-pMHC complex samples are configured with prediction task identifiers and corresponding task tags; the TCR-pMHC complex samples include peptide sequences, MHC pseudo-sequences and TCR chain information. The structured coding module is used to perform fixed-length structured coding on TCR-pMHC complex samples to obtain structured coding features; The structured coding features include complex position sequences, position-level attribute features, chain segment grouping identifiers, residue pair type matrices, residue pair message masks, and real residue pair pooling masks. The sequence feature processing module is used to combine the prediction task identifier, generate an initial one-dimensional sequence state based on positional attribute features, and perform local feature fusion of each biological chain in the initial one-dimensional sequence state according to the chain segment grouping identifier and the complex position sequence to obtain the fused one-dimensional sequence state. The sequence-residue pair collaborative modeling module is used to update the fused one-dimensional sequence state by combining the residue pair type matrix and the residue pair message mask to obtain the updated one-dimensional sequence state; then, the two-dimensional residue pair state is obtained from the updated one-dimensional sequence state; the updating of the updated one-dimensional sequence state and the two-dimensional residue pair state are performed alternately until the end; during the updating of the updated one-dimensional sequence state and the two-dimensional residue pair state, the updated one-dimensional sequence state and the two-dimensional residue pair state are conditionally modulated according to the prediction task identifier. The multi-scale characterization fusion module is used to extract task marker characterization, classification marker characterization, global complex characterization, and characterization of each biological chain from the modulated one-dimensional sequence state; perform relation type pooling on the modulated two-dimensional residue pair state according to the residue pair type matrix to obtain relation type characterization; perform real residue pair pooling on the modulated two-dimensional residue pair state according to the real residue pair pooling mask to obtain inter-chain interaction characterization; and concatenate and map the task marker characterization, classification marker characterization, global complex characterization, characterization of each biological chain, and inter-chain interaction characterization into a shared fusion characterization. The multi-task prediction module is used to generate prediction values for each task based on shared fusion representation using multiple task-specific prediction heads, select the target task prediction value according to the prediction task identifier, and convert the target task prediction value into pMHC presentation tendency, pMHC immunogenicity tendency, or TCR-pMHC specific tendency. During the training process of the multi-task prediction system, the network parameters of the corresponding modules are adjusted in conjunction with the task labels, and the trained multi-task prediction system is used to perform task prediction on the TCR-pMHC complex to be predicted.
2. The TCR-pMHC complex multi-task prediction system based on sequence and residue pair co-modeling according to claim 1, characterized in that, For the sample acquisition module: The TCR chain information includes TCRα chain information and TCRβ chain information; The prediction task identifiers include pMHC presentation task identifiers, pMHC immunogenicity task identifiers, first TCR-pMHC specific task identifiers, and second TCR-pMHC specific task identifiers. The prediction task identifier is determined based on the task field in the TCR-pMHC complex sample; When no explicit prediction task identifier is provided and the service entry is TCR-pMHC specific prediction, if the TCRα chain is in a missing state and the TCRβ chain is in a CDR3-only sequence state or a complete sequence state, it is determined to be the first TCR-pMHC specific task identifier; otherwise, it is determined to be the second TCR-pMHC specific task identifier. The TCRα chain information and TCRβ chain information each have one of the following states: complete sequence state, CDR3 sequence only state, and missing state.
3. The TCR-pMHC complex multi-task prediction system based on sequence and residue pair co-modeling according to claim 2, characterized in that, For the structured coding module: The peptide sequence, MHC pseudo-sequence, TCRα chain information, and TCRβ chain information were encoded into position intervals of length 15, 34, 130, and 130, respectively. The CDR3 sequence containing only TCR chain information is placed in a preset window consisting of the 78th to 109th positions of the corresponding TCR chain position interval, and the positions outside the preset window are marked as unobserved positions; the corresponding positions lacking TCR chain information are marked as modality missing positions; after the task marker, classification marker, each chain start marker, separator marker and end marker are involved in the encoding, a complex position sequence with a length of 319 is formed.
4. The TCR-pMHC complex multi-task prediction system based on sequence and residue pair co-modeling according to claim 3, characterized in that, For the sequence-residue pair co-modeling module: A pre-normalized multi-head self-attention and feedforward network are used to update the state of the fused one-dimensional sequence; The task vector is processed through a two-layer feedforward network to generate a sequence scaling vector and a sequence bias vector. Task-conditional sequence modulation of the updated one-dimensional sequence state includes: The sequence scaling vector and sequence bias vector are broadcast along the position dimension of the updated one-dimensional sequence state, and the attention effective position mask is broadcast along the feature dimension of the updated one-dimensional sequence state to obtain the modulated one-dimensional sequence state. The task vector is obtained by inputting the predicted task identifier into the task embedding table.
5. The TCR-pMHC complex multi-task prediction system based on sequence and residue pair co-modeling according to claim 4, characterized in that, For the sequence-residue pair co-modeling module, the method for obtaining the two-dimensional residue pair state from the updated one-dimensional sequence state is as follows: The updated one-dimensional sequence state is normalized, and the left projection, right projection, and gated projection of each residue in the normalized one-dimensional sequence state are calculated; the update amount of the residue pair at position i and position j is calculated. for: , In the formula For normalization, The left projection of the residue at position i, For the right projection of the residue at position j, For the residue-gated projection at position i, For the residue-gated projection at position j, This serves as the type identifier for the residue pair corresponding to position i and position j. For a trainable residue pair type embedding table, The message mask for the residue pairs between positions i and j; The current residue pair layer has generated a state. By performing residual accumulation, the updated residue pair layer state is obtained. : ; Based on the updated residue pair layer state After obtaining the attention-updated two-dimensional residue states at positions i and j, the updated two-dimensional residue pair states are obtained from the attention-updated two-dimensional residue states at positions i and j. Then perform a residue pair feedforward update to obtain the two-dimensional residue pair state after the feedforward update. ; Generate residue pair scaling vectors and residue pair bias vectors from the task vectors; then, make the residue pair scaling vectors and residue pair bias vectors follow the two-dimensional residue pair states respectively. Broadcasting the dimensions of positions i and j yields the modulated two-dimensional residue pair state.
6. The TCR-pMHC complex multi-task prediction system based on sequence and residue pair co-modeling according to claim 5, characterized in that, For the multi-scale representation fusion module, The modulated one-dimensional sequence state is subjected to masked attention pooling to obtain peptide characterization, MHC characterization, TCRα chain characterization, TCRβ chain characterization, and global complex characterization. The modulated two-dimensional residue pair state is then subjected to relation type pooling according to the residue pair type matrix to obtain six relation type characters: peptide-MHC, peptide-TCRα, peptide-TCRβ, MHC-TCRα, MHC-TCRβ, and TCRα-TCRβ. The modulated two-dimensional residue pair state is then pooled according to a real residue pair pooling mask covering the real residue pairs of peptide-MHC, peptide-TCRα, peptide-TCRβ, MHC-TCRα, and MHC-TCRβ to obtain the main interaction characterization. The auxiliary interaction characterization is obtained according to a real residue pair pooling mask covering the real residue pairs of TCRα-TCRβ. The task-labeled representation, classification-labeled representation, global complex representation, four biological chain representations, six relation type representations, main interaction representation, and auxiliary interaction representation are concatenated and mapped into a shared fusion representation.
7. The TCR-pMHC complex multi-task prediction system based on sequence and residue pair co-modeling according to claim 6, characterized in that, In the multi-task prediction module, the target task prediction value is converted into a pMHC presentation tendency, pMHC immunogenicity tendency, or TCR-pMHC specific tendency between 0 and 1 using the Sigmoid function.
8. The TCR-pMHC complex multi-task prediction system based on sequence and residue pair co-modeling according to claim 7, characterized in that, The method for adjusting the network parameters of each module in conjunction with task tags is as follows: The task prediction value of the corresponding task-specific prediction head is selected based on the prediction task identifier of the TCR-pMHC complex sample; Calculate the binary cross-entropy loss between the predicted task value and the corresponding task label; The shared parameters, task conditional parameters, and task-specific prediction head parameters of the multi-task prediction system are updated through backpropagation until the preset stopping condition is met.
9. A multi-task prediction method for TCR-pMHC complex based on sequence and residue pair co-modeling, characterized in that... include, A TCR-pMHC complex sample is obtained, and the TCR-pMHC complex sample is configured with a prediction task identifier and a corresponding task tag; the TCR-pMHC complex sample includes peptide sequence, MHC pseudo sequence and TCR chain information; Fixed-length structured encoding was performed on TCR-pMHC complex samples to obtain structured encoding features; The structured coding features include complex position sequences, position-level attribute features, chain segment grouping identifiers, residue pair type matrices, residue pair message masks, and real residue pair pooling masks. Combining the prediction task identifier, an initial one-dimensional sequence state is generated based on the location-level attribute features. Then, according to the chain segment grouping identifier and the complex position sequence, the local features of each biological chain in the initial one-dimensional sequence state are fused to obtain the fused one-dimensional sequence state. The state of the fused one-dimensional sequence is updated by combining the residue pair type matrix and the residue pair message mask to obtain the updated one-dimensional sequence state; then the two-dimensional residue pair state is obtained from the updated one-dimensional sequence state; the updated one-dimensional sequence state and the two-dimensional residue pair state are alternately updated until the end; during the update of the updated one-dimensional sequence state and the two-dimensional residue pair state, the updated one-dimensional sequence state and the two-dimensional residue pair state are conditionally modulated according to the prediction task identifier. Task marker representation, classification marker representation, global complex representation, and biological chain representation are extracted from the modulated one-dimensional sequence state. Relationship type pooling is performed on the modulated two-dimensional residue pair state according to the residue pair type matrix to obtain the relationship type representation. Real residue pair pooling is performed on the modulated two-dimensional residue pair state according to the real residue pair pooling mask to obtain the inter-chain interaction representation. The task marker representation, classification marker representation, global complex representation, biological chain representation, and inter-chain interaction representation are concatenated and mapped into a shared fusion representation. The multi-task prediction module uses multiple task-specific prediction heads to generate prediction values for each task based on shared fusion characterization. The target task prediction value is selected according to the prediction task identifier and converted into pMHC presentation tendency, pMHC immunogenicity tendency or TCR-pMHC specific tendency. The network parameters of the multi-task prediction module were adjusted by combining task labels, and the trained multi-task prediction system was used to predict the TCR-pMHC complex to be predicted.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the system described in any one of claims 1 to 8.