Compression Method and Device for Biological Sequence Identifiers, Decompression Method and Device

By splitting the identifier of the FASTQ format file into sub-identifiers and defining window encoding rules, the problem of poor compression rate and applicability in the prior art is solved, and a more efficient compression effect is achieved.

CN115497569BActive Publication Date: 2025-08-01MGI HLDG CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110669731.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-17
Publication Date
2025-08-01
Estimated Expiration
2041-06-17

AI Technical Summary

Technical Problem

The prior art cannot balance the applicability and compression ratio when compressing FASTQ format files, the applicability of the total score method is poor, and the compression ratio of the differential method is low.

Method used

Split the biological sequence identifier into several sub-identifiers, define window encoding rules, and divide the sub-identifiers with the same meaning into the same window for encoding, and compress them according to the encoding rules.

Benefits of technology

Under the premise of compatibility with special data, the compression rate of all identifier data is improved and the encoding and codec performance is ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115497569B_ABST
    Figure CN115497569B_ABST
Patent Text Reader

Abstract

The present invention discloses a compression method and device for biological sequence identifiers, as well as a decompression method and device. For each identifier in a gene sequencing file, the identifier is split into several sub-identifiers; encoding rules for several windows are defined, and the encoding rules match the text format of the sub-identifiers; the sub-identifiers with the same referential meaning are divided into the same window; for each window, all the sub-identifiers in the window are encoded according to the corresponding encoding rule, and the encoding results of each window are aggregated into the compression result of the identifier. These methods maximize the compression ratio of all identifier data while ensuring compatibility with special data as much as possible, and at the same time ensure the encoding and decoding performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of biological data processing, and in particular, to a method and device for compressing biological sequence identifiers, and a method and device for decompressing the same. Background Art

[0002] Since the birth of DNA (deoxyribonucleic acid) sequencing technology, biological sequence data has been continuously growing, and the growth rate is getting faster and faster. With the accumulation of data, the data storage cost and transmission cost have been continuously increasing. Therefore, it is necessary to compress biological sequence data to reduce costs.

[0003] FASTQ is a text format for storing biological sequences and their sequencing quality information. A FASTQ file contains multiple biological sequence fragments (reads), and every four lines represent a biological sequence fragment as a unit.

[0004] Each biological sequence fragment contains four lines:

[0005] 1. The first line: starts with "@", followed by a unique sequence ID identifier, and the identifier may contain several sequence description contents;

[0006] 2. The second line: the base sequence, usually a string composed of ACGTN, and in extremely rare cases, other characters may appear;

[0007] 3. The third line: starts with "+", followed by nothing, or followed by an optional ID identifier and optional description contents. If there is content after "+", the content must be the same as the content after "@" in the first line;

[0008] 4. The fourth line: the sequencing quality value of the base, corresponding to the base sequence in the second line, and each base sequence corresponds to a sequencing quality value. The sequencing quality value of the base refers to the sequencing credibility of each base. There are two quality value systems, starting from! and @ respectively, and the range is about 40 characters.

[0009] At first, tools such as gzip and bzip2 (both are compression tools) were used to compress FASTQ format files. Due to insufficient utilization of the characteristics of FASTQ format files, the compression ratio was not ideal. Later, tools specifically for compressing FASTQ format files appeared, such as SeqDB and G-SQZ (both are compression tools). They both chose to encode the base sequence and sequencing quality value in the FASTQ format file in combination, while the identifiers in the FASTQ format file were still encoded independently. The compression ratio of this strategy was very poor, so it was quickly abandoned. Currently, the mainstream practice is to independently compress the three information streams of identifiers, base sequences, and sequencing quality values in the FASTQ format file.

[0010] Since the identifiers in FASTQ format files basically follow a format that combines fixed characters and variables and have strong regularity, there are mainly two types of compression methods: one is the "total - part method", that is, recording the overall format in the file header and then recording the variable values of each identifier when compressing it, such as KungFQ (a compression tool); the other is the "differential method", that is, encoding the difference between each identifier and the previous identifier, such as Quip (a compression tool). However, the total - part method has poor applicability and can only recognize identifiers in specific formats; the differential method has poor fitting to the format and a lower compression rate. Neither of the two compression methods can take both into account. Summary of the Invention

[0011] In order to overcome the defect in the prior art that it is impossible to balance applicability and compression rate when compressing FASTQ format files (either poor applicability or low compression rate), the present invention provides a compression method and device for biological sequence identifiers, as well as a decompression method and device.

[0012] The present invention solves the above - mentioned technical problems through the following technical solutions:

[0013] In a first aspect, a compression method for biological sequence identifiers is provided, including:

[0014] For each identifier in a gene sequencing file, split the identifier into several sub - identifiers;

[0015] Define the encoding rules for several windows, and the encoding rules match the text format of the sub - identifiers;

[0016] Group the sub - identifiers with the same referential meaning into the same window;

[0017] For each window, encode all the sub - identifiers in the window according to the corresponding encoding rules, and summarize the encoding results of each window into the compression result of the identifier.

[0018] Optionally, for each identifier in a gene sequencing file, splitting the identifier into several sub - identifiers includes:

[0019] Determine whether the identifier is an identifier of a biological sequence obtained by single - end sequencing or an identifier of a biological sequence obtained by paired - end sequencing;

[0020] In the case of determining that the identifier is an identifier of a biological sequence obtained by single - end sequencing, split the identifier into sub - identifiers corresponding to each window according to a predefined splitting rule; the number and / or attributes of the windows are determined by the text format of the sub - identifiers of the initially split identifier.

[0021] In the case where it is determined that the identifier is an identifier of a biological sequence obtained based on paired-end sequencing, the first fragment and the second fragment of the identifier are respectively split into sub-identifiers corresponding to each window according to a predefined splitting rule.

[0022] Optionally, if the identifier is an identifier of a biological sequence obtained based on paired-end sequencing, the compression method further includes:

[0023] Determining the difference information between each sub-identifier of the first fragment and the sub-identifier at the same ordinal position in the second fragment;

[0024] Determining the text format of the sub-identifier of the first fragment and the difference information as the text format of the sub-identifier of the identifier, or determining the text format of the sub-identifier of the second fragment read2 and the difference information as the text format of the sub-identifier of the identifier.

[0025] Optionally, the splitting rule includes:

[0026] Splitting according to consecutive symbols and consecutive non-symbols;

[0027] And / or, splitting according to the consecutive same content and different content between the identifier and other identifiers.

[0028] Optionally, it further includes:

[0029] Determining the text format of the identifier according to the text format of each sub-identifier;

[0030] Commonly encoding identifiers with the same text format.

