DNA sequence vectorization parallel comparison method and device based on wavefront algorithm

By introducing a vectorized parallel computing method into the wavefront algorithm, and using marker vectors and mask vectors to perform parallel computing on diagonal lines, the problem of excessive computational volume and memory overhead of DNA sequence alignment algorithms in the prior art is solved. Efficient DNA sequence alignment is achieved.

CN119479815AActive Publication Date: 2025-02-18NAT UNIV OF DEFENSE TECH

Patent Information

Application Number
CN202411757905.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2025-02-18
Estimated Expiration
2044-12-03

AI Technical Summary

Technical Problem

When existing DNA sequence alignment algorithms process sequences of hundreds of thousands in length, the calculation amount and memory overhead are too large, and there are difficult obstacles to the wavefront algorithm in vectorized parallel computing, resulting in inefficient comparison.

Method used

The DNA sequence vectorized parallel alignment method based on wavefront algorithm is used. By setting the mark vector and mask vector, parallel calculations on the diagonal line are realized, which reduces the calculation complexity and accelerates the alignment process through vectorization operations.

Benefits of technology

It significantly reduces the computational complexity and memory requirements of DNA sequence alignment, improves the alignment efficiency, and makes large-scale accurate base-level long-read comparisons more feasible.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119479815A_ABST
    Figure CN119479815A_ABST
Patent Text Reader

Abstract

The invention relates to a DNA sequence vectorization parallel comparison method and device based on a wavefront algorithm. According to the method, on the basis of a wavefront algorithm, aiming at existing defects, a core data structure and an algorithm process are reorganized, a vectorization implementation scheme is further designed, general vectorization of a wavefront comparison algorithm is achieved, the running speed of length comparison is increased, and large-scale accurate base-level length reading comparison is more feasible.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method and device for vectorized parallel comparison of DNA sequences based on a wavefront algorithm. Background Art

[0002] The third generation sequencing technology is an emerging DNA sequencing method that aims to overcome the limitations of the first two generations of sequencing technology and provide faster and more accurate genomic information. Compared with the first and second generation technologies, the third generation sequencing technology has significant features such as single molecule sequencing, longer read length, and no base preference. Due to its own characteristics, the third generation sequencing has greatly promoted the development of various bioinformatics applications such as genome assembly, structural variation detection, and pan-genome construction.

[0003] Sequence alignment is a fundamental problem in bioinformatics, which compares the read data obtained by sequencing with the existing reference genome to determine the matching of the reads and their positions in the genome, and serves as the basis for subsequent data analysis.

[0004] Classic alignment algorithms, such as the Needleman-Wunsch algorithm or the Smith-Waterman algorithm, use dynamic programming to compare sequences. The idea is to assign different penalties to matches, mismatches, insertions, deletions, etc. during alignment, and the score of each base will be updated according to the four situations from the previous base to the base. The time complexity of these dynamic programming algorithms is where is the sequence length. However, such complexity makes the alignment efficiency extremely low for sequences with a length of hundreds of thousands. For a single read of hundreds of thousands of bases, the amount of computation required is at the level of tens of billions, and the memory required exceeds tens of GB. A single alignment requires processing a massive amount of reads, and the final computational and memory overhead is beyond the capacity of existing processing equipment. Therefore, we need to design alignment algorithms with lower complexity and use parallel computing methods such as vectorization to accelerate the calculation process.

[0005] Most existing algorithms abandon certain areas to be compared in advance during the comparison. For example, X-drop will terminate certain comparison paths in advance based on the penalty points of the comparison process; the banded idea is to limit the calculation area to cells of a certain width around the existing best sequence in the dynamic programming matrix. This type of algorithm reduces the computational overhead to a certain extent, but has a major flaw, that is, it ignores the calculation of a part of the area and cannot guarantee that the comparison result is optimal.

[0006] Santiago et al. proposed the wavefront alignment algorithm in the paper "Fast gap-affine pairwise alignment using the wavefront algorithm", which greatly reduced the complexity of the alignment. The wavefront alignment algorithm is no longer based on the dynamic programming of the sequence bases, but is iteratively calculated based on the penalty. In the wavefront alignment algorithm, the matching penalty is 0, and the remaining penalties are all positive numbers. The main process is: first, starting from 0 points, start the alignment of the first base of the two sequences; second, determine all the farthest positions that can be directly matched by the current penalty, which exist at a certain position on several diagonals, and this position is the wavefront of the current penalty; third, according to the wavefront penalty, calculate the next insertion, deletion, and mismatch penalty, and obtain the position in the scoring matrix; fourth, repeat the second to third steps until the last base of the two sequences is calculated. The wavefront alignment algorithm reduces the complexity to, where is the maximum penalty for the alignment. Compared with the classic dynamic programming algorithm, the amount of calculation is reduced by 1-2 orders of magnitude. However, due to the characteristics of the algorithm itself, the calculations of the wavefront algorithm in the second and third steps are difficult to be vectorized, which hinders the further improvement of the algorithm's performance.

