Method, device, equipment and memory for generating reverse weighted sequence alignment seeds

By assigning weights to each k-mer, the smallest subseed with reverse weighting is generated, and the false positive site problem of genomic repeat regions is solved, and accurate alignment and efficient calculation of genomic repeat regions are achieved.

CN115719618BActive Publication Date: 2025-08-22NAT UNIV OF DEFENSE TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211422257.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-14
Publication Date
2025-08-22
Estimated Expiration
2042-11-14

AI Technical Summary

Technical Problem

Existing seed generation methods When processing genomic repetition regions, high-frequency minimal subseed leads to an increase in false positive sites, affecting alignment accuracy and computational efficiency.

Method used

The reverse-weighted sequence alignment seed generation method is used to give weight to each k-mer, and the probability that the high-frequency k-mer is selected as the smallest subseed is generated, and the false positive sites are avoided.

Benefits of technology

Accurate alignment in the repeated regions of the genome is achieved, false positive sites are reduced, the integrity of the seed generation algorithm is maintained, and efficient alignment algorithm design is supported.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115719618B_ABST
    Figure CN115719618B_ABST
Patent Text Reader

Abstract

The present application relates to a method, apparatus, device, and memory for generating reverse-weighted sequence alignment seeds in the field of computer technology. The method comprises: dividing a read reference sequence into N windows, generating continuous overlapping k-mers for each window; counting the number of occurrences of each k-mer in all windows, and calculating the frequency of occurrence of each k-mer; assigning a weight value to each k-mer based on the frequency of occurrence of each k-mer, wherein the weight value of the k-mer decreases as the frequency of occurrence of the k-mer increases; calculating the hash value of each k-mer based on the base sequence information and frequency of occurrence of each k-mer using a preset hash function; and generating a minimum subseed for each window based on the hash value of each k-mer in each window. This method implements reverse-weighted seed generation for genomic repetitive regions, supporting the design and implementation of precise alignment algorithms.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, device and memory for generating reverse weighted sequence alignment seeds. Background Art

[0002] Sequence alignment compares the read sequences output by the sequencer with the reference genome to identify the most likely origin of the read on the genome. Sequence alignment is a fundamental and important step in sequencing data analysis, and its results are a prerequisite for all other steps. Seed-and-extension sequence alignment algorithms can effectively narrow the scope of base-level alignment, reduce computational effort, and increase alignment speed. However, the large number of repetitive fragments in repetitive regions of the genome can cause seed positioning errors, resulting in false-positive hits and affecting sequence alignment accuracy.

[0003] Among existing seed generation methods, the minimizer method offers advantages in both time and space, and is becoming increasingly common. This method evenly divides the genome into several windows of equal length. Within each window, a series of k-mers (k-base segments) are generated. The hash value of each k-mer is calculated using a predefined hash function, and the k-mer with the smallest hash value is selected as the minimum seed for each window. However, eukaryotic genomes contain many repetitive segments, such as tandem repeats like satellite DNA near centromeres. This results in a higher frequency of minimum seeds selected for repetitive regions of the genome than for other regions. During alignment, these high-frequency minimum seeds guide the mapping algorithm to locate repetitive regions, resulting in numerous false-positive sites and a significant amount of wasted computation and space during the base alignment phase.

[0004] Heng Li published a method in the paper "Minimap2: pairwise alignment for nucleotide sequences" that counts the frequencies of all minimum subseeds and discards the top 0.02% of the most frequently occurring minimum subseeds. Chirag Jain et al. published a method in the paper "A Fast Approximate Algorithm for Mapping Long Reads to Large Reference Databases" that discards the top 0.001% of the most frequently occurring minimum subseeds. Although these two methods avoid false positive sites to a certain extent, they undermine the integrity of the minimum subseed algorithm and reduce the accuracy of alignment of genomic repetitive regions, which will affect downstream data analysis. Relevant research papers have shown that the above schemes have resulted in reduced homology detection rates in genomic repetitive regions and assembly errors of high-copy plasmids. Summary of the Invention

[0005] Based on this, it is necessary to provide a reverse weighted sequence alignment seed generation method, device, equipment and memory to address the above technical problems.

[0006] A method for generating reverse weighted sequence alignment seeds, comprising:

[0007] The reference sequence is read and divided into N windows, wherein the first N-1 windows each contain w bases, the number of bases in the Nth window is no greater than w, and N and w are both integers greater than 1.

[0008] According to each of the windows, consecutive overlapping k-mers are generated for the corresponding window.

[0009] The occurrence count of each k-mer in all windows is counted to obtain the occurrence count of each k-mer.

[0010] Calculate the frequency of each k-mer based on the number of occurrences of each k-mer.

[0011] According to the occurrence frequency of each k-mer, a preset weight function is used to calculate the weight value of each k-mer; the weight value of the k-mer decreases as the occurrence frequency of the k-mer increases.

[0012] According to the base sequence information and occurrence frequency of each k-mer, a preset hash function is used to calculate the hash value of each k-mer.

[0013] Compare the hash values ​​of all k-mers in each window separately and generate the minimum subseed for each window.

[0014] In one embodiment, the hash value of each k-mer is calculated using a preset hash function according to the base sequence information and occurrence frequency of each k-mer. The preset hash function in the step is:

[0015]

[0016] Among them, h(k i ) is the hash value of the i-th k-mer, and the range of the hash value is the open interval (0,1); k i is the base sequence information of the i-th k-mer; φ(f(k i )) is the weight value of the i-th k-mer, and the weight value range is the open interval (0,1); g(k i ) is a common hash function that does not consider weight information, and the hash value range is an open interval (0,1).

[0017] In one embodiment, the hash values ​​of all k-mers in each window are compared to generate the minimum subseed of each window, including:

[0018] Take the first window as the current window; take the first k-mer in the current window as the current k-mer; set the minimum hash value of the k-mer in the current window to 1; compare the hash value of the current k-mer in the current window with the minimum hash value to obtain a comparison result; when the comparison result is that the hash value of the current k-mer is less than the minimum hash value, update the minimum hash value to the hash value of the current k-mer, and record the corresponding k-mer as the alternative minimum sub-seed of the current window; when the comparison result is that the hash value of the current k-mer is greater than the minimum hash value, if the current k-mer is not the last k-mer in the current window, process the next k-mer; if the current k-mer is the last k-mer in the current window, use the alternative minimum sub-seed of the current window as the minimum sub-seed of the current window, update the current window to the next window, and continue the next round of iteration until all windows are traversed and the minimum sub-seed generation process of all windows is completed.

[0019] In one embodiment, the number of occurrences of each k-mer in all windows is counted to obtain the number of occurrences of each k-mer, including:

[0020] Set the frequency record table to be empty. The information in the frequency record table includes: k-mer, the number of occurrences of k-mer, and the frequency of occurrence of k-mer; read a k-mer, record it as k i , and check whether the frequency record table already contains the same frequency as k i k-mer with the same sequence; if the frequency record table does not contain the k-mer i k-mer with the same sequence, then add a row to the frequency record table and add k i Record in this line and set k i The number of occurrences of is recorded as 1; if the frequency record table contains i For k-mers with the same sequence, the number of occurrences of the corresponding k-mer in the frequency record table is increased by 1; the next k-mer is read and the processing is continued until all k-mers are traversed to obtain the number of occurrences of each k-mer.

[0021] A reverse weighted sequence alignment seed generation device, comprising:

[0022] The reference sequence reading module is used to read the reference sequence and divide the reference sequence into N windows, wherein the first N-1 windows each contain w bases, the number of bases in the Nth window is not greater than w, and N and w are both integers greater than 1.

[0023] The k-mer occurrence frequency statistics module is used to generate continuous overlapping k-mers for the corresponding window according to each of the windows; count the number of occurrences of each k-mer in all windows to obtain the number of occurrences of each k-mer; and calculate the occurrence frequency of each k-mer based on the number of occurrences of each k-mer.

[0024] The k-mer weight calculation module calculates the weight value of each k-mer based on the frequency of occurrence of each k-mer using a preset weight function; the weight value of the k-mer decreases as the frequency of occurrence of the k-mer increases.

[0025] The k-mer hash value calculation module is used to calculate the hash value of each k-mer based on the base sequence information and occurrence frequency of each k-mer using a preset hash function.