[0031] In a second aspect, a method for decompressing a biological sequence identifier is provided, including:

[0032] Determining decompression information for decompressing the binary stream of the identifier; wherein, the binary stream is obtained by compressing the identifier by the compression method of the biological sequence identifier described in any one of the above, and the decompression information is determined according to the text format generated during the compression of the identifier;

[0033] Decompressing the binary stream according to the decompression information to obtain the identifier of the biological sequence.

[0034] In a third aspect, a compression device for a biological sequence identifier is provided, including:

[0035] A splitting module, configured to split each identifier in the gene sequencing file into a plurality of sub-identifiers;

[0036] A definition module for defining encoding rules for a number of windows, where the encoding rules match the text format of the sub-identifiers;

[0037] A partitioning module for partitioning sub-identifiers with the same referential meaning into the same window;

[0038] An encoding module for, for each window, encoding all the sub-identifiers in the window according to the corresponding encoding rules, and aggregating the encoding results of each window into the compression result of the identifier.

[0039] In a fourth aspect, a decompression device for a biological sequence identifier is provided, including:

[0040] A determination module for determining decompression information for decompressing the binary stream of the identifier; wherein, the binary stream is obtained by compressing the identifier by the compression method of the biological sequence identifier described in any one of the above, and the decompression information is determined according to the text format generated during the compression of the identifier;

[0041] A decompression module for decompressing the binary stream according to the decompression information to obtain the identifier of the biological sequence.

[0042] In a fifth aspect, an electronic device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where when the processor executes the computer program, the method described in any one of the above is implemented.

[0043] In a sixth aspect, a computer-readable storage medium has a computer program stored thereon, and when the program is executed by a processor, the method described in any one of the above is implemented.

[0044] The positive and progressive effects of the present invention are as follows:

[0045] The embodiments of the present invention can, on the premise of being as compatible with special data as possible, maximize the compression ratio of all identifier data, while ensuring the encoding and decoding performance. Description of the Drawings

[0046] Figure 1 is a flowchart of a compression method for a biological sequence identifier provided by an exemplary embodiment of the present invention.

[0047] Figure 2a is a flowchart of another compression method for a biological sequence identifier provided by an exemplary embodiment of the present invention.

[0048] Figure 2b is a schematic diagram of window splitting when a format determination is made on an identifier by a compression method for a biological sequence identifier provided by an exemplary embodiment of the present invention.

[0049] Figure 2c It is a schematic diagram of window splitting when generating a new large encoder with format mismatch in a compression method of a biological sequence identifier provided by an exemplary embodiment of the present invention.

[0050] Figure 3a It is a flowchart of another compression method of a biological sequence identifier provided by an exemplary embodiment of the present invention.

[0051] Figure 3b It is a flowchart of encoding the identifier of a biological sequence of paired-end sequencing by using a compression method of a biological sequence identifier provided by an exemplary embodiment of the present invention.

[0052] Figure 3c It is a flowchart of encoding a window that is neither a symbol nor a pure number by using an encoding method of a biological sequence identifier provided by an exemplary embodiment of the present invention.

[0053] Figure 3d It is a flowchart of encoding a window of pure numbers by using an encoding method of a biological sequence identifier provided by an exemplary embodiment of the present invention.

[0054] Figure 4 It is a flowchart of a decompression method of a biological sequence identifier provided by an exemplary embodiment of the present invention.

[0055] Figure 5 It is a flowchart of another decompression method of a biological sequence identifier provided by an exemplary embodiment of the present invention.

[0056] Figure 6 It is a schematic diagram of the structure of an electronic device shown in an exemplary embodiment of the present invention. Detailed implementation manners

[0057] The present invention will be further described below by way of embodiments, but the present invention is not limited to the scope of the described embodiments.

[0058] An embodiment of the present invention provides a compression method of a biological sequence identifier, and the compression process of the identifier will be introduced in detail below.

[0059] Figure 1 It is a flowchart of a compression method of a biological sequence identifier provided by an exemplary embodiment of the present invention. The compression method includes the following steps:

[0060] Step 101: For each identifier in the gene sequencing file, split the identifier into several sub-identifiers.

[0061] The types of gene sequencing include single-end sequencing and paired-end sequencing. Paired-end sequencing further includes Paired-end sequencing and mate-paired sequencing. For single-end sequencing, a single FASTQ (gene sequencing) file is generated per sequencing run. For paired-end sequencing, a pair of FASTQ files are generated per sequencing run. These two FASTQ files store data for the 5'-end sequenced biological sequence fragments (read1) and the 3'-end sequenced biological sequence fragments (read2) respectively. The number of lines in these two FASTQ files is equal, and each pair of FASTQ files corresponds one-to-one in terms of file location and is adjacent in terms of genomic location. For paired-end sequences, the identifier content of the paired sequences is also basically the same. Therefore, compressing a pair of FASTQ format files simultaneously can better remove data redundancy and optimize the compression ratio.

[0062] Therefore, before compression, it is necessary to determine whether the biological sequence is obtained based on single-end sequencing or paired-end sequencing based on the number of FASTQ files. Different compression strategies are adopted for biological sequences obtained based on different gene sequencing types, and the judgment information on whether the original file is single-end sequencing or paired-end sequencing is written into the compressed file. In the following text, the biological sequence obtained based on single-end sequencing is referred to as single-end data, and the biological sequence obtained based on paired-end sequencing is referred to as paired-end data.

[0063] Since identifiers are used to record the sequencing information of each biological sequence and generally follow a fixed format, sub-identifiers can be divided into two categories: information (usually letters, numbers, or a combination of both, each representing a different meaning, such as the sequencer number, the sequencing coordinates of the sequence, the number of the sequence in the file, etc.), and delimiters used to separate information (usually symbols, such as slashes and underscores). The ordinal positions of sub-identifiers with the same meaning on the identifier are often fixed. In addition, there may be a situation where two or more pieces of information on an identifier are related to each other (such as the content of two pieces of information on the identifier being exactly the same). Therefore, splitting the identifier into individual sub-identifiers and corresponding the sub-identifiers to each window, so that a window contains independent information or delimiters, can enable sub-identifiers with the same meaning in different identifiers to be encoded together. Sub-identifiers with the same meaning have high similarity, so this can improve the compression ratio.

[0064] In one embodiment, if it is determined that the identifier is for a biological sequence obtained by single-end sequencing, the identifier is split into sub-identifiers corresponding to each window according to a predefined splitting rule.

[0065] In one embodiment, if it is determined that the identifier is an identifier of a biological sequence obtained based on paired-end sequencing, the first fragment and the second fragment of the identifier are respectively split into sub-identifiers corresponding to each window according to a predefined splitting rule.

