Gene sequence compression method, retrieval method and device

Through the 2bit gene sequence compression algorithm and new gene sequence search method of the MapReduce framework, the problem of low gene data processing and retrieval efficiency is solved, efficient gene sequence compression and retrieval is achieved, suitable for distributed systems, and the storage of gene data is improved and search efficiency.

CN118887997APending Publication Date: 2024-11-01COMP NETWORK INFORMATION CENT CHINESE ACADEMY OF SCI
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410853044.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-11-01

AI Technical Summary

Technical Problem

Existing gene sequence search methods are inefficient in processing large-scale gene data, making it difficult to meet the needs of fast and accurate comparisons. Especially in distributed systems, traditional methods have problems with insufficient compression and retrieval efficiency.

Method used

The MapReduce framework is used to implement the 2bit gene sequence compression algorithm. The gene sequence is processed into a sequence with only nucleic acid bases and serialized through Map operation. The Reduce operation is spliced ​​and stored, and a new gene sequence retrieval method is proposed, in bytes Direct matching in the stream avoids the complete restore and index construction required in traditional methods.

Benefits of technology

The processing and retrieval efficiency of gene data is improved, the speed of the 2bit compression algorithm is optimized, the gene sequence characteristics are retained, and the efficient matching result processing is achieved, reducing the calculation time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118887997A_ABST
    Figure CN118887997A_ABST
Patent Text Reader

Abstract

The invention discloses a gene sequence compression method and device and a gene sequence retrieval method and device, and belongs to the field of bioinformatics. According to the gene sequence compression method, 2bit-based gene sequence compression is realized through a MapReduce framework, and the method comprises the steps of sequence file analysis, serialization processing and splicing storage. The retrieval method comprises the steps of target sequence reading, query sequence preprocessing, distance table calculation and matching. The device part comprises an import module, an export module, a query module and a function expansion module. According to the method, a distributed MapReduce framework and index-free byte stream matching are adopted, efficient processing and retrieval of large-scale gene data are achieved, and the compression speed and the retrieval efficiency are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of bioinformatics, and specifically relates to a gene sequence compression method, a retrieval method and a device. Background Art

[0002] Gene sequence retrieval is a key technology in bioinformatics, which is used to find specific genes or DNA sequences in huge genomic databases. Through alignment algorithms, researchers can find similarities between sequences to reveal their functions and evolutionary relationships. Commonly used sequence retrieval tools include BLAST, FASTA, and Smith-Waterman algorithms. Among them, BLAST is widely used because of its fast speed and high sensitivity, while the Smith-Waterman algorithm is known for its high precision and is suitable for small-scale alignments. In addition, hidden Markov models (HMMs) also play an important role in protein sequence alignment and structure prediction.

[0003] Gene sequence retrieval has important applications in many fields, including functional annotation, evolutionary research, disease research, and drug development. By comparing newly sequenced gene or protein sequences with sequences in known databases, researchers can infer their functions and help understand the biological effects and molecular mechanisms of genes. Comparing gene sequences between different species helps to study their evolutionary relationships, and in disease research, gene sequence retrieval can help discover and diagnose disease-related mutant genes. In drug development, gene sequence retrieval helps identify disease-related genes or proteins and guide the development of new drugs.

[0004] With the improvement of sequencing technology and computing power, gene sequence retrieval methods continue to improve. The introduction of big data and artificial intelligence technology provides new solutions for the rapid and accurate comparison of gene sequences. In the future, gene sequence retrieval will be more efficient and intelligent, and play a greater role in scientific research and practical applications. By continuously optimizing algorithms and introducing new technologies, gene sequence retrieval has not only promoted the progress of genomic research, but also had a profound impact on fields such as medicine and agriculture. Summary of the invention

[0005] The purpose of the present invention is to provide a gene sequence compression method, a retrieval method and a device to improve the processing scale and retrieval efficiency of gene data.

[0006] The technical solution adopted by the present invention to achieve the above-mentioned purpose is as follows:

[0007] In a first aspect, the present invention provides a gene sequence compression method, comprising the following steps:

[0008] Parse the gene sequence file to obtain sequence information and sequence segments;

[0009] Based on the Map operation, the sequence segments are processed into sequences consisting of only nucleic acid bases and then serialized;

[0010] Based on the Reduce operation, the above sequence information and serialization results are concatenated and stored in the sequence file.

[0011] Furthermore, the identification line in the gene sequence file is read to obtain the sequence information.

[0012] Furthermore, for the original sequence in the gene sequence file, blank characters are removed and the sequence is divided into segments of 64 KB, wherein the portion less than 64 KB at the end is divided into the last segment to obtain a sequence segment.

[0013] Furthermore, for a gene sequence file containing multiple sequence data, the gene sequence file is split into gene sequence files containing only a single sequence data according to the identification line, and then each of the split gene sequence files is parsed to obtain corresponding sequence information and sequence segments.

[0014] Furthermore, the steps of processing the sequence segment into a sequence of only nucleic acid bases based on the Map operation and performing serialization include:

[0015] Record the relative position and length of lowercase characters in the sequence segment and store them in a list in the form of tuples, and then convert the lowercase characters to uppercase characters;

[0016] Record the relative position and length of the unknown base characters in the sequence segment and store them in a list in the form of tuples, then delete all unknown base characters;

[0017] Record the characters and relative positions of the heterozygous bases in the sequence segment and store them in a list in the form of tuples, then delete all the heterozygous bases;

[0018] After the above steps, a sequence consisting of only nucleic acid bases is obtained, and each nucleic acid base in the sequence consisting of only nucleic acid bases is mapped according to the relationship of A-00, G-01, C-10, T-11 or U-11, and the mapping results of every 4 bases are packaged into one byte to realize the serialization of the sequence consisting of only nucleic acid bases.

[0019] Furthermore, the step of splicing the sequence information and the serialization result based on the Reduce operation includes:

[0020] 1) Splice the sequence information of each sequence segment and then serialize it;

[0021] 2) splicing the sequencing results of the nucleic acid base sequences;

[0022] 3) Splicing the serialization result obtained in step 1) and the splicing result obtained in step 2).

[0023] In a second aspect, the present invention provides a gene sequence retrieval method, comprising the following steps:

[0024] According to the target sequence information provided by the user, the data stream of the target sequence is read from the stored sequence file;

[0025] Preprocess the query sequence provided by the user;

[0026] Calculate the distance table based on the preprocessing results;

[0027] Match the query sequence in the target sequence according to the distance table and return the matching results.

[0028] Furthermore, the step of preprocessing the query sequence provided by the user includes:

[0029] Serialize the query sequence based on the Map operation;

[0030] Add 1 to 3 adenine characters in sequence before the serialization result to obtain 3 shift serialization results;

[0031] Convert the original query serialization and the shift serialization result into byte arrays.

[0032] Furthermore, the method for calculating the distance table according to the preprocessing result is to process the byte array converted from the original query sequence and the shift serialization result to obtain a distance table, each row in the distance table includes a byte value and a relative distance list, and the processing steps include:

[0033] Create a location information list, initialize all elements, and initialize the traversal index index;

[0034] For the value corresponding to each index in the byte array, calculate the corresponding index of the current byte in the location information list; add an offset value to each byte so that the byte range is mapped to the length range of the location information list;

[0035] Check whether the corresponding index in the position information list is the initial value. If so, add the corresponding row in the relative distance list; otherwise, calculate the distance between the current index and the corresponding index in the position information list, find the relative distance list corresponding to the current byte, and insert the distance to the end of the relative distance list;

[0036] Update the most recent position of the current byte and update the corresponding index in the position information list to the current index.

[0037] Furthermore, the step of matching the query sequence in the target sequence according to the distance table includes:

[0038] Initialize a result list and match counter with the same length as the byte array of the query sequence;

[0039] Traverse the values ​​in the target sequence byte array. When the value is in the distance table, take out the relative distance list in the distance table, and compare the values ​​in the relative position to see if they are the same. If they are the same, store them in the result list and increase the result count by one.

