Method and device for calculating gene expression matrix, electronic equipment and storage medium
By using a parallel processing approach based on genes, the computational performance degradation caused by uneven chromosome data in existing technologies has been solved, realizing a method and apparatus for efficiently generating gene expression matrices, thereby improving computational efficiency and resource utilization.
Patent Information
- Application Number
- CN202310694450.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-12
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-06-12
AI Technical Summary
Existing technologies cannot fully utilize computing resources, especially when dealing with uneven chromosome data, leading to performance degradation and an inability to efficiently generate gene expression matrices.
A parallel processing approach based on genes is adopted, and genes in each chromosome are processed serially. Multi-threaded parallel technology is used to annotate short read data and correct molecular identifiers to generate a gene expression matrix.
It improves computational efficiency, reduces memory usage, and ensures the accuracy of gene expression matrices and full utilization of computational resources.
Smart Images

Figure CN119132425B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data processing technology, and in particular to a method and apparatus for calculating a gene expression matrix, an electronic device, and a storage medium. Background Technology
[0002] Sequencing data is aligned with a reference genome to generate a BAM file. Spatiotemporal analysis requires extracting spatial location information (coordinate data), molecular identifiers, and gene annotations based on alignment positions from the BAM file. After filtering, correction, and deduplication, this information is converted into a gene expression matrix for subsequent gene analysis.
[0003] With the continuous increase in sequencing throughput, the amount of data that the analysis workflow needs to process has increased exponentially, posing severe challenges to program performance and memory usage. Current technologies primarily employ sequential reading of BAM files, which cannot fully utilize the multi-core capabilities of modern processors. While chromosome parallel processing can leverage multi-core concurrency to some extent, the data volume of different chromosomes across different species is not uniform. When encountering uneven data distribution, such as a large data volume on only one chromosome, performance degrades back to single-threaded processing once other chromosomes have been processed. Summary of the Invention
[0004] This disclosure provides a method, apparatus, electronic device, and storage medium for calculating gene expression matrices. Its main objective is to address the problem of insufficient utilization of computing resources in existing technologies.
[0005] According to a first aspect of this disclosure, a method for calculating a gene expression matrix is provided, comprising:
[0006] Based on the gene annotation file, the short read data in the file are annotated to determine the first gene to which the first short read data belongs; wherein, the first short read data is the short read data annotated to the first gene.
[0007] Molecular identifier correction is performed on the first short read data in the first gene to obtain the molecular identifier correction result of the first short read data;
[0008] When performing molecular identification correction on the first short read data, the second short read data is further annotated to determine the second gene to which the second short read data belongs; wherein, the second short read data is the short read data adjacent to the first short read data, and the second gene is the gene adjacent to the first gene in the comparison file;
[0009] Molecular identifier correction was performed on the second short read data in the second gene to obtain the molecular identifier correction result of the second short read data;
[0010] After molecular identifier correction has been performed on all short read data in the alignment file, the corresponding gene expression matrix is output based on the molecular identifier correction results of the first short read data and the molecular identifier correction results of the second short read data.
[0011] Optionally, the step of obtaining first annotation information by comparing and annotating short read data in a gene annotation file, and determining the first gene to which the first short read data belongs, includes:
[0012] Call the annotation thread to obtain the alignment position of the short read data in the alignment file;
[0013] The short read data is annotated according to the gene annotation file and the alignment position to determine the first gene to which the first short read data belongs;
[0014] The annotation thread runs an annotation algorithm to annotate short read data.
[0015] Optionally, before performing molecular identifier correction on the first short read data in the first gene, the method further includes:
[0016] The main thread is invoked to determine whether the first gene is complete based on the gene annotation file and the first short read data.
[0017] The step of performing molecular marker correction on the first short read data in the first gene further includes:
[0018] If the first gene is determined to be intact, the first short read data is then subjected to molecular marker correction.
[0019] Optionally, the method further includes:
[0020] If it is determined that the first gene is incomplete, then continue to annotate the short read data in the alignment file.
[0021] Optionally, the step of performing molecular identifier correction on the first short read data in the first gene to obtain the molecular identifier correction result of the first short read data includes:
[0022] Invoke the correction thread to determine the spatial coordinates and corresponding molecular identifiers in the first short read data;
[0023] All molecular identifiers in the first gene at the same spatial coordinates are corrected to obtain the molecular identifier correction results of the first short read data.
[0024] The correction thread runs a correction algorithm to perform molecular identifier correction on short read data.
[0025] Optionally, the step of correcting all molecular identifiers in the first gene at the same spatial coordinates to obtain the molecular identifier correction result of the first short read data includes:
[0026] Count the number of each molecular identifier in the first short read data;
[0027] Calculate the Hamming distance between any two molecular identifiers based on the base sequence corresponding to the molecular identifier;
[0028] Obtain any two molecular identifiers whose Hamming distance is less than a preset threshold, and modify the first molecular identifier to the second molecular identifier, wherein the molecular identifier with a smaller quantity among any two molecular identifiers is the first molecular identifier, and the molecular identifier with a larger quantity among any two molecular identifiers is the second molecular identifier;
[0029] The number of molecular identifier types is counted to obtain the molecular identifier correction result.
[0030] Optionally, the step of further annotating the second short read data and determining the second gene to which the second short read data belongs during molecular identifier correction of the first short read data includes:
[0031] When the correction thread performs molecular identification correction on the first short read data, the annotation thread is called to annotate the second short read data to determine the second gene to which the second short read data belongs; wherein, the main thread, the annotation thread and the correction thread run in parallel.
[0032] Optionally, when molecular identifier correction has been performed on all short read data in the alignment file, the corresponding gene expression matrix is output based on the molecular identifier correction results of the first short read data and the molecular identifier correction results of the second short read data, including:
[0033] Once all short read data in the comparison file has been corrected, the first gene expression matrix corresponding to the first gene and the second gene expression matrix corresponding to the second gene are output based on the molecular identifier correction results of the first short read data and the molecular identifier correction results of the second short read data, respectively.
[0034] According to a second aspect of this disclosure, a gene expression matrix calculation apparatus is provided, comprising:
[0035] The first annotation unit is used to annotate the short read data in the gene annotation file by comparing them, and to determine the first gene to which the first short read data belongs; wherein, the first short read data is the short read data annotated to the first gene.
[0036] The first correction unit is used to perform molecular identification correction on the first short read data in the first gene to obtain the molecular identification correction result of the first short read data.
[0037] The second annotation unit is used to continue annotating the second short read data while performing molecular identifier correction on the first short read data, and to determine the second gene to which the second short read data belongs; wherein, the second short read data is the short read data adjacent to the first short read data, and the second gene is the gene adjacent to the first gene in the comparison file;
[0038] The second correction unit is used to perform molecular identification correction on the second short read data in the second gene to obtain the molecular identification correction result of the second short read data.
[0039] The output unit is used to output the corresponding gene expression matrix based on the molecular identification correction results of the first short read data and the second short read data, provided that molecular identification correction has been performed on all short read data in the alignment file.
[0040] Optionally, the first annotation unit is further used for:
[0041] The acquisition module is used to call the annotation thread to obtain the alignment position of the short read data in the alignment file; the annotation thread runs an annotation algorithm to annotate the short read data;
[0042] An annotation module is used to annotate the short read data according to the gene annotation file and the alignment position, and to determine the first gene to which the first short read data belongs.
[0043] Optionally, the device further includes:
[0044] The judgment unit is used to call the main thread before performing molecular identification correction on the first short read data in the first gene, and to determine whether the first gene is complete based on the gene annotation file and the first short read data.
[0045] The first correction unit is also used for:
[0046] If the first gene is determined to be intact, the first short read data is then subjected to molecular marker correction.
[0047] Optionally, the device further includes:
[0048] The third annotation unit is used to continue annotating the short read data in the alignment file if it is determined that the first gene is incomplete.
[0049] Optionally, the first correction unit includes:
[0050] The determination module is used to call the correction thread to determine the spatial coordinates and corresponding molecular identifiers in the first short read data; the correction thread runs a correction algorithm to perform molecular identifier correction on the short read data.
[0051] The correction module is used to correct all molecular identifiers in the first gene under the same spatial coordinates to obtain the molecular identifier correction result of the first short read data.
[0052] Optionally, the correction module is further configured to:
[0053] Count the number of each molecular identifier in the first short read data;
[0054] Calculate the Hamming distance between any two molecular identifiers based on the base sequence corresponding to the molecular identifier;
[0055] Obtain any two molecular identifiers whose Hamming distance is less than a preset threshold, and modify the first molecular identifier to the second molecular identifier, wherein the molecular identifier with a smaller quantity among any two molecular identifiers is the first molecular identifier, and the molecular identifier with a larger quantity among any two molecular identifiers is the second molecular identifier;
[0056] The number of molecular identifier types is counted to obtain the molecular identifier correction result.
[0057] Optionally, the second annotation unit is further used for:
[0058] When the correction thread performs molecular identification correction on the first short read data, the annotation thread is called to annotate the second short read data to determine the second gene to which the second short read data belongs; wherein, the main thread, the annotation thread and the correction thread run in parallel.
[0059] Optionally, the output unit is further configured to:
[0060] Once all short read data in the comparison file has been corrected, the first gene expression matrix corresponding to the first gene and the second gene expression matrix corresponding to the second gene are output based on the molecular identifier correction results of the first short read data and the molecular identifier correction results of the second short read data, respectively.
[0061] According to a third aspect of this disclosure, an electronic device is provided, comprising:
[0062] At least one processor; and
[0063] A memory communicatively connected to the at least one processor; wherein,
[0064] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method described in the first aspect above.
[0065] According to a fourth aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are configured to cause the computer to perform the method described in the first aspect above.
[0066] According to a fifth aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the method described in the first aspect above.
[0067] This disclosure provides a method, apparatus, electronic device, and storage medium for calculating a gene expression matrix. Based on a gene annotation file, short reads in the file are annotated to determine the first gene to which the first short read belongs; wherein the first short read is the short read annotated to the first gene; the first short read in the first gene is subjected to molecular identifier correction to obtain the molecular identifier correction result of the first short read; while performing molecular identifier correction on the first short read, second short reads are annotated to determine the second gene to which the second short read belongs; wherein the second short read is the short read adjacent to the first short read, and the second gene is the gene adjacent to the first gene in the comparison file; the second short read in the second gene is subjected to molecular identifier correction to obtain the molecular identifier correction result of the second short read; after all short reads in the comparison file have undergone molecular identifier correction, the corresponding gene expression matrix is output based on the molecular identifier correction results of the first and second short reads. Compared with related technologies, the embodiments of this disclosure, by serially processing different chromosomes and parallel processing the short read data of genes in each chromosome, can make full use of computing resources and improve computing efficiency.
[0068] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0069] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0070] Figure 1 A flowchart illustrating a method for calculating a gene expression matrix provided in an embodiment of this disclosure;
[0071] Figure 2 This is a schematic diagram of a method for calculating a gene expression matrix;
[0072] Figure 3 This is a schematic diagram illustrating the calculation process of a gene expression matrix according to an embodiment of the present disclosure;
[0073] Figure 4 A flowchart illustrating another method for calculating a gene expression matrix provided in this disclosure embodiment;
[0074] Figure 5 A flowchart illustrating another method for calculating a gene expression matrix provided in this disclosure embodiment;
[0075] Figure 6 A schematic diagram of the structure of a gene expression matrix computing device provided in an embodiment of this disclosure;
[0076] Figure 7 A schematic diagram of the structure of another gene expression matrix computing device provided in an embodiment of this disclosure;
[0077] Figure 8 A schematic block diagram of an example electronic device provided for embodiments of this disclosure. Detailed Implementation
[0078] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0079] The following description, with reference to the accompanying drawings, outlines a method and apparatus for calculating gene expression matrices, an electronic device, and a storage medium according to embodiments of the present disclosure.
[0080] Figure 1 This is a flowchart illustrating a method for calculating a gene expression matrix provided in an embodiment of this disclosure.
[0081] like Figure 1 As shown, the method includes the following steps:
[0082] Step 101: Based on the gene annotation file, compare and annotate the short read data in the file to determine the first gene to which the first short read data belongs; wherein, the first short read data is the short read data annotated to the first gene.
[0083] In the embodiments of this disclosure, the alignment file is a BAM file generated after sequencing data is aligned with a reference genome. The BAM file includes, but is not limited to, information such as base sequences, quality values, and alignment positions. At the start of computation, the data reading thread reads short reads from the BAM file from the storage device into memory. The annotation thread compares the read data in memory with the gene annotation file to determine the first gene to which the first short read belongs; the first short read is the currently being processed read. Based on the alignment position of the currently processed read, it determines which gene the current read belongs to. The annotated read data is temporarily stored in memory for subsequent threads to access.
[0084] Step 102: Molecular identifier correction is performed on the first short read data in the first gene to obtain the molecular identifier correction result of the first short read data.
[0085] In the embodiments of this disclosure, when it is detected that the read data being annotated by the annotation thread cannot be annotated to the first gene, the molecular ID (MID) information in the first short read data is corrected. This can be achieved by, but is not limited to, starting a correction thread to perform MID correction on the read data of the first gene. After correction is complete, the molecular ID correction result of the first short read data is obtained. The molecular ID correction result includes both the processing result of the corrected read data and other MID-related information; the embodiments of this disclosure do not constitute a limitation on the molecular ID correction result. The corrected read data is output to a file sequentially using a write data thread, and memory space is released. This process can release memory promptly, ensuring available memory space for subsequent threads and improving program efficiency.
[0086] Step 103: While performing molecular identifier correction on the first short read data, continue to annotate the second short read data to determine the second gene to which the second short read data belongs; wherein, the second short read data is the short read data adjacent to the first short read data, and the second gene is the gene adjacent to the first gene in the alignment file.
[0087] Those skilled in the art will understand that, due to the significant differences in data size for each chromosome, processing BAM files in parallel for each chromosome cannot fully utilize the multi-threaded capabilities of the computer. For details, please refer to... Figure 2While parallel processing of chromosomes can leverage multi-core concurrency to some extent, the data volume of different chromosomes across different species is not uniform. When encountering uneven data distribution, such as a large data volume on one chromosome, performance degrades back to single-threaded processing once other chromosomes have finished processing. This can easily lead to a situation where the thread corresponding to the chromosome with smaller data volume has already completed processing, while the thread corresponding to the chromosome with larger data volume is still processing.
[0088] In the embodiments of this disclosure, concurrency is achieved on a gene-by-gene basis, thereby solving the problem of drastic performance drops when chromosome data is uneven. The program can process each chromosome serially, and while processing each chromosome, multiple threads process the data of each gene, thus improving concurrency efficiency. Please refer to [link to relevant documentation]. Figure 3 While correcting the read data corresponding to the first gene, the annotation thread and the read data thread continue to run, annotating the read data after the first gene to obtain the second gene corresponding to the second short read data. Since the BAM file is sorted by alignment position, when the start position of a read exceeds the end position of a gene, it means that all read data for this gene has been collected, and no more reads will be annotated for this gene.
[0089] Step 104: Perform molecular identification correction on the second short read data in the second gene to obtain the molecular identification correction result of the second short read data.
[0090] In the embodiments of this disclosure, the annotation thread temporarily stores the annotated read data in memory before continuing to annotate other read data in the bam file. Meanwhile, another correction thread can be started to correct the read data of the second gene. As the program continues to run, a new correction thread is started for each gene, achieving a multi-threaded concurrent effect. This parallel processing on a gene-by-gene basis and serial processing on chromosomes can fully utilize the processor's multi-threaded processing capabilities and improve the processing efficiency of the gene expression matrix.
[0091] Step 105: After molecular identifier correction has been performed on all short read data in the alignment file, the corresponding gene expression matrix is output based on the molecular identifier correction results of the first short read data and the molecular identifier correction results of the second short read data.
[0092] In the embodiments of this disclosure, when the MID correction thread finishes running, the data writing thread outputs the read data in memory sequentially to a file, freeing up memory space for correction of other genes. After MID correction has been performed on all read data in all bam files, the gene expression matrix is output. This embodiment of the disclosure solves the problem of excessive memory usage in the prior art when processing data on a chromosome-by-chromosome basis; by reading data gene by gene instead of loading all read data of the current chromosome into memory, memory usage can be reduced.
[0093] This disclosure provides a method for calculating a gene expression matrix. Based on a gene annotation file, short reads in the file are annotated to determine the first gene to which the first short read belongs. The first short read is the short read annotated to the first gene. Molecular identification correction is performed on the first short read in the first gene to obtain the molecular identification correction result. While performing molecular identification correction on the first short read, second short reads are annotated to determine the second gene to which the second short read belongs. The second short read is the short read adjacent to the first short read, and the second gene is the gene adjacent to the first gene in the comparison file. Molecular identification correction is performed on the second short read in the second gene to obtain the molecular identification correction result. After molecular identification correction has been performed on all short reads in the comparison file, the corresponding gene expression matrix is output based on the molecular identification correction results of the first and second short reads. Compared with related technologies, the embodiments of this disclosure, by serially processing different chromosomes and parallel processing the short read data of genes in each chromosome, can make full use of computing resources and improve computing efficiency.
[0094] To clearly illustrate the embodiments of this disclosure, a flowchart illustrating another method for calculating a gene expression matrix is provided.
[0095] like Figure 4 As shown, the method includes the following steps:
[0096] Step 201: Call the annotation thread to obtain the comparison position of the short read data in the comparison file.
[0097] Step 202: Annotate the short read data according to the gene annotation file and the alignment position to determine the first gene to which the first short read data belongs.
[0098] Specifically, in this embodiment of the disclosure, the alignment position information in the BAM file, as well as the start and end positions of the gene annotation file, are obtained by the annotation thread to find and compare which gene the currently processed read data belongs to, and update the annotated gene name into the read data and store it in memory so that subsequent threads can read it for computation.
[0099] Step 203: Invoke the main thread to determine whether the first gene is complete based on the gene annotation file and the first short read data.
[0100] Specifically, in this embodiment of the disclosure, after annotating the current read data, it is necessary to determine whether the first annotated gene is complete. This can avoid errors when outputting the gene expression matrix later. Since the BAM file is sorted by alignment position, when the start position of a read exceeds the end position of a gene, it means that all read data for this gene has been collected, and no more reads will be annotated to this gene. For example, if the main thread detects that the alignment start position of an annotated read exceeds 2000, since the BAM file is sorted by position, this means that subsequent read data will not have the opportunity to be annotated to gene A (1000, 2000).
[0101] Step 204: Molecular identifier correction is performed on the first short read data.
[0102] Specifically, in this embodiment of the disclosure, if it is determined that the first gene annotation is complete, then step 206 is executed. That is, the main thread starts the MID correction thread to perform MID correction processing on the molecular identifier.
[0103] Step 205: Continue to annotate the short read data in the comparison file.
[0104] Specifically, in this embodiment of the disclosure, as explained above: since the BAM files are sorted by alignment position, when the start position of a read exceeds the end position of a gene, it indicates that all read data for that gene has been collected, and no more reads will be annotated for that gene. If the first gene is determined to be incomplete, the read data in the BAM file needs to be annotated further to ensure the completeness and accuracy of the output gene expression matrix.
[0105] Step 206: Invoke the correction thread to determine the spatial coordinates and corresponding molecular identifiers in the first short read data.
[0106] Specifically, in this embodiment of the disclosure, by obtaining the annotated read data through the correction thread, information such as spatial coordinates, MID, and genes can be obtained, and MID correction can be performed on the current first short read data.
[0107] Step 207: Correct all molecular identifiers in the first gene at the same spatial coordinates to obtain the molecular identifier correction results of the first short read data.
[0108] As one possible implementation of this disclosure, for a gene expression matrix, the number of each molecular identifier in the first short read data is counted; the Hamming distance between any two molecular identifiers is calculated based on the base sequence corresponding to the molecular identifier; any two molecular identifiers with a Hamming distance less than a preset threshold are obtained, and the sum of the numbers of any two molecular identifiers is calculated based on the number of any two molecular identifiers, wherein the molecular identifier with a smaller number among any two molecular identifiers is the first molecular identifier, and the molecular identifier with a larger number among any two molecular identifiers is the second molecular identifier; the number of the second molecular identifiers is updated to the sum of the numbers; the first molecular identifier is deleted; the number of molecular identifier types is counted to obtain the molecular identifier correction result. For a BAM file, after obtaining any two molecular identifiers with a Hamming distance less than the preset threshold, the method further includes: modifying the first molecular identifier to the second molecular identifier, wherein the molecular identifier with a smaller number among any two molecular identifiers is the first molecular identifier, and the molecular identifier with a larger number among any two molecular identifiers is the second molecular identifier; and updating the information of the modified molecular identifier to the BAM file.
[0109] Specifically, in this embodiment of the disclosure, when performing MID correction, all MIDs of the same gene under the same spatial coordinates are processed. First, the number of each type of MID is counted. Then, the Hamming distance between any two MIDs is calculated. For MID pairs whose Hamming distance meets a preset threshold, the MIDs with fewer MIDs are corrected to MIDs with more MIDs. Finally, the number of MID types of the same gene under the same spatial coordinates is counted.
[0110] Step 208: When the correction thread performs molecular identification correction on the first short read data, the annotation thread is called to annotate the second short read data to determine the second gene to which the second short read data belongs; wherein, the main thread, the annotation thread and the correction thread run in parallel.
[0111] For details in the embodiments disclosed herein, please refer to the following: Figure 3After the main thread starts the MID correction thread, the annotation thread continues to annotate the short reads following the first short read, obtaining the second short read corresponding to the second gene. After the annotation thread annotates the second gene, it continues to annotate the short reads following the second gene. After the annotation thread finishes annotating the second gene, the main thread starts another MID correction thread to perform correction processing, achieving parallel processing of genes in the BAM file. The main thread, annotation thread, and correction thread run in parallel. For example, after the annotation thread finishes annotating the first short read, a correction thread 1 is started to correct the first short read. The annotation thread continues to annotate the second short read. After the annotation is completed, a correction thread 2 is started to correct the second short read.
[0112] Step 209: After all the short read data in the comparison file has been corrected, the first gene expression matrix corresponding to the first gene and the second gene expression matrix corresponding to the second gene are output according to the molecular identifier correction results of the first short read data and the molecular identifier correction results of the second short read data.
[0113] After performing MID correction on all read data in all bam files, the gene expression matrix is output based on the data collected in step 206 and the results of molecular identifier correction.
[0114] Gene expression matrix: This file has four columns: gene name, x-coordinate, y-coordinate, and number of MID types. Example: "NOC2L 78845 57735 1".
[0115] To clearly illustrate the embodiments of this disclosure, this disclosure provides a flowchart of another method for calculating a gene expression matrix.
[0116] like Figure 5 As shown, the method includes the following steps:
[0117] Step 301: The data reading thread reads the data into memory sequentially.
[0118] Step 302: The annotation thread compares the read data in memory with the gene annotation file and updates the annotated gene names.
[0119] Step 303: The main thread detects that the read annotation corresponding to gene A is complete, and the main thread starts MID correction thread 1.
[0120] Specifically, when the main thread detects that the alignment start position of a certain read after annotation exceeds 2000, since the BAM file is sorted by position, this means that subsequent reads will no longer have the opportunity to be annotated to gene A (1000, 2000). The main thread starts MID correction thread 1, which performs MID correction on all data before the current read based on Hamming distance. When the Hamming distance is less than the threshold, the fewer MIDs are corrected to the more MIDs.
[0121] Step 304: When MID correction thread 1 is running, the thread detects that the read annotation corresponding to gene B is completed, and the main thread starts MID correction thread 2.
[0122] Specifically, while MID correction thread 1 is running, the data reading thread and the annotation thread continue to run; when the main thread detects that the alignment start position of a certain read after annotation exceeds 3000, which means that subsequent reads will no longer have the opportunity to be annotated to gene B (2001, 3000), the main thread starts MID correction thread 2 to perform MID correction on the reads of gene B.
[0123] Step 305: When MID correction threads 1 and 2 are running, the thread detects that the read annotation corresponding to gene C is completed, and the main thread starts MID correction thread 3.
[0124] Specifically, when the main thread detects that the alignment start position of a read after annotation exceeds 4000, which means that subsequent reads will no longer have the opportunity to be annotated to gene C (2001, 3000), the main thread starts MID correction thread 3 to perform MID correction on the reads of gene C.
[0125] Step 306: When all MID correction threads have finished running, the data writing thread outputs the read data in memory to the file in sequence, freeing up space for other genes. In this example, the processing ends when all three gene data have been processed.
[0126] Step 307: Once all genes have been processed, output the gene expression matrix.
[0127] For a description of the embodiments of this disclosure, please refer to the above embodiments and... Figure 3 For the purposes of this disclosure, the embodiments will not be described in detail.
[0128] Corresponding to the above-described method for calculating the gene expression matrix, this invention also proposes a device for calculating the gene expression matrix. Since the device embodiments of this invention correspond to the method embodiments described above, details not disclosed in the device embodiments can be referred to in the method embodiments described above, and will not be repeated here.
[0129] Figure 6 This is a schematic diagram of the structure of a gene expression matrix computing device provided in an embodiment of this disclosure, as shown below. Figure 6 As shown, it includes:
[0130] The first annotation unit 41 is used to annotate the short read data in the gene annotation file by comparing them, and to determine the first gene to which the first short read data belongs; wherein, the first short read data is the short read data annotated to the first gene.
[0131] The first correction unit 42 is used to perform molecular identification correction on the first short read data in the first gene to obtain the molecular identification correction result of the first short read data.
[0132] The second annotation unit 43 is used to continue annotating the second short read data when performing molecular identifier correction on the first short read data, and to determine the second gene to which the second short read data belongs; wherein, the second short read data is short read data adjacent to the first short read data, and the second gene is the gene adjacent to the first gene in the comparison file;
[0133] The second correction unit 44 is used to perform molecular identification correction on the second short read data in the second gene to obtain the molecular identification correction result of the second short read data.
[0134] The output unit 45 is used to output the corresponding gene expression matrix based on the molecular identification correction results of the first short read data and the second short read data, after all short read data in the alignment file have undergone molecular identification correction.
[0135] This disclosure provides a gene expression matrix calculation device. Based on a gene annotation file, it compares and annotates short read data in the file to determine the first gene to which the first short read data belongs; wherein the first short read data is the short read data annotated to the first gene; the first short read data in the first gene is subjected to molecular identifier correction to obtain the molecular identifier correction result of the first short read data; while performing molecular identifier correction on the first short read data, it continues to annotate second short read data to determine the second gene to which the second short read data belongs; wherein the second short read data is the short read data adjacent to the first short read data, and the second gene is the gene adjacent to the first gene in the comparison file; the second short read data in the second gene is subjected to molecular identifier correction to obtain the molecular identifier correction result of the second short read data; after all short read data in the comparison file has undergone molecular identifier correction, the corresponding gene expression matrix is output based on the molecular identifier correction results of the first short read data and the molecular identifier correction results of the second short read data. Compared with related technologies, the embodiments of this disclosure, by serially processing different chromosomes and parallel processing the short read data of genes in each chromosome, can make full use of computing resources and improve computing efficiency.
[0136] Furthermore, in one possible implementation of this embodiment, such as Figure 7 As shown, the first annotation unit 41 further includes:
[0137] The acquisition module 411 is used to call the annotation thread to obtain the alignment position of the short read data in the alignment file; the annotation thread runs an annotation algorithm to annotate the short read data;
[0138] Annotation module 412 is used to annotate the short read data according to the gene annotation file and the alignment position, and to determine the first gene to which the first short read data belongs.
[0139] Furthermore, in one possible implementation of this embodiment, such as Figure 7 As shown, the device further includes:
[0140] The judgment unit 46 is used to call the main thread before performing molecular identification correction on the first short read data in the first gene, and to determine whether the first gene is complete based on the gene annotation file and the first short read data.
[0141] The first correction unit 42 is also used for:
[0142] If the first gene is determined to be intact, the first short read data is then subjected to molecular marker correction.
[0143] Furthermore, in one possible implementation of this embodiment, such as Figure 7 As shown, the device further includes:
[0144] The third annotation unit 47 is used to continue annotating the short read data in the alignment file if it is determined that the first gene is incomplete.
[0145] Furthermore, in one possible implementation of this embodiment, such as Figure 7 As shown, the first correction unit 42 includes:
[0146] The determination module 421 is used to call the correction thread to determine the spatial coordinates and corresponding molecular identifiers in the first short read data; the correction thread runs a correction algorithm to perform molecular identifier correction on the short read data.
[0147] The correction module 422 is used to correct all molecular identifiers in the same spatial coordinates of the first gene to obtain the molecular identifier correction result of the first short read data.
[0148] Furthermore, in one possible implementation of this embodiment, such as Figure 7 As shown, the correction module 422 is further used for:
[0149] Count the number of each molecular identifier in the first short read data;
[0150] Calculate the Hamming distance between any two molecular identifiers based on the base sequence corresponding to the molecular identifier;
[0151] Obtain any two molecular identifiers whose Hamming distance is less than a preset threshold, and modify the first molecular identifier to the second molecular identifier, wherein the molecular identifier with a smaller quantity among any two molecular identifiers is the first molecular identifier, and the molecular identifier with a larger quantity among any two molecular identifiers is the second molecular identifier;
[0152] The number of molecular identifier types is counted to obtain the molecular identifier correction result.
[0153] Furthermore, in one possible implementation of this embodiment, the second annotation unit 43 is also used for:
[0154] When the correction thread performs molecular identification correction on the first short read data, the annotation thread is called to annotate the second short read data to determine the second gene to which the second short read data belongs; wherein, the main thread, the annotation thread and the correction thread run in parallel.
[0155] Furthermore, in one possible implementation of this embodiment, the output unit 45 is further configured to:
[0156] Once all short read data in the comparison file has been corrected, the first gene expression matrix corresponding to the first gene and the second gene expression matrix corresponding to the second gene are output based on the molecular identifier correction results of the first short read data and the molecular identifier correction results of the second short read data, respectively.
[0157] It should be noted that the foregoing explanation of the method embodiments also applies to the apparatus of this embodiment, and the principle is the same, so it is not limited in this embodiment.
[0158] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0159] Figure 8 A schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0160] like Figure 8 As shown, device 500 includes a computing unit 501, which can perform various appropriate actions and processes based on a computer program stored in ROM (Read-Only Memory) 502 or a computer program loaded from storage unit 508 into RAM (Random Access Memory) 503. RAM 503 can also store various programs and data required for the operation of device 500. The computing unit 501, ROM 502, and RAM 503 are interconnected via bus 504. I / O (Input / Output) interface 505 is also connected to bus 504.
[0161] Multiple components in device 500 are connected to I / O interface 505, including: input unit 506, such as keyboard, mouse, etc.; output unit 507, such as various types of monitors, speakers, etc.; storage unit 508, such as disk, optical disk, etc.; and communication unit 509, such as network card, modem, wireless transceiver, etc. Communication unit 509 allows device 500 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0162] The computing unit 501 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, CPUs (Central Processing Units), GPUs (Graphics Processing Units), various special-purpose AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSPs (Digital Signal Processors), and any suitable processor, controller, microcontroller, etc. The computing unit 501 performs the various methods and processes described above, such as the method for calculating a gene expression matrix. For example, in some embodiments, the method for calculating a gene expression matrix can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as storage unit 508. In some embodiments, part or all of the computer program can be loaded and / or installed on device 500 via ROM 502 and / or communication unit 509. When the computer program is loaded into RAM 503 and executed by the computing unit 501, one or more steps of the methods described above can be performed. Alternatively, in other embodiments, the computing unit 501 may be configured to perform the aforementioned gene expression matrix calculation method by any other suitable means (e.g., by means of firmware).
[0163] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application-Specific Standard Products), SOCs (System-on-Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0164] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0165] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0166] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0167] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include LANs (Local Area Networks), WANs (Wide Area Networks), the Internet, and blockchain networks.
[0168] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service ecosystem, addressing the shortcomings of traditional physical hosts and VPS (Virtual Private Server, or simply "VPS") services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers incorporating blockchain technology.
[0169] It's important to note that artificial intelligence (AI) is the study of enabling computers to simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, and big data processing. AI software technologies primarily include computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graph technologies.
[0170] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0171] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for calculating a gene expression matrix, characterized in that, include: Based on the gene annotation file, the short read data in the file are annotated to determine the first gene to which the first short read data belongs; wherein, the first short read data is the short read data annotated to the first gene. Molecular identifier correction is performed on the first short read data in the first gene to obtain the molecular identifier correction result of the first short read data; When performing molecular identification correction on the first short read data, the second short read data is further annotated to determine the second gene to which the second short read data belongs; wherein, the second short read data is the short read data adjacent to the first short read data, and the second gene is the gene adjacent to the first gene in the comparison file; Molecular identifier correction was performed on the second short read data in the second gene to obtain the molecular identifier correction result of the second short read data; After molecular identifier correction has been performed on all short read data in the alignment file, the corresponding gene expression matrix is output based on the molecular identifier correction results of the first short read data and the molecular identifier correction results of the second short read data.
2. The method according to claim 1, characterized in that, The step of comparing and annotating short read data in a gene annotation file to determine the first gene to which the first short read data belongs includes: Call the annotation thread to obtain the alignment position of the short read data in the alignment file; The short read data is annotated according to the gene annotation file and the alignment position to determine the first gene to which the first short read data belongs; The annotation thread runs an annotation algorithm to annotate short read data.
3. The method according to claim 1, characterized in that, Before performing molecular identifier correction on the first short read data in the first gene, the method further includes: The main thread is invoked to determine whether the first gene is complete based on the gene annotation file and the first short read data. The step of performing molecular marker correction on the first short read data in the first gene further includes: If the first gene is determined to be intact, the first short read data is then subjected to molecular marker correction.
4. The method according to claim 3, characterized in that, The method further includes: If it is determined that the first gene is incomplete, then continue to annotate the short read data in the alignment file.
5. The method according to claim 1, characterized in that, The step of performing molecular identifier correction on the first short read data in the first gene to obtain the molecular identifier correction result of the first short read data includes: Invoke the correction thread to determine the spatial coordinates and corresponding molecular identifiers in the first short read data; All molecular identifiers in the first gene at the same spatial coordinates are corrected to obtain the molecular identifier correction results of the first short read data. The correction thread runs a correction algorithm to perform molecular identifier correction on short read data.
6. The method according to claim 5, characterized in that, The step of correcting all molecular identifiers in the same spatial coordinates of the first gene to obtain the molecular identifier correction result of the first short read data includes: Count the number of each molecular identifier in the first short read data; Calculate the Hamming distance between any two molecular identifiers based on the base sequence corresponding to the molecular identifier; Obtain any two molecular identifiers whose Hamming distance is less than a preset threshold, and modify the first molecular identifier to the second molecular identifier, wherein the molecular identifier with a smaller quantity among any two molecular identifiers is the first molecular identifier, and the molecular identifier with a larger quantity among any two molecular identifiers is the second molecular identifier; The number of molecular identifier types is counted to obtain the molecular identifier correction result.
7. The method according to any one of claims 1-6, characterized in that, The step of further annotating the second short read data during molecular identifier correction of the first short read data to determine the second gene to which the second short read data belongs includes: When the correction thread performs molecular identification correction on the first short read data, the annotation thread is called to annotate the second short read data to determine the second gene to which the second short read data belongs; wherein, the main thread, the annotation thread and the correction thread run in parallel.
8. The method according to claim 1, characterized in that, When all short read data in the alignment file have undergone molecular identifier correction, based on the molecular identifier correction results of the first short read data and the molecular identifier correction results of the second short read data, the corresponding gene expression matrix is output, including: Once all short read data in the comparison file has been corrected, the first gene expression matrix corresponding to the first gene and the second gene expression matrix corresponding to the second gene are output based on the molecular identifier correction results of the first short read data and the molecular identifier correction results of the second short read data, respectively.
9. A computational device for a gene expression matrix, characterized in that, include: The first annotation unit is used to annotate the short read data in the gene annotation file by comparing them, and to determine the first gene to which the first short read data belongs; wherein, the first short read data is the short read data annotated to the first gene. The first correction unit is used to perform molecular identification correction on the first short read data in the first gene to obtain the molecular identification correction result of the first short read data. The second annotation unit is used to continue annotating the second short read data while performing molecular identifier correction on the first short read data, and to determine the second gene to which the second short read data belongs; wherein, the second short read data is the short read data adjacent to the first short read data, and the second gene is the gene adjacent to the first gene in the comparison file; The second correction unit is used to perform molecular identification correction on the second short read data in the second gene to obtain the molecular identification correction result of the second short read data. The output unit is used to output the corresponding gene expression matrix based on the molecular identification correction results of the first short read data and the second short read data, provided that molecular identification correction has been performed on all short read data in the alignment file.
10. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-8.
11. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-8.
12. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method according to any one of claims 1-8.
Citation Information
Patent Citations
Method and device for analyzing sequencing data of space transcriptome chip
CN115331733A
Shared memory-based gene analysis method and apparatus, and computer device
WO2022082878A1