[0066] Among them, the above splitting rule includes: splitting according to consecutive symbols and consecutive non-symbols.

[0067] Step 102: Define the encoding rules for several windows, and the encoding rules match the text format of the sub-identifiers.

[0068] After splitting the identifier according to the above splitting rule, the text format of the sub-identifiers includes: delimiter format, pure number format, and non-pure number (including numbers and letters) format. Sub-identifiers with different text formats have different characteristics, and different encoding strategies should be adopted. The method of applying different encoding strategies is to declare a large encoder. The large encoder contains several windows, each window has an independent encoder, and the encoding rules of each window match the text format of the sub-identifiers one by one. Since the text formats of the sub-identifiers jointly constitute the text format of the identifier, identifiers with the same text format of the same type correspond to one large encoder.

[0069] Specifically, the encoding rules include: for consecutive symbols as delimiters, their content is generally fixed, so the encoding rule is not to encode the content but only record the format; for consecutive non-symbols as information, they can be divided into pure numbers and non-pure numbers; for pure numbers as information, the encoding rule is to regard the whole as a number for encoding; for non-pure numbers as information, their content generally does not change in length, so the encoding rule is to regard them as individual characters for encoding. In addition, there is also a situation where the sub-identifier corresponding to a certain window is exactly the same as the sub-identifier of other windows. Its encoding rule is to record the relationship between this window and the corresponding window, thus saving the cost of repeated encoding. In addition, there is also a situation where the sub-identifier corresponding to a certain pure number window represents the length information of the sequence. Its encoding rule is to record the characteristic that this window is length information while encoding the pure number, so that the cost of repeated encoding can be saved when compressing the base information and quality values of the sequencing sequence.

[0070] Step 103: Divide sub-identifiers with the same referential meaning into the same window.

[0071] After each identifier obtains the text format of the sub-identifier, identifiers with the same text format are encoded with the same large encoder, and the encoding rules of each window of the large encoder correspond one by one to the sub-identifiers of these identifiers. Inside the large encoder, sub-identifiers with the same referential meaning of each identifier are divided into the same window for joint encoding.

[0072] Specifically, determine the text formats of the respective sub-identifiers of the identifier and record them as the text format of the identifier. The methods include: Since identifiers with the same text format are encoded by the same large encoder, their text formats only need to be recorded once.

[0073] When an identifier with a text format that is not completely the same as any existing large encoder appears, a new large encoder can be declared. The window division rule of the new large encoder can be based not only on the sub-identifiers of the identifier but also on the comparison result between the identifier and the already encoded identifiers.

[0074] In addition, it is also possible to make one large encoder encode not only identifiers with exactly the same text format, as long as the text format differences of identifiers with not completely the same text format are additionally recorded.

[0075] Among them, the determination of whether the text formats are the same is related to the encoding rules of the window, including: the number of windows, the window attributes at the same ordinal position must be the same, the length and content of consecutive non-symbol windows must be consistent; the length of consecutive non-symbol non-pure digital windows must be consistent; the length of consecutive pure digital windows must be consistent, etc.

[0076] Step 104: For each window, encode all the sub-identifiers in the window according to the corresponding encoding rules, and summarize the encoding results of each window into the compression result of the identifier.

[0077] If it is selected to co-encode identifiers with the same text format, then for the co-encoded data, each of its windows corresponds one by one. For the content of each identifier in the same window, use the encoder of that window to encode them one by one according to the encoding rules of the window. If the method adopted is order-based matching, that is, read the identifiers sequentially. When the text format of an identifier is the same as that of the previous identifier, continue to classify it into the batch of identifiers for co-encoding, otherwise regard the current identifier as a new batch. This order matching method does not need to record the order of the identifiers; if the method adopted is batch-based matching, that is, read the identifiers sequentially and classify the identifiers into batches with the same format for encoding, then it is necessary to record the order of each identifier in each batch for restoring the order of the original identifiers.

[0078] If it is selected to encode the identifiers sequentially and record the text format differences, it is still possible to encode the content of each identifier in the same window one by one using the encoder of that window according to the encoding rules of the window.

[0079] After encoding each window, summarize and output the binary streams of the encoding results of each window, which is the compression result of the identifier in the gene sequencing file.

[0080] In the embodiments of the present invention, by splitting each identifier, analyzing its text format, defining the encoding rules of the window according to the text format, and dividing the sub-identifiers with the same referential meaning into the same window for common encoding, the integration and compression of identifiers are achieved, the information is utilized to the greatest extent, the fitting of the overall rules is improved, the compression rate is increased, and this compression method has a wide applicability and is applicable to various FASTQ files.

[0081] In one embodiment, the text formats of all identifiers in the gene sequencing file are sequentially recognized, and a matching method based on the order is adopted to commonly encode the identifiers with the same text format. During the encoding process, the sub-identifiers of each identifier in the same window are encoded according to the encoding rules of the window, and finally the encoding results of all windows are output as the compression result.

[0082] In one embodiment, the text formats of the identifiers are sequentially determined. When the text format of an identifier is the same as that of the previous identifier, it is continuously grouped into the common encoding of this batch of identifiers; otherwise, the current identifier is regarded as a new batch, and each batch is independently encoded. The first identifier is selected from the gene sequencing file as the initial identifier, its encoding is performed and its text format is recorded, and then the second identifier is selected to determine its text format and determine whether the text format of the second identifier is the same as that of the initial identifier; in the case of determination of sameness, the sub-identifiers of the second identifier are encoded in the respective windows of the initial identifier; in the case of determination of difference, the results of the respective windows of the initial identifier are output, the second identifier is used as the initial identifier, its encoding is performed and its text format is recorded; then the third identifier is selected to determine its text format, and according to whether it is the same as the initial identifier, the corresponding steps of the second identifier are repeated. And so on, until the compression of all identifiers in the gene sequencing file is completed, and finally the results of the respective windows of the initial identifier are output.

[0083] The following details the compression process of the biological sequence identifier in the scenario where the text formats of all identifiers in the gene sequencing file are sequentially recognized and a matching method based on the order is adopted.

[0084] Figure 2a is a flowchart of another compression method for biological sequence identifiers provided by an exemplary embodiment of the present invention. The compression method includes the following steps:

[0085] Step 201, based on whether the gene sequencing file is single or paired, recognize it as single-end sequencing data or double-end sequencing data.

