A method of tcr sequence encoding visualization
By training a TCR encoding model using deep learning methods, the challenge of associating high-throughput TCR data with antigen targets was solved, achieving efficient encoding and visualization, and enhancing the application potential of TCR data in immunological and clinical research.
Patent Information
- Application Number
- CN202210883046.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-26
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2042-07-26
AI Technical Summary
Existing technologies struggle to efficiently correlate high-throughput TCR sequencing data with their antigen targets, limiting the application of large-scale TCR data in immunological and clinical research. Existing clustering methods suffer from high computational complexity or low purity.
A TCR encoding model was trained using deep learning methods to map TCR sequences into Euclidean space. The similarity of TCR molecules was preserved through a Siamese network model, and the output layer of the deep learning model was used for visualization.
It achieves efficient encoding and visualization of TCR sequences, preserves the similarity of TCR molecules, provides a new method for identifying specific TCRs, and is suitable for large-scale TCR data analysis.
Smart Images

Figure CN115171793B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of bioengineering technology, specifically a method for visualizing TCR sequence encoding. Background Technology
[0002] T cells are effectors of cell-mediated adaptive immunity in jawed vertebrates. Reactive T cells proliferate clonally, and their progeny inherit the same antigen-specific T cell receptors (TCRs), constituting long-term immune memory of antigens. Therefore, the dynamics of different TCR repertoires in an individual reflect the individual's immune history.
[0003] T cell receptors are proteins on the surface of T cells that are responsible for specifically recognizing their target antigens (the major histocompatibility complex MHC on antigen-presenting cells). When the TCR binds to the antigen peptide and the MHC complex, T lymphocytes are activated through signal transduction and enter the subsequent immune response process.
[0004] Currently, high-throughput TCR sequencing enables us to characterize an individual's TCR library. However, directly correlating these sequenced TCR data with their antigen targets remains a challenging task, thus limiting the use of these data in immunological and clinical research.
[0005] Recent studies have shown that the similarity of the highly variable complementarity-determining region 3 (CDR3) of the TCR represents the structural similarity of antigen recognition. Therefore, clustering similar CDR3s has become an important approach to identifying antigen-specific TCRs.
[0006] Currently, many TCR clustering methods have been developed to study antigen-specific T cell responses, such as TCRdist, iSMART, and GLIPH2. However, achieving high clustering specificity requires pairwise Smith-Waterman (SW) alignments of CDR3 sequences and TCR variable gene (TRBV) alleles, which involves quadratic computational complexity and is generally unsuitable for large-scale TCR data (≥100K sequences). Among motif-based clustering methods, GLIPH2 achieves faster speed but significantly lower specificity. clusTCR uses physicochemical features to digitally encode CDR3 sequences, achieving even faster computation. However, this method omits TCR variable gene information and uses a less rigorous Hamming distance instead of SW alignments, resulting in lower cluster purity. Therefore, to more effectively utilize large-scale TCR sequencing data, efficient TCR encoding methods that ensure similarity between TCRs are needed. Summary of the Invention
[0007] The purpose of this invention is to propose a TCR sequence encoding and visualization method. This method uses deep learning to train a reliable TCR encoding model using existing TCR data, enabling efficient encoding and visualization of TCR sequences while preserving the similarity between different TCR molecules, thus providing a new method for identifying specific TCRs.
[0008] To achieve the above objectives, the present invention adopts the following technical solution:
[0009] A method for visualizing TCR sequence encoding includes the following steps:
[0010] S1. Acquire TCR sequencing data and perform preprocessing;
[0011] S2. Generate training data based on the preprocessed TCR sequencing data;
[0012] S3. Build a deep learning model and train it using training data;
[0013] S4. Set the output layer of the deep learning model, encode the TCR as data points and visualize them.
[0014] Preferably, the TCR sequencing data in step S1 includes TCR-beta sequence data from COVID-19 positive patients and healthy individuals, as well as highly reliable novel coronavirus-specific TCR data from the ImmuneCODE-MIRA-Release002.1 database, and the TCR-beta sequence data from COVID-19 positive patients and healthy individuals are preprocessed.
[0015] Preferably, the preprocessing procedure for the TCR-beta sequence data of COVID-19 positive patients and healthy individuals in step S1 is as follows:
[0016] S11. Use pgen to calculate the TCR generation probability PGen, and use the Poisson model to calculate the p value representing TCR clonal amplification;
[0017] S12. In a sample, use TOTAL_TCR_CLONALITY*PGen to assume the expected clonality of a particular TCR as the lambda parameter of the Poisson model.
[0018] S13. Use the R function ppois to calculate the probability that the TCR has higher clonality. TCRs with a p value less than 1e-30 are considered to be amplified TCRs.
[0019] S14. The amplified TCRs are sorted in descending order of clone number, and only the top 1 / 5000 amplified TCRs in the total clone number of each sample are retained for further analysis.
[0020] Preferably, the specific process of step S2 is as follows:
[0021] S21 and TCR are defined by a variable region gene Vgene and a CDR3 amino acid sequence. The variable region gene Vgene and CDR3 amino acid sequence of the data retained in S14 are extracted to form the TCR set used to generate training data pairs.
[0022] S22. Generate TCR data pairs (TCR1, TCR2) using the data retained in step S14, and calculate the similarity level of each TCR pair using the TCRdist method to generate the similarity d between TCRs, where TCR1 and TCR2 are two different TCRs in the TCR set.
[0023] S23. The training data for the deep learning model is (TCR1, TCR2, d).
[0024] Preferably, the specific process of step S3 is as follows:
[0025] S31. Build a BRET-based Siamese network model. The two branches of the Siamese network model have the same structure and share weights during training. Each branch consists of a BERT module and an output layer.
[0026] S32. Each branch of the Siamese network model maps the TCR sequence to Euclidean space. m∈Z + For each pair of training data (TCR1, TCR2) ∈ TCR, the loss function of the Siamese network model makes the Euclidean distance in its embedding space equal to the TCR similarity d calculated by the TCRdist method. The loss function of this Siamese network model is:
[0027]
[0028] For each p pairs of TCR sequences, the similarity between TCRs is preserved by minimizing the loss function, where TCR1 and TCR2 are the input TCR data pairs. d represents the model's mapping to the TCR, and d represents the similarity of the TCR data pairs calculated by the TCRdist method.
[0029] Preferably, the specific process of step S4 is as follows:
[0030] S41. Set the output layer of the deep learning model to n dimensions, and encode the TCR as data points in n-dimensional Euclidean space;
[0031] S42. Set the output layer of the deep learning model to 2D, encode the TCR into 2D data points for visualization, and display it in a scatter plot.
[0032] Preferably, the specific process of the pgen method in step S11 is as follows:
[0033] S111. Obtain the CDR3 region sequence data of the sample TCRβ chain and its related VDJ gene information;
[0034] S112. Non-productive CDR3 sequences are retained for subsequent analysis;
[0035] S113. Each CDR3 sequence that generates recombination is characterized by a set of discrete variables, where the discrete variables are the VDJ gene information associated with the CDR3.
[0036] S114. The probability P(E) of a recombination event E is obtained from the joint distribution of the above discrete variables.
[0037] S115. The probability of generating a specific CDR3 sequence σ is equal to the recombination event E that can generate σ. σ The sum of probabilities.
[0038] Preferably, the specific process of the TCRdist method in step S32 is as follows:
[0039] S321, The TCR being compared is mapped to the amino acid sequence of its CDR ring;
[0040] S322. The CDR sequence is aligned using the IMGT reference multi-sequence alignment method, and the distance score of each position in the aligned sequence is calculated using the BLOSUM62 similarity matrix.
[0041] S323. Calculate the weighted sum of the distance scores for each location to obtain the final TCR similarity d.
[0042] After adopting the above technical solution, the present invention has the following advantages compared with the prior art: the TCR sequence encoding visualization method retains the similarity of different TCR molecules, encodes the TCR sequence into a high-dimensional Euclidean space, makes similar TCRs more closely arranged in the embedding space, and maps them to a low-dimensional space for visualization, which can provide a new way for the identification of potential specific TCRs. Attached Figure Description
[0043] Figure 1 This is a flowchart of the present invention;
[0044] Figure 2 This is a framework diagram of the deep learning model of the present invention;
[0045] Figure 3 The TCR similarity retention effect after encoding the deep learning model of this invention;
[0046] Figure 4 This is a visualization of the results of the present invention. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0048] See Figures 1 to 4 A TCR sequence encoding visualization method includes the following steps:
[0049] S1. Acquire TCR sequencing data and perform preprocessing;
[0050] The TCR sequencing data mentioned in step S1 includes TCR-beta sequence data from COVID-19 positive patients and healthy individuals, as well as highly reliable novel coronavirus-specific TCR data from the ImmuneCODE-MIRA-Release002.1 database, and the TCR-beta sequence data from COVID-19 positive patients and healthy individuals are preprocessed;
[0051] The preprocessing procedure for TCR-beta sequence data from COVID-19 positive patients and healthy individuals described in step S1 is as follows:
[0052] S11. Use pgen to calculate the TCR generation probability PGen, and use the Poisson model to calculate the p value representing TCR clonal amplification;
[0053] The specific process of the pgen method in step S11 is as follows:
[0054] S111. Obtain the CDR3 region sequence data of the sample TCRβ chain and its related VDJ gene information;
[0055] S112. Non-productive CDR3 sequences are retained for subsequent analysis;
[0056] S113. Each CDR3 sequence that generates recombination is characterized by a set of discrete variables, where the discrete variables are the VDJ gene information associated with the CDR3.
[0057] S114. The probability P(E) of a recombination event E is obtained from the joint distribution of the above discrete variables.
[0058] S115. The probability of generating a specific CDR3 sequence σ is equal to the recombination event E that can generate σ. σ The sum of probabilities;
[0059] S12. In a sample, use TOTAL_TCR_CLONALITY*PGen to assume the expected clonality of a particular TCR as the lambda parameter of the Poisson model.
[0060] S13. Use the R function ppois to calculate the probability that the TCR has higher clonality. TCRs with a p value less than 1e-30 are considered to be amplified TCRs.
[0061] S14. The amplified TCRs are sorted in descending order of clone number, and only the top 1 / 5000 amplified TCRs in the total clone number of each sample are retained for further analysis.
[0062] S2. Generate training data based on the preprocessed TCR sequencing data;
[0063] The specific process of step S2 is as follows:
[0064] S21 and TCR are defined by a variable region gene Vgene and a CDR3 amino acid sequence. The variable region gene Vgene and CDR3 amino acid sequence of the data retained in S14 are extracted to form the TCR set used to generate training data pairs.
[0065] S22. Generate TCR data pairs (TCR1, TCR2) using the data retained in step S14, and calculate the similarity level of each TCR pair using the TCRdist method to generate the similarity d between TCRs, where TCR1 and TCR2 are two different TCRs in the TCR set.
[0066] S23. The training data for the deep learning model is (TCR1, TCR2, d);
[0067] S3. Build a deep learning model and train it using training data;
[0068] The specific process of step S3 is as follows:
[0069] S31. Construct a BRET-based Siamese network model. The two branches of the Siamese network model have identical structures and share weights during training. Each branch consists of a BERT module and an output layer. The structure of the Siamese network model is as follows: Figure 2 As shown;
[0070] S32. Each branch of the Siamese network model maps the TCR sequence to Euclidean space. m∈Z +For each pair of training data (TCR1, TCR2) ∈ TCR, the loss function of the Siamese network model makes the Euclidean distance in its embedding space equal to the TCR similarity d calculated by the TCRdist method. The loss function of this Siamese network model is:
[0071]
[0072] For each p pairs of TCR sequences, the similarity between TCRs is preserved by minimizing the loss function, where TCR1 and TCR2 are the input TCR data pairs. The model maps the TCR to this TCR, and d represents the similarity of the TCR data pairs calculated by the TCRdist method.
[0073] The specific process of the TCRdist method in step S32 is as follows:
[0074] S321, The TCR being compared is mapped to the amino acid sequence of its CDR ring;
[0075] S322. The CDR sequence is aligned using the IMGT reference multi-sequence alignment method, and the distance score of each position in the aligned sequence is calculated using the BLOSUM62 similarity matrix.
[0076] S323. The distance scores for each location are weighted and summed to obtain the final TCR similarity d;
[0077] S4. Set up the output layer of the deep learning model, encode the TCR into data points and visualize them;
[0078] The specific process of step S4 is as follows:
[0079] S41. Set the output layer of the deep learning model to n dimensions, and encode the TCR as data points in n-dimensional Euclidean space;
[0080] S42. Set the output layer of the deep learning model to 2D, encode the TCR into 2D data points for visualization, and display it in a scatter plot, such as... Figure 4 As shown.
[0081] The above description is merely a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method of TCR sequence encoding visualization, characterized in that, The method comprises the following steps: S1, obtaining TCR sequencing data and preprocessing; The preprocessing process of the TCR-beta sequence data of the COVID-19 positive patients and healthy people in step S1 is as follows: S11, calculating the TCR generation probability PGen using the pgen method, and calculating the p value representing the clonal expansion of the TCR using the Poisson model; S12, in a sample, using TOTAL_TCR_CLONALITY*PGen to assume the expected clonality of a specific TCR as the lambda parameter of the Poisson model; S13, calculating the probability that the TCR has higher clonality using the R function ppois, and considering that the TCR with a p value less than 1e-30 is an expanded TCR; S14, ranking the expanded TCRs in descending order of clone number, and only retaining the top 1 / 5000 expanded TCRs in the total clone number of each sample for further analysis; S2, generating training data based on the preprocessed TCR sequencing data; The specific process of step S2 is as follows: S21, the TCR is defined by a variable region gene V gene and a CDR3 amino acid sequence, and the variable region gene V gene and the CDR3 amino acid sequence of the retained data in S14 are extracted to constitute a TCR set for generating training data pairs; S22, generating TCR data pairs (TCR1, TCR2) using the retained data in step S14, and calculating the similarity level of each pair of TCRs using the TCRdist method to generate the similarity d between TCRs, wherein TCR1 and TCR2 are two different TCRs in the TCR set; S23, the training data of the deep learning model is (TCR1, TCR2, d); S3, building a deep learning model and training the deep learning model using the training data; The specific process of step S3 is as follows: S31, building a BRET-based twin network model, the two branches of the twin network model are the same in structure and share weights during the training process, and each branch is composed of a BERT module and an output layer; S32, each branch of the twin network model maps the TCR sequences into the Euclidean space, m∈Z + For each pair of training data (TCR1, TCR1) e TCR, the Loss function of the twin network model makes the Euclidean distance in its embedding space equal to the TCR similarity d calculated by the TCRdist method, and the Loss function of the twin network model is: For each pair of TCR sequences, similarity between TCRs is maintained by minimizing a Loss function, where TCR1 and TCR2 are the input pair of TCR data, For the model's mapping of this TCR, d is the TCR data pair similarity computed by the TCRdist method; S4, setting the output layer of the deep learning model, encoding the TCR into data points and visualizing.
2. A method of visualizing TCR sequence encoding according to claim 1, wherein, The TCR sequencing data in step S1 includes the TCR-beta sequence data of COVID-19 positive patients and healthy people and high-trust novel coronavirus specific TCR data from the ImmuneCODE-MIRA-Release002.1 database, and the TCR-beta sequence data of COVID-19 positive patients and healthy people is preprocessed.
3. A method of visualizing TCR sequence encoding according to claim 1, wherein, The specific process of step S4 is as follows: S41, setting the output layer of the deep learning model to n dimensions, and encoding the TCR into data points in an n-dimensional Euclidean space; S42, setting the output layer of the deep learning model to 2 dimensions, encoding the TCR into 2-dimensional data points for visualization, and displaying in a scatter plot.
4. A method of visualizing TCR sequence encoding according to claim 1, wherein, The specific process of the pgen method in step S11 is as follows: S111, obtaining sample TCR beta chain CDR3 region sequence data and its related VDJ gene information; S112, reserve non-productive CDR3 sequences for subsequent analysis; S113, represent each recombined CDR3 sequence with a set of discrete variables, which are VDJ gene information related to the CDR3; S114, obtain a probability P(E) of a recombination event E from the joint distribution of the above discrete variables; S115, generating a probability of a particular CDR3 sequence σ being producible by a recombination event E σ of the sum of probabilities of the recombination events E.
5. A method of visualizing TCR sequence encoding according to claim 1, wherein, The specific process of the TCRdist method in step S32 is as follows: S321, the compared TCR is mapped to the amino acid sequence of its CDR loop; S322, align the CDR sequences based on the multiple sequence alignment method of IMGT reference, and use the BLOSUM62 similarity matrix to calculate the distance score of each position in the aligned sequence; S323, weight and sum the distance scores of each position to obtain the final TCR similarity d.
Citation Information
Patent Citations
Method for screening tumor-specific T cells and TCRs
CN110675914A
Establishment method of antigen-specific TCR database and evaluation method of antigen-specific TCR
CN112133372A