[0040] When the result count is equal to or exceeds half of the length of the query byte array, the match is considered successful and the position of the first element of the current result list in the query sequence byte array is returned; otherwise, the result list and result count are initialized, and the traversal index is moved forward to the current index plus the query byte array length, and then the traversal operation is repeated.

[0041] A gene sequence storage and retrieval device, comprising:

[0042] Gene sequence import module, used to import gene sequence files from user-specified paths into databases or file systems;

[0043] Gene sequence export module, used to export user-specified gene sequences from a database or file system to a specified path;

[0044] A gene sequence query module is used to receive target sequence and query sequence information input by the user and return the query results in the database or file system;

[0045] Function expansion module, used to implement user-defined functions related to gene sequence information.

[0046] Furthermore, the custom function includes one or more of the following functions:

[0047] BioSequence.fromURL: Import gene sequence from uniform resource locator;

[0048] BioSequence.fromBytes: Import gene sequence from bytecode;

[0049] BioSequence.fromFile: Import gene sequences from the specified file path;

[0050] BioSequence.exportSequence: Exports gene sequences from the graph database to the specified path;

[0051] BioSequence.getInformation: Get the information of the gene sequence file, including the submission agency and submission time information;

[0052] BioSequence.length: Get the length of the gene sequence;

[0053] BioSequence.getLowerCasePosition: Get the relative position and length of lowercase characters;

[0054] BioSequence.getNCasePosition: Get the starting point and length of the unknown base character;

[0055] BioSequence.getNonAGCTCasePosition: Get the starting point and character of the heterozygous base;

[0056] BioSequence.searchOne: Searches for the first occurrence of the query sequence in the target sequence and returns the alignment of the two sequences;

[0057] BioSequence.searchAll: Searches for all occurrences of the query sequence in the target sequence and returns the alignment results of all similar sequences.

[0058] The innovation of the present invention is:

[0059] 1. Implemented a 2-bit gene sequence compression algorithm based on MapReduce: A new gene sequence compression method was implemented in a distributed system, using the MapReduce framework, so that the algorithm can process large-scale gene data.

[0060] 2. New gene sequence retrieval method: A new retrieval method is proposed. Different from the traditional method, it directly matches in compressed data, thus improving the retrieval efficiency.

[0061] 3. Application device in database system: realizes the application of the above retrieval method in the database system, making the storage and retrieval of gene data more efficient.

[0062] The advantages of the present invention are:

[0063] 1. Optimized 2-bit compression algorithm: a) Improved compression speed: Using the MapReduce method, the 2-bit algorithm is optimized, making the compression speed higher than the traditional implementation. b) Preserving gene sequence features: Using the 2-bit compression method, some gene sequence features are preserved, providing a basis for subsequent retrieval.

[0064] 2. New search algorithm: a) Byte stream matching: Matching is performed in the byte stream, and there is no need to restore the compressed file to a string, thus avoiding the problem of the traditional method of completely restoring the compressed file before matching. b) Index-free search: There is no need to build a string index, and search is performed directly in the byte stream, which reduces the time for gene sequence search. c) Efficient matching result processing: When restoring the string, the bytes in the matching result are used as seeds, and only part of the target sequence data needs to be decompressed, which reduces the calculation time of the seed expansion algorithm based on the traditional method.

[0065] Based on the above innovations and advantages, the present invention provides a more efficient solution in the compression and retrieval of gene sequences. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] Figure 1 This is a schematic diagram of gene sequence compression.

[0067] Figure 2 The following is an example of the serialization result read from the target sequence file.

[0068] Figure 3 This is an example diagram of the serialization result after the query sequence is shifted.

[0069] Figure 4 This is an example diagram of the calculation results of the query sequence distance table.

[0070] Figure 5 The following is an example diagram of the matching process and possible situations. DETAILED DESCRIPTION

[0071] In order to make the various technical features and advantages or technical effects in the above technical solutions of the present invention more obvious and easy to understand, they are described in detail below with reference to the accompanying drawings.