[0086] The types of gene sequencing include single - end sequencing and paired - end sequencing. Paired - end sequencing further includes Paired - end sequencing and mate - paired sequencing. For single - end sequencing, a single FASTQ file is generated per sequencing run. For paired - end sequencing, a pair of FASTQ files is generated per sequencing run. These two FASTQ files store the data of the 5' - end sequenced biological sequence fragments (read1) and the 3' - end sequenced biological sequence fragments (read2) respectively. The number of lines in these two FASTQ files is equal, and each pair of FASTQ files is in one - to - one correspondence in terms of file location and adjacent in terms of genomic location. For paired - end sequences, the identifier content of the paired sequences is also basically the same. Therefore, compressing a pair of FASTQ - formatted files simultaneously can better remove data redundancy and optimize the compression ratio.

[0087] Therefore, before compression, it is necessary to determine whether the biological sequence is obtained based on single - end sequencing or paired - end sequencing according to the number of gene sequencing files. Different compression strategies are adopted for biological sequences obtained based on different gene sequencing types, and the judgment information of single - end sequencing or paired - end sequencing of the identifier will be written into the compressed file. In the following text, the biological sequence obtained based on single - end sequencing is called single - end data, and the biological sequence obtained based on paired - end sequencing is called paired - end data.

[0088] Step 202: For single - end data, select one from the uncompressed identifiers as the initial identifier, split the initial identifier into several sub - identifiers, and record the text format of the initial identifier; for paired - end data, select a pair from the uncompressed identifiers as the initial identifier, split the initial identifier into several sub - identifiers, and record the text format of the initial identifier.

[0089] Among them, the acquisition order of the identifier can be the order recorded in the gene sequencing file, or the acquisition order of the identifier can be determined according to actual needs. If it is the latter, the order needs to be recorded for use during decompression. Since the original identification code recorded in the gene sequencing file is in text format, it needs to be encoded.

[0090] For the biological sequence obtained by single - end sequencing (single - end data) and the biological sequence obtained by paired - end sequencing (paired - end data), the specific methods for determining the text format are different.

[0091] The following introduces the implementation method for determining the text format of single - end data.

[0092] For single - end data, for the initial identifier, an encoder with an encoding range covering all characters in the ASCII (American Standard Code for Information Interchange) code within [32, 127] is used for encoding, and the encoding result is denoted as init_bits; according to the predefined splitting rules for the initial identifier, the encoding result of the initial identifier is split into individual and continuous sub - identifiers, and the text format init_format of each sub - identifier is recorded (init_format is only in memory and not written to the result file), and the text format of each sub - identifier contained in the initial identifier is directly determined as the text format of the initial identifier.

[0093] In addition, the text format of the initial identifier can also be recorded by not directly recording init_bits, but by choosing to record init_format and directly encoding each sub - identifier of the initial identifier with each window (the encoding method is the same as the method in step 206).

[0094] Figure 2b It is a schematic diagram of the result of identifier splitting provided by an exemplary embodiment of the present invention. In the figure, continuous symbols and continuous non - symbols are used as the splitting rules, and the identifier "@TEST123.4 4C009R042_292727length = 717 / 1" is split into 8 symbol windows, 5 pure - number windows and 3 non - pure - number windows, a total of 16 windows.

[0095] The predefined splitting rules can be, but are not limited to, splitting the initial identifier into each sub - identifier according to continuous symbols and continuous non - symbols, and recording the text format of each sub - identifier. The text format can include, but is not limited to, the following parameters: the attribute of the sub - identifier, such as pure symbol, pure number, unsigned and non - pure number, etc.; the character length of the sub - identifier; the character content of the sub - identifier; the list of processed strings corresponding to the window of the sub - identifier (denoted as window_str_list, the sub - identifier processed by this window). Among them, the list of processed strings can be used as a reference for identifier compression. For example, at the beginning, it is impossible to determine what compression method is suitable for the identifier of a certain window. After processing n identifiers, the compression method can be determined according to the processed situation in the list of processed strings.

[0096] In the embodiment of the present invention, based on the data characteristics of the identifier, the splitting rule is set to split according to continuous symbols and continuous non - symbols, so the splitting is relatively efficient. Of course, in addition to the above - mentioned splitting rules, other splitting rules can also be adopted, and the present invention does not make special limitations on this.

[0097] In addition, if this step jumps from step 205, the current identifier can also be compared with previous identifiers, such as Figure 2c, after the non-symbol and non-pure-digit sub-identifier exhibits a variable-length feature, the variable-length digit part is cut off from other parts to form a new window.

[0098] Correspondingly, the attribute (text format) of the sub-identifier can also be described as other types. For example, the attribute can be the relationship between the sub-identifier and other sub-identifiers, such as Figure 2b the sub-identifiers in the fourth and sixth windows are exactly the same. The attribute of the sub-identifier corresponding to the sixth window can be marked as "identical to the content of the fourth window". If marked in this way, then when encoding an identifier with the content of "the fourth window and the sixth window are not exactly the same" later, it is determined that the formats are different.

[0099] Another example is that the content of the third-to-last pure-digit window is 717. Since it follows "length=", its content is basically equivalent to the length of the base sequence and can be marked. Then, in the part of base sequence compression, there is no need to encode the sequence length to save space.

[0100] The implementation method for determining the text format of double-ended data is introduced below.

[0101] For double-ended data, for the first segment and the second segment of the initial identifier, they are encoded using an encoder whose encoding range covers all characters in the ASCII code within [32, 127], and the obtained encoding result is denoted as init_bits. The first segment and the second segment of the initial identifier are respectively split according to a preset splitting rule, and each sub-identifier in the first segment is compared with the sub-identifier at the same ordinal position in the second segment, and the difference information is recorded, denoted as init_pe_diff. For example, assume the first segment is "@TEST123.4 4C009R042_292727length=717 / 1", and the second segment is "@TEST123.4 4C009R042_292727length=717 / 2". The only difference between the two is that the last character differs by 1, and the difference information is "the last character differs by 1". Denote the text format of each sub-identifier contained in the first segment (or the second segment) as init_format, and determine init_format and the difference information init_pe_diff as the text format of the initial identifier.

[0102] The purpose of determining the text format of the identifier is to compress the identifiers with the same text format together.

[0103] Among them, the specific implementation method for determining the text format of each sub-identifier in the first segment (or the second segment) of the identifier is similar to the specific implementation method for determining the text format of the sub-identifier of single-ended data, and will not be elaborated here.

[0104] Step 203: For single-ended data, select one from the uncompressed identifiers as the current identifier and determine its text format; for double-ended data, select a pair from the uncompressed identifiers as the current identifier and determine its text format. The specific implementation of determining the text format of the current identifier is similar to that of the initial identifier, and the specific implementation process will not be elaborated here.

[0105] For single-ended data, record the text formats of the respective sub-identifiers of the current identifier as current_format; for double-ended data, record the text formats current_format of the respective sub-identifiers of the first segment (or the second segment) of the current identifier, and the difference information between the first segment and the second segment as current_pe_diff.