[0026] The minimum subseed generation module is used to compare the hash values ​​of all k-mers in each window and generate the minimum subseed for each window.

[0027] In one embodiment, the preset hash function in the k-mer hash value calculation module is:

[0028]

[0029] Among them, h(k i ) is the hash value of the i-th k-mer, and the range of the hash value is the open interval (0,1); k i is the base sequence information of the i-th k-mer; φ(f(k i )) is the weight value of the i-th k-mer, and the weight value range is the open interval (0,1); g(k i ) is a common hash function that does not consider weight information, and the hash value range is an open interval (0,1).

[0030] In one embodiment, the minimum sub-seed generation module is further used to take the first window as the current window; take the first k-mer in the current window as the current k-mer; set the minimum hash value of the k-mer in the current window to 1; compare the hash value of the current k-mer in the current window with the minimum hash value to obtain a comparison result; when the comparison result is that the hash value of the current k-mer is less than the minimum hash value, the minimum hash value is updated to the hash value of the current k-mer, and the corresponding k-mer is recorded as the alternative minimum sub-seed of the current window; when the comparison result is that the hash value of the current k-mer is greater than the minimum hash value, if the current k-mer is not the last k-mer in the current window, the next k-mer is processed; if the current k-mer is the last k-mer in the current window, the alternative minimum sub-seed of the current window is used as the minimum sub-seed of the current window, the current window is updated to the next window, and the next round of iteration is continued until all windows are traversed to complete the minimum sub-seed generation process for all windows.

[0031] In one embodiment, the k-mer occurrence frequency statistics module is further used to set the frequency record table to be empty, wherein the information in the frequency record table includes: k-mer, the number of occurrences of k-mer, and the frequency of occurrence of k-mer; read a k-mer and record it as k i , and check whether the frequency record table already contains the same frequency as k i k-mer with the same sequence; if the frequency record table does not contain the k-mer i k-mer with the same sequence, then add a row to the frequency record table and add k i Record in this line and set k i The number of occurrences of is recorded as 1; if the frequency record table contains i For k-mers with the same sequence, the number of occurrences of the corresponding k-mer in the frequency record table is increased by 1; the next k-mer is read and the processing is continued until all k-mers are traversed to obtain the number of occurrences of each k-mer.

[0032] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.

[0033] A computer-readable storage medium stores a computer program, which implements the steps of the above method when executed by a processor.

[0034] The above-mentioned reverse weighted sequence alignment seed generation method, apparatus, device and memory include: reading a reference sequence and dividing the reference sequence into N windows, each window containing w bases; generating continuous overlapping k-mers for the corresponding window based on each window; counting the number of occurrences of each k-mer in all windows to obtain the number of occurrences of each k-mer; calculating the occurrence frequency of each k-mer based on the number of occurrences of each k-mer; calculating the weight value of each k-mer based on the occurrence frequency of each k-mer using a preset weight function, wherein the weight value of the k-mer decreases as the occurrence frequency of the k-mer increases; calculating the hash value of each k-mer based on the base sequence information and occurrence frequency of each k-mer using a preset hash function; and comparing the hash values ​​of all k-mers in each window to generate the minimum subseed for each window. This method avoids reducing false positive sites by deleting high-frequency seeds, ensures the integrity of the seed generation algorithm, realizes reverse weighted seed generation for genomic repetitive regions, and supports the design and implementation of accurate alignment algorithms. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 Schematic diagram of a flow chart of a reverse weighted sequence alignment seed generation method in one embodiment;

[0036] Figure 2 1 is a structural block diagram of a reverse weighted sequence alignment seed generation device in one embodiment;

[0037] Figure 3 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0038] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0039] The reason for false positive positioning in genomic duplication regions is that the frequency of the minimum subseed in the duplication region is too high. If the k-mer with too high a frequency can be avoided from being selected as the minimum subseed, this problem can be solved. Therefore, the present invention proposes to adopt a seed selection method with weights, assigning a weight to each k-mer. The higher the weight, the greater the probability of this k-mer being selected as the minimum subseed, and the lower the weight, the smaller the probability of being selected as the minimum subseed. For k-mers with higher frequencies, lower weights are assigned to achieve inverse weighting, so that the probability of high-frequency k-mers being selected as the minimum subseed can be reduced, and thus too many false positive sites will not be generated.