[0072] The present invention provides a gene sequence compression method, which is a 2-bit gene sequence compression algorithm based on MapReduce. The arrangement process is as follows: Figure 1 As shown, the specific processing steps include:

[0073] 1) Parse the gene sequence file into sequence information and sequence segments:

[0074] i. For a gene sequence file containing only a single sequence data, read the identification line starting with ">" as the sequence information. Remove the blank characters from the original gene sequence and divide it into 64KB segments. The part less than 64KB at the end is divided into the last segment to obtain the sequence segment.

[0075] ii. For a gene sequence file containing multiple sequence data, the gene sequence data is split by the identification line, and the information of the entire file is stored in the file information. The split data is processed in the same way as in step i.

[0076] 2) Based on Map, the input gene sequence segment is processed into a sequence of only nucleic acid bases and sequenced:

[0077] i. After recording the relative position and length of the lowercase characters in the sequence segment and storing them in a list in the form of a tuple, convert them into the corresponding uppercase characters;

[0078] ii. After recording the relative position and length of the unknown base characters in the sequence segment and storing them in a list in the form of tuples, delete all unknown base characters;

[0079] iii. After recording the characters and relative positions of the heterozygous bases in the sequence segment and storing them in a list in the form of tuples, delete all the heterozygous bases.

[0080] iv. Serialize the nucleic acid base sequence. Map each nucleic acid base in the nucleic acid base sequence according to A-00, G-01, C-10, T-11 (U-11), and pack the mapping results of every 4 bases into one byte.

[0081] 3) Based on Reduce, the obtained gene sequence information and the gene sequence segment serialization results are spliced, then written into a file and stored in the specified file path.

[0082] i. Splice the sequence information of each sequence segment and then serialize it;

[0083] ii. splicing the sequencing results of the nucleic acid base sequences;

[0084] iii. Concatenate the serialization result obtained in step i and the concatenation result obtained in step ii.

[0085] 4) Storage: The final spliced ​​gene sequence data is written into a file and stored in a specified file path of the file system or database.

[0086] The present invention provides a gene sequence retrieval method, which is to retrieve the gene sequence processed by the above gene sequence compression method, comprising the following steps:

[0087] 1) Get the target sequence:

[0088] According to the target sequence information provided by the user, the data stream of the target sequence is read from the stored sequence file.

[0089] 2) Query sequence preprocessing:

[0090] i. Performing the same serialization operation on the query sequence (Query) as in step 2) of the gene sequence compression method, the serialization result of the query sequence using the 2-bit algorithm can be obtained;

[0091] ii. Add 1 to 3 adenine characters "00" before the serialization result to obtain 3 serialization results after shift processing;

[0092] iii. Convert the original query sequence and the shift serialization result into byte arrays (ArrayByte1 to ArrayByte4).

[0093] 3) Distance Table calculation:

[0094] The byte arrays converted from the original query sequence and the shifted serialization result are processed to obtain the distance table DistanceTable. Each row in the table includes a byte value (ByteValue) and a relative distance list (DistanceList). The processing steps are as follows:

[0095] i. Initialization: Create a position information list (PositionList) with a length of 256 and initialize all elements to -1. At the same time, initialize the traversal index (index, ranging from 0 to the length of the query sequence byte array).

[0096] ii. Calculate the relative position: For the value corresponding to each index of the four byte arrays, perform the following operations at the same time:

[0097] Calculate the corresponding index (current) of the current byte in the position information list (PositionList). Add an offset value of 128 to each byte so that the byte range (-128 to 127) is mapped to the length range (0 to 255) of PositionList.

[0098] Check if PositionList(current) is -1. If it is -1, add the corresponding row to DistanceTable (ByteValue is the current byte, initialize DistanceList to the current index); if it is not -1, calculate the distance between the current index and the index recorded in PositionList(current) (distance = index-PositionList(current)), find the DistanceList corresponding to the current byte, and insert distance to the end of DistanceList.

[0099] Update the position where the current byte appears most recently. Set PositionList(current) = index, and update PositionList(current) to the current index index.

[0100] 4) Match the query sequence in the target sequence:

[0101] i. Initialize a result list (ResultList) and a match counter (ResultCount) with the same length as the byte array of the query sequence;

[0102] ii. Traverse the values ​​in the target sequence byte array. When its value is in the DistanceTable, take out the relative distance list in the DistanceTable and compare the values ​​in the relative positions to see if they are the same. If they are the same, store them in ResultList and increase ResultCount by one.

[0103] iii. When ResultCount / query byte array length>=0.5, it can be determined that the match is successful, and the position of the first element of the current result list in the query sequence byte array is returned; otherwise, initialize ResultList and ResultCount, and move the traversal index forward to the current index plus the query byte array length, and then repeat operations ii to iii.

[0104] The present invention provides a gene sequence storage and retrieval device, which can implement the processing of the above two methods. The device includes the following modules:

[0105] The gene sequence import module is used to receive the import file path provided by the user, which can be a gene sequence file, a byte file or a network resource (URL), and import the file into the database or file system after processing;

[0106] The gene sequence export module is used to receive the export file path and the target sequence to be exported provided by the user, and export the target sequence to the specified path after restoration;

[0107] Gene sequence query module, used to receive and process the query sequence and target sequence information provided by the user, and perform query after exporting the target sequence in the database or file system;

[0108] Function extension module, used to implement the user-defined function (UDF, User-Defined Function) related to gene sequence information.

[0109] The following provides specific embodiments:

[0110] Example 1

[0111] This embodiment specifically implements the gene sequence compression method of the present invention, and the implementation steps include:

[0112] 1) Analysis of gene sequence files:

[0113] The following gene sequence file data is the first chromosome of the assembled genome TAIR10 of Arabidopsis thaliana:

[0114]

[0115] Parse the above gene sequence file, including sequence information and sequence segments:

[0116] i. Sequence information: extract the identification line starting with “>” to obtain the sequence information; if the file contains multiple sequence data, extract them separately;

[0117] ii. Sequence segment: Extract the sequence segment in the file except the identification line. In addition, if the file contains multiple sequence data, split the file and process different sequences separately.

[0118] 2) Based on the Map operation, the original sequence segment is processed into a sequence containing only nucleic acid bases and serialized:

[0119] i. Record the relative position and length of lowercase characters in the original sequence, and convert all lowercase characters to uppercase characters: findConsecutiveLowerCasePositions(sequence);

[0120] ii. After recording the relative positions and lengths of all unknown bases in the sequence, delete all unknown base characters: removeAndRecordN(noLowerCaseSequence);

[0121] iii. After recording the relative positions and characters of all heterozygous bases in the sequence, delete all heterozygous base characters: removeAndRecord(noNSequence);

[0122] iv. Serialize the nucleic acid base sequence segments obtained after the above processing of each sequence segment: subSequenceSerialize(subSequence).

[0123] 3) Based on the Reduce operation, all sequence information and serialization results are spliced:

[0124] i. Splicing the sequence information of each sequence segment and serializing the splicing result;

[0125] ii. splicing the sequencing results of the nucleic acid base sequences;

[0126] iii. Concatenate the results of i and ii.

[0127] 4) Store the spliced ​​sequence data files in the file system or database:

[0128] i. Store in the file system, specify the file path, and write the sequence information, sequence segment, and serialized byte array into the file in the file system in sequence.

[0129] ii. Store in the database and import the file according to the database storage rules.

[0130] Example 2

[0131] This embodiment implements the gene sequence retrieval method of the present invention, and the implementation steps include:

[0132] 1) The user provides the target gene sequence file information and reads the sequence information from the file. Figure 2 As shown; if this embodiment is to query in the file system, the gene sequence data can be read through the export module in GenomeStore according to the file path provided by the user; if the query is in the database, the sequence stored in the database can be restored and exported to the specified path through the exportSequence module according to the sequence and file path specified by the user.

[0133] 2) The user provides a query sequence, and after shifting and serialization, the result is as follows Figure 3 shown.

[0134] 3) Calculate the byte distance table in the query sequence, such as Figure 4 shown.