[0007] The core calculation of the wavefront algorithm lies in the second and third steps, which are called sequence expansion and calculation of the next wavefront, respectively. In the wavefront algorithm, there are two layers of loops: the first layer is the traversal of the penalty points, from 0 to the maximum penalty point; the second layer is the traversal of the diagonals involved in the current wavefront. Under the two-layer loop, two tasks, sequence expansion and calculation of the next wavefront, will be performed. The process of traversing the diagonals has the potential for vectorization from the perspective of data dependency. However, there are obvious defects in these two steps, which make it impossible to complete vectorization, as described below: In the sequence expansion step, the farthest position that the penalty can reach for the elements on each diagonal is calculated. In sequence alignment, the amount of calculation on different diagonals is uncertain, and the calculation content required to terminate the calculation is different. If vectorization is considered, different elements in a vector will have different calculation tasks, and the calculation of some elements has been terminated while some elements still need to be calculated. This feature makes the calculation of this step impossible to be vectorized.

[0008] In the calculation of the next wavefront step, it is necessary to make a judgment based on the position and score of the current wavefront. After the judgment, different branches perform different calculation tasks. This branch makes vectorization difficult to execute. It is necessary to judge whether all elements in the vector are in the same branch, otherwise the vectorized instruction needs to be degenerated into a scalar instruction. In addition, branch judgment may cause pipeline pauses, which is not conducive to improving algorithm performance. Summary of the invention

[0009] Based on this, it is necessary to provide a DNA sequence vectorized parallel alignment method and device based on the wavefront algorithm to address the above technical problems.

[0010] A DNA sequence vectorized parallel alignment method based on a wavefront algorithm, the method comprising: Obtain the sequence to be compared and the reference sequence.

[0011] Set the initial penalty to 0, the initial wavefront coordinates to (0,0), and the current position to be compared to the position of the initial wavefront.

[0012] Query all diagonals involved in the current comparison position and w The diagonal line is the current group w diagonal lines; w is the preset vector width.

[0013] In the current group w Set a marker vector on the diagonal line, and perform vectorized parallel sequence expansion calculation on the current position to be compared according to the marker vector to obtain the current group w The diagonal lines correspond to the penalty wavefront.

[0014] In the current group w On the diagonal lines, the initial coordinates of the next wavefront are calculated by vectorization and parallelization.

[0015] For the next group w Diagonal lines are traversed, and the initial coordinate calculation before the next wave is continued until all diagonal lines are traversed.

[0016] The next penalty is calculated based on the penalty of the next wavefront until all bases of the two sequences are traversed.

[0017] According to the penalty situation, the corresponding wavefront coordinates are obtained in descending order of penalty value to determine the final comparison result.

[0018] In one embodiment, in the current group w Set a marker vector on the diagonal line, and perform vectorized parallel sequence expansion calculation on the current position to be compared according to the marker vector to obtain the current group w The wavefront of the penalty points corresponding to the diagonal lines includes: Initialize the wavefront coordinates of the penalty to the coordinates of the current initial position.

[0019] Set the marker vector and set the initial value of each element of the marker vector to 1.

[0020] Determine the current group wCan the elements on the diagonal be extended in sequence? If yes, mark the corresponding bit as 1; if not, mark the corresponding bit as 0; save the judgment result in the vector middle.

[0021] The marker vector and the vector Perform a bitwise AND operation on the vectors and save the result in the tag vector.

[0022] Perform a vector addition operation on the horizontal and vertical coordinates of the current wavefront and the marking vector, and use the obtained result as the calculated wavefront coordinate.

[0023] Determine whether all elements of the tag vector are all 0. If not, continue to perform vectorized parallel sequence expansion calculations. If all are 0, obtain the previous group. w The diagonal lines correspond to the penalty wavefront.

[0024] In one embodiment, in the current group w On the diagonal lines, the initial coordinates of the next wavefront are calculated by vectorization and parallelization, including: Set the mask vector; the width of the mask vector is w .

[0025] Perform vector logic calculations and determine the current w Whether the diagonal line is within the wavefront range of the previous penalty; if so, mark the corresponding bit in the mask vector as 1, otherwise mark the corresponding bit in the mask vector as 0.