[0040] In one embodiment, Figure 1 As shown, a reverse weighted sequence alignment seed generation method is provided, which includes the following steps:

[0041] Step 100: Read a reference sequence and divide the reference sequence into N windows, wherein the first N-1 windows each contain w bases, the number of bases in the Nth window is no more than w, and N and w are both integers greater than 1.

[0042] Specifically, in the field of gene comparison, the reference sequence is a gene base sequence sample accumulated over many years, also known as a standard gene library, which represents the correspondence between currently known genes and gene effects. By comparing the sequence to be compared with the reference sequence, the gene effect of the sequence to be compared can be predicted.

[0043] Step 102: Based on each window, generate continuous overlapping k-mers for the corresponding window.

[0044] Specifically, read a window and generate continuous overlapping k-mers for the window. If it is not the Nth window, then it is w-k+1 k-mers, recorded as k i , i = 1, 2, ..., w-k+1. If it is the Nth window, then v-k+1 k-mers are generated. Continue to generate consecutive overlapping k-mers for the next window, and so on, until all N windows of the reference sequence are traversed, and consecutive overlapping k-mers are generated for each window.

[0045] Step 104: Count the number of occurrences of each k-mer in all windows to obtain the number of occurrences of each k-mer.

[0046] Step 106: Calculate the occurrence frequency of each k-mer based on the number of occurrences of each k-mer.

[0047] Specifically, read a k-mer and its number of occurrences n in the frequency record table i ; According to the number of occurrences of k-mer, calculate its occurrence frequency f(k i ); continue to read the next k-mer and its occurrence times, and calculate the frequency of occurrence, and so on, until all k-mers in the frequency record table are traversed, and the frequency of occurrence of each k-mer is obtained.

[0048] Step 108: Calculate the weight value of each k-mer based on the occurrence frequency of each k-mer using a preset weight function; the weight value of the k-mer decreases as the occurrence frequency of the k-mer increases.

[0049] Specifically, read a k-mer and its occurrence frequency f(k i), use the preset weight function to calculate the weight value of the k-mer, and continue to read the next k-mer whose weight value has not been calculated in the frequency record table and its occurrence frequency f(k i ), use the preset weight function to calculate the weight value of the k-mer, and so on, until all k-mers in the frequency record table are traversed, and the weight value of each k-mer is obtained.

[0050] The preset weight function is designed as follows: the input of the preset weight function φ is the occurrence frequency f(k i ), the output is the weight value, which ranges from (0,1). The preset weight function φ can assign lower weights to k-mers with particularly high frequencies and higher weights to k-mers with low frequencies, thus achieving inverse weighting.

[0051] Step 110: Calculate the hash value of each k-mer using a preset hash function based on the base sequence information and occurrence frequency of each k-mer.

[0052] Specifically, read a k-mer k in the frequency record table i and its frequency information; according to k i The base sequence information and frequency of occurrence are calculated by the hash function h(k i ) Calculate its hash value H i .

[0053] Step 112: Compare the hash values ​​of all k-mers in each window respectively to generate the minimum subseed of each window.

[0054] The above-mentioned reverse weighted sequence alignment seed generation method includes: reading a reference sequence and dividing the reference sequence into N windows; generating continuous overlapping k-mers for each window; counting the number of occurrences of each k-mer in all windows to obtain the number of occurrences of each k-mer; calculating the frequency of occurrence of each k-mer based on the number of occurrences of each k-mer; calculating the weight value of each k-mer based on the frequency of occurrence of each k-mer using a preset weight function, wherein the weight value of the k-mer decreases as the frequency of occurrence of the k-mer increases; calculating the hash value of each k-mer based on the base sequence information and frequency of occurrence of each k-mer using a preset hash function; and comparing the hash values ​​of all k-mers in each window to generate the minimum subseed for each window. This method avoids reducing false positive sites by deleting high-frequency seeds, ensures the integrity of the seed generation algorithm, realizes reverse weighted seed generation for genomic repetitive regions, and supports the design and implementation of accurate alignment algorithms.

[0055] In one embodiment, the preset hash function in step 110 is:

[0056]