[0135] 4) Match the query sequence in the target sequence stream data, such as Figure 5 shown.

[0136] 5) Use searchOne(GenomeSequence,Query) of the Search module to obtain the most similar subsequence in the target sequence.

[0137] 6) Use searchAll(GenomeSequence,Query) of the Search module to obtain all subsequences in the target sequence that are similar to the query sequence.

[0138] Example 3

[0139] This embodiment provides a storage and retrieval device for gene sequences. Considering the versatility, the system can be implemented using Scala / Java code to facilitate cross-platform porting. The system includes the following modules:

[0140] The gene sequence import module is used to receive the import file path provided by the user, which can be a gene sequence file, a byte file or a network resource (URL), and import the file into the database or file system after processing;

[0141] The gene sequence export module is used to receive the export file path and the target sequence to be exported provided by the user, and export the target sequence to the specified path after restoration;

[0142] Gene sequence query module, used to receive and process the query sequence and target sequence information provided by the user, and perform query after exporting the target sequence in the database or file system;

[0143] Function extension module, used to implement the user-defined function (UDF, User-Defined Function) related to gene sequence information.

[0144] Among them, custom functions can include the following categories:

[0145] 1) Functions used for gene sequence import module:

[0146] i.BioSequence.fromURL: Import gene sequence from uniform resource locator;

[0147] ii.BioSequence.fromBytes: Import gene sequence from bytecode;

[0148] iii.BioSequence.fromFile: Import gene sequence from the specified file path.

[0149] 2) Functions used for gene sequence export module:

[0150] i.BioSequence.exportSequence: Exports gene sequences from the graph database to the specified path.

[0151] 3) Functions used for gene sequence query module:

[0152] i.BioSequence.getInformation: Get the information of the gene sequence file, including the submission agency, submission time, etc.;

[0153] ii.BioSequence.length: Get the length of the gene sequence;

[0154] iii.BioSequence.getLowerCasePosition: Get the relative position and length of lowercase characters;

[0155] iv.BioSequence.getNCasePosition: Get the starting point and length of the unknown base character;

[0156] v.BioSequence.getNonAGCTCasePosition: Get the starting point and character of the heterozygous base;

[0157] vi.BioSequence.searchOne: retrieves the query sequence that appears for the first time in the target sequence and returns the comparison results of the two sequences;

[0158] vii.BioSequence.searchAll: Retrieve all occurrences of the query sequence in the target sequence and return the comparison results of all similar sequences.

[0159] Parts of the present invention that are not described in detail belong to the common knowledge of those skilled in the art.

[0160] Although the present invention has been disclosed as above by way of embodiments, it is not intended to limit the present invention. Appropriate modifications or equivalent substitutions of the technical solutions of the present invention made by ordinary technicians in the field should all be included in the protection scope of the present invention. The protection scope of the present invention shall be based on what is defined in the claims.

Claims

1. A gene sequence compression method, characterized in that: The following steps are involved: Parse the gene sequence file to obtain sequence information and sequence segments; Based on the Map operation, the sequence segments are processed into sequences consisting of only nucleic acid bases and then serialized; Based on the Reduce operation, the above sequence information and serialization results are concatenated and stored in the sequence file.

2. The gene sequence compression method according to claim 1, characterized in that: The identification line in the gene sequence file is read to obtain the sequence information; for the original sequence in the gene sequence file, the blank characters are removed and the sequence is divided into segments of 64KB, wherein the part less than 64KB at the end is divided into the last segment to obtain the sequence segment.

3. The gene sequence compression method according to claim 1, characterized in that: For a gene sequence file containing multiple sequence data, the gene sequence file is split into gene sequence files containing only a single sequence data according to the identification line, and then each of the split gene sequence files is parsed to obtain the corresponding sequence information and sequence segments.