[0026] Using vector instructions, the calculation results of the elements marked as 1 and 0 in the mask vector are determined; the calculation results include three vectors, namely, insertion, deletion, and mismatch comparison result vectors.

[0027] Perform a vector addition operation on the same type comparison result vectors of the calculation results corresponding to the elements marked as 1 and marked as 0 in the mask vector to obtain the final comparison result vectors of insertion, deletion and mismatch.

[0028] The maximum value of the mismatched final alignment result vector and the inserted final alignment result vector is calculated, and a vector addition operation of 1 is performed on the obtained result to obtain the result of the current wavefront base insertion component.

[0029] The maximum value of the mismatched final alignment result vector and the deleted final alignment result vector is calculated, and the obtained result is used as the result of the missing component of the current wavefront base.

[0030] Select the maximum value among the result of the base missing component of the current wavefront, the result of the base insertion component of the current wavefront, and the result of vector addition operation on the mismatched final comparison result vector, and use the maximum value as the result of the mismatch component of the current wavefront, and use the result of the mismatch component of the current wavefront as the initial coordinate of the next wavefront.

[0031] In one embodiment, the step of calculating the calculation result of the element corresponding to the mark 1 in the mask vector includes: The insertion, deletion, and mismatch comparison results of the previous wavefront are saved in three intermediate vectors respectively.

[0032] Perform bitwise AND operations on the three intermediate vectors and the mask vector respectively, and save the results to vectors respectively. In the calculation, the calculation results of the elements corresponding to the elements marked as 1 in the mask vector are obtained.

[0033] In one embodiment, the step of calculating the calculation result of the element corresponding to the element marked as 0 in the mask vector includes: Assign the three first intermediate vectors to negative infinity.

[0034] Perform a bitwise inversion operation on the mask vector and save the result to the vector middle.

[0035] The three first intermediate vectors and vector Perform bitwise AND operation on the vectors and save the results to the vectors respectively. In the calculation, the calculation results of the elements corresponding to the elements marked as 0 in the mask vector are obtained.

[0036] A DNA sequence vectorized parallel alignment device based on a wavefront algorithm, the device comprising: The sequence acquisition module is used to obtain the sequence to be compared and the reference sequence.

[0037] The parallel comparison initialization module is used to set the initial penalty to 0, the initial wavefront coordinates to (0,0), and the current position to be compared to the position of the initial wavefront.

[0038] The vectorized parallel comparison module is used to query all diagonals involved in the current comparison position. w The diagonal line is the current group w diagonal lines; w is the preset vector width; in the current group w Set a marker vector on the diagonal line, and perform vectorized parallel sequence expansion calculation on the current position to be compared according to the marker vector to obtain the current group w The wavefront of the penalty corresponding to the diagonal line; in the current group wOn the diagonal lines, the initial coordinates of the next wavefront are calculated by vectorization and parallelization; w Diagonals, continue to calculate the initial coordinates of the next wavefront until all diagonals are traversed; according to the penalty of the next wavefront, continue to calculate the next penalty until all bases of the two sequences are traversed.

[0039] The comparison result determination module is used to obtain the corresponding wavefront coordinates in descending order of penalty value according to the penalty situation, and determine the final comparison result.

[0040] The above-mentioned wavefront algorithm-based DNA sequence vectorized parallel alignment method and device, based on the wavefront algorithm, reorganizes the core data structure and algorithm flow to address its existing defects, and further designs a vectorized implementation scheme, thereby realizing the universal vectorization of the wavefront alignment algorithm, accelerating the running speed of length alignment, and making large-scale accurate base-level long-read alignment more feasible. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 A schematic diagram of a process of a DNA sequence vectorization parallel alignment method based on a wavefront algorithm in one embodiment; Figure 2 The present invention is a process of vectorized parallel alignment of DNA sequences based on the wavefront algorithm in another embodiment; Figure 3 It is a structural block diagram of a DNA sequence vectorization parallel alignment device based on the wavefront algorithm in one embodiment. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0043] In one embodiment, Figure 1 As shown, a DNA sequence vectorization parallel alignment method based on the wavefront algorithm is provided, and the method comprises the following steps: Step 100: Obtain a sequence to be compared and a reference sequence.

[0044] Step 102: Set the initial penalty to 0, the initial wavefront coordinates to (0, 0), and the current position to be compared to the position of the initial wavefront.

[0045] Step 104: Query all diagonals involved in the current comparison position and w The diagonal line is the current group w diagonal lines; w is the preset vector width.

[0046] Specifically, when the total number of all diagonals is less than w If there are 10000 diagonals, remove all the diagonals.