[0057] Among them, h(k i ) is the hash value of the i-th k-mer, and the range of the hash value is the open interval (0,1); k i is the base sequence information of the i-th k-mer; φ(f(k i )) is the weight value of the i-th k-mer, and the weight value range is the open interval (0,1); g(k i ) is a common hash function that does not consider weight information, and the hash value range is an open interval (0,1).

[0058] In one embodiment, step 112 includes: taking the first window as the current window; taking the first k-mer in the current window as the current k-mer; setting the minimum hash value of the k-mer in the current window to 1; comparing the hash value of the current k-mer in the current window with the minimum hash value to obtain a comparison result; when the comparison result is that the hash value of the current k-mer is less than the minimum hash value, updating the minimum hash value to the hash value of the current k-mer, and recording the corresponding k-mer as the alternative minimum sub-seed of the current window; when the comparison result is that the hash value of the current k-mer is greater than the minimum hash value, if the current k-mer is not the last k-mer in the current window, processing the next k-mer; if the current k-mer is the last k-mer in the current window, taking the alternative minimum sub-seed of the current window as the minimum sub-seed of the current window, updating the current window to the next window, and continuing the next round of iteration until all windows are traversed and the minimum sub-seed generation process of all windows is completed.

[0059] In one embodiment, step 104 includes: setting the frequency record table to be empty, the information in the frequency record table includes: k-mer, the number of occurrences of k-mer, and the frequency of occurrence of k-mer; reading a k-mer, recorded as k i , and check whether the frequency record table already contains the same i k-mer with the same sequence; if the frequency record table does not contain k i k-mer with the same sequence, add a row to the frequency record table and add k i Record in this line and set k i The number of occurrences of is recorded as 1; if there is a iFor k-mers with the same sequence, the number of occurrences of the corresponding k-mer in the frequency record table is increased by 1; the next k-mer is read, and the process continues until all k-mers are traversed, and the number of occurrences of each k-mer is obtained. The frequency record table is shown in Table 1.

[0060] Table 2 Frequency record table

[0061] k-mer <![CDATA[Count n i > <![CDATA[Frequency f(k i )]]> <![CDATA[k1]]> <![CDATA[n1]]> <![CDATA[f1]]> <![CDATA[k2]]> <![CDATA[n1]]> <![CDATA[f2]]> <![CDATA[k3]]> <![CDATA[n1]]> <![CDATA[f3]]> …… …… ……

[0062] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. In addition, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0063] In one embodiment, Figure 2 As shown, a reverse weighted sequence alignment seed generation device is provided, comprising: a reference sequence reading module, a k-mer occurrence frequency statistics module, a k-mer weight calculation module, a k-mer hash value calculation module and a minimum subseed generation module, wherein:

[0064] The reference sequence reading module is used to read the reference sequence and divide the reference sequence into N windows, where the first N-1 windows each contain w bases, the number of bases in the Nth window is not greater than w, and N and w are both integers greater than 1.

[0065] The k-mer occurrence frequency statistics module is used to generate continuous overlapping k-mers for each window; count the number of occurrences of each k-mer in all windows to obtain the number of occurrences of each k-mer; and calculate the occurrence frequency of each k-mer based on the number of occurrences of each k-mer.

[0066] The k-mer weight calculation module calculates the weight value of each k-mer based on the frequency of occurrence of each k-mer and a preset weight function; the weight value of the k-mer decreases as the frequency of occurrence of the k-mer increases.

[0067] The k-mer hash value calculation module is used to calculate the hash value of each k-mer based on the base sequence information and occurrence frequency of each k-mer using a preset hash function.

[0068] The minimum subseed generation module is used to compare the hash values ​​of all k-mers in each window and generate the minimum subseed for each window.

[0069] In one embodiment, the preset hash function in the k-mer hash value calculation module is:

[0070]

[0071] Among them, h(k i ) is the hash value of the i-th k-mer, and the range of the hash value is the open interval (0,1); k i is the base sequence information of the i-th k-mer; φ(f(k i )) is the weight value of the i-th k-mer, and the weight value range is the open interval (0,1); g(k i ) is a common hash function that does not consider weight information, and the hash value range is an open interval (0,1).

[0072] In one embodiment, the minimum sub-seed generation module is further used to take the first window as the current window; take the first k-mer in the current window as the current k-mer; set the minimum hash value of the k-mer in the current window to 1; compare the hash value of the current k-mer in the current window with the minimum hash value to obtain a comparison result; when the comparison result is that the hash value of the current k-mer is less than the minimum hash value, the minimum hash value is updated to the hash value of the current k-mer, and the corresponding k-mer is recorded as the alternative minimum sub-seed of the current window; when the comparison result is that the hash value of the current k-mer is greater than the minimum hash value, if the current k-mer is not the last k-mer in the current window, the next k-mer is processed; if the current k-mer is the last k-mer in the current window, the alternative minimum sub-seed of the current window is used as the minimum sub-seed of the current window, the current window is updated to the next window, and the next round of iteration is continued until all windows are traversed to complete the minimum sub-seed generation process for all windows.

[0073] In one embodiment, the k-mer occurrence frequency statistics module is further used to set the frequency record table to be empty, and the information in the frequency record table includes: k-mer, the number of occurrences of k-mer, and the frequency of occurrence of k-mer; read a k-mer, record it as k i , and check whether the frequency record table already contains the same ik-mer with the same sequence; if the frequency record table does not contain k i k-mer with the same sequence, add a row to the frequency record table and add k i Record in this line and set k i The number of occurrences of is recorded as 1; if there is a i For k-mers with the same sequence, the number of occurrences of the corresponding k-mer in the frequency record table is increased by 1; the next k-mer is read and the processing continues until all k-mers are traversed, and the number of occurrences of each k-mer is obtained.

[0074] The specific definition of the reverse weighted sequence alignment seed generation device can be found in the definition of the reverse weighted sequence alignment seed generation method above, which will not be repeated here. The various modules in the above-mentioned reverse weighted sequence alignment seed generation device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so that the processor calls and executes the operations corresponding to the above modules.

[0075] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, a reverse weighted sequence alignment seed generation method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad provided on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0076] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0077] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above method embodiment when executing the computer program.

