Data processing method and related equipment
Patent Information
- Application Number
- CN202310303465.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-13
- Publication Date
- 2024-09-13
Smart Images

Figure CN118643013A
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and in particular to a data processing method and related equipment. Background Art
[0002] Faced with the rapid expansion of data, enterprises need to continuously purchase a large number of storage devices to cope with the growing storage demand. However, simply increasing storage capacity does not seem to be a fundamental solution to the problem. The concept of efficient storage is proposed for this purpose. It aims to alleviate the space growth problem of storage systems, reduce the space occupied by data, simplify storage management, maximize the use of existing resources, and reduce costs. Data compression technology reduces redundancy by re-encoding data to achieve the purpose of reducing data capacity. It is one of the key technologies for data reduction.
[0003] Current data compression technology cannot meet the needs of some scenarios. For example, with the extensive 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 take up a large storage space, use more computing resources, and consume a long processing time, and the compression efficiency is low.
[0004] 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. Summary of the invention
[0005] 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.
[0006] 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 respectively according to the description information compression parameters, the sequence compression parameters and the quality score compression parameters, 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 the data block corresponding to each of 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.
[0007] In a possible implementation, obtaining multiple blocks according to the block information and the first file may include: 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 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 the data type to obtain the blocks corresponding to the any data entry set, the data type including at least one of description information, sequence and quality score.
[0008] As an example, the block information includes a memory size identifier (memID), then the block processing of the first file according to the block information to obtain multiple data entry sets may include: determining memory information according to the memID; and block processing of the first file based on the memory information to obtain the multiple data entry sets. The memory information may refer to the memory upper limit or memory size of each block.
[0009] As an example, taking the example 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 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.
[0010] In a possible implementation, the block corresponding to any data entry set may further include: length information of each data entry in the set of data entries, the length information being the length of the sequence of the corresponding data entry or the length of the quality score, and the data block further includes: data compressed from the length information of each data entry in the corresponding block. In this way, the necessary basis is provided for the subsequent decompression of the second file.
[0011] In a 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 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.
[0012] As an example, according to the quality score compression parameter, compressing the first quality score in each of the multiple blocks respectively may include: obtaining the context string of any quality score character among the multiple quality score characters in any block of the multiple blocks; determining the feature value of any quality score character according to the first parameter and the context string of any quality score character; determining the target compression model based on the second parameter and the feature value of any quality score character; compressing any quality score character based on the target compression model; and obtaining the compression result of the first quality score corresponding to any block according to the compression results of the multiple quality score characters. In this way, dynamic compression is performed on each quality score character. Since the feature value of 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 value corresponding to the same feature value with the latest target compression model used, which puts greater pressure on memory and processing, the efficiency is also improved compared to the current compression scheme.
[0013] Wherein, the determining of the 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 the characteristic value corresponding to each group of quality score character strings in the multiple groups of quality score character strings is the same; and determining the first compression model for the 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, the compressing of 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. In this way, by classifying the quality score characters according to the characteristic value, the number of executions of the compression process is reduced, and after the quality score character string corresponding to each characteristic value is compressed, the target compression model corresponding to the characteristic value may not be maintained in the memory, so that fast and efficient "static" encoding can be achieved, and the pressure on memory and processing is also small.
[0014] As an example, in the technical solution of "static" encoding, in order to effectively restore the first file, the second file may also include: a feature value of the first quality score character in any of the blocks.
[0015] In a possible implementation, 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 may further include: saving the quality score strings whose lengths are less than the threshold value of the string length in the multiple groups of quality score strings to a target area; and compressing the quality score strings in the target area based on a general compression algorithm. In this way, multiple separate compressions of too short quality score strings are avoided, and by accumulating these shorter quality score characters to the target area and uniformly compressing them using a general compression algorithm, the compression efficiency is effectively improved.
[0016] 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 any of the description fragments into binary and then compressing it; if any of the description fragments does not belong to integer type data, then compressing any of the description fragments using the LZ algorithm; and obtaining the compression result of the description information corresponding to any of the blocks according to the compression results corresponding to the multiple description fragments. In this way, rapid compression of the description information in each block is achieved.
[0017] In a possible implementation, the sequence compression parameters may include: packing length and a third compression model. Then, according to the sequence compression parameters, compressing the first sequence in each of the multiple blocks respectively may include: processing the first sequence in any block of the multiple blocks according to the N-pack strategy to obtain a fourth sequence, wherein N is an integer greater than 1 and matches the packing length; compressing the fourth sequence according to the third compression model to obtain a compression result of the sequence corresponding to any block. In this way, fast compression of the sequence in each block is achieved.
[0018] In a possible implementation, the compression result of the description information may include the size of the description information after compression and the first compression stream corresponding to the description information, the first compression stream includes 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 compression stream corresponding to the sequence, the second compression stream includes 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 compression stream corresponding to the quality score, the third compression stream includes 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.
[0019] 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.
[0020] In a 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. In this way, it is convenient for a user to randomly read a certain part of the data in the second file.
[0021] In a possible implementation, the first file is a FASTQ file.
[0022] In a possible implementation, the method may further include: based on the file header of the second file, decompressing multiple data blocks in the second file to obtain the first file. In this way, effective decompression of highly efficient compressed files is achieved, providing a basis for friendly file storage.
[0023] In the second aspect, the present application also provides a data processing method, which may include: based on the above model, obtaining feature values of multiple characters included in the first data, the feature value of any character in the multiple characters is used to characterize the feature of the above character string of a preset length of the any character; according to the feature value of any character, determining the target compression model; based on the target compression model, compressing the any character to obtain second data, the second data is the compression result of the first data. In this way, high-efficiency compression of the high-order model is achieved, and less storage space is occupied.
[0024] In a possible implementation, obtaining the feature 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 feature 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.
[0025] In a possible implementation, determining the target compression model according to the feature value of any character may include: sorting the multiple characters in the first data according to the feature value to obtain multiple groups of character strings, wherein the feature value corresponding to each group of character strings in the multiple groups of character strings is the same; for a first group of character strings in the multiple groups of character strings, determining the first compression model based on the feature value and mapping relationship 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, compressing any character based on the target compression model to obtain the 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.
[0026] The first data may be a quality score in any block after the FASTQ file is segmented.
[0027] In a third aspect, the present application provides a communication device, which includes a processing unit, and the processing unit is used to implement methods corresponding to the first aspect, the second aspect and possible implementation methods thereof.
[0028] 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 possible implementation methods thereof.
[0029] In a fifth aspect, the present application further provides a storage medium, wherein the storage medium stores instructions, and when the instructions are executed on a processor, methods corresponding to the first aspect, the second aspect and possible implementations thereof are implemented.
[0030] In a sixth aspect, the present application further provides a program product, which includes a program, and when the program runs on a processor, implements the methods corresponding to the first aspect, the second aspect and their possible implementation methods.
[0031] 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
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can also be obtained based on these drawings.
[0033] Figure 1 This is a schematic diagram of a compressed FASTQ file in an embodiment of the present application;
[0034] Figure 2 for Figure 1 A schematic diagram of a file header in the file shown;
[0035] Figure 3 for Figure 2 A schematic diagram of a quality score compression parameter in a file header shown;
[0036] Figure 4 for Figure 1 A schematic diagram of a data block in the file shown;
[0037] Figure 5 for Figure 4A schematic diagram of Compressed Quality Scores in the data block shown;
[0038] Figure 6 for Figure 1 A schematic diagram of a type of end block in the file shown;
[0039] Figure 7 for Figure 1 A schematic diagram of an optional block in the file shown;
[0040] Figure 8 for Figure 1 A schematic diagram of a file including a directory area is shown;
[0041] Fig. 9 A schematic diagram of a data processing method 100 in an embodiment of the present application;
[0042] Fig.10 This is a flowchart of an implementation method of S1031 in an embodiment of the present application;
[0043] Fig.11 A flowchart of a data processing method 200 in an embodiment of the present application;
[0044] Fig.12 This is a schematic diagram of the structure of a communication device 1200 according to an embodiment of the present application;
[0045] Fig.13 This is a schematic diagram of the structure of a communication device 1300 according to an embodiment of the present application;
[0046] Fig.14 14 is a schematic diagram of the structure of a communication device 1400 in an embodiment of the present application. DETAILED DESCRIPTION
[0047] With the rapid expansion of data, data compression technology has become necessary and important in data transmission and storage. Although the current data compression technology can perform lossless compression on the data involved in various scenarios. However, in some scenarios, the use of these conventional data compression technologies cannot achieve the purpose of efficient data compression, which is an unacceptable shortcoming for fields involving large amounts of data. For example, with the large-scale application of genetic data, only conventional data compression technology is used to compress the FASTQ files generated by gene sequencing as ordinary files to be compressed, and the compression efficiency cannot meet the needs of this field. For example, FQZComp and GTZ are two conventional compression algorithms, but when compressing FASTQ files, FQZComp needs to maintain a model including many parameters. The huge model is reflected in the communication device as a data structure that occupies a large amount of memory. Maintaining a huge data structure in a performance-limited system will greatly affect the computing efficiency, thereby making the compression efficiency very low; GTZ is a bit-level dynamic encoding algorithm, which encodes each bit and needs to maintain multiple models that may be required by the characters on the next bit, making the compression efficiency low.
[0048] Based on this, the embodiment of the present application provides a data processing method, in which compression parameters and block information are pre-configured in the file header. When compressing the first file to be compressed, the first file can be firstly processed into blocks based on the block information to obtain multiple blocks; then, each block is compressed based on the compression parameters to obtain the corresponding data block; then, the second file is obtained according to the file header and the data blocks corresponding to the multiple blocks of the first file, and 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 the compression scheme related parameters in the file header of the file that conforms to the defined compressed file format, and after the file is 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, so as to achieve efficient data compression.
[0049] The method provided in the embodiment of the present application can be applied to unstructured data storage to reduce storage 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, a cloud, or a 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 by software or hardware.
[0050] The data processing method provided in the embodiment of the present application can be applied to FASTQ files, for example. The following takes the compression and decompression of FASTQ files as an example to introduce the embodiment of the present application.
[0051] FASTQ file is a file format for storing data obtained after gene sequencing. FASTQ file can include multiple groups of data entries, each group of data entries can have 4 lines, namely: description information line, base sequence line, comment line and quality score line. Among them, the bases in the base sequence line correspond to the quality scores in the quality score line one by one, and the quality score is used to indicate the sequencing quality of the corresponding base; the comment line can be empty, or it can include special symbols, and it can also include the description information in the description information line. The nucleic acid sequence can include four bases: A, C, T and G. In the FASTQ file, the bases are represented as corresponding ASCII codes; the value range of the quality score can be ASCII code 0x21 (i.e. the lowest value, ASCII code of '!') to 0x7e (i.e. the highest value, ASCII code of '~'). For example, FASTQ file 1 includes data entries 1 to data entries 100. Taking data entry 1 as an example, data entry 1 can be represented as: <description information line 1, base sequence line 1, comment line 1 and quality score line 1>.
[0052] The file format of the compressed FASTQ file defined in the embodiments of the present application can be found in Figure 1 As shown, it can be expressed as: file header, data block 1, data block 2, ..., data block m and ending block, where m is an integer greater than 1.
[0053] Below Figure 1 The specific format of each part is exemplified.
[0054] like Figure 2 As shown, 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 at least one of a check bit (hCRC).
[0055] Among them, the format signature is used to write Figure 1The signature of the file shown can be user-defined and can be 4 bytes in length. File size, the size of the FASTQ file after the user indicates the file is decompressed, can be 4 bytes in length. memID, used to determine the memory information of the block, 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 according to memID, the memory size occupied by each block needs to be less than the memory upper limit. The length of the third line status can be 1 byte, and the first 4 bits represent the status of the third line of each data entry of 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 is a repeat of the first line content, 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 byte and the second byte can indicate whether semantic segmentation is performed. When the value of the first byte and the second byte = 1, it means that semantic segmentation is required. When the value of the first byte and the second byte = 0, it means that semantic segmentation is not required. The third byte and the fourth byte indicate the compression model used for the description information. For example, when the value of the third byte and the fourth byte = 0, it means that zstd compression is used for the description information. When the value of the third byte and the fourth byte = 1, it means that gzip compression is used for the description information. When the value of the third byte and the fourth byte = 2 or a value greater than 2, the corresponding compression model can be customized. The length of the sequence compression parameter may be 4 bytes, the first byte and the second byte may indicate whether byte-level packing is performed, for example, when the value of the first byte and the second byte = 0, it indicates no packing, when the value of the first byte and the second byte = 1, it indicates two-by-two packing, when the value of the first byte and the second byte = 2, it indicates three-by-three packing; the third byte and the fourth byte may indicate the compression model used for the base sequence (hereinafter referred to as the sequence), for example, when the value of the third byte and the fourth byte = 0, it indicates that the sequence is compressed using zstd, when the value of the third byte and the fourth byte = 1, it indicates that the sequence is compressed using gzip, when the value of the third byte and the fourth byte = 2, it indicates that the sequence is compressed using a first-order Markov model, when the value of the third byte and the fourth byte = 3, it indicates that the sequence is compressed using a second-order Markov model, when the value of the third byte and the fourth byte = 4, it indicates that the sequence is compressed using a third-order Markov model. hCRC may be 1 byte in length.
[0056] The quality score compression parameters can be Figure 3As shown, the length can be 4 bytes, and can include a compressor (Compressors) and a model identifier (modelID). Optionally, the quality score compression parameter can also include a cut size (cutSize). Among them, the length of Compressors can be 2 bytes, which is used to indicate the compression model corresponding to different values. For example, if the function module in the compressor plug-in module of the communication device itself, which is used to carry the method provided by the embodiment of the present application, includes multiple compression models, then the compression model can be determined in the function module through the value of Compressors; if the function module in the compressor plug-in module of the communication device itself, which is used to carry the method provided by the embodiment of the present application, does not include a compression model, then the interface can be determined through 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, which can be 1 byte in length. The feature value of the above string of the character 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 threshold of the string length for compression. The value will vary with the compression model determined by Compressors. It is used to adjust the balance between compression rate and compression efficiency. It can be 1 byte in length. The compression rate refers to the percentage of the compressed file size to the pre-compression file size. The 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. The compression efficiency can be quantified by the compression throughput (or compression throughput). The greater the compression throughput (or compression throughput), the better the compression efficiency.
[0057] 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 in 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).
[0058] like Figure 4 As shown, the data block may include: type (bType), compressed block size (CompressedBlockSize), compressed record length (Compressed Record Len), compression result of description information (Compressed Desc), compression result of sequence (Compressed Sequence), compression result of quality score (Compressed Quality Scores) and check bit (CRC). Among them, bType is used to indicate the type of the block, and the length can be 1 byte. When bType = 0, it indicates that the block is a data block. When bType = 1, it indicates that the block is an end block. The extended optional block can be indicated by extending the value of bType. ComperssedBlockSIze is used to indicate the size of the data block. The size of the data block can ignore the CRC in the data block, and the length can be 4 bytes. Compressed Record Len is used to indicate the compression result after compressing the sequence length in each data entry recorded in the block corresponding to this data block, and the length is variable. Compressed Desc is the compressed data carrying the description information of this data block, and the length is variable. CompressedSequence is the compressed data carrying the sequence of this data block, and the length is variable. Compressed Quality Scores, carries the compressed quality score of this data block, with a variable length. The CRC can be 4 bytes long.
[0059] For Compressed Desc, Compressed Sequence, and Compressed QualityScores in the data block, the format can be the same. For Compressed Quality Scores, the format can be found in Figure 5 As shown, it 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, and compressedStream at least includes the data after the quality score is compressed. Optionally, the Compressed Quality Scores can also include the size of the quality score before compression (inSize), inSize can be used to prompt the size of the compressed stream after decompression, so as to avoid the risk of storage caused by files that are too large after decompression, and provide convenience for users.
[0060] like Figure 6 As shown, the end block may include: bType, end block size and CRC. Among them, bType = 1 is used to indicate that the block is an end block, and the length can be 1 byte. The end block size is used to indicate the length of the end block, and the length of the end block may not consider the CRC in the end block, that is, the end block size = 0, and the length can be 4 bytes. The length of the CRC can be 4 bytes.
[0061] The file format defined in the embodiment of the present application may also include an optional block that can be extended. The optional block may be located between the file header and data block 1, or between data block m and the end block. Figure 7 As shown, the optional block may include, for example: bType, optional block size, optional block information and CRC. The value of bType may be an integer between 2 and 255, which is used to indicate the type of the extended optional block and may be 1 byte in length. The optional block size is used to indicate the length of the optional block, which may not take into account the CRC in the optional block and may be 4 bytes in length. The optional block information is used to indicate the content carried by the optional block and may be of variable length. The length of the CRC may be 4 bytes.
[0062] 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 directory areas. The directory area can be, for example, Figure 8 As shown, the directory area includes the same number of directory blocks as the data blocks, that is, the directory area includes directory blocks 1 to m. The format of each target block is shown in Figure 7The format of the optional block shown in FIG. 1 is different in that: 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 of content: the sequence number of the first data entry in the corresponding data block, the number of the corresponding data block in the Figure 1 The location in the file shown and the corresponding data block in Figure 1 The position of the FASTQ file before the file is compressed is shown in the figure, and 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 through the indication of each directory block, so that the user can flexibly and quickly read each data block in the file after the FASTQ file is compressed as defined in the embodiment of the present application.
[0063] After introducing the file format defined for the compressed FASTQ file according to the embodiment of the present application, a data processing scheme applicable to the file format is described.
[0064] like Fig. 9 As shown, the data processing method 100 provided in the embodiment of the present application may include, for example, the following S101 to S104:
[0065] S101, obtaining a file header, wherein the file header includes: block information, description information compression parameters, sequence compression parameters, and quality score compression parameters.
[0066] 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 a 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.
[0067] For more information about the file header, see the above Figure 2 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.
[0068] 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.
[0069] The first file is the original file to be compressed, and the first file can be, for example, a FASTQ file. The above-mentioned lightweight compressed storage format for FASTQ files defined in the embodiment of the present application is implemented based on block and data separation, that is, the data items in the FASTQ file are divided into different blocks, compressed according to the blocks, and then packaged into a complete compressed file.
[0070] 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 to obtain the blocks corresponding to the any data entry set, the data type including at least one of descriptive information, sequence and quality score.
[0071] For S1021, if the block information of the file header includes memID, S1021 may include, for example: first, determining the memory information according to 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 may be determined based on memID and preset formula 1, and 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 may be determined based on 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.
[0072] 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.
[0073] In 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.
[0074] 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.
[0075] It should be noted that in order to enable the compressed file to accurately restore the first 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, and the length of the sequence and quality score in the same data entry are consistent. In this way, block 1 can be represented 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.
[0076] S103: Obtain a data block corresponding to each of the multiple blocks according to the file header and the multiple blocks.
[0077] 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 compression 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 the embodiment of the present application, and they may be executed in any order or simultaneously.
[0078] S1031, compress the first description information in each of the multiple blocks according to the description information compression parameter, and obtain a compression result of the description information corresponding to each of the multiple blocks.
[0079] As an example, if the description information compression parameters in the file header include: segmentation strategy and the second compression model, then, Fig.10 As shown, 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, executing the following steps according to the second compression model: S1031c, if any one of the description fragments is integer type data, then converting any one of the description fragments into binary and then compressing it; S1031d, if any one of the description fragments is not integer type data, then compressing 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.
[0080] It should be noted that the second compression model in the description information compression parameters may refer to the compression process of S1031c to S1031e. The second compression model may include multiple compression algorithms (also called encoding algorithms), for example, the LZ algorithm in this example and the algorithm corresponding to S1031c.
[0081] 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.
[0082] 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 block 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 block.
[0083] It can be seen that in the embodiment of the present application, the LZ fast matching algorithm is used 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.
[0084] Assume that the first sequence includes: ACCCTCGCAATC, N=3, then ACC corresponds to a1, CTC corresponds to a2, GCA corresponds to a3, ATC corresponds to a4, then 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 to skip the match must be less than 3 characters. Since the above repetition is 2 characters, the matching skipping condition of the short sequence is met, so the two bold a2 and a6 are not considered to be matched. If the matching skipping condition of the short sequence is not met, it is necessary to record only one of the multiple matching strings, and the other matching strings only record the position relationship or distance information between them and the recorded string.
[0085] S1033: Compress the first quality score in 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.
[0086] The quality score compression parameters may include at least: a first parameter and a second parameter. The first parameter is used to indicate a context model, which is used to determine the feature value of the context string of the character to be encoded. For the description of the first parameter, please refer to Figure 3 The second parameter is used to determine the compression model corresponding to the eigenvalue. For the relevant description of the second parameter, see Figure 3 Description of Compressors in .
[0087] As an example, S1033 may include: S1033a, for any quality score character among the multiple quality score characters in any block of the multiple blocks, obtaining the context string of the any quality score character; S1033b, determining the feature value of the any quality score character based on the first parameter and the context string of the any quality score character; S1033c, determining the target compression model based on the second parameter and the feature value of the any quality score character; S1033d, compressing the any quality score character based on the target compression model; S1033e, obtaining the compression result of the first quality score corresponding to the any block based on the compression results of the multiple quality score characters. The feature value may also be referred to as a conditional parameter.
[0088] Taking the above text in which the sequence includes characters a0 to a14 in sequence and the above text model corresponds to 4 characters as an example, the corresponding feature values calculated by S1033a to S1033b can be shown in the following Table 1:
[0089] Table 1
[0090] sequence a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 Eigenvalue 1 2 3 3 1 2 1 3 2 2 3 1 1 3 2
[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):
[0092] F(a0,a1,a2,a3)=T1(a3)+(D2(a2,a3)<<4)+(D2(a1,a2)<<6)+(D1(a0,a1)<<7)...Formula (1)
[0093] Among them, F(a0, a1, a2, a3) is the eigenvalue of a4. T1() can be implemented through the empirical table, empirical correspondence, or preset function 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 storing 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 or not. 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 to be left shifted is in front of "<<", and the number of bits to be left shifted is behind "<<". The number of bits to be left shifted is determined based on the order of each upper character in the upper character string and the bits after each upper character is compressed.
[0094] 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 function 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 that is the farthest away, D1(y, x) that can reflect less information can be used to reflect the influence of a0 on the eigenvalue of a4.
[0095] It should be noted that for the eigenvalues of characters in the upper character string that do not meet the preset length (such as 4 bytes), they can be implemented based on a shorter upper character string and other calculation methods, or they can also be obtained based on experience or other means. This application embodiment does not make any limitations.
[0096] After calculating the eigenvalues of each quality score character, a target compression model (which can also be called an encoding model or 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.
[0097] It should be noted that the execution of the above S1033a~S1033e can be to first use S1033a~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, S1033c~S1033d are performed bit by bit on 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 values before with the latest target compression model used, which is memory and processing. The pressure is relatively large; in another case, S1033c~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 execution times of S1033c and S1033d are reduced. Moreover, after each characteristic value completes S1033c and S1033d, 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 reduce the pressure on memory and processing.
[0098] 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 the characteristic values corresponding to each group of quality score character strings in the multiple groups of quality score character strings are the same; 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 values 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.
[0099] Taking the above Table 1 as an example, after executing S1033c, three groups of quality score character strings can be obtained, as shown in the following Table 2:
[0100] Table 2
[0101] sequence a0 a4 a6 a11 a12 a1 a5 a8 a9 a14 a2 a3 a7 a10 a13 Eigenvalue 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3
[0102] The first quality score character string may be a0, a4, a6, a11 and a12, and the characteristic value corresponding to the first quality score character string is 1; the first quality score character string may be a1, a5, a8, a9 and a14, and the characteristic value corresponding to the first quality score character string is 2; the first quality score character string may be a2, a3, a7, a10 and a13, and the characteristic value corresponding to the first quality score character string is 3. It should be noted that the specific process of grouping the quality score characters may include: the first step is to count the number of occurrences of each characteristic value 5 and the number of different characteristic values 3; the second step is to set the same number of pointers as the number of occurrences of different characteristic values 3, and the position indicated by each pointer is determined based on the number of occurrences of each feature, 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; the third step is to fill in the position pointed to by the pointer corresponding to the characteristic value of each character in Table 1 in sequence according to the characteristic value of the character, and when there is a character filled in, the pointer moves to the next character position.
[0103] Taking the first quality score string of 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, so that the string of 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.
[0104] Assuming that the compression result of the string of a0, a4, a6, a11 and a12 is compression result 1, the compression result of the string of a1, a5, a8, a9 and a14 is compression result 2, and the compression result of the string of 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.
[0105] It should be noted that in the scheme of re-ordering the quality score characters and then compressing them, in order to ensure that the decompression can be completed effectively, it is necessary to restore the rearranged multiple groups of quality score strings to the 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, so 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 considered that a1 is behind a0, and the position of a1 remains unchanged, if the characteristic value of a1 is 2, then the first character in a 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, then the first character in a 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.
[0106] In some implementations, in the scheme of re-sorting the quality score characters before compression, in order to further improve the compression efficiency, the quality score compression parameter in the file header may further include a third parameter, which is used to indicate the threshold of the length of the string for performing the compression operation. For the relevant description of the third parameter, see Figure 3 In the implementation, for each group of quality score strings in the multiple groups of quality score strings, it is first determined whether the length of the group of quality score strings is less than the threshold of the string length. If not, it is considered that the length of the group of quality score strings reaches the standard for compression, and S1033c and S1033d are performed on the group of quality score strings; if yes, the group of quality score strings is temporarily not compressed and saved to the target area; in this way, the quality score characters to be compressed are accumulated in the target area, and 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 threshold of the string length indicated by the third parameter), or when all the quality score strings in the block complete the above determination, the quality score strings in the target area are compressed using a preset general compression algorithm for compressing target area data.
[0107] 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.
[0108] It can be seen that for the first quality score of each block, the lightweight FASTQ compression algorithm with optimal binning + fast entropy coding has achieved a SOTA level of compression rate, does not require the input of reference sequences, occupies less memory, and significantly improves compression efficiency, which has obvious advantages over the complex models in the commonly used Gzip and GTZ. In the case of 2 megabytes (MB) of data cutting, Gzip, GTZ and the FASTQ compression algorithm were used to test more than 700 gigabytes (GB) of genetic data. The specific comparison can be seen in Table 3 below:
[0109] Table 3
[0110] Compression Algorithm Gzip GTZ FASTQ compression algorithm Compression 3.09 5.3 5.4 Compression / decompression throughput (Mbps / core) 20 / 100 15 / 15 70 / 160
[0111] Mbps / core refers to the transmission of one million bits per core per second, where Mbps stands for Million bits per second.
[0112] S1031 to S1033 are executed for each block to obtain the compression result of the description information of the block, the compression result of the sequence and the compression result of the quality score. In addition, the compression result of the length information is obtained by compressing the length information of the record. Finally, various compression results are saved in the data block corresponding to the block according to the file format defined in the embodiment of the present application. For details, please refer to Figure 4 and Figure 5 Related instructions.
[0113] S104, obtaining 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.
[0114] After obtaining the multiple data blocks, the multiple data blocks are arranged in sequence between the file header and the end block to obtain the second file.
[0115] Among them, the compression result of the description information may at least 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 at least 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 at least 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.
[0116] In order to facilitate random reading of FASTQ files and implement operations on very large files, some optional blocks can be extended as directory areas between the file header and the first data block, or between the last data block and the end block. The directory area can be, for example, Figure 8 As shown, the directory area includes the same number of directory blocks as data blocks. The format of each target block is shown in Figure 7 The format of the optional block shown. For the directory block included in the second file, the target block may 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.
[0117] 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: based on the file header of the second file, decompressing multiple data blocks in the second file to obtain the first file.
[0118] In specific implementation, the decompression process may include: the first step, obtaining the file header of the second file; the second step, based on the parameters in the file header, correspondingly decompressing the compressed data in each data block; the third step, obtaining a third file based on the decompression results of each data block, and under the condition that the second file is safe 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: respectively 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 decompression 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.
[0119] 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 files with large amounts of data friendly, but also greatly improves the compression efficiency of files with large amounts of data.
[0120] The above compression and decompression methods for quality scores in FASTQ files can be adapted to other data that can be compressed as above.
[0121] like Fig.11 As shown, the embodiment of the present application further provides a data processing method 200, which may include the following S201 to S203:
[0122] S201, based on the above model, obtain feature values of multiple characters included in the first data, the feature value of any character in the multiple characters is used to characterize the feature of the above character string of a preset length of the any character.
[0123] As an example, S201 may include: for any character among the multiple characters, obtaining a context string of a preset length of the any character; and determining a feature value of the any character according to the 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 refer to the above formula (1) and related descriptions, for example.
[0124] It should be noted that the implementation method of S201 and the technical effect achieved can refer to the relevant description in the above S1033b.
[0125] The first data may be the first quality score in any block of the FASTQ file after S101.
[0126] S202: Determine a target compression model according to the feature value of any character.
[0127] S203, compressing 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.
[0128] As an example, S202-S203 may include: for each character, determining a target compression model applicable to the character based on the feature value of the character, 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 uniformly calculated in advance based on S201, 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 used, which puts greater pressure on memory and processing, the efficiency is also improved compared to the current compression scheme.
[0129] As another example, S202 may include: sorting multiple characters in the first data according to feature values to obtain multiple groups of strings, wherein the feature values corresponding to each group of strings in the multiple groups of strings are the same; for the first group of strings in the multiple groups of strings, determining a first compression model based on the feature values and mapping relationships corresponding to the first group of strings, wherein the mapping relationships include the corresponding relationships between multiple groups of feature values and compression models. Then, S203 may include: compressing the first group of 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.
[0130] It should be noted that the implementation method of S202 to S203 and the technical effects achieved can refer to the relevant descriptions in the above S1033c to S1033e.
[0131] In the method 200, the context model can be understood as a high-order prediction model of an 8-bit parameter space. For the first data being a character sequence a1, a2, ..., an, ..., a k-order context model attempts to use the first k characters at the current position to preset the probability distribution of the current character. The example in the embodiment of the present application uses k=4 as an example for relevant explanation, 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 context of the 4th-order model as a parameter space, the size of this parameter space is 32 bits. This value is very large, because for every additional 1 bit of the context length, the space size increases by 1 times, and the context model provided in the embodiment of the present application can use a high-efficiency context model with a 32-bit space. If FQZcomp is used, it will take up 16 bits, and the context model provided in the embodiment of the present application can be further compressed to 8 bits, which is 256 times smaller than the FQZcomp model, but the prediction effect remains almost unchanged. The 8-bit model can be easily connected to a more mature high-order encoder, so the 8-bit solution is not only more advanced than the existing 16-bit technology, but also has stronger practicality.
[0132] In addition, the method 200 can also use a compression scheme of a high-order model that replaces dynamic coding with relatively static coding. 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 probability of all possible characters (i.e., the entire distribution) needs 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 the character is 1 byte, the entire string is 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 the memory at all times. When the above model is a high-order conditional probability model, each character has more than one conditional probability, but multiple conditional probabilities. At present, all these probability values are placed in the memory. For each character to be encoded in a string, according to the condition to which the character belongs (e.g., the above value), the corresponding probability value is read and selected. 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, and a total of 256*65536=16777216 bits, about 16MB of probabilities, need to be stored. If 1 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 1 complete 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 the current CPU, even with this size, even if only short floating point numbers are used, there is 128KB of memory usage, and the compression model cannot put all the parameters into the level 1 cache. When encoding, because of the random changes above, the data structure of the compression model needs to be randomly read and updated, which will cause a certain performance degradation. The embodiment of the present application simply reorders the order of characters, arranges all characters with the same characteristics together, and records the size of this subsequence, so there is no need to randomly read from a large data structure, and static encoding can be introduced to achieve compression, thereby improving the efficiency of encoding. In addition, the method provided by the embodiment of the present application can work with very small memory requirements because it does not need to store and maintain all compression models.
[0133] It should be noted that the technical solution provided in the embodiment 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, efficient lightweight compression and storage can be achieved.
[0134] Accordingly, the embodiment of the present application further provides a communication device 1200, such as Fig.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. Wherein:
[0135] The first obtaining unit 1201 is used 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 can be executed Fig. 9 S101 shown.
[0136] The second obtaining unit 1202 is configured to obtain a plurality of blocks according to the block information and the first file, wherein each block in the plurality of blocks includes first description information, a first sequence and a first quality score. The second obtaining unit 1202 may be executed Fig. 9 S102 shown.
[0137] The first compression unit 1203 is used to compress the first description information, the first sequence and the first quality score in each of the multiple blocks according to the description information compression parameter, the sequence compression parameter and the quality score compression parameter, and obtain a data block corresponding to each of the multiple blocks, wherein the data block includes: 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. The first compression unit 1203 can be executed Fig. 9 S103 shown.
[0138] 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 be executed Fig. 9 S104 shown.
[0139] 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 to obtain the blocks corresponding to the any data entry set, and the data type includes at least one of description information, sequence and quality score.
[0140] Optionally, the block information includes a memory size identifier memID, and the block subunit is specifically used to: determine the 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.
[0141] 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 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.
[0142] Optionally, the block corresponding to any one of the data entry sets also includes: 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 block also includes: compressed data of the length information of each data entry in the corresponding block.
[0143] 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 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.
[0144] 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 used to obtain a context string of any quality score character among multiple quality score characters in any block of the multiple blocks; the first determining subunit is used to determine a feature value of any quality score character according to the first parameter and the context string of any quality score character; the second determining subunit is used to determine a target compression model based on the second parameter and the feature value of any quality score character; the first compression subunit is used to compress the any quality score character based on the target compression model; and the third obtaining subunit is used to obtain a compression result of the first quality score corresponding to any block according to the compression results of the multiple quality score characters.
[0145] 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 the characteristic values corresponding to each group of quality score character strings in the multiple groups of quality score character strings are the same; 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 values 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.
[0146] Optionally, the second file further includes: a characteristic value of the first quality score character in any of the blocks.
[0147] Optionally, 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 apparatus 1200 may further include: a storage unit and a second compression unit. The storage unit is used to store the quality score strings whose lengths are less than the threshold value of the string length in the multiple groups of quality score strings to the target area; and the second compression unit is used to compress the quality score strings in the target area based on a general compression algorithm.
[0148] 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 convert any description fragment into binary and then compress it; if any description fragment does not belong to integer type data, then compress any description fragment 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.
[0149] 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 used to process the first sequence in any block of the multiple blocks according to the N-pack strategy to obtain a fourth sequence, where N is an integer greater than 1 and matches the packing length; the third compression subunit is used to compress the fourth sequence according to the third compression model to obtain a compression result of the sequence corresponding to any block.
[0150] 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.
[0151] 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.
[0152] 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.
[0153] Optionally, the first file is a FASTQ file.
[0154] Optionally, the apparatus 1200 further includes: a decompression unit. The decompression unit is 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.
[0155] It should be noted that various specific implementation modes of the communication device 1200 can be found in Fig. 9 The corresponding introduction of method 100 will not be repeated in this embodiment.
[0156] Accordingly, the embodiment of the present application further provides a communication device 1300, such as Fig.13 The communication device 1300 may include: a first obtaining unit 1301, a determining unit 1302, and a second obtaining unit 1303. Wherein:
[0157] The first obtaining unit 1301 is used to obtain the feature values of multiple characters included in the first data based on the above model, and the feature value of any character in the multiple characters is used to characterize the feature of the above character string of a preset length of any character. The first obtaining unit 1301 can be executed Fig.11 S201 shown.
[0158] The determination unit 1302 is used to determine the target compression model according to the feature value of any character. The determination unit 1302 may be executed Fig.11 S202 shown.
[0159] The second obtaining unit 1303 is used to compress the any character based on the target compression model to obtain second data, where the second data is the compression result of the first data. The second obtaining unit 1303 can be executed Fig.11 S203 shown.
[0160] Optionally, the first obtaining unit 1301 may include: a first obtaining subunit and a first determining subunit. The first obtaining subunit is used to obtain a context string of a preset length of any character among the multiple characters; and the first determining subunit is used to determine the feature value of any character according to the compressed length of each context character in the context string, each context character in the context string, and a preset calculation rule.
[0161] Optionally, the determination unit 1302 may include: a second obtaining subunit and a second determining subunit, the second obtaining subunit being used to sort the multiple characters in the first data according to the feature value to obtain multiple groups of strings, wherein the feature value corresponding to each group of strings in the multiple groups of strings is the same; the second determining subunit being used to determine the first compression model for the first group of strings in the multiple groups of strings based on the feature value and mapping relationship corresponding to the first group of strings, wherein the mapping relationship includes the correspondence between multiple groups of feature values and compression models. The second obtaining unit 1303 is specifically used to compress the first group of strings based on the first compression model to obtain third data, wherein the second data includes the third data.
[0162] Optionally, the first data is a quality score in any block after the FASTQ file is segmented.
[0163] It should be noted that various specific implementation modes of the communication device 1300 can be found in Fig.11 The corresponding introduction of method 200 will not be repeated in this embodiment.
[0164] See also Fig.14 , an embodiment of the present application provides a communication device 1400. The communication device 1400 may be an execution subject in any of the above embodiments. The communication device 1400 may implement the functions of the above embodiments. The communication device 1400 includes at least one processor 1401, a bus system 1402, a memory 1403, and at least one communication interface 1404.
[0165] The communication device 1400 is a hardware structure device that can be used to implement Fig.12 The functional modules in the communication device 1200 are shown. For example, those skilled in the art may think of Fig.12The 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 the figure 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 Fig.13 The first obtaining unit 1301 , the determining unit 1302 , and the second obtaining unit 1303 in the communication device 1300 shown in the figure can be implemented by the at least one processor 1401 calling the code in the memory 1403 .
[0166] Optionally, the communication device 1400 may also be used to implement the functions of the network device or the control entity in any of the above embodiments.
[0167] 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.
[0168] The bus system 1402 may include a path for transmitting information between the components.
[0169] The communication interface 1404 is used to communicate with other devices or communication networks.
[0170] The memory 1403 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store 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 compressed optical 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 that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processor via a bus. The memory may also be integrated with the processor.
[0171] The memory 1403 is used to store the 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, so as to realize the functions in the method of the present application.
[0172] In a specific implementation, as an embodiment, the processor 1401 may include one or more CPUs, such as Fig.14 CPU0 and CPU1 in.
[0173] In a specific implementation, as an embodiment, the communication device 1400 may include multiple processors, such as Fig.14 1401 and 1407 in the embodiment of the present invention. Each of these processors may be a single-CPU processor or a multi-CPU processor. A processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0174] It should be understood that the communication devices or communication equipment in the above-mentioned various product forms respectively have any functions implemented by the execution subject in the above-mentioned method embodiment, which will not be repeated here.
[0175] The embodiment of the present application further provides a chip, including a processor and an interface circuit, the interface circuit is used to receive instructions and transmit them to the processor; the processor, for example, can be a specific implementation form of the message processing device in the embodiment of the present application, and can be used to execute the above method 100 or method 200. The processor is coupled to a memory, and the memory is used to store programs or instructions. When the program or instruction is executed by the processor, the chip system implements the method in any of the above method embodiments.
[0176] Optionally, the processor in the chip system may be one or more. The processor may be implemented by hardware or by software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented by software, the processor may be a general-purpose processor implemented by reading software code stored in a memory.
[0177] Optionally, the memory in the chip system may be one or more. The memory may be integrated with the processor or may be separately provided with the processor, which is not limited in the present application. Exemplarily, 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 may be provided on different chips. The present application does not specifically limit the type of memory and the arrangement of the memory and the processor.
[0178] 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.
[0179] 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 in the above embodiments.
[0180] In addition, an embodiment of the present application also provides a program product, which, when executed on a processor, enables the processor to execute a method of any one of the implementation modes of the aforementioned method 100 or method 200.
[0181] 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.
[0182] 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.
[0183] In this application, ordinal numbers such as "1", "2", "3", "first", "second" and "third" are used to distinguish multiple objects but are not used to limit the order of multiple objects.
[0184] “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.
[0185] Through the description of the above implementation methods, it can be known that those skilled in the art can clearly understand that all or part of the steps in the above-mentioned embodiment method can be implemented by means of software plus a general hardware platform. Based on such an 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., including a number of instructions for 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 of the present application or some parts of the embodiments.
[0186] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and 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, and the relevant parts can be referred to the partial description of the method embodiment. The device and system embodiments described above are merely schematic, in which 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 they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0187] The above is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. It should be noted that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the present application, and these improvements and modifications should also be regarded as the protection scope of the present application.
Claims
1. A data processing method, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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 among the multiple groups of quality score character strings, determining a first compression model based on a feature value corresponding to the first quality score character string; 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is 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, It is characterized in that The first file is a FASTQ file.
17. The method according to any one of claims 1 to 15, It is 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, It is 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, It is 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; The characteristic value of any one of the characters is determined according to the compressed length of each of the characters in the above character string, each of the characters in the above character string and a preset calculation rule.
20. The method according to claim 18 or 19, It is 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, It is characterized in that The first data is the quality score in any block after the FASTQ file is segmented.
22. A communication device, It is 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, It is 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, It is 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, It is 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
Cited By
Data processing method and related device
EP4664308A1
Data processing method and related device
WO2024187947A1