[0047] Step 106: In the current group w Set a marker vector on the diagonal line, and perform vectorized parallel sequence expansion calculation on the current position to be compared according to the marker vector to obtain the current group w The diagonal lines correspond to the penalty wavefront.

[0048] Step 108: In the current group w On the diagonal lines, the initial coordinates of the next wavefront are calculated by vectorization and parallelization.

[0049] Step 110: Next Group w Diagonal lines are traversed, and the initial coordinate calculation before the next wave is continued until all diagonal lines are traversed.

[0050] Specifically, when the remaining diagonal is insufficient w If there are 10000 diagonals, all the remaining diagonals will be used as the next group. w diagonal lines.

[0051] Step 112: Continue calculating the next penalty based on the penalty of the next wavefront until all bases of the two sequences are traversed.

[0052] Step 114: According to the penalty situation, the corresponding wavefront coordinates are obtained in descending order of penalty values ​​to determine the final comparison result.

[0053] In the above-mentioned DNA sequence vectorized parallel alignment method based on the wavefront algorithm, the method, based on the wavefront algorithm, reorganizes the core data structure and algorithm flow to address its existing defects, and further designs a vectorized implementation scheme, thereby realizing the universal vectorization of the wavefront alignment algorithm, accelerating the running speed of length alignment, and making large-scale accurate base-level long-read alignment more feasible.

[0054] In one embodiment, step 106 includes: initializing the wavefront coordinates of the penalty to the coordinates of the current initial position; setting a marker vector, and setting the initial value of each element of the marker vector to 1; determining the current group w Can the elements on the diagonal be extended in sequence? If yes, mark the corresponding bit as 1; if not, mark the corresponding bit as 0; save the judgment result in the vector In the vector, the marker vector and the vector Perform a bitwise AND operation on the vectors and save the result in the marker vector; perform a vector addition operation on the horizontal and vertical coordinates of the current wavefront and the marker vector, and use the result as the calculated wavefront coordinates; determine whether all elements of the marker vector are all 0. If not, continue to perform vectorized parallel sequence expansion calculation; if all are 0, obtain the previous group w The diagonal lines correspond to the penalty wavefront.

[0055] In one embodiment, step 108 includes: setting a mask vector; the width of the mask vector is w ; Perform vector logic calculations and determine the current w Whether the diagonal line is within the wavefront range of the previous penalty; if it is within the wavefront range of the previous penalty, mark the corresponding bit in the mask vector as 1, otherwise mark the corresponding bit in the mask vector as 0; use vector instructions to determine the calculation results of the elements marked as 1 and marked as 0 in the mask vector; the calculation results include three vectors, which are the comparison result vectors of insertion, deletion and mismatch respectively; perform vector addition operation on the comparison result vectors of the same type of the calculation results of the elements marked as 1 and marked as 0 in the mask vector to obtain the final comparison result vectors of insertion, deletion and mismatch; calculate the final comparison result vector of mismatch and the maximum value of the inserted final comparison result vector, and perform vector addition operation on the obtained result to obtain the result of the current wavefront base insertion component; calculate the maximum value of the unmatched final comparison result vector and the deleted final comparison result vector, and use the obtained result as the result of the current wavefront base missing component; select the maximum value among the result of the current wavefront base missing component, the result of the current wavefront base insertion component and the result of the vector addition operation on the unmatched final comparison result vector, and use the maximum value as the result of the unmatched component of the current wavefront, and use the result of the unmatched component of the current wavefront as the initial coordinate of the next wavefront.

[0056] In one embodiment, the calculation step of the calculation result of the element marked as 1 in the mask vector includes: saving the comparison results of the previous wavefront insertion, deletion, and mismatch into three intermediate vectors respectively; performing vector bitwise AND operation on the three intermediate vectors and the mask vector respectively, and saving the obtained results into vectors respectively. In the calculation, the calculation results of the elements corresponding to the elements marked as 1 in the mask vector are obtained.

[0057] In one embodiment, the calculation step of the calculation result of the element corresponding to the mark 0 in the mask vector includes: assigning the three first intermediate vectors to negative infinity; performing a vector bitwise inversion operation on the mask vector, and saving the obtained result to the vector In the figure, the three first intermediate vectors and the vector Perform bitwise AND operation on the vectors and save the results to the vectors respectively. In the calculation, the calculation results of the elements corresponding to the elements marked as 0 in the mask vector are obtained.