[0078] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method embodiment are implemented.

[0079] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0080] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0081] The above-described embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.

Claims

1. A reverse weighted sequence alignment seed generation method, characterized in that: The method comprises: Read the reference sequence and divide the reference sequence into N windows, where the first N-1 windows each contain w bases, the number of bases in the Nth window is no more than w, and N and w are both integers greater than 1; According to each of the windows, generating continuous overlapping k-mers for the corresponding window; Count the number of occurrences of each k-mer in all windows to obtain the number of occurrences of each k-mer; Calculate the occurrence frequency of each k-mer based on the number of occurrences of each k-mer; According to the occurrence frequency of each k-mer, a preset weight function is used to calculate the weight value of each k-mer; the weight value of the k-mer decreases as the occurrence frequency of the k-mer increases; According to the base sequence information and occurrence frequency of each k-mer, a preset hash function is used to calculate the hash value of each k-mer; the preset hash function is: Among them, h(k i ) is the hash value of the i-th k-mer, and the range of the hash value is the open interval (0,1); k i is the base sequence information of the i-th k-mer; φ(f(k i )) is the weight value of the i-th k-mer, and the weight value range is the open interval (0,1); g(k i ) is a common hash function that does not consider weight information, and the range of hash values ​​is an open interval (0,1); Compare the hash values ​​of all k-mers in each window separately and generate the minimum subseed for each window.

2. The method according to claim 1, characterized in that Compare the hash values ​​of all k-mers in each window separately and generate the minimum subseed for each window, including: Make the first window the current window; Take the first k-mer in the current window as the current k-mer; Set the minimum hash value of the k-mer in the current window to 1; Compare the hash value of the current k-mer in the current window with the minimum hash value to obtain the comparison result; When the comparison result is that the hash value of the current k-mer is less than the minimum hash value, the minimum hash value is updated to the hash value of the current k-mer, and the corresponding k-mer is recorded as the candidate minimum sub-seed of the current window; When the comparison result is that the hash value of the current k-mer is greater than the minimum hash value, if the current k-mer is not the last k-mer in the current window, continue to process the next k-mer; if the current k-mer is the last k-mer in the current window, then use the alternative minimum sub-seed of the current window as the minimum sub-seed of the current window, update the current window to the next window, and continue to the next round of iteration until all windows are traversed and the minimum sub-seed generation process of all windows is completed.