[0106] Step 204: Determine whether the text format of the current identifier is the same as that of the initial identifier.

[0107] The text format includes multiple parameters. For example, the number of windows, the attributes of the sub-identifiers, the character lengths of the sub-identifiers, the string lists corresponding to the windows of the sub-identifiers, etc. Each parameter is compared one by one. When all parameters are the same, it is determined that the text formats of the initial identifier and the current identifier are the same; when there is one parameter that is different, it is determined that their text formats are different.

[0108] For example, if the number of windows of the two is different, it is determined that they are different and the comparison ends; if the number of windows is the same, then the attributes of the sub-identifiers corresponding to the windows are compared pairwise. If the attributes of the sub-identifiers are different, it is determined that they are different and the comparison ends; if the attributes of the sub-identifiers are the same, in a window of pure symbols or non-symbols and non-pure numbers, if the character lengths of the sub-identifiers are different, it is determined that they are different; in a window of pure symbols, if the contents of the sub-identifiers are different, it is determined that they are different and the comparison ends; for double-ended data, if the difference information of the two is different, it is determined that they are different and the comparison ends; if none of the above situations occur after the comparison is completed, it is determined that they are the same.

[0109] In Step 204, if the judgment result is yes, that is, the text format of the current identifier is the same as that of the initial identifier, then execute Step 206 and continue to select the current identifier for text format judgment.

[0110] In Step 204, if the judgment result is no, that is, the text format of the current identifier is different from that of the initial identifier, then execute Step 205.

[0111] Step 205: Take the current identifier as the initial identifier. Then return to Step 202.

[0112] Step 206: Split the current identifier into several sub-identifiers based on the same splitting rule as the initial identifier, divide each sub-identifier of the current identifier into the corresponding windows of the initial identifier, and encode them using the encoders of each window of the initial identifier.

[0113] The same text format of the initial identifier and the current identifier means that the sub-identifiers of both follow the same format, and each sub-identifier can be encoded according to the same encoding rule. Then, the sub-identifiers with the same referential meaning in the current identifier and the initial identifier are divided into the same window.

[0114] In one embodiment, each sub-identifier corresponds to a window, and each window is configured with an independent encoder. Given that the text format of the current identifier is the same as that of the initial identifier, that is, the number and attributes of the sub-identifiers of both match one by one, then the sub-identifiers will fall into the corresponding windows and be encoded by the encoders within the windows.

[0115] The summarization of the encoding results of each window can be but is not limited to: encapsulating the encoding results of each window in a packaging format to facilitate distinguishing the results of different windows during decompression.

[0116] Step 207: Determine whether all the identifiers in the FASTQ file have been processed.

[0117] If the judgment result is yes, then execute Step 208.

[0118] If the judgment result is no, otherwise execute Step 203.

[0119] Step 208: Output init_bits and the encoding results (binary code streams) of each window, and give a prompt of successful compression.

[0120] In one embodiment, init_bits and the binary code stream of each window are output after being encapsulated in a packaging format. In one output, init_bits and the binary code streams of each window, these pieces of information will also be encapsulated as a whole and then output. The encapsulation can be but is not limited to being implemented through EBML (Extensible Binary Meta Language, a coding language).

[0121] Figure 3a It is a flowchart of another method for compressing biological sequence identifiers provided by an exemplary embodiment of the present invention. The compression method includes the following steps:

[0122] Step 301: Determine whether the gene sequencing type is single-end sequencing or paired-end sequencing.

[0123] Based on whether the gene sequencing file is single or paired, it is identified as single-end data or paired-end data. If the gene sequencing file is single, it is determined that the gene sequencing type is single-end sequencing and the obtained data is single-end data. If the gene sequencing file is paired, it is determined that the gene sequencing type is paired-end sequencing and the obtained data is paired-end data.

[0124] In step 301, the judgment information of single-end sequencing or paired-end sequencing is written into the compressed file.

[0125] In step 301, if the judgment is yes, that is, the identifier is obtained based on single-end sequencing, then step 302 is executed.

[0126] In step 301, if the judgment is no, that is, the identifier is obtained based on paired-end sequencing and the identifier is an identifier pair containing read1 and read2, then step 303 is executed.

[0127] Step 302: Read the first one from the uncompressed identifier as the initial identifier. Then step 304 is executed.

[0128] Step 303: Read the first pair from the uncompressed identifier as the initial identifier. Then step 304 is executed.

[0129] Step 304: Encode the initial identifier with a general encoder to obtain init_bits.

[0130] In step 304, if it is single-end data, the initial identifier is encoded with an encoder whose encoding range covers all characters with ASCII codes in [32, 127], and the encoding result is init_bits. After the encoding is completed, step 305 is executed.

[0131] In step 304, if it is paired-end data, the initial identifiers of read1 and read2 are respectively encoded with an encoder whose encoding range covers all characters with ASCII codes in [32, 127] to obtain two binary streams, which are collectively called init_bits. After the encoding is completed, steps 306 and 307 are executed.

[0132] Step 305: Determine and record the text format of the initial identifier, denoted as init_format.

[0133] See Figure 3b, The method for determining the format of the identifier of the biological sequence obtained by single-end sequencing is the same as that for determining the format of the identifier of read1 in paired-end sequencing. Here, it is split according to the splitting rule of continuous symbols or continuous non-symbols, and the obtained init_format includes but is not limited to: the number of windows is 16, including 8 symbol windows, 5 pure number windows, and 3 unsigned non-pure number windows. Then, both the fourth and sixth windows are pure numbers and have the same value, which is recorded as the same content window, and only the fourth window is encoded.

[0134] In one embodiment, after step 305, it is judged whether all identifiers have been processed, that is, whether there are still uncompressed identifiers in the FASTQ file. If the judgment result is yes, step 316 is executed; if the judgment result is no, step 308 is executed.

[0135] Step 306: Determine and record the format of the initial identifier of read1, denoted as init_format.

[0136] In step 306, the format determination method is similar to that in step 305, which will not be elaborated here.

[0137] Step 307: Determine and record the difference information init_pe_diff between the initial identifier of read2 and the initial identifier of read1.

[0138] See Figure 3b , Find the difference between the identifiers of read2 and read1, and record "changing the last digit 1 to 2" as init_pe_diff. It should be noted that since both read2 and read1 contain length information and read1 and read2 are of unequal length, in the rule, for the pure number sub-identifier following "length =" in read2, it is put into init_format and not included in init_pe_diff.