[0058] In one embodiment, a method for vectorized parallel alignment of DNA sequences based on a wavefront algorithm is provided, and the specific steps include: Step 1: Assign the initial penalty value to 0, the initial wavefront coordinates to (0,0), and use the position of the initial wavefront as the current position to be compared; Step 2: Query the diagonal lines involved in the current position to be compared, according to the vector width , before obtaining Diagonal lines (less than If there are no items, take out all diagonals); Step 3: In the current On the diagonal lines, a marking vector is set, and a vectorized parallel sequence expansion calculation is performed on the positions to be compared according to the marking vector to obtain the wavefront of the penalty; Step 3.1: Initialize the wavefront coordinates of the penalty to the coordinates of the current initial position; Step 3.2: Set the marker vector , and assign its initial value to all 1s; Step 3.3: Determine the current Can the elements on the diagonal be extended in sequence? If yes, the corresponding bit is marked as 1, otherwise it is marked as 0, and the judgment result is saved in the vector middle; Step 3.4: Mark the vector and vector Perform a bitwise AND operation on the vectors and save the result to the tag vector middle; Step 3.5: Compare the horizontal and vertical coordinates of the current wavefront with the marker vector Perform a vector addition operation as the calculated wavefront coordinates.

[0059] Step 3.6: Determine the label vector Whether it is all 0; Step 3.6.1: Label the vector All 0s indicate that the final wavefront has been obtained, and step 4 is executed; Step 3.6.2: Label the vector If it is not all 0, it means that the final wavefront has not been obtained yet, and step 3.3 is executed; Step 4: In the current On the diagonal lines, the next wavefront is calculated by vectorization and parallelization; Step 4.1: Set the mask vector , the width is ; Step 4.2: Perform vector logic calculations to determine the current Is the diagonal line within the wavefront range of the previous penalty? If so, the mask vector The corresponding bit in is marked as 1, otherwise the corresponding bit is marked as 0; Step 4.3: Use vector instructions to obtain the mask vector The calculation results of the elements marked as 1 in ; Step 4.3.1: Save the comparison results of the three types (insertion, deletion, mismatch) of the previous wave into vectors middle; Step 4.3.2: Separately transform the vectors and vector Perform bitwise AND operation on the vectors and save the results to the vectors respectively middle; Step 4.4: Use vector instructions to obtain the mask vector The calculation results of the elements marked as 0 in ; Step 4.4.1: Convert the vector Assign a value of negative infinity; Step 4.4.2: Vector Perform bitwise inversion of the vector and save the result to the vector middle; Step 4.3.2: Separately transform the vectors and vector Perform bitwise AND operation on the vectors and save the results to the vectors respectively middle; Step 4.5: Vector and vector ,vector and the vector 𝑟 vector and vector Perform vector addition operations and save the results to vectors middle; Step 4.6: Calculation and The maximum value of the vector is obtained, and the vector is added by 1 as the result of the current wavefront base insertion component. ; Step 4.7: Calculation and The vector maximum value of the missing component of the current wavefront base ; Step 4.8: Perform vector addition operation and take the sum The maximum value in , as a result of the mismatch component of the current wavefront , Also serves as the initial coordinates before the next wave; Step 5: Get the next Diagonal lines (less than If there are no diagonals, remove all diagonals), and repeat steps 3-4 until all diagonals in step 2 are completed; Step 6: Repeat steps 2-5 according to the penalty calculated for the next wavefront until the last base of both sequences has been considered; Step 7: According to the penalty situation, obtain the corresponding wavefront coordinates in descending order of penalty value to determine the final comparison result.

[0060] 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. Moreover, 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.

[0061] In a verification example, an experiment was conducted to verify the feasibility of the method by simulating sequence alignment data. Table 1 shows the experimental results of this example.

[0062] Table 1 Experimental results of real data and simulated data

[0063] The values ​​in Table 1 are in seconds, where WFA-vect represents the method of the present application, WFA represents the unvectorized wavefront alignment algorithm, and the rest are commonly used and popular base-level alignment cores.

[0064] Table 1 is divided into three columns. The first column shows the running time to get accurate results without using algorithms such as X-drop and banded. The second column shows the running time to get acceptable results using the above algorithms. The third column does not use a penalty function but uses the edit distance. The algorithms with the shortest running time in the first two columns are marked in bold.

[0065] In Table 1, ONT and PacBio represent the real data obtained by the two sequencing methods used, and the rest are the sequence lengths generated by simulated data. N / A means that the method reports an error due to memory or other factors during operation.

[0066] In one embodiment, Figure 3 As shown, a DNA sequence vectorized parallel alignment device based on the wavefront algorithm is provided, comprising: a sequence acquisition module, a parallel alignment initialization module, a vectorized parallel alignment module and an alignment result determination module, wherein: The sequence acquisition module is used to obtain the sequence to be compared and the reference sequence.