4. The gene sequence compression method according to claim 1, characterized in that: The steps of processing the sequence segment into a sequence of only nucleic acid bases and serializing it based on the Map operation include: Record the relative position and length of lowercase characters in the sequence segment and store them in a list in the form of tuples, and then convert the lowercase characters to uppercase characters; Record the relative position and length of the unknown base characters in the sequence segment and store them in a list in the form of tuples, then delete all unknown base characters; Record the characters and relative positions of the heterozygous bases in the sequence segment and store them in a list in the form of tuples, then delete all the heterozygous bases; After the above steps, a sequence consisting of only nucleic acid bases is obtained, and each nucleic acid base in the sequence consisting of only nucleic acid bases is mapped according to the relationship of A-00, G-01, C-10, T-11 or U-11, and the mapping results of every 4 bases are packaged into one byte to realize the serialization of the sequence consisting of only nucleic acid bases.

5. The gene sequence compression method according to claim 1, characterized in that: The steps of splicing the sequence information and the serialization result based on the Reduce operation include: 1) Splice the sequence information of each sequence segment and then serialize it; 2) splicing the sequencing results of the nucleic acid base sequences; 3) Splicing the serialization result obtained in step 1) and the splicing result obtained in step 2).

6. A gene sequence retrieval method, which performs retrieval based on the gene sequence data obtained by the gene sequence compression method according to claim 1, characterized in that: The following steps are involved: According to the target sequence information provided by the user, the data stream of the target sequence is read from the stored sequence file; Preprocess the query sequence provided by the user; Calculate the distance table based on the preprocessing results; Match the query sequence in the target sequence according to the distance table and return the matching results.

7. The gene sequence retrieval method according to claim 6, characterized in that: The steps for preprocessing the query sequence provided by the user include Serialize the query sequence based on the Map operation; Add 1 to 3 adenine characters in sequence before the serialization result to obtain 3 shift serialization results; Convert the original query serialization and the shift serialization result into byte arrays.

8. The gene sequence retrieval method according to claim 6, characterized in that: The method for calculating the distance table according to the preprocessing result is to process the byte array converted from the original query sequence and the shift serialization result to obtain a distance table. Each row in the distance table includes a byte value and a relative distance list. The processing steps include: Create a location information list, initialize all elements, and initialize the traversal index index; For the value corresponding to each index in the byte array, calculate the corresponding index of the current byte in the location information list; add an offset value to each byte so that the byte range is mapped to the length range of the location information list; Check whether the corresponding index in the position information list is the initial value. If so, add the corresponding row in the relative distance list; otherwise, calculate the distance between the current index and the corresponding index in the position information list, find the relative distance list corresponding to the current byte, and insert the distance to the end of the relative distance list; Update the most recent position of the current byte and update the corresponding index in the position information list to the current index.

9. The gene sequence retrieval method according to claim 6, characterized in that: The steps of matching the query sequence in the target sequence according to the distance table include: Initialize a result list and match counter with the same length as the byte array of the query sequence; Traverse the values ​​in the target sequence byte array. When the value is in the distance table, take out the relative distance list in the distance table, and compare the values ​​in the relative position to see if they are the same. If they are the same, store them in the result list and increase the result count by one. When the result count is equal to or exceeds half of the length of the query byte array, the match is considered successful and the position of the first element of the current result list in the query sequence byte array is returned; otherwise, the result list and result count are initialized, and the traversal index is moved forward to the current index plus the query byte array length, and then the traversal operation is repeated.

10. A gene sequence storage and retrieval device, based on the gene sequence compression method of claim 1 and the gene sequence retrieval method of claim 6, characterized in that: include: Gene sequence import module, used to import gene sequence files from user-specified paths into databases or file systems; Gene sequence export module, used to export user-specified gene sequences from a database or file system to a specified path; A gene sequence query module is used to receive target sequence and query sequence information input by the user and return the query results in the database or file system; Function expansion module, used to implement user-defined functions related to gene sequence information.

Citation Information

Patent Citations

  • Parallelization gene data compression method based on Hadoop

    CN110299187A

  • Lossless compression method for multiple FASTA format gene sequences

    CN110970088A

  • Query method, device and system for similar patient diagnosis records based on block editing distance

    CN115602278A

  • Methods for comparative metagenomic analysis

    US20210249102A1