[0139] In one embodiment, after executing steps 306 and 307, it is judged whether all identifiers have been processed, that is, whether there are still uncompressed identifiers in the FASTQ file. If the judgment result is yes, step 316 is executed; if the judgment result is no, step 309 is executed.

[0140] Step 308: Read the next one from the uncompressed identifiers as the current identifier.

[0141] In step 308, after the reading is completed, step 310 is executed.

[0142] Step 309: Read the next pair from the uncompressed identifiers as the current identifier.

[0143] In step 309, after reading is completed, step 311 is executed.

[0144] Step 310: Determine the text format current_format of the current identifier.

[0145] In step 310, the format determination method is similar to that in step 305, which will not be elaborated here. Then step 314 is executed.

[0146] Step 311: Determine the text format current_format of the current identifier read1.

[0147] In step 311, the determination method of the text format is similar to that in step 305, which will not be elaborated here. Then step 312 is executed.

[0148] Step 312: Compare the difference between read2 and read1 of the current identifier, and record the difference information current_pe_diff.

[0149] In step 312, the method for determining the difference information is similar to that in step 307, which will not be elaborated here. Then step 313 is executed.

[0150] Step 313: Match init_pe_diff and current_pe_diff.

[0151] In step 313, it is only necessary to compare whether init_pe_diff and current_pe_diff are the same. If they match, step 314 is executed; otherwise, step 316 is executed.

[0152] Step 314: Match init_format and current_format.

[0153] In step 314, a comparison is made between init_format and current_format. The main rules include but are not limited to: if the number of windows of the two is different, it is determined that they are different and the comparison ends; if the number of windows is the same, then the attributes of the sub-identifiers corresponding to the windows are compared pairwise. If the attributes of the sub-identifiers are different, it is determined that they are different and the comparison ends; if the attributes of the sub-identifiers are the same, in a window of pure symbols or non-symbols and non-pure numbers, if the character lengths of the sub-identifiers are different, it is determined that they are different; in a window of pure symbols, if the contents of the sub-identifiers are different, it is determined that they are different and the comparison ends; for a window of repeated content, if its contents are not exactly the same, it is determined that they are different and the comparison ends.

[0154] See Figure 3bThe text format of the identifier "@TEST123.4 4C009R042_292727length=717 / 1" is the same as that of "@TEST123.5 5C009R043_292735length=675 / 1" because the attributes and contents of each window comply with the rules. However, the text format of the identifier "@TEST123.10C010R023_310021length=589 / 1" is inconsistent because the number of windows is different.

[0155] In step 314 , if the two are the same, execute step 315 ; otherwise, execute step 316 .

[0156] Step 315: Encode each sub-identifier in each window.

[0157] See also Figure 3b ,Each sub-identifier is encoded in the window to which it belongs, and each window has an independent encoder and generates an independent binary stream.

[0158] During the encoding process, the sub-identifiers of identifiers with the same text format are encoded using the same encoder and the same encoding rules to achieve a high compression rate.

[0159] See also Figure 3c For non-symbolic and non-pure numeric windows, each bit is encoded using an independent encoder. In the figure, "C009R042" and "C009R043" represent two sub-identifiers in a window. The two sub-identifiers have different characteristics and need to be encoded.

[0160] See also Figure 3d In the figure, "292727" and "292735" represent two sub-identifiers in a pure numeric window, encoded using the same encoder according to the encoding rules for pure numeric values. For pure numeric windows, since the pure numbers in FASTQ files are usually close together and the differences are small, a new encoding method is used. This method converts each number into its difference with the previous number in the window. The sign of the difference, the length of the absolute value of the difference in base n, and the value of each bit after conversion to base n are then encoded.

[0161] In step 315 , after the encoding is completed, if all identifiers have been processed, step 316 is executed; otherwise, step 308 (single-ended data) or step 309 (dual-ended data) is executed.

[0162] Step 316: Output init_bits, and each window outputs the encoding result.

[0163] The encoded result of each window is a binary stream, which is sequentially and completely output to the result file to ensure that it can be completely decompressed.

[0164] In one embodiment, after encapsulation in an encapsulation format (i.e., adding information such as the length and attributes of the binary stream in front of the binary stream of each window), the reliability and maintainability can be improved. In step 316, if this step is triggered by 313 or 314, then after the output ends, step 302 (single-end data) or step 303 (double-end data) is executed; if this step is triggered by 315 or 305 or 307, then the compression ends.

[0165] The decompression process of the identifier is the reverse process of the compression process of the identifier. First, the decompression information for decompressing the binary stream of the identifier is determined; among them, the binary stream is obtained by compressing the identifier using the compression method of the biological sequence identifier provided in any of the above embodiments, and the decompression information is determined according to the text format generated during the compression of the identifier. According to this decompression information, the binary stream can be decompressed to obtain the identifier of the biological sequence.

[0166] The decoding process of the identifier is introduced in detail below.

[0167] Figure 4 It is a flowchart of a method for decompressing a biological sequence identifier provided by an exemplary embodiment of the present invention. The decompression method includes the following steps:

[0168] Step 401: Decompress part of the information from the compressed file to know whether the gene sequencing file is single-end sequencing or double-end sequencing.

[0169] In step 401, the decompressed information comes from the information of "single-end sequencing or double-end sequencing" written into the compressed file in step 101.

[0170] Step 402: Decode init_bits to obtain the text of the initial identifier, and determine the format of the initial identifier.

[0171] In step 402, the decoding method of init_bits is different for single-end data and double-end data. In single-end data, init_bits will only have one binary stream; in double-end data, init_bits can be regarded as two binary streams.

[0172] In step 402, if it is single-end data, only init_format needs to be determined, while for double-end data, init_pe_diff also needs to be determined.

[0173] In step 402, the determination of the text format of the initial identifier is consistent with the compression, so the results of the text format determination are also consistent.

[0174] In addition, if it is selected not to record init_bits but to record init_format during encoding and directly encode each sub-identifier of the initial identifier with each window, then in this step, instead of decoding init_bits, init_format is decoded.

[0175] Step 403: Based on the text format, decompress the binary stream of each window to obtain the sub-identifiers of each window.

[0176] In step 403, that is, based on the text format, determine the corresponding encoding rule, and use this encoding rule to decompress the binary stream of each window to obtain the sub-identifiers of each window.

[0177] In step 403, when the encoding format text format is already known, for the window to be encoded, initialize each encoder accordingly, and then decompress the binary stream of each window in the compressed file to obtain the sub-identifier text of each window.

[0178] Step 404: Concatenate the decoded sub-identifiers into the original biological sequence identifier.

[0179] Step 405: If the file is not decompressed completely, go to step 402.