[0067] The parallel comparison initialization module is used to set the initial penalty to 0, the initial wavefront coordinates to (0,0), and the current position to be compared to the position of the initial wavefront.

[0068] The vectorized parallel comparison module is used to query all diagonals involved in the current comparison position. w The diagonal line is the current group w diagonal lines; w is the preset vector width; in the current group w Set a marker vector on the diagonal line, and perform vectorized parallel sequence expansion calculation on the current position to be compared according to the marker vector to obtain the current group w The wavefront of the penalty corresponding to the diagonal line; in the current group w On the diagonal lines, the initial coordinates of the next wavefront are calculated by vectorization and parallelization; w Diagonals, continue to calculate the initial coordinates of the next wavefront until all diagonals are traversed; according to the penalty of the next wavefront, continue to calculate the next penalty until all bases of the two sequences are traversed.

[0069] The comparison result determination module is used to obtain the corresponding wavefront coordinates in descending order of penalty value according to the penalty situation, and determine the final comparison result.

[0070] In one embodiment, the vectorized parallel comparison module is also used to initialize the wavefront coordinates of the penalty to the coordinates of the current initial position; set a marker vector, and set the initial value of each element of the marker vector to 1; determine the current group w Can the elements on the diagonal be extended in sequence? If yes, mark the corresponding bit as 1; if not, mark the corresponding bit as 0; save the judgment result in the vector In the vector, the marker vector and the vector Perform a bitwise AND operation on the vectors and save the result in the marker vector; perform a vector addition operation on the horizontal and vertical coordinates of the current wavefront and the marker vector, and use the result as the calculated wavefront coordinates; determine whether all elements of the marker vector are all 0. If not, continue to perform vectorized parallel sequence expansion calculation; if all are 0, obtain the previous group w The diagonal lines correspond to the penalty wavefront.

[0071] In one embodiment, the vectorized parallel comparison module is further used to set a mask vector; the width of the mask vector is w ; Perform vector logic calculations and determine the current w Whether the diagonal line is within the wavefront range of the previous penalty; if it is within the wavefront range of the previous penalty, mark the corresponding bit in the mask vector as 1, otherwise mark the corresponding bit in the mask vector as 0; use vector instructions to determine the calculation results of the elements marked as 1 and marked as 0 in the mask vector; the calculation results include three vectors, which are the comparison result vectors of insertion, deletion and mismatch respectively; perform vector addition operation on the comparison result vectors of the same type of the calculation results of the elements marked as 1 and marked as 0 in the mask vector to obtain the final comparison result vectors of insertion, deletion and mismatch; calculate the final comparison result vector of mismatch and the maximum value of the inserted final comparison result vector, and perform vector addition operation on the obtained result to obtain the result of the current wavefront base insertion component; calculate the maximum value of the unmatched final comparison result vector and the deleted final comparison result vector, and use the obtained result as the result of the current wavefront base missing component; select the maximum value among the result of the current wavefront base missing component, the result of the current wavefront base insertion component and the result of the vector addition operation on the unmatched final comparison result vector, and use the maximum value as the result of the unmatched component of the current wavefront, and use the result of the unmatched component of the current wavefront as the initial coordinate of the next wavefront.

[0072] In one of the embodiments, the step of calculating the calculation results of the elements marked as 1 in the mask vector in the vectorized parallel comparison module includes: saving the comparison results of the previous wavefront insertion, deletion, and mismatch into three intermediate vectors respectively.

[0073] Perform bitwise AND operations on the three intermediate vectors and the mask vector respectively, and save the results to vectors respectively. In the calculation, the calculation results of the elements corresponding to the elements marked as 1 in the mask vector are obtained.

[0074] In one embodiment, the calculation step of the calculation result of the element marked as 0 in the mask vector in the vectorized parallel comparison module includes: assigning the three first intermediate vectors to negative infinity; performing a vector bitwise inversion operation on the mask vector, and saving the obtained result to the vector In the figure, the three first intermediate vectors and the vector Perform bitwise AND operation on the vectors and save the results to the vectors respectively. In the calculation, the calculation results of the elements corresponding to the elements marked as 0 in the mask vector are obtained.

[0075] For the specific definition of the DNA sequence vectorization parallel comparison device based on the wavefront algorithm, please refer to the definition of the DNA sequence vectorization parallel comparison method based on the wavefront algorithm above, which will not be repeated here. Each module in the above-mentioned DNA sequence vectorization parallel comparison device based on the wavefront algorithm 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 the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0076] The technical features of the above embodiments may 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.

