Data processing method and related device
By configuring compression parameters and blocking information in the file header, FASTQ files are processed and compressed in blocks, which solves the problem of low efficiency in the existing technology and achieves efficient compression and decompression of gene sequencing files, which is suitable for large amounts of data. storage and transmission.
Patent Information
- Application Number
- PCT/CN2024/072222
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-13
- Filing Date
- 2024-01-15
- Publication Date
- 2024-09-19
AI Technical Summary
Existing data compression technology is inefficient when processing gene sequencing files. Especially during the compression and decompression process of FASTQ files, a large number of models and parameters need to be maintained, resulting in high computing resource usage and long processing time, which cannot meet the needs of efficient storage and transmission. needs.
By pre-configuring compression parameters and chunking information in the file header, the file to be compressed is processed into chunks, and specific compression algorithms and models are used to compress and decompress each chunk, defining a new compressed file format to improve efficiency.
It achieves efficient compression and decompression of gene sequencing files, reduces storage and computing resource usage, significantly improves compression efficiency, and is suitable for storage and transmission scenarios of large amounts of data.
Smart Images

Figure CN2024072222_19092024_PF_FP_ABST
Abstract
Description
A data processing method and related equipment
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on March 13, 2023, with application number 202310303465.3 and invention name “A data processing method and related equipment”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of storage technology, and in particular to a data processing method and related equipment. Background Art
[0003] Faced with the rapid growth of data, enterprises need to continuously purchase large quantities of storage devices to meet the ever-increasing storage needs. However, simply increasing storage capacity does not seem to fundamentally solve the problem. The concept of efficient storage was proposed precisely to address this issue. It aims to alleviate the problem of storage system space growth, reduce data usage, simplify storage management, maximize the utilization of existing resources, and reduce costs. Data compression technology is one of the key technologies for data reduction, reducing data capacity by re-encoding data to reduce redundancy.
[0004] Current data compression technology cannot meet the needs of some scenarios. For example, with the widespread application of genetic data, when compressing genetic sequencing files, there are problems such as the need to record massive parameters of the compression model, the need to maintain multiple compression models, or the need for bit-level dynamic encoding. This will occupy a large storage space, use more computing resources, and consume a long processing time, resulting in low compression efficiency.
[0005] Based on this, it is urgent to provide a more reasonable data processing method to overcome the problem of low compression efficiency of current data compression technology.
[0006] Summary of the Invention
[0007] Based on this, the present application provides a data processing method and related equipment, which can quickly compress the data to be compressed with a high compression rate, making the storage of the data to be compressed easier.
[0008] In a first aspect, the present application provides a data processing method, which may include: obtaining a file header, the file header including: block information, description information compression parameters, sequence compression parameters and quality score compression parameters; obtaining multiple blocks based on the block information and a first file, each of the multiple blocks including first description information, a first sequence and a first quality score; compressing the first description information, the first sequence and the first quality score in each of the multiple blocks according to the description information compression parameters, the sequence compression parameters and the quality score compression parameters, respectively, to obtain a data block corresponding to each block in the multiple blocks, the data block including: a compression result of the description information of the corresponding block, a compression result of the sequence and a compression result of the quality score; obtaining a second file, the second file being a compressed file of the first file, the second file including: the file header and a data block corresponding to each block in the multiple blocks. In this way, by defining a compressed file format, the compression scheme related parameters are pre-configured in the file header of the file that conforms to the defined compressed file format, the file is divided into blocks and compressed according to the instructions of the file header, and the compression result is filled into the data block after the file header in a manner that conforms to the defined compressed file format to obtain the compressed file, thereby achieving efficient data compression.
[0009] In one possible implementation, obtaining multiple blocks based on the block information and the first file may include: performing block processing on the first file based on the block information to obtain multiple data entry sets, each data entry set in the multiple data entry sets including at least one group of data entries; classifying the data entries in any data entry set in the multiple data entry sets according to data types to obtain blocks corresponding to the any data entry set, where the data type includes at least one of descriptive information, sequence, and quality score.
[0010] As an example, if the block information includes a memory size identifier (memID), then the step of segmenting the first file according to the block information to obtain multiple data entry sets may include: determining memory information according to the memID; and segmenting the first file based on the memory information to obtain the multiple data entry sets. The memory information may refer to a memory upper limit or memory size of each block.
[0011] As an example, taking the example of any data entry set including a first data entry and a second data entry, the first data entry includes second description information, a second sequence and a second quality score, and the second data entry includes third description information, a third sequence and a third quality score, then, in the block corresponding to any data entry set, the first description information includes the second description information and the third description information, the first sequence includes the second sequence and the third sequence, and the first quality score includes the second quality score and the third quality score.
[0012] In one possible implementation, the block corresponding to any one of the data entry sets may further include length information for each data entry in the set, where the length information is the length of the sequence or the length of the quality score of the corresponding data entry. The data block also includes compressed data of the length information for each data entry in the corresponding block. This provides the necessary basis for subsequent decompression of the second file.
[0013] In one possible implementation, the quality score compression parameter includes: a first parameter and a second parameter, the first parameter is used to indicate a context model, the context model is used to determine a characteristic value of a context string of a character to be encoded, and the second parameter is used to determine a compression model corresponding to the characteristic value.
[0014] As an example, compressing the first quality score in each of the multiple blocks based on the quality score compression parameter may include: obtaining a context string for any quality score character from among the multiple quality score characters in any of the multiple blocks; determining a feature value for the quality score character based on the first parameter and the context string for the quality score character; determining a target compression model based on the second parameter and the feature value for the quality score character; compressing the quality score character based on the target compression model; and obtaining a compression result for the first quality score corresponding to the block based on the compression results for the multiple quality score characters. In this way, dynamic compression is performed on a quality score-by-quality score character basis. Since the feature value for each quality score character has been uniformly calculated in advance, although it is necessary to continuously maintain the target compression model used in the past and update the historical feature values corresponding to the same feature value with the latest target compression model, which places greater pressure on memory and processing, it is also more efficient than current compression schemes.
[0015] Determining a target compression model based on the second parameter and the characteristic value of any quality score character may include: sorting the quality score characters in any block according to the characteristic value to obtain multiple groups of quality score character strings, wherein each group of quality score character strings has the same characteristic value; and determining a first compression model for a first quality score character string in the multiple groups of quality score character strings based on the characteristic value corresponding to the first quality score character string. Thus, compressing any quality score character based on the target compression model may include compressing the first quality score character string based on the first compression model. By classifying quality score characters according to their characteristic values, the number of compression executions is reduced. Furthermore, after compression is completed for each quality score character string corresponding to the characteristic value, the target compression model corresponding to that characteristic value need not be maintained in memory, enabling fast and efficient "static" encoding and reducing memory and processing pressure.
[0016] As an example, in the technical solution of "static" encoding, in order to effectively restore the first file, the second file may further include: a feature value of the first quality score character in any block.
[0017] In one possible implementation, the quality score compression parameters further include a third parameter indicating a string length threshold for performing compression. The method may further include: storing quality score strings whose lengths are less than the string length threshold in the multiple sets of quality score strings into a target area; and compressing the quality score strings in the target area based on a universal compression algorithm. This avoids multiple individual compressions of very short quality score strings. By accumulating these shorter quality score strings into the target area and uniformly compressing them using the universal compression algorithm, compression efficiency is effectively improved.
[0018] In a possible implementation, the description information compression parameters may include: a segmentation strategy and a second compression model. Then, compressing the first description information in each of the multiple blocks according to the description information compression parameters may include: segmenting the first description information in any of the multiple blocks according to the segmentation strategy to obtain multiple description fragments; for any of the multiple description fragments, performing the following steps according to the second compression model: if any of the description fragments belongs to integer type data, then converting the any description fragment into binary and then compressing it; if any of the description fragments does not belong to integer type data, then compressing the any description fragment using the LZ algorithm; and obtaining the compression result of the description information corresponding to any block based on the compression results corresponding to the multiple description fragments. In this way, rapid compression of the description information in each block is achieved.
[0019] In one possible implementation, the sequence compression parameters may include a packing length and a third compression model. Compressing the first sequence in each of the multiple blocks based on the sequence compression parameters may include: processing the first sequence in any of the multiple blocks according to an N-pack strategy to obtain a fourth sequence, where N is an integer greater than 1 and matches the packing length; and compressing the fourth sequence according to the third compression model to obtain a compression result for the sequence corresponding to any of the blocks. In this way, rapid compression of the sequence in each block is achieved.
[0020] In one possible implementation, the compression result of the description information may include the size of the description information after compression and the first compressed stream corresponding to the description information, the first compressed stream including the compressed data of the description information; the compression result of the sequence may include the size of the sequence after compression and the second compressed stream corresponding to the sequence, the second compressed stream including the compressed data of the sequence; the compression result of the quality score may include the size of the quality score after compression and the third compressed stream corresponding to the quality score, the third compressed stream including the compressed data of the quality score. In addition, the compression result of the description information may also include the size of the description information before compression, so as to let the user know the size of the part after decompression and provide a reference for the user's decompression. Similarly, the compression result of the sequence may also include the size of the sequence before compression, and the compression result of the quality score may also include the size of the quality score before compression.
[0021] In a possible implementation, the file header further includes at least one of the following fields: a format signature, a file size, a third line status, or a check digit.
[0022] In one possible implementation, the second file further includes a directory block, and the target block indicates the sequence number of the first data entry in the block, the position of the block in the second file, and the position of the block in the first file. This facilitates a user to randomly read a portion of data in the second file.
[0023] In a possible implementation, the first file is a FASTQ file.
[0024] In one possible implementation, the method may further include: decompressing multiple data blocks in the second file based on the file header of the second file to obtain the first file. In this way, efficient decompression of the highly compressed file is achieved, providing a basis for friendly file storage.
[0025] In a second aspect, the present application further provides a data processing method, which may include: obtaining feature values of multiple characters included in first data based on the above model, wherein the feature value of any character in the multiple characters is used to characterize the features of the above string of a preset length of the any character; determining a target compression model based on the feature value of the any character; and compressing the any character based on the target compression model to obtain second data, wherein the second data is the compression result of the first data. In this way, high-efficiency compression of the high-order model is achieved while occupying less storage space.
[0026] In one possible implementation, obtaining the characteristic values of multiple characters included in the first data based on the above model may include: obtaining a context string of a preset length for any character among the multiple characters; and determining the characteristic value of any character based on the compressed length of each context character in the above string, each context character in the above string and a preset calculation rule.
[0027] In one possible implementation, determining a target compression model based on the feature value of any character may include: sorting multiple characters in the first data according to the feature value to obtain multiple groups of character strings, wherein each group of character strings has the same feature value; and determining a first compression model for a first group of character strings in the multiple groups of character strings based on the feature values corresponding to the first group of character strings and a mapping relationship, wherein the mapping relationship includes a correspondence between multiple groups of feature values and compression models. Then, compressing any character based on the target compression model to obtain second data may include: compressing the first group of character strings based on the first compression model to obtain third data, wherein the second data includes the third data.
[0028] The first data may be a quality score in any block after the FASTQ file is segmented.
[0029] In a third aspect, the present application provides a communication device, which includes a processing unit, and the processing unit is used to implement the methods corresponding to the first aspect, the second aspect and their possible implementation methods.
[0030] In a fourth aspect, the present application provides a communication device, comprising a processor and a memory; the processor is used to execute instructions stored in the memory so that the communication device implements the methods corresponding to the first aspect, the second aspect and their possible implementation methods.
[0031] In a fifth aspect, the present application also provides a storage medium storing instructions, which, when executed on a processor, implement the methods corresponding to the first aspect, the second aspect, and possible implementations thereof.
[0032] In a sixth aspect, the present application also provides a program product, which includes a program. When the program runs on a processor, it implements the methods corresponding to the first aspect, the second aspect and their possible implementation methods.
[0033] In the seventh aspect, the present application provides a chip including a memory and a processor, the memory being used to store instructions, and the processor being used to call and execute the instructions from the memory to implement the methods corresponding to the first aspect, the second aspect and their possible implementation methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] FIG1 is a schematic diagram of a compressed FASTQ file according to an embodiment of the present application;
[0035] FIG2 is a schematic diagram of a file header in the file shown in FIG1 ;
[0036] FIG3 is a schematic diagram of a quality score compression parameter in the file header shown in FIG2 ;
[0037] FIG4 is a schematic diagram of a data block in the file shown in FIG1 ;
[0038] FIG5 is a schematic diagram of Compressed Quality Scores in the data block shown in FIG4 ;
[0039] FIG6 is a schematic diagram of an end block in the file shown in FIG1 ;
[0040] FIG7 is a schematic diagram of an optional block in the file shown in FIG1 ;
[0041] FIG8 is a schematic diagram of a file including a directory area shown in FIG1;
[0042] FIG9 is a flow chart of a data processing method 100 according to an embodiment of the present application;
[0043] FIG10 is a flow chart of an implementation method of S1031 in an embodiment of the present application;
[0044] FIG11 is a flow chart of a data processing method 200 according to an embodiment of the present application;
[0045] FIG12 is a schematic structural diagram of a communication device 1200 according to an embodiment of the present application;
[0046] FIG13 is a schematic structural diagram of a communication device 1300 according to an embodiment of the present application;
[0047] FIG14 is a schematic structural diagram of a communication device 1400 in an embodiment of the present application. DETAILED DESCRIPTION
[0048] With the rapid growth of data, data compression technology has become essential and important for data transmission and storage. While current data compression technologies can provide lossless compression for data in various scenarios, in some cases, these conventional data compression technologies cannot achieve efficient data compression. This is an unacceptable shortcoming for fields dealing with large amounts of data. For example, with the widespread application of genomic data, using only conventional data compression technologies and treating the FASTQ files generated by gene sequencing as ordinary files to be compressed will not meet the compression efficiency requirements of this field. For example, FQZComp and GTZ are two conventional compression algorithms. However, when compressing FASTQ files, FQZComp requires maintaining a model with numerous parameters. This large model is reflected in a memory-intensive data structure in communication devices. Maintaining this large data structure in performance-constrained systems significantly reduces computational efficiency, resulting in low compression efficiency. GTZ is a bit-level dynamic encoding algorithm that encodes each bit and requires maintaining multiple models that may be required by the character at the next bit, resulting in low compression efficiency.
[0049] Based on this, an embodiment of the present application provides a data processing method, in which compression parameters and block information are pre-configured in a file header. When compressing a first file to be compressed, the first file can be firstly block-processed based on the block information to obtain multiple blocks; then, each block can be compressed based on the compression parameters to obtain corresponding data blocks; then, a second file is obtained based on the file header and the data blocks corresponding to the multiple blocks of the first file. The second file is the file obtained after compressing the first file based on the method provided in the embodiment of the present application. It can be seen that the embodiment of the present application defines a compressed file format, pre-configures compression scheme-related parameters in the file header of a file that conforms to the defined compressed file format, and after the file is block-divided and compressed according to the instructions of the file header, the compression result is filled into the data block after the file header in a manner that conforms to the defined compressed file format to obtain the compressed file, thereby achieving efficient data compression.
[0050] The method provided in the embodiment of the present application can be applied to unstructured data storage to reduce storage capacity expansion and achieve a reduction in storage costs. For example, a program product corresponding to the method in the embodiment of the present application can be provided on a controller, cloud or server, and a communication device can download and use the program product from the above-mentioned controller, cloud or server; the communication device can integrate a functional module that can carry the program product in its own compressor plug-in module, and the functional module can be implemented through software or hardware.
[0051] The data processing method provided in the embodiment of the present application can be applied to FASTQ files, for example. The following describes the embodiment of the present application by taking the compression and decompression of FASTQ files as an example.
[0052] A FASTQ file is a file format for storing data obtained from gene sequencing. A FASTQ file can contain multiple data entries, each of which can have four lines: a description line, a base sequence line, a comment line, and a quality score line. Each base in the base sequence line corresponds to a quality score in the quality score line, which indicates the sequencing quality of the corresponding base. The comment line can be empty, contain special symbols, or contain the descriptive information in the description line. Nucleic acid sequences can contain four bases: A, C, T, and G. In a FASTQ file, these bases are represented by their corresponding ASCII codes. The quality score ranges from 0x21 (the lowest value, ASCII code for '!') to 0x7e (the highest value, ASCII code for '~'). For example, FASTQ file 1 contains data entries 1 to 100. Taking data entry 1 as an example, data entry 1 can be represented as: <description line 1, base sequence line 1, comment line 1, and quality score line 1>.
[0053] The compressed file format of the FASTQ file defined in the embodiment of the present application can be shown in Figure 1, for example, and can be represented as: file header, data block 1, data block 2, ..., data block m and end block, where m is an integer greater than 1.
[0054] The specific formats of each part in FIG1 are exemplarily described below.
[0055] As shown in Figure 2, the file header may include: a memory size identifier (memID), a description information compression parameter (Desc_compress_para), a sequence compression parameter (Seq_compress_para), and a quality score compression parameter (QS_compress_para). Optionally, the file header may also include: a format signature (Signature), a file size (fileSize), a third line status (Fastq-stat), or a checksum (hCRC).
[0056] Among them, the format signature is used to write the signature of the file shown in Figure 1. The signature can be customized by the user and can be 4 bytes in length. The file size indicates the size of the FASTQ file after the file is decompressed by the user and can be 4 bytes in length. The memID is used to determine the memory information of the block and can be 1 byte in length. For example, the memory occupied by each block is calculated based on the value of memID as 2^(memID) bytes; for another example, the memory upper limit of the block calculated based on memID needs to be less than the memory upper limit. The third line status can be 1 byte in length, and the first 4 bits represent the status of the third line of each data entry in the FASTQ file. For example, when the third line is the default state, the first 4 bits of the third line status = 0b0001; when the third line repeats the content of the first line, the first 4 bits of the third line status = 0b0000; the last 4 bits indicate whether the read length of the current FASTQ file is equal. If equal, the last 4 bits of the third line status = 0b0001; if not equal, the last 4 bits of the third line status = 0b0000. The length of the description information compression parameter can be 4 bytes. The first and second bytes can indicate whether semantic word segmentation is performed. When the value of the first and second bytes is 1, it means that semantic word segmentation is required. When the value of the first and second bytes is 0, it means that semantic word segmentation is not required. The third and fourth bytes indicate the compression model used for the description information. For example, when the value of the third and fourth bytes is 0, it means that zstd compression is used for the description information. When the value of the third and fourth bytes is 1, it means that gzip compression is used for the description information. When the value of the third and fourth bytes is 2 or a value greater than 2, the corresponding compression model can be customized. The length of the sequence compression parameter can be 4 bytes. The first and second bytes can indicate whether byte-level packing is performed. For example, when the values of the first and second bytes are 0, it indicates no packing. When the values of the first and second bytes are 1, it indicates two-by-two packing. When the values of the first and second bytes are 2, it indicates three-by-three packing. The third and fourth bytes can indicate the compression model used for the base sequence (hereinafter referred to as the sequence). For example, when the values of the third and fourth bytes are 0, it indicates that zstd compression is used for the sequence. When the values of the third and fourth bytes are 1, it indicates that gzip compression is used for the sequence. When the values of the third and fourth bytes are 2, it indicates that a first-order Markov model is used for the sequence. When the values of the third and fourth bytes are 3, it indicates that a second-order Markov model is used for the sequence. When the values of the third and fourth bytes are 4, it indicates that a third-order Markov model is used for the sequence. The hCRC can be 1 byte in length.
[0057] The quality score compression parameter can be as shown in Figure 3, which can be 4 bytes in length and can include a compressor (Compressors) and a model identifier (modelID). Optionally, the quality score compression parameter can also include a cut size (cutSize). The length of Compressors can be 2 bytes, which is used to indicate the compression model corresponding to different values. For example, if the functional module used to carry the method provided by the embodiment of the present application in the compressor plug-in module of the communication device itself includes multiple compression models, then the compression model can be determined in the functional module by the value of Compressors; if the functional module used to carry the method provided by the embodiment of the present application in the compressor plug-in module of the communication device itself does not include a compression model, then the interface can be determined by the value of Compressors, through which the compression model deployed in the compressor plug-in module can be called. ModelID is used to indicate the above model and can be 1 byte in length. The feature value of the above string of characters to be encoded can be determined based on the above model indicated by modelID. The feature value can be used as the input value of Compressors to determine the corresponding compression model in Compressors. cutSize is used to indicate the string length threshold for compression. The value varies with the compression model determined by Compressors. It is used to adjust the balance between compression ratio and compression efficiency and can be 1 byte in length. The compression ratio refers to the percentage of the compressed file size to the uncompressed file size. Compression efficiency can be measured by the length of time used for compression. For the same file, the longer the compression time, the worse the compression efficiency. Compression efficiency can be quantified by compression throughput (or compression throughput). The higher the compression throughput (or compression throughput), the better the compression efficiency.
[0058] It should be noted that the interface style of the compressor protected by the embodiment of the present application will use modelID and cutSize as global external parameters. All compressors compatible with the file format defined by the embodiment of the present application can use the following interface configuration: Compressor(dstPtr, dstSize, srcPtr, srcSize, workSpacePtr, workSpaceSize, modelID, cutSize). Among them, dstPtr (i.e., the target memory start pointer) and dstSize (i.e., the target memory size) are used to point to the compressed output memory block. srcPtr (i.e., the source memory start pointer) and srcSize (i.e., the source memory size) correspond to the memory where the input data is located. workSpacePtr (i.e., the workspace memory start pointer) and workSpaceSize (i.e., the workspace memory size) correspond to the workspace needed to rearrange data in the embodiment of the present application. Furthermore, ModelID and cutSize are used to correspond to the above model required in the embodiment of the present application (it can also be other high-order models).
[0059] As shown in Figure 4, a data block may include: type (bType), compressed block size (CompressedBlockSize), compressed record length (CompressedRecordLen), compressed descriptive information (CompressedDesc), compressed sequence (CompressedSequence), compressed quality scores (CompressedQualityScores), and a checksum (CRC). bType indicates the type of block and can be 1 byte long. When bType = 0, it indicates a data block; when bType = 1, it indicates a trailing block. Extended optional blocks can be indicated by extending the value of bType. CompressedBlockSIze indicates the size of the data block, excluding the CRC within the data block. CompressedRecordLen indicates the compression result of compressing the sequence length of each data entry in the corresponding block of this data block. This variable length is used. CompressedDesc carries the compressed descriptive information of this data block. This variable length is used. CompressedSequence carries the compressed sequence of this data block. This variable length is used. Compressed Quality Scores: This field carries the compressed quality scores of this data block. It has a variable length. The CRC can be 4 bytes long.
[0060] The formats of Compressed Desc, Compressed Sequence, and Compressed Quality Scores in the data block can be the same. For Compressed Quality Scores, the format can be shown in Figure 5 and can include: the compressed size of the quality score (cSize) and the compressed stream (compressedStream). cSize can be used to determine the end of compressedStream during decompression. compressedStream at least includes the compressed data of the quality score. Optionally, the Compressed Quality Scores can also include the uncompressed size of the quality score (inSize). inSize can be used to indicate the decompressed size of the compressed stream to avoid the storage risk caused by overly large files after decompression, providing convenience for users.
[0061] As shown in Figure 6, the trailing block may include: bType, trailing block size, and CRC. bType = 1 indicates that the block is a trailing block and can be 1 byte long. The trailing block size indicates the length of the trailing block, which can be independent of the CRC in the trailing block. For example, if the trailing block size = 0, the length can be 4 bytes. The CRC can be 4 bytes long.
[0062] The file format defined in the embodiment of the present application may also include an optional block that can be extended. The position of the optional block can be between the file header and data block 1, or between data block m and the end block. As shown in Figure 7, the optional block may include, for example: bType, optional block size, optional block information and CRC. Among them, the value of bType can be an integer between 2 and 255, which is used to indicate the type of extended optional block and can be 1 byte in length. The optional block size is used to indicate the length of the optional block. The length of the optional block can ignore the CRC in the optional block and can be 4 bytes in length. The optional block information is used to indicate the content carried by the optional block and has a variable length. The length of the CRC can be 4 bytes.
[0063] As an example, in order to support random reading of FASTQ files and facilitate the operation of very large files, some optional blocks can be extended between the file header and data block 1 as a directory area. The directory area can be, for example, as shown in Figure 8, including the same number of directory blocks as the data blocks, that is, the directory area includes directory blocks 1 to directory blocks m. The format of each target block refers to the format of the optional block shown in Figure 7, with the following differences: first, the bType of the optional block is set to an undefined value, for example, bType = 5, indicating that the optional block is a directory block; second, the optional block information is filled with information that can indicate the corresponding data block. For example, the optional block information can be 20 bytes: the sequence number of the first data entry in the corresponding data block, the position of the corresponding data block in the file shown in Figure 1, and the position of the corresponding data block in the FASTQ file before file compression shown in Figure 1. The lengths of the above three parts in the optional block information can be 4 bytes, 8 bytes, and 8 bytes, respectively. In this way, the corresponding data block can be easily determined by the indication of each directory block, which facilitates the user to flexibly and quickly read each data block in the compressed file of the FASTQ file defined in the embodiment of the present application.
[0064] After introducing the file format defined for the compressed FASTQ file according to the embodiment of the present application, the data processing scheme applicable to this file format is described.
[0065] As shown in FIG9 , the data processing method 100 provided in the embodiment of the present application may include, for example, the following S101 to S104:
[0066] S101, obtaining a file header, wherein the file header includes: block information, description information compression parameters, sequence compression parameters, and quality score compression parameters.
[0067] In specific implementation, compression-related configuration parameters can be saved in the file header, thereby ensuring that the original file to be compressed is subsequently processed based on the file header, and the file header is used as part of the compressed file, so that the compressed file can be accurately decompressed based on the file header of the compressed file to restore the original file.
[0068] For the relevant description of the file header, please refer to Figure 2 and the related description above. Among them, the block information may include memID; the file header may also include at least one of the following fields: format signature, file size, third line status or check bit.
[0069] S102: Obtain multiple blocks according to the block information and the first file, each of the multiple blocks including first description information, a first sequence, and a first quality score.
[0070] The first file is the original file to be compressed, which can be, for example, a FASTQ file. The lightweight compression storage format for FASTQ files defined in the embodiments of the present application is implemented based on block segmentation and data separation. That is, the data entries in the FASTQ file are segmented into different blocks, compressed according to the blocks, and then packaged into a complete compressed file.
[0071] As an example, S102 may include: S1021, performing block processing on the first file according to the block information to obtain multiple data entry sets, each data entry set in the multiple data entry sets includes at least one group of data entries; S1022, classifying the data entries in any data entry set in the multiple data entry sets according to the data type, and obtaining the blocks corresponding to the any data entry set, the data type including at least one of descriptive information, sequence and quality score.
[0072] For S1021, if the block information of the file header includes memID, S1021 may include, for example: first, determining the memory information based on the memID; then, performing block processing on the first file based on the memory information to obtain the multiple data entries. The memory information may refer to the memory size or memory upper limit of the block. For example, the memory size of the block can be determined based on the memID and preset formula 1. The preset formula may be, for example: the memory size of the block is equal to 2^(memID); for another example, the memory upper limit of the block can be determined based on the memID and preset formula 2. Then, it is necessary to ensure that the size of the block does not exceed the memory upper limit during block segmentation.
[0073] For S1022, assuming that any data entry set includes a first data entry and a second data entry, the first data entry includes second description information, a second sequence, and a second quality score, and the second data entry includes third description information, a third sequence, and a third quality score, then, in the block corresponding to the data entry set, the first description information includes the second description information and the third description information, the first sequence includes the second sequence and the third sequence, and the first quality score includes the second quality score and the third quality score.
[0074] In a specific implementation, S1022 may include: on the one hand, extracting the description information of each data entry in the data entry set to form a longer description information as the first description information in the block corresponding to the data entry set; on the other hand, since the sequence and quality score in the data entry both end with length information, after removing the length information at the end of the sequence of each data entry in the data entry set, the two adjacent sequences are connected at the end to obtain the first sequence in the block corresponding to the data entry set. Similarly, after removing the length information at the end of the quality score of each data entry in the data entry set, the two adjacent quality scores are connected at the end to obtain the first quality score in the block corresponding to the data entry set.
[0075] For example, assuming that the first file includes data entries 1 to data entry 100, execute S1021 and divide the first file into five parts according to the instructions of the block information: data entry set 1 {data entry 1, data entry 2, ..., data entry 20}, data entry set 2 {data entry 21, data entry 22, ..., data entry 40}, data entry set 3 {data entry 41, data entry 42, ..., data entry 60}, data entry set 4 {data entry 61, data entry 62, ..., data entry 80} and data entry set 5 {data entry 81, data entry 82, ..., data entry 100}. Execute S1022. Taking data entry set 1 as an example, block 1 corresponding to data entry set 1 can be expressed as: block 1 {description information A1, sequence B1, quality score C1}, wherein description information A1 includes description information 1, description information 2, ..., description information 20, and description information 1 to description information 20 belong to data entry 1 to data entry 20 respectively; sequence B1 includes sequence 1, sequence 2, ..., sequence 20, and sequence 1 to sequence 20 belong to data entry 1 to data entry 20 respectively; quality score C1 includes quality score 1, quality score 2, ..., quality score 20, and quality score 1 to quality score 20 belong to data entry 1 to data entry 20 respectively.
[0076] It should be noted that in order to accurately restore the first file after the compressed file, in the method 100, it is also necessary to record the length information of each data entry in each block in addition to executing S102. Since the description information in the data entry can be accurately restored according to its own characteristics, the length information of the data entry can be the length of the sequence of the data entry or the length of the quality score. The length of the sequence and the quality score in the same data entry are consistent. In this way, block 1 can be expressed as: block 1 {{length information set 1}, description information A1, sequence B1, quality score C1}, wherein the length information set 1 can include: the length 1 of sequence 1, the length 2 of sequence 2, ... the length 20 of sequence 20.
[0077] S103: Obtain a data block corresponding to each of the multiple blocks according to the file header and the multiple blocks.
[0078] The implementation of S103 may include: adaptively compressing each of the multiple blocks according to the compression parameters corresponding to the different data types in the file header, and placing the compressed results into the corresponding data blocks. As an example, S103 may include the following S1031 to S1033. The execution order of S1031, S1032, and S1033 is not limited in this embodiment of the application and can be executed in any order or simultaneously.
[0079] S1031 : Compress the first description information in each of the multiple blocks according to the description information compression parameter to obtain a compression result of the description information corresponding to each of the multiple blocks.
[0080] As an example, if the description information compression parameters in the file header include: a segmentation strategy and a second compression model, then, as shown in Figure 10, S1031 may, for example, include: S1031a, segmenting the first description information in any one of the multiple blocks according to the segmentation strategy to obtain multiple description fragments; S1031b, for any one of the multiple description fragments, performing the following steps according to the second compression model: S1031c, if any one of the description fragments belongs to integer type data, converting the any one of the description fragments into binary and then compressing it; S1031d, if any one of the description fragments does not belong to integer type data, compressing the any one of the description fragments using the LZ algorithm; S1031e, obtaining the compression result of the description information corresponding to any one of the blocks based on the compression results corresponding to the multiple description fragments. Among them, the segmentation strategy may include indication information of whether semantic segmentation is required in the description information compression parameters. If it is determined based on the description information compression parameters that semantic segmentation is required, then S1031a includes semantic segmentation of the description information when performing segmentation; or, if the description information compression parameters indicate that semantic segmentation is not required, or there is no indication information of whether semantic segmentation is required in the description information compression parameters, then special symbols in the description information (such as commas, semicolons or colons) can be used as the segmentation strategy in S1031a for segmentation; or, if the description information compression parameters indicate that semantic segmentation is required, the description information can be multiply segmented according to special symbols and semantics.
[0081] It should be noted that the second compression model in the description information compression parameters can refer to the compression process of S1031c~S1031e. The second compression model can include multiple compression algorithms (also called encoding algorithms), for example, it can include the LZ algorithm in this example and the algorithm corresponding to S1031c.
[0082] S1032: Compress the first sequence in each of the multiple blocks according to the sequence compression parameter to obtain a compression result of the sequence corresponding to each of the multiple blocks.
[0083] As an example, if the sequence compression parameters in the file header include: packing length and a third compression model, then S1032 may, for example, include: S1032a, processing the first sequence in any one of the multiple blocks according to the N-pack strategy to obtain a fourth sequence, where N is an integer greater than 1, and N matches the packing length; S1032b, compressing the fourth sequence according to the third compression model to obtain a compression result of the sequence corresponding to any one of the blocks.
[0084] It can be seen that in the embodiment of the present application, the LZ fast matching algorithm is adopted when compressing the sequence in each block. Compared with the current LZ algorithm, the proposed improvements include: First, using the N-pack strategy, N adjacent elements in the original sequence (such as bases in the base sequence) are grouped into a new symbol, and then these new symbols are compressed to form a new sequence, corresponding to S1032a; Second, based on the general open source zstandard algorithm, its matching strategy is adjusted according to the characteristics of the sequence, and the matching of short sequences is skipped, thereby improving the compression efficiency, corresponding to S1032b.
[0085] Assume the first sequence includes: ACCCTCGCAATC, N=3. Then, ACC corresponds to a1, CTC corresponds to a2, GCA corresponds to a3, and ATC corresponds to a4. Therefore, the fourth sequence includes: a1, a2, a3, a4. If the fourth sequence includes: a1, a2, a6, a4, ..., a3, a2, a6, a5, ..., the length of the short sequence for skipping matching must be less than 3 characters. Since the above repetition is 2 characters, the short sequence matching skip condition is met. Therefore, the two bold characters a2 and a6 are not considered matched. If the short sequence matching skip condition is not met, only one of the multiple matching strings needs to be recorded. For the other matching strings, only the positional relationship or distance between them and the recorded string is recorded.
[0086] S1033 : Compress the first quality score of each of the multiple blocks according to the quality score compression parameter to obtain a compression result of the quality score corresponding to each of the multiple blocks.
[0087] The quality score compression parameters may include at least a first parameter and a second parameter. The first parameter indicates a context model, which is used to determine the feature value of the context string of the character to be encoded. For details about the first parameter, see the description of modelID in FIG3 . The second parameter determines the compression model corresponding to the feature value. For details about the second parameter, see the description of Compressors in FIG3 .
[0088] As an example, S1033 may include: S1033a, obtaining a context string for any quality score character among the multiple quality score characters in any of the multiple blocks; S1033b, determining a feature value of the quality score character based on the first parameter and the context string of the quality score character; S1033c, determining a target compression model based on the second parameter and the feature value of the quality score character; S1033d, compressing the quality score character based on the target compression model; and S1033e, obtaining a compression result of the first quality score corresponding to the block based on the compression results of the multiple quality score characters. The feature value may also be referred to as a conditional parameter.
[0089] Taking the above text as an example, where the sequence includes characters a0 to a14 in sequence and the above text model corresponds to 4 characters, the corresponding feature values calculated by S1033a to S1033b can be shown in Table 1 below:
[0090] Table 1
[0091] The implementation of S1033a to S1033b can be understood through this example. Taking the calculation of the eigenvalue of a4 as an example, it can be determined that the 4-character string above a4 is a0 to a3. Assuming that the compressed lengths of a0 to a3 are 1, 1, 2, and 4 bits, respectively, the eigenvalue corresponding to a4 can be calculated using the following formula (1): F(a0, a1, a2, a3) = T1(a3) + (D2(a2, a3) < < 4) + (D2(a1, a2) < < 6) + (D1(a0, a1) < < 7) ... Formula (1)
[0092] Among them, F(a0, a1, a2, a3) is the eigenvalue of a4. T1() can be implemented through the empirical table, empirical correspondence, or preset functional relationship in the above model. Taking the empirical table as an example, T1 can be expressed as [0, …, 255] → [0, …, 16], and T1(a3) can map a3 between 0 and 255 to a value between 0 and 16. D2(y, x) is a function for saving the difference situation. For example, when x = y, D2(y, x) = 0; when x < y, D2(y, x) = 1; when x > y, D2(y, x) = 2. D1(y, x) is a function for indicating whether they are the same. For example, when x = y, D1(y, x) = 0; when x and y are not equal, D1(y, x) = 1. "<< " is the left shift symbol. The object before "<< " is the object to be left shifted, and the number of bits to be left shifted after "<< " is determined based on the order of each above-mentioned character in the above-mentioned character string and the bits after each above-mentioned character is compressed.
[0093] For a3 adjacent to a4, in order to reflect that a3 has the greatest influence on the appearance of a4, an empirical table, empirical correspondence, or preset functional relationship is used to reflect the influence of a3 on the eigenvalue of a4. For a1 and a2 relatively close to a4, D2(y, x) that can reflect more information can be used to reflect the influence of a1 and a2 on the eigenvalue of a4. For a0 with the farthest distance, D1(y, x) that can reflect less information can be used to reflect the influence of a0 on the eigenvalue of a4.
[0094] It should be noted that for the eigenvalue of a character in an above-mentioned character string that does not meet the preset length (such as 4 bytes), it can be implemented based on a shorter-length above-mentioned character string and other calculation methods, or it can also be obtained based on experience or other methods, which is not limited in the embodiments of this application.
[0095] After calculating the eigenvalues of each quality score character, a target compression model (which can also be called an encoding model or a probability model) applicable to each quality score character can be determined based on the eigenvalues and the second parameter, and each quality score character is compressed using the corresponding target compression model to obtain the compression result of each quality score character, thereby obtaining the compression result of the first quality score. This process belongs to the dynamic encoding method.
[0096] It should be noted that the execution of the above S1033a to S1033e can be to first use S1033a to S1033b to calculate the characteristic values of all quality score characters in the first quality score of the block; then, in one case, according to the order in which the quality score characters appear in the first quality score, perform S1033c to S1033d bit by bit for each quality score character to obtain the compression result of each quality score character. This process requires continuous maintenance of the target compression model used in the past, and updates the historical characteristic values corresponding to the same characteristic value with the latest target compression model used, which is very time-consuming for memory and processing. The pressure is relatively high; in another case, S1033c to S1033d can be executed simultaneously for multiple quality score characters with the same characteristic value according to the characteristic value of each quality score character to obtain the compression results of multiple quality score characters corresponding to the characteristic value. In this way, the quality score characters are classified according to the characteristic value, and the number of executions of S1033c and S1033d is reduced. Moreover, after S1033c and S1033d are completed for each characteristic value, the target compression model corresponding to the characteristic value does not need to be maintained in the memory, which can achieve fast and efficient "static" encoding and less pressure on memory and processing.
[0097] In some implementations, S1033c may include: sorting the quality score characters in any of the blocks according to the characteristic values to obtain multiple groups of quality score character strings, wherein each group of the multiple groups of quality score character strings corresponds to the same characteristic value; and determining a first compression model for a first quality score character string in the multiple groups of quality score character strings based on the characteristic value corresponding to the first quality score character string. Then, S1033d may include: compressing the first quality score character string based on the first compression model.
[0098] Taking Table 1 above as an example, after executing S1033c, three sets of quality score character strings can be obtained, as shown in Table 2 below:
[0099] Table 2
[0100] The first quality score character string may be a0, a4, a6, a11, and a12, and the corresponding characteristic value of the first quality score character string is 1; the first quality score character string may be a1, a5, a8, a9, and a14, and the corresponding characteristic value of the first quality score character string is 2; the first quality score character string may be a2, a3, a7, a10, and a13, and the corresponding characteristic value of the first quality score character string is 3. It should be noted that the specific process of grouping quality score characters may include: first, counting the number of occurrences of each characteristic value 5 and the number of different characteristic values 3; second, setting a number of pointers equal to the number of occurrences of different characteristic values 3, with the position indicated by each pointer determined based on the number of occurrences of each characteristic value, for example, pointer 1 points to the position of the 0th character, pointer 2 points to the position of the 5th character, and pointer 3 points to the position of the 10th character; third, for each character in Table 1, filling the position pointed to by the pointer corresponding to the characteristic value in sequence according to the characteristic value of the character, and when a character is filled in, the pointer moves to the next character position.
[0101] Taking the first quality score string a0, a4, a6, a11, and a12 as an example, for S1033d, specifically, based on the characteristic value of 1 and the second parameter, a first compression model corresponding to 1 is determined. Thus, the string a0, a4, a6, a11, and a12 is input into the first compression model, and the first compression model outputs the compression result of the string.
[0102] Assume that the compression result of the string a0, a4, a6, a11, and a12 is compression result 1, the compression result of the string a1, a5, a8, a9, and a14 is compression result 2, and the compression result of the string a2, a3, a7, a10, and a13 is compression result 3. Then, the compression results of the first quality score in the block include: compression result 1, compression result 2, and compression result 3.
[0103] It should be noted that in the scheme of reordering the quality score characters before compression, to ensure effective decompression, the rearranged multiple groups of quality score strings need to be restored to their original order, and the characteristic value of the first quality score character can also be recorded in the block. For example, in the examples shown in Tables 1 and 2, the characteristic value of a0 can be recorded as 1. Then, after decompressing the compression result of the first quality score, the sequence shown in Table 2 is obtained; then, the characteristic value of a1 is calculated based on the characteristic value of a0. If the characteristic value of a1 is 1, it is assumed that a1 follows a0 and the position of a1 remains unchanged. If the characteristic value of a1 is 2, the first character in the group of quality score strings with a characteristic value of 2 is extracted to the character position after a0. If the characteristic value of a1 is 3, the first character in the group of quality score strings with a characteristic value of 3 is extracted to the character position after a0. And so on. After calculating the characteristic value of each character, the corresponding character is extracted from the corresponding quality score string based on the characteristic value until all quality score characters are restored to their original positions.
[0104] In some implementations, in the scheme of reordering the quality score characters before performing compression, to further improve compression efficiency, the quality score compression parameters in the file header may further include a third parameter, which is used to indicate a threshold for the length of the string for which compression is performed. For a description of the third parameter, see the description of cutSize in FIG3 . In this implementation, for each of the multiple sets of quality score strings, a determination is first made as to whether the length of the quality score string in the set is less than the string length threshold. If not, the length of the quality score string in the set is deemed to meet the compression criteria, and steps S1033c and S1033d are performed on the quality score string in the set. If so, the quality score string in the set is temporarily not compressed and is saved in the target area. In this manner, the quality score characters to be compressed are accumulated in the target area. When the length of the quality score string in the target area reaches a preset length (which may be the same as or different from the string length threshold indicated by the third parameter), or when all quality score strings in the block meet the above determination, the quality score strings in the target area are compressed using a preset universal compression algorithm for compressing data in the target area.
[0105] It should be noted that in the embodiment of the present application, the length of a character is measured in bytes, that is, one character occupies 8 bits of space.
[0106] As can be seen, the lightweight FASTQ compression algorithm, which combines optimal binning with fast entropy coding for the first quality score of each block, achieves state-of-the-art compression rates. It requires no reference sequence input, occupies less memory, and significantly improves compression efficiency, offering significant advantages over the complex models used in commonly used Gzip and GTZ. Using 2-megabyte (MB) data cuts, Gzip, GTZ, and this FASTQ compression algorithm were tested on over 700 gigabyte (GB) of genetic data. A detailed comparison can be seen in Table 3 below:
[0107] Table 3
[0108] Mbps / core refers to the transmission of one million bits per second per core, where Mbps stands for Million bits per second.
[0109] S1031 to S1033 are executed for each block to obtain the compression results of the block's description information, sequence compression results, and quality score compression results. Furthermore, by compressing the length information of the record, a compression result of the length information is obtained. Finally, the various compression results are saved in the data block corresponding to the block according to the file format defined in the embodiment of the application. For details, please refer to the relevant descriptions of Figures 4 and 5.
[0110] S104: Obtain a second file, where the second file is a compressed file of the first file, and the second file includes: the file header and a data block corresponding to each of the multiple blocks.
[0111] After obtaining the plurality of data blocks, the plurality of data blocks are arranged in sequence between the file header and the end block to obtain a second file.
[0112] Among them, the compression result of the description information may at least include: the compressed size of the description information and the first compressed stream corresponding to the description information, the first compressed stream including the compressed data of the description information; the compression result of the sequence may at least include: the compressed size of the sequence and the second compressed stream corresponding to the sequence, the second compressed stream including the compressed data of the sequence; the compression result of the quality score may at least include: the compressed size of the quality score and the third compressed stream corresponding to the quality score, the third compressed stream including the compressed data of the quality score.
[0113] To facilitate random reading of FASTQ files and enable operations on very large files, some optional blocks can be added between the file header and the first data block, or between the last data block and the trailing block, to serve as directory areas. For example, the directory area can be shown in FIG8 . The directory area includes the same number of directory blocks as the number of data blocks. The format of each target block is similar to the format of the optional blocks shown in FIG7 . For directory blocks included in the second file, the target block can indicate the sequence number of the first data entry in the block, the position of the block in the second file, and the position of the block in the first file.
[0114] It should be noted that after obtaining the second file, when there is a need to decompress the second file, the method 100 may further include: decompressing multiple data blocks in the second file based on the file header of the second file to obtain the first file.
[0115] In a specific implementation, the decompression process may include: a first step of obtaining the file header of the second file; a second step of decompressing the compressed data in each data block based on the parameters in the file header; a third step of obtaining a third file based on the decompression results of each data block, and under the condition that the second file is secure and the decompression process is correct, the third file is the same as the first file. For the second step, the process of decompressing the compressed data in a certain data block may include: performing corresponding decompression on the compression results of the length information, the compression results of the description information, the compression results of the sequence, and the compression results of the quality score, and restoring the decompressed results of each part of the content into a set of data entries of the FASTQ file according to the decompressed content of the compression result of the length information and the format characteristics of the FASTQ file. For the third step, the data entry sets obtained after decompression of each data block can be combined into a third file.
[0116] It can be seen that through this method 100, lightweight compression and decompression of FASTQ files can be effectively achieved, which not only makes the storage of large-scale files more user-friendly, but also greatly improves the compression efficiency of large-scale files.
[0117] The above compression and decompression methods for quality scores in FASTQ files can be adapted to other data that can be compressed as described above.
[0118] As shown in FIG11 , the embodiment of the present application further provides a data processing method 200 , which may include, for example, the following steps S201 to S203 :
[0119] S201 , based on the above model, obtain feature values of a plurality of characters included in the first data, wherein the feature value of any character in the plurality of characters is used to characterize features of the above character string of a preset length of the any character.
[0120] As an example, S201 may include: obtaining, for any character among the multiple characters, a context string of a preset length for the character; and determining a feature value of the character based on a compressed length of each context character in the context string, each context character in the context string, and a preset calculation rule. The preset calculation rule may be, for example, as described in formula (1) and related descriptions.
[0121] It should be noted that the implementation method of S201 and the technical effects achieved can be found in the relevant description in the above S1033b.
[0122] The first data may be the first quality score in any block of the FASTQ file after S101.
[0123] S202: Determine a target compression model according to the feature value of any character.
[0124] S203: compress the any character based on the target compression model to obtain second data, where the second data is a compression result of the first data.
[0125] As an example, S202-S203 may include, for example, determining, for each character, a target compression model applicable to the character based on the character's feature value, and then compressing the character using the target compression model. In this way, dynamic compression is performed character by character. Since the feature value of each character has been pre-calculated uniformly based on S201, although it is necessary to continuously maintain the target compression models used in the past and update the historical feature values corresponding to the same feature values with the latest target compression model, which places greater pressure on memory and processing, the efficiency is also improved compared to current compression schemes.
[0126] As another example, S202 may include, for example: sorting multiple characters in the first data according to feature values to obtain multiple groups of character strings, wherein the feature values corresponding to each group of the multiple groups of character strings are the same; for the first group of character strings in the multiple groups of character strings, determining a first compression model based on the feature values and mapping relationships corresponding to the first group of character strings, wherein the mapping relationship includes the correspondence between multiple groups of feature values and compression models. Then, S203 may include, for example: compressing the first group of character strings based on the first compression model to obtain third data, wherein the second data includes the third data. In this way, by classifying characters according to feature values, the number of executions of S202 and S203 is reduced, and after each feature value completes S202 and S203, the target compression model corresponding to the feature value may not be maintained in the memory, thereby enabling fast and efficient "static" encoding and less pressure on memory and processing.
[0127] It should be noted that the implementation method of S202 to S203 and the technical effects achieved can be found in the relevant descriptions in S1033c to S1033e above.
[0128] In the method 200, the above model can be understood as a high-order prediction model with an 8-bit parameter space. For the first data being a character sequence a1, a2, ..., an, ..., a k-order above model attempts to use the first k characters of the current position to preset the probability distribution of the current character. The examples in the embodiments of the present application are explained using k=4 as an example. That is, for any character an (n>4), the values of the four symbols a(n-4), a(n-3), a(n-2) and a(n-1) are used to predict the probability of each possible character appearing at position n. The output of this prediction is the distribution Pn, which gives the probability of each possible symbol appearing at position n. If a byte is regarded as a character, then the range of the character value is 0-255, and the amount of information is 8 bits; if there are 4 characters, the amount of information is 32 bits. Taking each possible 4-character above of the 4th-order model as a parameter space, the size of this parameter space is 32 bits. This value is significant because each additional bit of context length doubles the space. The context model provided in the present embodiment allows for a highly efficient 32-bit context model. Using FQZcomp would require 16 bits, but the present embodiment can further compress the context to 8 bits, a 256-fold reduction compared to the FQZcomp model, while maintaining nearly the same prediction performance. The 8-bit model can be easily coupled with a more mature high-order encoder. Therefore, the 8-bit solution is not only more advanced than existing 16-bit technologies, but also offers greater practicality.
[0129] In addition, method 200 can also use a high-order model compression scheme that replaces dynamic encoding with relatively static encoding. If entropy coding is used to encode character a, the predicted probability p(a) of character a needs to be known; if the code text encoded by the entropy coding algorithm is to be decoded, the predicted probabilities of all possible characters (i.e., the entire distribution) need to be known. Therefore, the entropy coding algorithm needs to maintain the distribution of the entire probability model (i.e., the compression model) while encoding or decoding. For example, when a character is a single byte, the entire string is composed of all possible byte values, i.e., 0-255. To use the entropy coding algorithm, the predicted probabilities of 256 possible values need to be maintained in memory at all times. When the above model is a high-order conditional probability model, each character has more than one conditional probability. Currently, all these probability values are stored in memory. For each character to be encoded in a string, the corresponding probability value is read and selected based on the condition to which the character belongs (e.g., the above value). Each conditional probability distribution itself can be regarded as a sub-model (because the sub-model fully records a valid distribution). For example, FQZcomp uses 16-bit byte-level prediction, then there are 256 characters, and each character has 2^16=65536 possible sub-models, requiring a total of 256*65536=16777216 bits, or about 16MB of probabilities. If one probability is represented by a 32-bit (i.e., 4-byte) floating-point number, 64MB of memory is required. If the prediction level is bits, because in the above example, the meaning of the quality score itself is provided by a full byte, the high and low bits are also used as conditions, and the model size will not change. This application uses 8-bit byte-level prediction, and only has 65536 (i.e., 64KB) possible probability values that need to be stored. However, on current CPUs, even with this size, even if only short floating-point numbers are used, there is still 128KB of memory occupied, and the compression model cannot put all the parameters into the level 1 cache. During encoding, due to the random changes mentioned above, the data structure of the compression model needs to be randomly read and updated, which will cause a certain performance degradation. The present embodiment simply reorders the characters, placing all characters with the same characteristics together and recording the size of this subsequence. This eliminates the need to randomly read from a large data structure, allowing for static encoding to achieve compression and improve encoding efficiency. Furthermore, the method provided by the present embodiment requires minimal memory because it does not require the storage and maintenance of all compression models.
[0130] It should be noted that the technical solution provided in the embodiments of the present application defines a high-throughput and high-compression data format for FASTQ files, and designs a data processing (i.e., data compression) process that can be configured and used. For scenarios similar to the compression of FASTQ files, it is possible to achieve highly efficient lightweight compression and storage.
[0131] Accordingly, the embodiment of the present application further provides a communication device 1200, as shown in Figure 12. The communication device 1200 may include: a first obtaining unit 1201, a second obtaining unit 1202, a first compression unit 1203, and a third obtaining unit 1204.
[0132] The first obtaining unit 1201 is configured to obtain a file header, wherein the file header includes: block information, description information compression parameters, sequence compression parameters, and quality score compression parameters. The first obtaining unit 1201 may execute S101 shown in FIG9 .
[0133] The second obtaining unit 1202 is configured to obtain multiple blocks according to the block information and the first file, wherein each block in the multiple blocks includes first description information, a first sequence, and a first quality score. The second obtaining unit 1202 may execute S102 shown in FIG9 .
[0134] A first compression unit 1203 is configured to compress the first description information, the first sequence, and the first quality score in each of the plurality of blocks according to the description information compression parameter, the sequence compression parameter, and the quality score compression parameter, respectively, to obtain a data block corresponding to each of the plurality of blocks, the data block including a compression result of the description information, the sequence, and the quality score for the corresponding block. The first compression unit 1203 may execute S103 shown in FIG9 .
[0135] The third obtaining unit 1204 is configured to obtain a second file, where the second file is a compressed file of the first file, and the second file includes: the file header and a data block corresponding to each of the multiple blocks. The third obtaining unit 1204 may execute S104 shown in FIG9 .
[0136] Optionally, the second obtaining unit 1202 may include: a blocking subunit and a first obtaining subunit, wherein the blocking subunit is used to block the first file according to the blocking information to obtain multiple data entry sets, each data entry set in the multiple data entry sets includes at least one group of data entries; the first obtaining subunit is used to classify the data entries in any data entry set in the multiple data entry sets according to the data type, and obtain the blocks corresponding to the any data entry set, and the data type includes at least one of descriptive information, sequence and quality score.
[0137] Optionally, the block information includes a memory size identifier memID, and the block subunit is specifically used to: determine memory information according to the memID; and perform block processing on the first file based on the memory information to obtain the multiple data entry sets.
[0138] Optionally, any one of the data entry sets includes a first data entry and a second data entry, the first data entry includes second description information, a second sequence and a second quality score, and the second data entry includes third description information, a third sequence and a third quality score. Then, in the block corresponding to any one of the data entry sets, the first description information includes the second description information and the third description information, the first sequence includes the second sequence and the third sequence, and the first quality score includes the second quality score and the third quality score.
[0139] Optionally, the block corresponding to any data entry set also includes: length information of each data entry in any data entry set, the length information is the length of the sequence of the corresponding data entry or the length of the quality score, and the data block also includes: compressed data of the length information of each data entry in the corresponding block.
[0140] Optionally, the quality score compression parameter includes: a first parameter and a second parameter, the first parameter is used to indicate a context model, the context model is used to determine a characteristic value of a context string of a character to be encoded, and the second parameter is used to determine a compression model corresponding to the characteristic value.
[0141] Optionally, the first compression unit 1203 may include: a second obtaining subunit, a first determining subunit, a second determining subunit, a first compression subunit, and a third obtaining subunit, wherein the second obtaining subunit is configured to obtain, for any quality score character among the multiple quality score characters in any block of the multiple blocks, a context string of the any quality score character; the first determining subunit is configured to determine a feature value of the any quality score character based on the first parameter and the context string of the any quality score character; the second determining subunit is configured to determine a target compression model based on the second parameter and the feature value of the any quality score character; the first compression subunit is configured to compress the any quality score character based on the target compression model; and the third obtaining subunit is configured to obtain a compression result of the first quality score corresponding to the any block based on the compression results of the multiple quality score characters.
[0142] Optionally, the second determination subunit is specifically configured to: sort the quality score characters in any of the blocks according to the characteristic values to obtain multiple groups of quality score character strings, wherein each group of the multiple groups of quality score character strings corresponds to the same characteristic value; and determine a first compression model for a first quality score character string in the multiple groups of quality score character strings based on the characteristic value corresponding to the first quality score character string. Then, the first compression subunit is specifically configured to: compress the first quality score character string based on the first compression model.
[0143] Optionally, the second file further includes: a characteristic value of the first quality score character in any block.
[0144] Optionally, the quality score compression parameters further include a third parameter, the third parameter being used to indicate a threshold value for the string length for performing the compression operation. The apparatus 1200 may further include: a storage unit configured to store, in a target area, quality score strings whose lengths are less than the threshold value among the multiple sets of quality score strings; and a second compression unit configured to compress the quality score strings in the target area based on a universal compression algorithm.
[0145] Optionally, the description information compression parameters include: a segmentation strategy, a second compression model and a fourth acquisition subunit, and the first compression unit 1203 may include: a segmentation subunit and a second compression subunit. The segmentation subunit is used to segment the first description information in any block of the multiple blocks according to the segmentation strategy to obtain multiple description fragments. The second compression subunit is used to perform the following steps according to the second compression model for any description fragment of the multiple description fragments: if any description fragment belongs to integer type data, then the any description fragment is converted into binary and then compressed; if any description fragment does not belong to integer type data, then the any description fragment is compressed using the LZ algorithm. The fourth acquisition subunit is used to obtain the compression result of the description information corresponding to any block based on the compression results corresponding to the multiple description fragments.
[0146] Optionally, the sequence compression parameters include a packing length and a third compression model, and the first compression unit 1203 may include a processing subunit and a third compression subunit. The processing subunit is configured to process the first sequence in any of the multiple blocks according to an N-pack strategy to obtain a fourth sequence, where N is an integer greater than 1 and matches the packing length; and the third compression subunit is configured to compress the fourth sequence according to the third compression model to obtain a compression result of the sequence corresponding to the any block.
[0147] Optionally, the compression result of the description information includes the compressed size of the description information and a first compressed stream corresponding to the description information, the first compressed stream including the compressed data of the description information; the compression result of the sequence includes the compressed size of the sequence and a second compressed stream corresponding to the sequence, the second compressed stream including the compressed data of the sequence; the compression result of the quality score includes the compressed size of the quality score and a third compressed stream corresponding to the quality score, the third compressed stream including the compressed data of the quality score.
[0148] Optionally, the file header further includes at least one of the following fields: a format signature, a file size, a third line status, or a check digit.
[0149] Optionally, the second file further includes a directory block, and the target block indicates the sequence number of the first data entry in the block, the position of the block in the second file, and the position of the block in the first file.
[0150] Optionally, the first file is a FASTQ file.
[0151] Optionally, the apparatus 1200 further includes a decompression unit configured to decompress a plurality of data blocks in the second file based on the file header of the second file to obtain the first file.
[0152] It should be noted that various specific implementation modes of the communication device 1200 can be found in the relevant introduction of the method 100 corresponding to FIG9 , and will not be described in detail in this embodiment.
[0153] Accordingly, the embodiment of the present application further provides a communication device 1300, as shown in Figure 13. The communication device 1300 may include: a first obtaining unit 1301, a determining unit 1302, and a second obtaining unit 1303.
[0154] The first obtaining unit 1301 is configured to obtain, based on the above model, feature values of a plurality of characters included in the first data, wherein the feature value of any character in the plurality of characters is used to characterize a feature of the above character string of a preset length. The first obtaining unit 1301 may execute S201 shown in FIG11 .
[0155] The determining unit 1302 is configured to determine a target compression model according to the feature value of any character. The determining unit 1302 may execute S202 shown in FIG11 .
[0156] The second obtaining unit 1303 is configured to compress the arbitrary character based on the target compression model to obtain second data, where the second data is a compression result of the first data. The second obtaining unit 1303 may execute S203 shown in FIG11 .
[0157] Optionally, the first obtaining unit 1301 may include: a first obtaining subunit and a first determining subunit. The first obtaining subunit is configured to obtain, for any character among the multiple characters, a context string of a preset length for the character; and the first determining subunit is configured to determine a feature value of the character based on the compressed length of each context character in the context string, each context character in the context string, and a preset calculation rule.
[0158] Optionally, determination unit 1302 may include: a second obtaining subunit and a second determining subunit, the second obtaining subunit being configured to sort multiple characters in the first data according to feature values to obtain multiple groups of character strings, wherein each group of character strings has the same feature value; a second determining subunit being configured to determine a first compression model for a first group of character strings in the multiple groups of character strings based on the feature values and a mapping relationship corresponding to the first group of character strings, wherein the mapping relationship includes a correspondence between multiple groups of feature values and compression models. Second obtaining unit 1303 is specifically configured to compress the first group of character strings based on the first compression model to obtain third data, wherein the second data includes the third data.
[0159] Optionally, the first data is a quality score in any block after the FASTQ file is segmented.
[0160] It should be noted that various specific implementation modes of the communication device 1300 can be found in the relevant introduction of the method 200 corresponding to FIG11 , and will not be described in detail in this embodiment.
[0161] Referring to Figure 14 , an embodiment of the present application provides a communication device 1400. This communication device 1400 can be the execution entity of any of the aforementioned embodiments. This communication device 1400 can implement the functions of the aforementioned embodiments. This communication device 1400 includes at least one processor 1401, a bus system 1402, a memory 1403, and at least one communication interface 1404.
[0162] The communication device 1400 is a hardware device that can be used to implement the functional modules in the communication device 1200 shown in Figure 12. For example, those skilled in the art can imagine that the first obtaining unit 1201, the second obtaining unit 1202, the first compression unit 1203, and the third obtaining unit 1204 in the communication device 1200 shown in Figure 12 can be implemented by the at least one processor 1401 calling the code in the memory 1403. For another example, those skilled in the art can imagine that the first obtaining unit 1301, the determining unit 1302, and the second obtaining unit 1303 in the communication device 1300 shown in Figure 13 can be implemented by the at least one processor 1401 calling the code in the memory 1403.
[0163] Optionally, the communication device 1400 may also be used to implement the functions of the network device or control entity in any of the above embodiments.
[0164] Optionally, the processor 1401 may be a general-purpose central processing unit (CPU), a network processor (NP), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.
[0165] The bus system 1402 may include a path for transmitting information between the components.
[0166] The communication interface 1404 is used to communicate with other devices or communication networks.
[0167] The memory 1403 may be a read-only memory (ROM) or other static storage device capable of storing static information and instructions, a random access memory (RAM) or other dynamic storage device capable of storing information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and capable of being accessed by a computer, but not limited thereto. The memory may be independent and connected to the processor via a bus. The memory may also be integrated with the processor.
[0168] The memory 1403 is used to store application code for executing the solution of the present application, and the execution is controlled by the processor 1401. The processor 1401 is used to execute the application code stored in the memory 1403, thereby realizing the functions of the method of the present application.
[0169] In a specific implementation, as an embodiment, the processor 1401 may include one or more CPUs, such as CPU0 and CPU1 in FIG14 .
[0170] In a specific implementation, as an embodiment, the communication device 1400 may include multiple processors, such as the processor 1401 and the processor 1407 in FIG14 . Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0171] It should be understood that the communication devices or communication equipment in the various product forms mentioned above respectively have any functions implemented by the execution subject in the above method embodiments, which will not be described in detail here.
[0172] The present application also provides a chip including a processor and an interface circuit, wherein the interface circuit is configured to receive instructions and transmit them to the processor; the processor, which may be, for example, a specific implementation of the message processing device in the present application embodiment, may be configured to execute the above-described method 100 or method 200. The processor is coupled to a memory configured to store programs or instructions. When the programs or instructions are executed by the processor, the chip system implements the method in any of the above-described method embodiments.
[0173] Optionally, there may be one or more processors in the chip system. The processor may be implemented in hardware or software. When implemented in hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented in software, the processor may be a general-purpose processor implemented by reading software code stored in a memory.
[0174] Optionally, the memory in the chip system may be one or more memories. The memory may be integrated with the processor or may be provided separately from the processor, which is not limited in this application. For example, the memory may be a non-transient processor, such as a read-only memory (ROM), which may be integrated with the processor on the same chip or provided on different chips. This application does not specifically limit the type of memory or the configuration of the memory and the processor.
[0175] Exemplarily, the chip system can be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD) or other integrated chips.
[0176] In addition, an embodiment of the present application further provides a storage medium, in which program code or instructions are stored. When the storage medium is run on a processor, the processor executes a method in any one of the implementation modes of the above embodiments.
[0177] In addition, an embodiment of the present application also provides a program product, which, when executed on a processor, enables the processor to execute any one of the aforementioned methods 100 or 200.
[0178] It should be understood that "determining B based on A" mentioned in the embodiments of the present application does not mean determining B only based on A, but B can also be determined based on A and / or other information.
[0179] It should be understood that the network architecture and business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field can know that with the evolution of network architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0180] In this application, ordinal numbers such as "1", "2", "3", "first", "second" and "third" are used to distinguish multiple objects and are not used to limit the order of multiple objects.
[0181] “A and / or B” mentioned in this application should be understood to include the following situations: only A, only B, or both A and B.
[0182] Through the description of the above embodiments, it can be known that those skilled in the art can clearly understand that all or part of the steps in the above embodiment methods can be implemented by means of software plus a general hardware platform. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a storage medium, such as a read-only memory (ROM) / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network communication device such as a router) to execute the methods described in each embodiment or certain parts of the embodiments of the present application.
[0183] Each embodiment in this specification is described in a progressive manner. The same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. In particular, for system embodiments and device embodiments, since they are basically similar to method embodiments, the description is relatively simple. For relevant parts, refer to the partial description of the method embodiment. The device and system embodiments described above are merely schematic. The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without making any creative effort.
[0184] The above description is only a preferred embodiment of the present application and is not intended to limit the scope of protection of the present application. It should be noted that those skilled in the art may make several improvements and modifications without departing from the scope of protection of the present application, and such improvements and modifications should also be considered as within the scope of protection of the present application.
Claims
1. A data processing method, characterized in that: include: Obtaining a file header, wherein the file header includes: block information, description information compression parameters, sequence compression parameters, and quality score compression parameters; According to the block information and the first file, a plurality of blocks are obtained, each of the plurality of blocks comprising first description information, a first sequence and a first quality score; According to the description information compression parameter, the sequence compression parameter and the quality score compression parameter, respectively compress the first description information, the first sequence and the first quality score in each of the multiple blocks to obtain a data block corresponding to each of the multiple blocks, wherein the data block includes: a compression result of the description information, a compression result of the sequence and a compression result of the quality score of the corresponding block; A second file is obtained, where the second file is a compressed file of the first file, and the second file includes: the file header and a data block corresponding to each of the multiple blocks.
2. The method according to claim 1, characterized in that The step of obtaining a plurality of blocks according to the block information and the first file includes: Performing block processing on the first file according to the block information to obtain multiple data entry sets, each of the multiple data entry sets including at least one group of data entries; Data entries in any data entry set among the multiple data entry sets are classified according to data types to obtain blocks corresponding to the any data entry set, where the data type includes at least one of description information, sequence, and quality score.
3. The method according to claim 2, characterized in that The block information includes a memory size identifier memID, and the first file is processed into blocks according to the block information to obtain multiple data entry sets, including: Determine memory information according to the memID; The first file is processed into blocks based on the memory information to obtain the multiple data entry sets.
4. The method according to claim 2 or 3, characterized in that: Any one of the data entry sets includes a first data entry and a second data entry, the first data entry includes second description information, a second sequence, and a second quality score, and the second data entry includes third description information, a third sequence, and a third quality score. Then, in the blocks corresponding to any one of the data entry sets, the first description information includes the second description information and the third description information, the first sequence includes the second sequence and the third sequence, and the first quality score includes the second quality score and the third quality score.
5. The method according to any one of claims 2 to 4, characterized in that: The blocks corresponding to any one of the data entry sets also include: length information of each data entry in the any one of the data entry sets, wherein the length information is the length of the sequence of the corresponding data entry or the length of the quality score, and the data blocks also include: data compressed from the length information of each data entry in the corresponding blocks.
6. The method according to any one of claims 1 to 5, characterized in that: The quality score compression parameters include: a first parameter and a second parameter, the first parameter is used to indicate a context model, the context model is used to determine a feature value of a context string of a character to be encoded, and the second parameter is used to determine a compression model corresponding to the feature value.
7. The method according to claim 6, characterized in that Compressing the first quality score in each of the multiple blocks according to the quality score compression parameter, respectively, includes: For any quality score character among the multiple quality score characters in any block of the multiple blocks, obtain a previous character string of the any quality score character; Determine a characteristic value of any quality score character according to the first parameter and a previous character string of any quality score character; Determining a target compression model based on the second parameter and the characteristic value of any one of the quality score characters; Based on the target compression model, compressing any one of the quality score characters; According to the compression results of the multiple quality score characters, a compression result of the first quality score corresponding to any one of the blocks is obtained.
8. The method according to claim 7, characterized in that The step of determining a target compression model based on the second parameter and the characteristic value of any one of the quality score characters comprises: sorting the quality score characters in any of the blocks according to the characteristic values to obtain multiple groups of quality score character strings, wherein the characteristic values corresponding to each group of quality score character strings in the multiple groups of quality score character strings are the same; For a first quality score character string in the plurality of groups of quality score character strings, based on a feature value corresponding to the first quality score character string, determining a first compression model; The compressing any one of the quality score characters based on the target compression model includes: The first quality score character string is compressed based on the first compression model.
9. The method according to claim 8, characterized in that The second file also includes: a characteristic value of the first quality score character in any of the blocks.
10. The method according to claim 8 or 9, characterized in that: The quality score compression parameter further includes a third parameter, and the third parameter is used to indicate a threshold value of the length of the string for performing the compression operation. The method further includes: The quality score character strings whose lengths are less than the threshold of the character string length in the plurality of groups of quality score character strings are saved in the target area; The quality score character string in the target area is compressed based on a general compression algorithm.
11. The method according to any one of claims 1 to 10, characterized in that: The description information compression parameters include: a segmentation strategy and a second compression model, and compressing the first description information in each of the multiple blocks according to the description information compression parameters includes: Segmenting the first description information in any block of the multiple blocks according to the segmentation strategy to obtain multiple description segments; For any description segment of the multiple description segments, perform the following steps according to the second compression model: If any of the description fragments is integer type data, then converting any of the description fragments into binary and then compressing them; If any of the description segments does not belong to integer type data, then, compressing any of the description segments using the LZ algorithm; According to the compression results corresponding to the multiple description fragments, the compression result of the description information corresponding to any one of the blocks is obtained.
12. The method according to any one of claims 1 to 11, characterized in that: The sequence compression parameters include: a packing length and a third compression model. According to the sequence compression parameters, the first sequence in each of the multiple blocks is compressed respectively, including: Processing a first sequence in any block of the multiple blocks according to an N-pack strategy to obtain a fourth sequence, where N is an integer greater than 1 and matches the packing length; The fourth sequence is compressed according to the third compression model to obtain a compression result of the sequence corresponding to any one of the blocks.
13. The method according to any one of claims 1 to 12, characterized in that: The compression result of the description information includes the size of the description information after compression and a first compressed stream corresponding to the description information, wherein the first compressed stream includes the compressed data of the description information; The compression result of the sequence includes the size of the sequence after compression and a second compressed stream corresponding to the sequence, and the second compressed stream includes the compressed data of the sequence; The compression result of the quality score includes the size of the quality score after compression and a third compressed stream corresponding to the quality score, and the third compressed stream includes the data after compression of the quality score.
14. The method according to any one of claims 1 to 13, characterized in that: The file header also includes at least one of the following fields: a format signature, a file size, a third line status, or a check digit.
15. The method according to any one of claims 1 to 14, characterized in that: The second file also includes a directory block, and the target block indicates the sequence number of the first data entry in the block, the position of the block in the second file, and the position of the block in the first file.
16. The method according to any one of claims 1 to 15, characterized in that: The first file is a FASTQ file.
17. The method according to any one of claims 1 to 15, characterized in that: The method further comprises: Based on the file header of the second file, multiple data blocks in the second file are decompressed to obtain the first file.
18. A data processing method, characterized in that: include: Based on the above model, characteristic values of a plurality of characters included in the first data are obtained, wherein the characteristic value of any character among the plurality of characters is used to characterize the characteristic of the above character string of a preset length of the any character; Determining a target compression model according to a feature value of any one of the characters; Compress any one of the characters based on the target compression model to obtain second data, where the second data is a compression result of the first data.
19. The method according to claim 18, characterized in that The step of obtaining feature values of a plurality of characters included in the first data based on the above model includes: For any character among the multiple characters, obtain a context string of a preset length of the any character; According to the compressed length of each preceding character in the preceding character string, each preceding character in the preceding character string and the preset calculation rule Then, determine the feature value of any character.
20. The method according to claim 18 or 19, characterized in that Determining the target compression model according to the feature value of any character includes: Sort the multiple characters in the first data according to the characteristic values to obtain multiple groups of character strings, wherein the characteristic values corresponding to each group of character strings in the multiple groups of character strings are the same; For a first group of character strings among the multiple groups of character strings, determining a first compression model based on feature values and mapping relationships corresponding to the first group of character strings, wherein the mapping relationships include corresponding relationships between multiple groups of feature values and compression models; The step of compressing the any character based on the target compression model to obtain second data includes: Based on the first compression model, the first group of character strings is compressed to obtain third data, and the second data includes the third data.
21. The method according to any one of claims 18 to 20, characterized in that: The first data is the quality score in any block after the FASTQ file is segmented.
22. A communication device, characterized in that: The communication device comprises a processing unit; The processing unit is used to execute the method according to any one of claims 1 to 21.
23. A communication device, characterized in that: The communication device includes a processor and a memory; The processor is configured to execute instructions stored in the memory, so that the communication device executes the method according to any one of claims 1 to 21.
24. A storage medium, characterized in that The storage medium stores instructions, and when the instructions are executed on the processor, the method according to any one of claims 1 to 21 is executed.
25. A program product, characterized in that The program product comprises a program, and when the program is run on a processor, the method according to any one of claims 1 to 21 is executed.
Citation Information
Patent Citations
Data processing method and related equipment
CN118643013A
Parallel compression and decompression method and system for FASTQ file
CN111628779A
File processing method and device, storage medium and electronic device
CN112817926A
Batch distributed compression method based on FASTQ gene big data
CN113268459A
Systems and methods for storing and transmitting diverse genomic data
CN115699190A
Cited By
TF card storage data analysis method and device, equipment and medium
CN121116706A