[0180] In step 405, if the file is not decompressed completely, it means that when the file was compressed, the format of the next identifier was different. Therefore, go to step 402 to start decompressing init_bits and the binary stream of each window again.

[0181] Figure 5 It is a flowchart of another method for decompressing a biological sequence identifier provided by an exemplary embodiment of the present invention. The decompression method includes the following steps:

[0182] Step 501: Determine whether it is single-end sequencing or paired-end sequencing.

[0183] Among them, the information of "whether it is single-end sequencing or paired-end sequencing" is written into the compressed file after determining single-end or paired-end based on the number of files in the compression method of the biological sequence identifier provided in any of the above embodiments.

[0184] In step 501, if it is single-end data, execute step 502; otherwise, execute step 503.

[0185] Step 502: Decode init_bits to obtain the text of the initial identifier.

[0186] In step 502, after obtaining init_bits, decode it with a decoder corresponding to the encoder that compressed the init_bits. After decoding, execute step 504.

[0187] Step 503: Decode init_bits to obtain the text of the initial identifier.

[0188] In step 503, after obtaining init_bits, decode it with a decoder. The binary streams of read1 and read2 are distinguished based on the encapsulation format, and the decoder only needs to correspond to the encoder that compressed the init_bits. After decoding, execute step 505.

[0189] Step 504: Determine the format init_format of the initial identifier.

[0190] In step 504, the format determination method is the same as that in step 305, which will not be elaborated here. After determination, execute step 507.

[0191] Step 505: Determine the initial identifier format init_format of read1.

[0192] In step 505, the format determination method is the same as that in step 504, which will not be elaborated here. After determination, execute step 506.

[0193] Step 506: Determine init_pe_diff.

[0194] In step 506, the difference information determination method is the same as that in step 307, which will not be elaborated here. After determination, execute step 508.

[0195] Step 507: For each window to be encoded, initialize an encoder, obtain the corresponding binary stream from the compressed file, and decompress the text of each sub-identifier.

[0196] Among them, the window information has been obtained in step 504. For those windows to be encoded (such as pure digital windows, non-symbol and non-pure digital windows), initialize the corresponding decoder, obtain the corresponding binary stream from the compressed file (if each binary stream has been reserved based on the encapsulation format during compression, it will be more convenient to obtain at this time), and decode through each decoder to obtain the text of each sub-identifier.

[0197] In step 507, after decoding, execute step 509.

[0198] Step 508: For each window to be encoded, initialize an encoder, obtain the corresponding binary stream from the compressed file, and decompress the text of each sub-identifier.

[0199] In step 508, the processing flow is the same as that in step 507, except that the processing object is replaced with read1, which will not be elaborated here. After the processing is completed, step 510 is executed.

[0200] Step 509: Concatenate each sub-identifier into the original identifier.

[0201] Among them, since the window information has been obtained in step 504, for windows that do not require encoding, their information is the same on each identifier, and for windows that require encoding, their information varies on each identifier. Generally speaking, the concatenation process is the reverse process of determining current_format.

[0202] In step 509, after the concatenation is completed, step 512 is executed.

[0203] Step 510: Concatenate each sub-identifier into the original read1 identifier.

[0204] In step 510, the processing flow is the same as that in step 509, except that the processing object is replaced with read1, which will not be elaborated here. After the concatenation is completed, step 511 is executed.

[0205] Step 511: Obtain the read2 identifier based on init_pe_diff and the read1 identifier.

[0206] Each read2 identifier is obtained by transforming the corresponding read1 identifier based on init_pe_diff.

[0207] In step 511, after the read2 identifier is restored, step 512 is executed.

[0208] Step 512: Output the identifier text to the decompressed file.

[0209] In step 512, after the output is completed, if the compressed file has been decompressed, the program ends; otherwise, step 502 (single-end data) or step 503 (double-end data) is executed.

[0210] Corresponding to the foregoing embodiments of the compression method and decompression method of the biological sequence identifier, the present invention also provides embodiments of a compression device and a decompression device for the biological sequence identifier.

[0211] An embodiment of the present invention provides an encoding device for a biological sequence identifier, which is used to encode the identifiers of multiple segments of biological sequences included in a biological sequence FASTQ file; the encoding device includes:

[0212] A splitting module, configured to split each identifier in a gene sequencing file into a plurality of sub - identifiers;

[0213] A defining module, configured to define encoding rules for a plurality of windows, where the encoding rules match the text format of the sub - identifiers;

[0214] A splitting module, configured to divide sub - identifiers with the same text format into the same window;

[0215] An encoding module, configured to, for each window, encode all the sub - identifiers in the window according to the corresponding encoding rule, and summarize the encoding results of each window into a compression result of the identifier.

[0216] Optionally, the splitting module includes:

[0217] A determining unit, configured to determine whether the identifier is an identifier of a biological sequence obtained by single - end sequencing or an identifier of a biological sequence obtained by paired - end sequencing;

[0218] A splitting unit, configured to, when it is determined that the identifier is an identifier of a biological sequence obtained by single - end sequencing, split the identifier into sub - identifiers corresponding to each window according to a predefined splitting rule; the number and / or attributes of each window are determined by the text format of the sub - identifiers of the initially split identifier.

[0219] The splitting unit is further configured to, when it is determined that the identifier is an identifier of a biological sequence obtained by paired - end sequencing, split the first fragment read1 and the second fragment read2 of the identifier into sub - identifiers corresponding to each window according to a predefined splitting rule.

[0220] Optionally, if the identifier is an identifier of a biological sequence obtained by paired - end sequencing, the compression device further includes:

[0221] A determining module, configured to determine the difference information between each sub - identifier of the first fragment read1 and the sub - identifier at the same ordinal position in the second fragment read2; and determine the text format of the identifier as the text format of the sub - identifiers of the first fragment and the difference information, or determine the text format of the identifier as the text format of the sub - identifiers of the second fragment and the difference information.

[0222] Optionally, the splitting rule includes: splitting according to consecutive symbols and consecutive non - symbols.

[0223] Optionally, the encoding module is configured to: determine the text format of the identifier according to the text format of each sub - identifier, and perform common encoding on identifiers with the same text format.

[0224] An embodiment of the present invention further provides a decoding device for a biological sequence identifier, including:

[0225] A determination module, configured to determine decompression information for decompressing a binary stream of an identifier; wherein, the binary stream is obtained by compressing the identifier using the compression method of the biological sequence identifier described in any of the above embodiments, and the decompression information is determined according to the text format generated during the ya-compression of the identifier;

[0226] A decompression module, configured to decompress the binary stream according to the decompression information to obtain the identifier of the biological sequence.

[0227] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of the present invention. Those of ordinary skill in the art can understand and implement it without creative efforts.