[0077] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A DNA sequence vectorized parallel alignment method based on the wavefront algorithm, characterized in that: The method comprises: Obtaining the sequence to be compared and the reference sequence; Set the initial penalty to 0, the initial wavefront coordinates to (0,0), and the current position to be compared to the position of the initial wavefront; Query all diagonals involved in the current comparison position and w The diagonal line is the current group w diagonal lines; w is the preset vector width; In the current group w A marking vector is set on the diagonal line, and a vectorized parallel sequence expansion calculation is performed on the current position to be compared according to the marking vector to obtain the current group w The wavefront of the penalty corresponding to the diagonal line; In the current group w On the diagonal lines, the initial coordinates of the next wavefront are calculated by vectorization and parallelization; For the next group w diagonal lines, and continue to calculate the initial coordinates before the next wave until all diagonals are traversed; According to the penalty of the next wavefront, the next penalty is calculated until all bases of the two sequences are traversed; According to the penalty situation, the corresponding wavefront coordinates are obtained in descending order of penalty value to determine the final comparison result.

2. The method according to claim 1, characterized in that In the current group w A marking vector is set on the diagonal line, and a vectorized parallel sequence expansion calculation is performed on the current position to be compared according to the marking vector to obtain the current group w The wavefront of the penalty points corresponding to the diagonal lines includes: Initialize the wavefront coordinates of the penalty to the coordinates of the current initial position; Set a tag vector, and set the initial value of each element of the tag vector to 1; Determine the current group w Can the elements on the diagonal be extended in sequence? If yes, mark the corresponding bit as 1; if not, mark the corresponding bit as 0; save the judgment result in the vector middle; The label vector and the vector Perform a bitwise AND operation on the vectors and save the obtained result in the tag vector; Performing a vector addition operation on the horizontal and vertical coordinates of the current wavefront and the marking vector, and using the obtained result as the calculated wavefront coordinate; Determine whether all elements of the tag vector are all 0. If not, continue to perform vectorized parallel sequence expansion calculation; if all are 0, obtain the previous group w The diagonal lines correspond to the penalty wavefronts.

3. The method according to claim 1, characterized in that In the current group w On the diagonal lines, the initial coordinates of the next wavefront are calculated by vectorization and parallelization, including: Set the mask vector; the width of the mask vector is w ; Perform vector logic calculations and determine the current w Whether the diagonal line is within the wavefront range of the previous penalty; if so, the corresponding bit in the mask vector is marked as 1, otherwise the corresponding bit in the mask vector is marked as 0; Using vector instructions, determining calculation results of elements marked as 1 and 0 in the mask vector; the calculation results include three vectors, which are insertion, deletion, and mismatch comparison result vectors; Performing vector addition operation on the same type comparison result vectors of the calculation results corresponding to the elements marked as 1 and marked as 0 in the mask vector to obtain a final comparison result vector of insertion, deletion and mismatch; Calculate the maximum value of the mismatched final alignment result vector and the inserted final alignment result vector, and perform vector addition operation on the obtained result to obtain the result of the current wavefront base insertion component; Calculate the maximum value of the mismatched final alignment result vector and the deleted final alignment result vector, and use the obtained result as the result of the missing component of the current wavefront base; Select the maximum value among the result of the base missing component of the current wavefront, the result of the base insertion component of the current wavefront, and the result of vector addition operation on the mismatched final comparison result vector, and use the maximum value as the result of the mismatch component of the current wavefront, and use the result of the mismatch component of the current wavefront as the initial coordinate of the next wavefront.

4. The method according to claim 3, characterized in that The calculation steps for the calculation results of the elements corresponding to the elements marked as 1 in the mask vector include: The insertion, deletion, and mismatch comparison results of the previous wavefront are saved into three intermediate vectors respectively; Perform bitwise AND operations on the three intermediate vectors and the mask vector respectively, and save the results to vectors respectively. In the calculation, the calculation results of the elements corresponding to the elements marked as 1 in the mask vector are obtained.

5. The method according to claim 3, characterized in that: The calculation steps for the calculation results of the elements corresponding to the 0 in the mask vector include: Assign the three first intermediate vectors to negative infinity; Perform a bitwise inversion operation on the mask vector and save the result to the vector middle; The three first intermediate vectors and vector Perform bitwise AND operation on the vectors and save the results to the vectors respectively. In the calculation, the calculation results of the elements corresponding to the elements marked as 0 in the mask vector are obtained.