3. The method according to claim 1, characterized in that Count the number of occurrences of each k-mer in all windows to obtain the number of occurrences of each k-mer, including: Set the frequency record table to be empty, wherein the information in the frequency record table includes: k-mer, the number of occurrences of k-mer, and the frequency of occurrence of k-mer; Read a k-mer, denoted as k i , and check whether the frequency record table already contains the same frequency as k i k-mers with identical sequences; If the frequency record table does not contain the frequency k i k-mer with the same sequence, then add a row to the frequency record table and add k i Record in this line and set k i The number of occurrences of is recorded as 1; If there is a frequency record table with k i For k-mers with the same sequence, the number of occurrences of the corresponding k-mer in the frequency record table is increased by 1; Read the next k-mer and continue processing until all k-mers are traversed, and get the number of occurrences of each k-mer.

4. A reverse weighted sequence alignment seed generation device, characterized in that: The device comprises: A reference sequence reading module is used to read the reference sequence and divide the reference sequence into N windows, wherein the first N-1 windows each contain w bases, the number of bases in the Nth window is not greater than w, and N and w are both integers greater than 1; A k-mer frequency statistics module is used to generate continuous overlapping k-mers for each window according to the window; count the number of occurrences of each k-mer in all windows to obtain the number of occurrences of each k-mer; and calculate the occurrence frequency of each k-mer based on the number of occurrences of each k-mer; A k-mer weight calculation module calculates the weight value of each k-mer based on the occurrence frequency of each k-mer using a preset weight function; the weight value of the k-mer decreases as the occurrence frequency of the k-mer increases; The k-mer hash value calculation module calculates the hash value of each k-mer based on the base sequence information and occurrence frequency of each k-mer using a preset hash function; the preset hash function is: Among them, h(k i ) is the hash value of the i-th k-mer, and the range of the hash value is the open interval (0,1); k i is the base sequence information of the i-th k-mer; φ(f(k i )) is the weight value of the i-th k-mer, and the weight value range is the open interval (0,1); g(k i ) is a common hash function that does not consider weight information, and the range of hash values ​​is an open interval (0,1); The minimum subseed generation module is used to compare the hash values ​​of all k-mers in each window and generate the minimum subseed for each window.

5. The device according to claim 4, characterized in that The minimum sub-seed generation module is further used to take the first window as the current window; take the first k-mer in the current window as the current k-mer; set the minimum hash value of the k-mer in the current window to 1; compare the hash value of the current k-mer in the current window with the minimum hash value to obtain a comparison result; when the comparison result is that the hash value of the current k-mer is less than the minimum hash value, the minimum hash value is updated to the hash value of the current k-mer, and the corresponding k-mer is recorded as the alternative minimum sub-seed of the current window; when the comparison result is that the hash value of the current k-mer is greater than the minimum hash value, if the current k-mer is not the last k-mer in the current window, the next k-mer is processed; if the current k-mer is the last k-mer in the current window, the alternative minimum sub-seed of the current window is used as the minimum sub-seed of the current window, the current window is updated to the next window, and the next round of iteration is continued until all windows are traversed to complete the minimum sub-seed generation process of all windows.

6. The device according to claim 4, characterized in that The k-mer occurrence frequency statistics module is also used to set the frequency record table to be empty. The information in the frequency record table includes: k-mer, the number of occurrences of k-mer, and the frequency of occurrence of k-mer; read a k-mer and record it as k i , and check whether the frequency record table already contains the same frequency as k i k-mer with the same sequence; if the frequency record table does not contain the k-mer i k-mer with the same sequence, then add a row to the frequency record table and add k i Record in this line and set k i The number of occurrences of is recorded as 1; if the frequency record table contains i For k-mers with the same sequence, the number of occurrences of the corresponding k-mer in the frequency record table is increased by 1; the next k-mer is read and the processing is continued until all k-mers are traversed to obtain the number of occurrences of each k-mer.

7. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 3 is implemented.

8. A computer readable memory having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • System and method for aligning genome sequence

    CN103793625A

  • Sequence alignment method and system, equipment and readable storage medium

    CN111402959A