[0228] Figure 6 It is a schematic structural diagram of an electronic device shown in an exemplary embodiment of the present invention, showing a block diagram of an exemplary electronic device 60 suitable for implementing the embodiments of the present invention. Figure 6 The shown electronic device 60 is only an example and should not bring any limitation to the functions and usage scope of the embodiments of the present invention.

[0229] As Figure 6 shown, the electronic device 60 may be presented in the form of a general-purpose computing device, for example, it may be a server device. The components of the electronic device 60 may include, but are not limited to: at least one of the above processors 61, at least one of the above memories 62, and a bus 63 connecting different system components (including the memory 62 and the processor 61).

[0230] The bus 63 includes a data bus, an address bus, and a control bus.

[0231] The memory 62 may include volatile memory, such as a random access memory (RAM) 621 and / or a cache memory 622, and may further include a read-only memory (ROM) 623.

[0232] The memory 62 may also include a program tool 625 (or utility) having a set (at least one) of program modules 624. Such program modules 624 include, but are not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment.

[0233] The processor 61 executes various functional applications and data processing by running computer programs stored in the memory 62, such as the methods provided in any of the above embodiments.

[0234] The electronic device 60 may also communicate with one or more external devices 64 (such as a keyboard, a pointing device, etc.). Such communication may be carried out through the input / output (I / O) interface 65. Moreover, the electronic device 60 for model generation may also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through the network adapter 66. As shown in the figure, the network adapter 66 communicates with other modules of the electronic device 60 for model generation through the bus 63. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in combination with the electronic device 60 for model generation, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems, etc.

[0235] It should be noted that, although several units / modules or sub-units / modules of the electronic device are mentioned in the above detailed description, such splitting is merely exemplary and not mandatory. In fact, according to the embodiments of the present invention, the features and functions of two or more of the above-described units / modules may be embodied in one unit / module. Conversely, the features and functions of one unit / module described above may be further split and embodied by multiple units / modules.

[0236] The embodiments of the present invention also provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the methods provided in any of the above embodiments are implemented.

[0237] Although the specific embodiments of the present invention have been described above, those skilled in the art should understand that this is only an example. The protection scope of the present invention is defined by the appended claims. Without departing from the principles and essence of the present invention, those skilled in the art may make various changes or modifications to these embodiments, but these changes and modifications all fall within the protection scope of the present invention.

Claims

1. A compression method for biological sequence identifiers, characterized in that, Including: For each identifier in the gene sequencing file, splitting the identifier into a plurality of sub - identifiers; Defining encoding rules for a plurality of windows, the encoding rules matching the text format of the sub - identifiers; Dividing sub - identifiers with the same referential meaning into the same window; For each window, encoding all the sub - identifiers in the window according to the corresponding encoding rules, and summarizing the encoding results of each window into the compression result of the identifier; Splitting the identifier into a plurality of sub - identifiers, including: Determining whether the identifier is an identifier of a biological sequence obtained by single - end sequencing or an identifier of a biological sequence obtained by paired - end sequencing; In the case where it is determined that the identifier is an identifier of a biological sequence obtained by single - end sequencing, splitting the identifier into sub - identifiers corresponding to each window according to a predefined splitting rule; the number and / or attributes of the windows are determined by the character type and length of the sub - identifiers of the initially split identifier; In the case where it is determined that the identifier is an identifier of a biological sequence obtained by paired - end sequencing, splitting the first fragment and the second fragment of the identifier into sub - identifiers corresponding to each window respectively according to a predefined splitting rule.

2. The compression method of a biological sequence identifier according to claim 1, characterized in that If the identifier is an identifier of a biological sequence obtained by paired - end sequencing, the compression method further includes: Determining the difference information between each sub - identifier of the first fragment of the identifier and the sub - identifier at the same ordinal position in the second fragment; Determining the text format of the sub - identifiers of the identifier as the text format of the sub - identifiers of the first fragment of the identifier and the difference information, or determining the text format of the sub - identifiers of the identifier as the text format of the sub - identifiers of the second fragment of the identifier and the difference information.

3. The compression method of a biological sequence identifier according to claim 1, wherein, The splitting rule includes: Splitting according to consecutive symbols and consecutive non - symbols; And / or, splitting according to the consecutive same content and different content between the identifier and other identifiers.

4. The compression method of a biological sequence identifier according to claim 1, characterized in that, Also including: Determining the text format of the identifier according to the text format of each sub - identifier; Encoding identifiers with the same text format together.

5. A decompression method for a biological sequence identifier, characterized in that, Including: Determining decompression information for decompressing the binary stream of the identifier; wherein, the binary stream is obtained by compressing the identifier by the compression method of the biological sequence identifier according to any one of claims 1 - 4, and the decompression information is determined according to the text format generated during the compression of the identifier; Decompressing the binary stream according to the decompression information to obtain the identifier of the biological sequence.

6. A compression device for biological sequence identifiers, characterized in that, Including: A splitting module, configured to split each identifier in the gene sequencing file into a plurality of sub - identifiers; A defining module, configured to define encoding rules for a plurality of windows, the encoding rules matching the text format of the sub - identifiers; A dividing module, configured to divide sub - identifiers with the same referential meaning into the same window; An encoding module, configured to encode all the sub - identifiers in each window according to the corresponding encoding rules for each window, and summarize the encoding results of each window into the compression result of the identifier; The splitting module includes: A determination unit, configured to determine whether the identifier is an identifier of a biological sequence obtained by single-end sequencing or an identifier of a biological sequence obtained by paired-end sequencing; A splitting unit, configured to, when it is determined that the identifier is an identifier of a biological sequence obtained by single-end sequencing, split the identifier into sub-identifiers corresponding to respective windows according to a predefined splitting rule; the number and / or attributes of the windows are determined by the text format of the sub-identifiers of the initially split identifier; The splitting unit is further configured to, when it is determined that the identifier is an identifier of a biological sequence obtained by paired-end sequencing, split the first segment and the second segment of the identifier into sub-identifiers corresponding to respective windows according to a predefined splitting rule.

7. A decompression device for a biological sequence identifier, characterized in that Comprising: A determination module, configured to determine decompression information for decompressing a binary stream of an identifier; wherein, the binary stream is obtained by compressing the identifier by the biological sequence identifier compression method according to any one of claims 1-4, and the decompression information is determined according to the text format generated during the compression of the identifier; A decompression module, configured to decompress the binary stream according to the decompression information to obtain the identifier of the biological sequence.

8. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Gene sequencing data storage and reading method and system

    CN110797082A

  • Base sequence coding method and system in FASTQ file compression

    CN112102883A