6. A DNA sequence vectorized parallel alignment device based on wavefront algorithm, characterized in that: The device comprises: A sequence acquisition module is used to obtain the sequence to be compared and the reference sequence; The parallel comparison initialization module is used to set the initial penalty to 0, the initial wavefront coordinates to (0,0), and the current position to be compared to the position of the initial wavefront; The vectorized parallel comparison module is used to query all diagonals involved in the current comparison position and w The diagonal line is the current group w diagonal lines; w is the preset vector width; in the current group w A marking vector is set on the diagonal line, and a vectorized parallel sequence expansion calculation is performed on the current position to be compared according to the marking vector to obtain the current group w The wavefront of the penalty corresponding to the diagonal line; in the current group w On the diagonal lines, the initial coordinates of the next wavefront are calculated by vectorization and parallelization; w diagonals, continue to calculate the initial coordinates of the next wavefront until all diagonals are traversed; according to the penalty of the next wavefront, continue to calculate the next penalty until all bases of the two sequences are traversed; The comparison result determination module is used to obtain the corresponding wavefront coordinates in descending order of penalty value according to the penalty situation, and determine the final comparison result.

7. The device according to claim 6, characterized in that The vectorized parallel comparison module is also used to initialize the wavefront coordinates of the penalty to the coordinates of the current initial position; set a marker vector, and set the initial value of each element of the marker vector to 1; determine the current group w Can the elements on the diagonal be extended sequentially? If so, mark the corresponding bit as 1; If not, mark the corresponding bit as 0; Save the judgment result in a vector In the above method, the label vector and the vector Perform a bitwise AND operation on the vectors and save the result in the tag vector; perform a vector addition operation on the horizontal and vertical coordinates of the current wavefront and the tag vector, and use the result as the calculated wavefront coordinates; determine whether all elements of the tag vector are all 0. If not, continue to perform vectorized parallel sequence expansion calculation; if all are 0, obtain the previous group w The diagonal lines correspond to the penalty wavefronts.

8. The device according to claim 6, characterized in that The vectorized parallel comparison module is also used to set a mask vector; the width of the mask vector is w ; Perform vector logic calculations and determine the current w Whether the diagonal line is within the wavefront range of the previous penalty; if so, the corresponding bit in the mask vector is marked as 1, otherwise the corresponding bit in the mask vector is marked as 0; Using vector instructions, determine the calculation results of the elements marked as 1 and marked as 0 in the mask vector; the calculation results include three vectors, which are respectively the comparison result vectors of insertion, deletion and mismatch; perform vector addition operation on the same type of comparison result vectors of the calculation results of the elements marked as 1 and marked as 0 in the mask vector to obtain the final comparison result vectors of insertion, deletion and mismatch; calculate the maximum value of the final comparison result vector of mismatch and the final comparison result vector of insertion, and perform vector addition operation on the obtained result to obtain the result of the current wavefront base insertion component; Calculate the maximum value of the mismatched final comparison result vector and the deleted final comparison result vector, and use the obtained result as the result of the base missing component of the current wavefront; select the maximum value among the result of the base missing component of the current wavefront, the result of the base insertion component of the current wavefront, and the result of vector addition operation on the mismatched final comparison result vector, and use the maximum value as the result of the mismatched component of the current wavefront, and use the result of the mismatched component of the current wavefront as the initial coordinate of the next wavefront.

9. The device according to claim 6, characterized in that The steps of calculating the calculation results of the elements marked as 1 in the mask vector in the vectorized parallel comparison module include: saving the comparison results of the previous wavefront insertion, deletion, and mismatch into three intermediate vectors respectively; Perform bitwise AND operations on the three intermediate vectors and the mask vector respectively, and save the results to vectors respectively. In the calculation, the calculation results of the elements corresponding to the elements marked as 1 in the mask vector are obtained.

10. The device according to claim 6, characterized in that The steps of calculating the calculation results of the elements marked as 0 in the mask vector in the vectorized parallel comparison module include: assigning the three first intermediate vectors to negative infinity; performing a vector bitwise inversion operation on the mask vector, and saving the obtained results to the vector In the figure, the three first intermediate vectors and the vector Perform bitwise AND operation on the vectors and save the results to the vectors respectively. In the calculation, the calculation results of the elements corresponding to the elements marked as 0 in the mask vector are obtained.

Citation Information

Patent Citations

  • System and method for aligning genome sequence

    CN103793625A

  • Time-varying mixed-phase seismic wavelet extraction method based on time-frequency spectrum simulation

    CN103995289A

  • Third-generation sequencing RNA-seq comparison method based on WFA algorithm

    CN114550820A

  • Interferometry method and apparatus for producing lateral metrology images

    US20030197871A1

  • Determination of optimal local sequence alignment similarity score

    US20040024536A1

Cited By

  • Differential-based vectorization parallel sequence-to-graph comparison method, device and equipment

    CN120600115A