A method of cancer tracing based on RNA sequencing
The cancer origin tracing network built using the transformer model solves the problem of gene information loss in existing methods and achieves high-precision cancer classification.
Patent Information
- Application Number
- CN202211567334.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-07
- Publication Date
- 2026-03-17
- Estimated Expiration
- 2042-12-07
Smart Images

Figure CN115798594B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of tumor origin tracing technology, specifically to a cancer origin tracing method based on RNA sequencing. Background Technology
[0002] Cancer of unknown primary (CUP) is a metastatic tumor that, despite standard diagnostic testing, cannot be located at its primary site. Without accurately identifying the location of the primary cancer, targeted treatment cannot be administered, leading to ineffective treatment and putting the patient at a disadvantage. Therefore, accurately identifying the primary site of cancer is crucial for effective treatment.
[0003] Currently, various cancer tracing methods utilize a wide range of data types, such as gene expression data and DNA methylation data. Among these, methods based on RNA sequencing data include SCOPE, CUP-AI-Dx, and TOD-CUP. Because RNA sequencing data can reach tens of thousands of dimensions, this high-dimensionality makes designing suitable machine learning methods difficult. Many existing machine learning methods suffer from simplistic models or loss of original genetic information. For example, SCOPE uses a simple fully connected network to predict cancer categories, but such networks may not effectively capture gene interactions, impacting classification performance. CUP-AI-Dx introduces convolutional modules into the network, representing an innovation in network design. However, CUP-AI-Dx does not use all genes but pre-screens them, leading to a loss of original genetic information and affecting classification performance. Therefore, to further improve the accuracy of cancer classification, a more robust network structure can be used to effectively capture gene interactions while utilizing all genes, avoiding the loss of original genetic information caused by gene screening. Summary of the Invention
[0004] The purpose of this invention is to provide a cancer tracing method based on RNA sequencing.
[0005] To achieve the above objectives, the present invention adopts the following technical solution:
[0006] A cancer tracing method based on RNA sequencing includes the following steps:
[0007] S1. Obtain TCGAFRESH data, TCGAFPE data, and TCGMETASTATIC data from the cancer data, and preprocess the cancer data.
[0008] S2. Building a cancer tracing network model based on the transformer model;
[0009] S3. Using the preprocessed TCGAFRESH data, the cancer tracing network model is trained to obtain the trained cancer tracing network model.
[0010] S4. Using the preprocessed TCGAFFPE data and TCGAMETASTATIC data as test data, the two test datasets are fed into the trained cancer source tracing network model to classify and trace the source of cancer.
[0011] Preferably, the specific process of step S1 is as follows:
[0012] S11. Obtain TCGAFRESH data, TCGAFPE data, and TCGAMETASTATIC data from the Tumor Genome Atlas (TCGA). There are a total of 32 cancer types. Among them, TCGAFRESH data and TCGAFPE data are sampled from primary lesions, and TCGAMETASTATIC data are sampled from metastatic lesions. All three types of data are in FPKM format.
[0013] S12. For each gene g, if the expression value of gene g in more than half of the samples is 0, then delete gene g; then perform log transformation on the gene data of all processed samples, specifically log(t+1), to obtain the transformed data, where t is the expression value of gene g.
[0014] S13. Assign a label to each cancer type. There are 32 cancer types in total, with the number of labels ranging from 0 to 31. Each cancer type corresponds to a numerical label.
[0015] S14. After the labels are assigned, assign a label to each sample according to the type of cancer to which each sample belongs.
[0016] Preferably, the sample numbers of TCGAFRESH data, TCGAFPE data, and TCGMETASTATIC data in step S11 are 9697, 246, and 391, respectively.
[0017] Preferably, the specific process of step S2 is as follows:
[0018] S21. Process RNA sequencing data using one-dimensional convolution, transforming the raw RNA data x into data x suitable for processing by the transformer model. e , where x∈R 1xW x e ∈R NxPW is the number of genes, P is the dimension of each embedding representation (256 dimensions), N = W / P, and the result of each convolution is the embedding representation.
[0019] S22. Concatenate the learnable category embedding representation with the embedding representation obtained by convolution;
[0020] S23. Add the concatenated embedding representation to the corresponding position embedding representation, retain the position information, and obtain the input data;
[0021] S24. Input the data into the TransformerEncoder editor. The TransformerEncoder editor consists of a multi-head self-attention module and an MLP module. Layernorm operations are applied before these two modules, and each module is connected by residuals. The TransformerEncoder editor has a total of 4 layers.
[0022] S25. Obtain the learnable category embedding representation in the corresponding output representation of the TransformerEncoder editor. Input the result into a two-layer fully connected network to obtain a 32-dimensional output, where each dimension represents the probability of each cancer category. Calculate the cross-entropy loss function using the true labels and the probabilities output by the transformer model, and optimize the transformer model to obtain the cancer tracing network model. The loss function is:
[0023]
[0024] Where K is the number of categories, and y is the true label. If the category is i, then y i If y is 1, otherwise y i y' is 0, representing the probability of cancer output by the network. i ' represents the probability of the i-th type of cancer in the network output.
[0025] Preferably, the specific process of step S3 is as follows: using the preprocessed TCGAFRESH data as training data, inputting it into the cancer tracing network model, and then using the SGD algorithm as the model optimization algorithm, with the learning rate set to 0.005, the batch size set to 128, and the number of training iterations set to 100. When the loss function value of the cancer tracing network model does not decrease for 30 consecutive iterations, the training is stopped, and the final cancer tracing network model is saved to obtain the trained cancer tracing network model.
[0026] Preferably, step S4 further includes performing t-SNE visualization processing on the embedded representation of TCGAFFPE data by the trained cancer tracing network model, clustering samples of the same cancer category together, and separating samples of different cancer categories into different regions.
[0027] After adopting the above technical solution, the present invention has the following beneficial effects: The present invention applies the transformer model to 20,000-dimensional RNA sequencing data. This advanced deep learning network framework can more effectively capture the interaction relationships between genes and learn the potential representation information of various cancers. Moreover, the present invention can use all genes as input, and there is no problem of losing original gene information due to gene screening, which can effectively improve the accuracy of cancer source tracing and classification. Attached Figure Description
[0028] Figure 1 This is a flowchart of the present invention;
[0029] Figure 2 This is a schematic diagram of the cancer tracing network model of the present invention;
[0030] Figure 3 This is a schematic diagram of the structure of the TransformerEncoder editor of this invention;
[0031] Figure 4 This is a visualization result of the t-SNE process of the present invention. Detailed Implementation
[0032] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0033] Example
[0034] like Figures 1 to 4 As shown, a cancer tracing method based on RNA sequencing includes the following steps:
[0035] S1. Obtain TCGAFRESH data, TCGAFPE data, and TCGMETASTATIC data from the cancer data, and preprocess the cancer data.
[0036] The specific process of step S1 is as follows:
[0037] S11. Obtain TCGAFRESH data, TCGAFPE data, and TCGAMETASTATIC data from the Tumor Genome Atlas (TCGA). There are a total of 32 cancer types. Among them, TCGAFRESH data and TCGAFPE data are sampled from primary lesions, and TCGAMETASTATIC data are sampled from metastatic lesions. All three types of data are in FPKM format.
[0038] The sample numbers of TCGAFRESH data, TCGAFPE data, and TCG METASTATIC data mentioned in step S11 are 9697, 246, and 391, respectively;
[0039] S12. For each gene g, if the expression value of gene g in more than half of the samples is 0, then delete gene g; then perform log transformation on the gene data of all processed samples, specifically log(t+1), to obtain the transformed data, where t is the expression value of gene g.
[0040] S13. Assign a label to each cancer type. There are 32 cancer types in total, with the number of labels ranging from 0 to 31. Each cancer type corresponds to a numerical label.
[0041] S14. After the labels are assigned, assign a label to each sample according to the type of cancer to which each sample belongs;
[0042] S2. Building a cancer tracing network model based on the transformer model;
[0043] The specific process of step S2 is as follows:
[0044] S21. Process RNA sequencing data using one-dimensional convolution, transforming the raw RNA data x into data x suitable for processing by the transformer model. e , where x∈R 1xW x e ∈R NxP W is the number of genes, P is the dimension of each embedding representation (256 dimensions), N = W / P, and the result of each convolution is the embedding representation.
[0045] S22. Concatenate the learnable category embedding representation with the embedding representation obtained by convolution;
[0046] S23. Add the concatenated embedding representation to the corresponding position embedding representation, retain the position information, and obtain the input data;
[0047] S24. Input the data into the TransformerEncoder editor. The TransformerEncoder editor consists of a multi-head self-attention module and an MLP module. Layernorm operations are applied before these two modules, and each module is connected by residuals. The TransformerEncoder editor has a total of 4 layers.
[0048] S25. Obtain the learnable category embedding representation in the corresponding output representation of the TransformerEncoder editor. Input the result into a two-layer fully connected network to obtain a 32-dimensional output, where each dimension represents the probability of each cancer category. Calculate the cross-entropy loss function using the true labels and the probabilities output by the transformer model, and optimize the transformer model to obtain the cancer tracing network model. The loss function is:
[0049]
[0050] Where K is the number of categories, and y is the true label. If the category is i, then y i If y is 1, otherwise y i y' is 0, representing the probability of cancer output by the network. i ' represents the probability of the i-th type of cancer in the network output;
[0051] S3. Using the preprocessed TCGAFRESH data, the cancer tracing network model is trained to obtain the trained cancer tracing network model.
[0052] The specific process of step S3 is as follows: the preprocessed TCGAFRESH data is used as training data and input into the cancer tracing network model. The SGD algorithm is then used as the model optimization algorithm, with the learning rate set to 0.005, the batch size set to 128, and the number of training iterations set to 100. Training is stopped when the loss function value of the cancer tracing network model does not decrease for 30 consecutive iterations. The final cancer tracing network model is then saved to obtain the trained cancer tracing network model.
[0053] S4. The preprocessed TCGAFFPE and TCGAMETASTATIC data were used as test data. These two test datasets were fed into the trained cancer source tracing network model to classify and trace the origins of cancer. The evaluation metric used in this invention is accuracy. For the TCGAFFPE data, the accuracy reached 98.78%; for the TCGAMETASTATIC data, the accuracy reached 93.61%. For the TCGAFFPE data, the CLSRepresentation output by the cancer source tracing network model was obtained and subjected to t-SNE visualization processing. Samples of the same cancer category were clustered together, and samples of different cancer categories were separated into different regions. The cancer source tracing classification results are as follows: Figure 4 As shown.
[0054] 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 for RNA sequencing-based cancer tracing, characterized in that, The method comprises the following steps: S1, obtaining TCGA FRESH data, TCGA FFPE data and TCGA METASTATIC data in cancer data, and preprocessing the cancer data; S2, building a cancer tracing network model based on a transformer model; The specific process of step S2 is: S21, processing RNA sequencing data using one-dimensional convolution, converting the original RNA data x into data x suitable for transformer model processing e wherein x e R 1 x W , x e e R N x P , W is the number of genes, P is the dimension of each embedding representation, which is 256 dimensions, N = W / P, and the result of each convolution is an embedding representation; S22, splicing the learnable category embedding representation with the embedding representation obtained by convolution; S23, adding the spliced embedding representation to the corresponding position embedding representation to retain the position information and obtain input data; S24, inputting the input data into an editor Transformer Encoder, the editor Transformer Encoder being composed of a multi-head self-attention module and an MLP module, and applying a Layernorm operation in front of the two modules, and each module being connected by a residual connection, the number of layers of the editor Transformer Encoder being 4 in total, S25, obtaining the output representation of the learnable category embedding representation in the editor Transformer Encoder, inputting the obtained result into a two-layer fully connected network, obtaining a 32-dimensional output, each dimension being the probability of each cancer category, calculating a cross-entropy loss function by using the real label and the probability output by the transformer model and optimizing the transformer model to obtain a cancer tracing network model; the loss function is: where K is the number of classes, y is the true label, and 1 if the class is i, otherwise 0, P(y | x) denotes the probability of cancer output by the network, P(y | x) denotes the probability of the i-th class cancer output by the network; S3, training the cancer tracing network model by using the preprocessed TCGA FRESH data to obtain a trained cancer tracing network model; S4, taking the preprocessed TCGA FFPE data and TCGA METASTATIC data as test data, and inputting the two test data sets into the trained cancer tracing network model to classify and trace the cancer.
2. The RNA sequencing based cancer tracing method as claimed in claim 1, wherein, The specific process of step S1 is: S11, obtaining TCGA FRESH data, TCGA FFPE data and TCGA METASTATIC data from the tumor genome atlas TCGA, and the number of cancer types being 32; wherein the TCGA FRESH data and the TCGA FFPE data are sampled from the primary lesion, the TCGA METASTATIC data are sampled from the metastatic lesion, and the formats of the three kinds of data are FPKM; S12, for each gene g, if the expression value of the gene g of more than half of the samples is 0, the gene g is deleted; then the gene data of all the processed samples are log converted, and the specific operation is log(t+1), wherein t is the expression value of the gene g, to obtain the converted data; S13, assigning a label to each cancer type, and there are 32 cancer types, and the label number is from 0 to 31, and each cancer type corresponds to a digital label; S14, after the label is assigned, assigning a label to each sample according to the cancer type to which the sample belongs.
3. The RNA sequencing based cancer tracing method as claimed in claim 2, wherein: The sample numbers of the TCGA FRESH data, the TCGA FFPE data and the TCGA METASTATIC data in step S11 are 9697, 246 and 391 respectively.
4. The RNA sequencing based cancer tracing method as claimed in claim 3, wherein, The specific process of step S3 is: using the preprocessed TCGA FRESH data as training data, inputting the training data into the cancer tracing network model, using the SGD algorithm as the model optimization algorithm, setting the learning rate to 0.005, setting the batch size to 128, setting the training iteration number to 100, stopping the training when the loss function value of the cancer tracing network model does not decrease continuously for 30 iterations, and saving the finally obtained cancer tracing network model to obtain the trained cancer tracing network model.
5. The RNA sequencing based cancer tracing method as claimed in claim 4, wherein, Step S4 further includes that the trained cancer tracing network model performs t-SNE visualization processing on the embedded representation of the TCGA FFPE data, and samples of the same cancer category are gathered together, and samples of different cancer categories are separated in different regions.
Citation Information
Patent Citations
Method for tracing cancer based on RNA sequencing data
CN112489725A