A method and apparatus for parallel alignment of DNA sequence vectorization based on wavefront algorithm
By optimizing the data structure and process of the wavefront alignment algorithm using vectorized parallel technology, the performance bottleneck of the wavefront alignment algorithm in vectorized parallel computing is solved, and efficient acceleration of DNA sequence alignment is achieved.
Patent Information
- Application Number
- CN202411757905.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-03
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-12-03
AI Technical Summary
Existing wavefront alignment algorithms suffer from computational uncertainty and performance bottlenecks caused by branching decisions in vectorized parallel computing, which cannot effectively accelerate the DNA sequence alignment process.
By setting marker vectors and mask vectors, using vectorized parallel technology to extend the sequence and calculate the next wavefront, the data structure and algorithm flow are reorganized to achieve a generalized vectorization of the wavefront alignment algorithm.
It accelerates the operation speed of DNA sequence alignment, making large-scale, accurate base-level long read alignment more feasible and improving computational efficiency.
Smart Images

Figure CN119479815B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method and apparatus for parallel alignment of DNA sequence vectorization based on wavefront algorithm. Background Technology
[0002] Third-generation sequencing (NGS) is an emerging DNA sequencing method designed to overcome the limitations of the first two generations of sequencing technologies, providing faster and more accurate genomic information. Compared to first and second-generation technologies, NGS offers significant advantages such as single-molecule sequencing, longer read lengths, and no base bias. These characteristics have greatly facilitated the development of applications in various bioinformatics fields, including genome assembly, structural variation detection, and pangenome construction.
[0003] Sequence alignment is a fundamental problem in bioinformatics. It compares sequenced reads with existing reference genomes to determine read matching and their location within the genome, serving as the basis for subsequent data analysis.
[0004] Classic alignment algorithms, such as the Needleman-Wunsch or Smith-Waterman algorithms, use dynamic programming to compare sequences. The idea is to assign different penalties for matches, mismatches, insertions, and missing bases during alignment, updating the score of each base based on these four possible outcomes from the previous base to that base. The time complexity of these dynamic programming algorithms is O(log n), where n is the sequence length. However, such complexity is extremely inefficient for sequences with lengths of hundreds of thousands of bases. For a single read segment of hundreds of thousands of bases, the computational cost is on the order of tens of billions, requiring over tens of gigabytes of memory. A single alignment needs to process a massive number of reads, and the resulting computational and memory overhead is beyond the capacity of current processing equipment. Therefore, we need to design alignment algorithms with lower complexity and utilize parallel computing methods such as vectorization to accelerate the computation process.
[0005] Most existing algorithms discard certain regions for comparison in advance during the alignment process. For example, X-drop terminates certain alignment paths early based on the penalty score during the alignment process; the banded approach, in dynamic programming matrices, restricts the computational region to cells of a certain width to the left and right of the current best sequence. These algorithms reduce computational overhead to some extent, but they have a major drawback: they ignore the computation of a portion of the region, thus failing to guarantee that the alignment result is optimal.
[0006] Santiago et al., in their paper "Fast gap-affine pairwise alignment using the wavefront algorithm," proposed a wavefront alignment algorithm that significantly reduces the complexity of alignment. Instead of dynamic programming based on sequence bases, the wavefront alignment algorithm iteratively calculates penalties. In this algorithm, a match penalty is 0, and all other penalties are positive. The main process is as follows: First, starting with a penalty of 0, the algorithm aligns the first base of each sequence. Second, it determines the farthest positions that the current penalty can directly match; these positions exist somewhere along several diagonals, and this position is the wavefront of the current penalty. Third, based on the wavefront penalty, it calculates the penalty for the next insertion, deletion, or mismatch and obtains its position in the scoring matrix. Fourth, it repeats steps two and three until the last base of each sequence has been calculated. The wavefront alignment algorithm reduces the complexity to a minimum, where is the maximum penalty for the alignment, representing a 1-2 order of magnitude reduction in computation compared to the classic dynamic programming algorithm. However, due to the inherent characteristics of the algorithm, the computations in the second and third steps of the wavefront algorithm are difficult to vectorize, hindering further improvements in the algorithm's performance.
[0007] The core computations of the wavefront algorithm lie in the second and third steps, namely sequence expansion and calculation of the next wavefront, respectively. The wavefront algorithm contains two nested loops: the first loop iterates through the penalty score from 0 to the maximum penalty; the second loop iterates through the diagonals involved in the current wavefront. Within these two loops, the tasks of sequence expansion and calculation of the next wavefront are performed. The diagonal traversal process, from a data dependency perspective, has the potential for vectorization. However, these two steps have significant drawbacks that prevent vectorization, as described below:
[0008] In the sequence expansion step, the furthest position reachable by the penalty score is calculated for each element on the diagonal. During sequence alignment, the computational complexity on different diagonals is uncertain, and the computational requirements for termination vary. Vectorization would result in different computational tasks for different elements within a vector, with some elements' computations already terminated while others still require calculation. This characteristic makes this step's computation impossible to vectorize.
[0009] In calculating the next wavefront step, a judgment needs to be made based on the current wavefront's position and score. After the judgment, different branches execute different computational tasks. This branching makes vectorization difficult to execute, requiring a check whether all elements within the vector are under the same branch; otherwise, the vectorization instruction needs to degenerate into a scalar instruction. Furthermore, branching decisions can potentially cause pipeline stalls, which is detrimental to algorithm performance. Summary of the Invention
[0010] Therefore, it is necessary to provide a method and apparatus for parallel alignment of DNA sequence vectorization based on wavefront algorithm to address the above-mentioned technical problems.
[0011] A parallel alignment method for DNA sequence vectorization based on wavefront algorithm, the method comprising:
[0012] Obtain the sequence to be compared and the reference sequence.
[0013] The initial penalty is set to 0, the initial wavefront coordinates are (0,0), and the current position to be compared is the position of the initial wavefront.
[0014] Query all diagonals involved in the current comparison position, and then... w The diagonal line is used as the current group w One diagonal line; w This is the preset vector width.
[0015] In the current group w Marker vectors are set on the diagonal lines. Based on the marker vectors, vectorized parallel sequence expansion calculations are performed on the current alignment position to obtain the current group. w The wavefront of the penalty points corresponding to each diagonal line.
[0016] In the current group w Along the diagonal line, the initial coordinates before the next wave are calculated through vectorized parallelism.
[0017] For the next group w Calculate the initial coordinates for the next wave along each diagonal line until all diagonals have been traversed.
[0018] Based on the penalty score of the next wavefront, continue calculating the penalty score for the next wavefront until all bases of both sequences have been traversed.
[0019] Based on the penalty points, the corresponding wavefront coordinates are obtained in descending order of penalty point value to determine the final comparison result.
[0020] In one embodiment, in the current group w Marker vectors are set on the diagonal lines. Based on the marker vectors, vectorized parallel sequence expansion calculations are performed on the current alignment position to obtain the current group. w The wavefronts of the penalties corresponding to each diagonal line include:
[0021] Initialize the wavefront coordinates of the penalty point to the coordinates of the current initial position.
[0022] Set a marker vector and initialize each element of the marker vector to 1.
[0023] Determine the current group wCan the elements on each diagonal be expanded into a sequence? If yes, mark the corresponding bit as 1; if not, mark the corresponding bit as 0. Store the result in a vector. middle.
[0024] Mark vectors and vectors Perform a bitwise AND operation on the vector and store the result in the tag vector.
[0025] Perform a vector addition operation between the current wavefront's horizontal and vertical coordinates and the marker vector, and use the result as the calculated wavefront coordinates.
[0026] Check if all elements of the marker vector are 0. If not, continue with vectorized parallel sequence expansion computation; if all elements are 0, obtain the first group. w The wavefront of the penalty points corresponding to each diagonal line.
[0027] In one embodiment, in the current group w Along the diagonal line, through vectorized parallelism, the initial coordinates before the next wave are calculated, including:
[0028] Set the mask vector; the width of the mask vector is... w .
[0029] Perform vector logic calculations, and sequentially determine the current... w Check if the diagonal line is within the wavefront range of the previous penalty; if it is, mark the corresponding bit in the mask vector as 1, otherwise mark the corresponding bit in the mask vector as 0.
[0030] Use vector commands to determine the calculation results of the elements marked as 1 and 0 in the mask vector; the calculation results include three vectors, namely the insertion, deletion and mismatch comparison result vectors.
[0031] The same type of comparison result vectors of the calculation results of the elements marked as 1 and 0 in the mask vector are added together to obtain the final comparison result vectors of insertion, deletion and mismatch.
[0032] Calculate the maximum value of the final alignment result vector of mismatches and the final alignment result vector of insertions, and then increment the resulting vector by 1 to obtain the result of the current wavefront base insertion component.
[0033] The maximum value between the final alignment result vector of mismatches and the final alignment result vector of deletions is calculated, and the result is used as the result of the current wavefront base deletion component.
[0034] The maximum value among the results of the current wavefront base deletion component, the current wavefront base insertion component, and the result of adding 1 to the final alignment result vector of the mismatch is selected, and the maximum value is used as the result of the mismatch component of the current wavefront. The result of the mismatch component of the current wavefront is used as the initial coordinate of the next wavefront.
[0035] In one embodiment, the calculation steps for the element marked as 1 in the mask vector include:
[0036] The alignment results of the previous wavefront insertion, deletion, and mismatch are saved into three intermediate vectors respectively.
[0037] Perform a bitwise AND operation on each of the three intermediate vectors and the mask vector, and save the results to a vector. In this process, we obtain the calculation results of the elements marked as 1 in the mask vector.
[0038] In one embodiment, the calculation steps for the element marked as 0 in the mask vector include:
[0039] Assign the value of the three first intermediate vectors to negative infinity.
[0040] Perform a bitwise inversion on the mask vector and save the result to a vector. middle.
[0041] The three first intermediate vectors and vectors are respectively... Perform a bitwise AND operation on the vectors and save the results to separate vectors. In this process, we obtain the calculation results of the elements marked as 0 in the mask vector.
[0042] A parallel alignment device for DNA sequence vectorization based on wavefront algorithm, the device comprising:
[0043] The sequence acquisition module is used to acquire the sequence to be aligned and the reference sequence.
[0044] The parallel alignment initialization module is used to set the initial penalty to 0, the initial wavefront coordinates to (0,0), and the current alignment position to be compared to the position of the initial wavefront.
[0045] The vectorized parallel alignment module is used to query all diagonals involved in the current alignment position and then... w The diagonal line is used as the current group w One diagonal line; w Preset vector width; in the current group w Marker vectors are set on the diagonal lines. Based on the marker vectors, vectorized parallel sequence expansion calculations are performed on the current alignment position to obtain the current group. wThe wavefront of the penalty corresponding to the diagonal line; in the current group w Along the diagonal line, through vectorized parallelism, the initial coordinates before the next wave are calculated; for the next group w For each diagonal, continue calculating the initial coordinates before the next wave until all diagonals have been traversed; based on the penalty score before the next wave, continue calculating the penalty score for the next wave until all bases of both sequences have been traversed.
[0046] The comparison result determination module is used to obtain the corresponding wavefront coordinates in descending order of penalty score based on the penalty score, and determine the final comparison result.
[0047] The above-mentioned DNA sequence vectorization parallel alignment method and device based on wavefront algorithm reorganizes the core data structure and algorithm flow to address the shortcomings of wavefront algorithm, and further designs a vectorization implementation scheme, realizing the general vectorization of wavefront alignment algorithm, accelerating the running speed of length alignment, and making large-scale accurate base-level long read alignment more feasible. Attached Figure Description
[0048] Figure 1 This is a flowchart illustrating a parallel alignment method for DNA sequence vectorization based on the wavefront algorithm in one embodiment.
[0049] Figure 2 This is a flowchart of parallel alignment of DNA sequence vectorization based on wavefront algorithm in another embodiment;
[0050] Figure 3 This is a block diagram of a DNA sequence vectorization parallel alignment device based on the wavefront algorithm in one embodiment. Detailed Implementation
[0051] 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.
[0052] In one embodiment, such as Figure 1 As shown, a parallel alignment method for DNA sequence vectorization based on the wavefront algorithm is provided. This method includes the following steps:
[0053] Step 100: Obtain the sequence to be aligned and the reference sequence.
[0054] Step 102: Set the initial penalty to 0, the initial wavefront coordinates to (0,0), and the current comparison position to be set to the position of the initial wavefront.
[0055] Step 104: Query all diagonals involved in the current comparison position, and then...w The diagonal line is used as the current group w One diagonal line; w This is the preset vector width.
[0056] Specifically, when the total number of all diagonals is less than w If there are 100 lines, then take out all the diagonals.
[0057] Step 106: In the current group w Marker vectors are set on the diagonal lines. Based on the marker vectors, vectorized parallel sequence expansion calculations are performed on the current alignment position to obtain the current group. w The wavefront of the penalty points corresponding to each diagonal line.
[0058] Step 108: In the current group w Along the diagonal line, the initial coordinates before the next wave are calculated through vectorized parallelism.
[0059] Step 110: For the next group w Calculate the initial coordinates for the next wave along each diagonal line until all diagonals have been traversed.
[0060] Specifically, when the remaining diagonal is insufficient w If the first group is empty, then all the remaining diagonals will be used as the next group. w A diagonal line.
[0061] Step 112: Based on the penalty score of the next wavefront, continue to calculate the penalty score for the next wavefront until all bases of the two sequences have been traversed.
[0062] Step 114: Based on the penalty points, obtain the corresponding wavefront coordinates in descending order of penalty point value to determine the final comparison result.
[0063] In the above-mentioned parallel alignment method for DNA sequence vectorization based on wavefront algorithm, the method reorganizes the core data structure and algorithm flow to address the shortcomings of wavefront algorithm, and further designs a vectorization implementation scheme, realizing the general vectorization of wavefront alignment algorithm, accelerating the running speed of length alignment, and making large-scale accurate base-level long read alignment more feasible.
[0064] In one embodiment, step 106 includes: initializing the wavefront coordinates of the penalty score 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; and determining the current group. w Can the elements on each diagonal be expanded into a sequence? If yes, mark the corresponding bit as 1; if not, mark the corresponding bit as 0. Store the result in a vector. In the middle; the marker vector and vector Perform a bitwise AND operation on the vector and store the result in the marker vector; perform a vector addition operation on the current wavefront's x and y coordinates and the marker vector, and use the result as the calculated wavefront coordinates; check if all elements of the marker vector are 0. If not, continue with vectorized parallel sequence expansion calculations; if all elements are 0, obtain the previous group. w The wavefront of the penalty points corresponding to each diagonal line.
[0065] In one embodiment, step 108 includes: setting a mask vector; the width of the mask vector is... w Perform vector logic calculations, and sequentially determine the current... w Check if the diagonal line is within the wavefront range of the previous penalty; if it is, mark the corresponding bit in the mask vector as 1, otherwise mark it as 0; use vector instructions to determine the calculation results of the elements marked as 1 and 0 in the mask vector; the calculation results include three vectors, namely the alignment result vectors for insertion, deletion, and mismatch; perform vector addition on the same type of alignment result vectors of the calculation results of the elements marked as 1 and 0 in the mask vector to obtain the final alignment result vectors for insertion, deletion, and mismatch; calculate the final alignment result vector for mismatch. The maximum value of the final alignment result vector of the insertion and the maximum value of the result are calculated, and the result is incremented by 1 to obtain the result of the current wavefront base insertion component. The maximum value of the final alignment result vector of the mismatch and the final alignment result vector of the deletion is calculated, and the result is used as the result of the current wavefront base deletion component. The maximum value of the result of the current wavefront base deletion component, the result of the current wavefront base insertion component, and the result of incrementing the final alignment result vector of the mismatch is selected, and the maximum value is used as the result of the current wavefront mismatch component. The result of the current wavefront mismatch component is used as the initial coordinate of the next wavefront.
[0066] In one embodiment, the calculation steps for the element marked as 1 in the mask vector include: saving the alignment results of the previous wavefront insertion, deletion, and mismatch into three intermediate vectors respectively; performing a bitwise AND operation on the three intermediate vectors and the mask vector respectively, and saving the results into vectors respectively. In this process, we obtain the calculation results of the elements marked as 1 in the mask vector.
[0067] In one embodiment, the calculation steps for the elements marked as 0 in the mask vector include: assigning the value of the three first intermediate vectors to negative infinity; performing a bitwise inversion operation on the mask vector; and saving the result to a vector. In the middle; respectively, the three first intermediate vectors and vectors are... Perform a bitwise AND operation on the vectors and save the results to separate vectors. In this process, we obtain the calculation results of the elements marked as 0 in the mask vector.
[0068] In one embodiment, a parallel alignment method for DNA sequence vectorization based on wavefront algorithm is provided, the specific steps of which include:
[0069] Step 1: Set the initial penalty score to 0 and the initial wavefront coordinates to (0,0), and use the position of the initial wavefront as the current position to be compared;
[0070] Step 2: Query the diagonals involved in the current alignment position, based on the vector width. Before obtaining diagonal (insufficient) (The rule is to extract all diagonals).
[0071] Step 3: In the current On the diagonal line, a marker vector is set, and vectorized parallel sequence expansion calculation is performed on the position to be compared based on the marker vector to obtain the wavefront of the penalty.
[0072] Step 3.1: Initialize the wavefront coordinates of the penalty score to the coordinates of the current initial position;
[0073] Step 3.2: Set the marker vector and initialize it with all 1s;
[0074] Step 3.3: Determine the current situation Check if the elements on the diagonal can be expanded into a sequence. If yes, mark the corresponding bit as 1; otherwise, mark the corresponding bit as 0. Save the result to a vector. middle;
[0075] Step 3.4: Transfer the tag vector sum vector Perform a bitwise AND operation on the vector and save the result to the tag vector. middle;
[0076] Step 3.5: Compare the x and y coordinates of the current wavefront with the marker vector. Perform vector addition to obtain the calculated wavefront coordinates.
[0077] Step 3.6: Determine the label vector Is it all zeros?
[0078] Step 3.6.1: Label Vector If all values are 0, it indicates that the final wavefront has been obtained, proceed to step 4;
[0079] Step 3.6.2: Label Vector If the result is not all zeros, it indicates that the final wavefront has not yet been obtained, so proceed to step 3.3;
[0080] Step 4: In the current On the diagonal line, the next wavefront is calculated through vectorized parallelism;
[0081] Step 4.1: Set the mask vector , with a width of ;
[0082] Step 4.2: Perform vector logic calculations, sequentially determining the current... If the diagonal line is within the wavefront range of the previous penalty, then change the mask vector. The corresponding bit is marked as 1, otherwise the corresponding bit is marked as 0;
[0083] Step 4.3: Use vector commands to obtain the mask vector. The calculation result of the element marked as 1 in the middle;
[0084] Step 4.3.1: Save the alignment results of the three categories (insertion, deletion, mismatch) from the previous wave to vectors respectively. middle;
[0085] Step 4.3.2: Convert the vectors respectively sum vector Perform a bitwise AND operation on the vectors and save the results to separate vectors. middle;
[0086] Step 4.4: Use vector commands to obtain the mask vector. The calculation result of the element marked as 0 in the middle;
[0087] Step 4.4.1: Convert the vector The value is assigned to be negative infinity;
[0088] Step 4.4.2: For vectors Perform a bitwise inversion operation on the vector and save the result to a vector. middle;
[0089] Step 4.3.2: Convert the vectors respectively sum vector Perform a bitwise AND operation on the vectors and save the results to separate vectors. middle;
[0090] Step 4.5: For vectors sum vector ,vector And vector 𝑟 vector sum vector Perform vector addition operations and save the results to vectors respectively. middle;
[0091] Step 4.6: Calculation and The maximum value of the vector is obtained, and the vector is incremented by 1 to obtain the result of the current wavefront base insertion component. ;
[0092] Step 4.7: Calculation and The maximum value of the vector is used as the result of the current wavefront base deletion component. ;
[0093] Step 4.8: [Regarding...] Perform a vector increment operation and take the sum. The maximum value in the value is used as the result of the mismatch component of the current wavefront. , Simultaneously serving as the initial coordinates before the next wave;
[0094] Step 5: Obtain the next... diagonal (insufficient) (If the pattern is broken, all diagonals are removed), repeat steps 3-4 until all diagonals in step 2 are completed;
[0095] Step 6: Based on the calculated penalty for the next wavefront, repeat steps 2-5 until the last base of both sequences has been considered;
[0096] Step 7: Based on the penalty points, obtain the corresponding wavefront coordinates in descending order of penalty point value to determine the final comparison result.
[0097] 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.
[0098] In a verification embodiment, its feasibility was experimentally verified using simulated sequence alignment data. Table 1 shows the experimental results of this embodiment.
[0099] Table 1. Experimental Results with Real and Simulated Data
[0100]
[0101] The numerical units in Table 1 are seconds. WFA-vect represents the method of this application, WFA represents the wavefront alignment algorithm without vectorization, and the rest are commonly used and popular base-level alignment cores.
[0102] Table 1 is divided into three columns. The first column represents the runtime for obtaining accurate results without using algorithms such as X-drop or banded. The second column represents the runtime for obtaining acceptable results using the aforementioned algorithms. The third column represents the runtime for algorithms that do not use penalty functions but instead use edit distance. The first two columns with the shortest runtimes are marked in bold.
[0103] In Table 1, ONT and PacBio represent the actual data obtained using the two sequencing methods, while the rest are the sequence lengths generated from simulated data. N / A indicates that the method encountered an error during runtime due to factors such as memory issues.
[0104] In one embodiment, such as Figure 3 As shown, a DNA sequence vectorization parallel alignment device based on wavefront algorithm is provided, including: a sequence acquisition module, a parallel alignment initialization module, a vectorized parallel alignment module, and an alignment result determination module, wherein:
[0105] The sequence acquisition module is used to acquire the sequence to be aligned and the reference sequence.
[0106] The parallel alignment initialization module is used to set the initial penalty to 0, the initial wavefront coordinates to (0,0), and the current alignment position to be compared to the position of the initial wavefront.
[0107] The vectorized parallel alignment module is used to query all diagonals involved in the current alignment position and then... w The diagonal line is used as the current group w One diagonal line; w Preset vector width; in the current group w Marker vectors are set on the diagonal lines. Based on the marker vectors, vectorized parallel sequence expansion calculations are performed on the current alignment position to obtain the current group. w The wavefront of the penalty corresponding to the diagonal line; in the current group w Along the diagonal line, through vectorized parallelism, the initial coordinates before the next wave are calculated; for the next group w For each diagonal, continue calculating the initial coordinates before the next wave until all diagonals have been traversed; based on the penalty score before the next wave, continue calculating the penalty score for the next wave until all bases of both sequences have been traversed.
[0108] The comparison result determination module is used to obtain the corresponding wavefront coordinates in descending order of penalty score based on the penalty score, and determine the final comparison result.
[0109] In one embodiment, the vectorized parallel alignment module is further configured to initialize the wavefront coordinates of the penalty score 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; and determine the current group. w Can the elements on each diagonal be expanded into a sequence? If yes, mark the corresponding bit as 1; if not, mark the corresponding bit as 0. Store the result in a vector. In the middle; the marker vector and vector Perform a bitwise AND operation on the vector and store the result in the marker vector; perform a vector addition operation on the current wavefront's x and y coordinates and the marker vector, and use the result as the calculated wavefront coordinates; check if all elements of the marker vector are 0. If not, continue with vectorized parallel sequence expansion calculations; if all elements are 0, obtain the previous group. w The wavefront of the penalty points corresponding to each diagonal line.
[0110] In one embodiment, the vectorized parallel comparison module is further configured to set a mask vector; the width of the mask vector is... w Perform vector logic calculations, and sequentially determine the current... w Check if the diagonal line is within the wavefront range of the previous penalty; if it is, mark the corresponding bit in the mask vector as 1, otherwise mark it as 0; use vector instructions to determine the calculation results of the elements marked as 1 and 0 in the mask vector; the calculation results include three vectors, namely the alignment result vectors for insertion, deletion, and mismatch; perform vector addition on the same type of alignment result vectors of the calculation results of the elements marked as 1 and 0 in the mask vector to obtain the final alignment result vectors for insertion, deletion, and mismatch; calculate the final alignment result vector for mismatch. The maximum value of the final alignment result vector of the insertion and the maximum value of the result are calculated, and the result is incremented by 1 to obtain the result of the current wavefront base insertion component. The maximum value of the final alignment result vector of the mismatch and the final alignment result vector of the deletion is calculated, and the result is used as the result of the current wavefront base deletion component. The maximum value of the result of the current wavefront base deletion component, the result of the current wavefront base insertion component, and the result of incrementing the final alignment result vector of the mismatch is selected, and the maximum value is used as the result of the current wavefront mismatch component. The result of the current wavefront mismatch component is used as the initial coordinate of the next wavefront.
[0111] In one embodiment, the calculation steps for the element marked as 1 in the mask vector in the vectorized parallel alignment module include: saving the alignment results of the previous wavefront insertion, deletion, and mismatch into three intermediate vectors respectively.
[0112] Perform a bitwise AND operation on each of the three intermediate vectors and the mask vector, and save the results to a vector. In this process, we obtain the calculation results of the elements marked as 1 in the mask vector.
[0113] In one embodiment, the calculation steps for 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 bitwise inversion operation on the mask vector; and saving the result to a vector. In the middle; respectively, the three first intermediate vectors and vectors are... Perform a bitwise AND operation on the vectors and save the results to separate vectors. In this process, we obtain the calculation results of the elements marked as 0 in the mask vector.
[0114] Specific limitations regarding the wavefront-based DNA sequence vectorization parallel alignment device can be found in the limitations of the wavefront-based DNA sequence vectorization parallel alignment method described above, and will not be repeated here. Each module in the aforementioned wavefront-based DNA sequence vectorization parallel alignment device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the computer device's memory as software, so that the processor can call and execute the corresponding operations of each module.
[0115] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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.
[0116] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A parallel alignment method for DNA sequence vectorization based on wavefront algorithm, characterized in that, The method includes: Obtain the sequence to be aligned and the reference sequence; The initial penalty is set to 0, the initial wavefront coordinates are (0,0), and the current position to be compared is the position of the initial wavefront. Query all diagonals involved in the current comparison position, and then... w The diagonal line is used as the current group w One diagonal line; w Preset vector width; In the current group w A marker vector is set on each diagonal line. Based on the marker vector, a vectorized parallel sequence expansion calculation is performed on the current alignment position to obtain the current group. w The wavefront of the penalty points corresponding to each diagonal line; In the current group w Along the diagonal line, the initial coordinates before the next wave are calculated through vectorized parallelism; For the next group w Continue calculating the initial coordinates for the next wave along each diagonal line until all diagonals have been traversed. Based on the penalty score of the next wavefront, continue to calculate the penalty score for the next wavefront until all bases of the two sequences have been traversed; Based on the penalty points, the corresponding wavefront coordinates are obtained in descending order of penalty point value to determine the final comparison result; Among them, in the current group w A marker vector is set on each diagonal line. Based on the marker vector, a vectorized parallel sequence expansion calculation is performed on the current alignment position to obtain the current group. w The wavefronts of the penalties corresponding to each diagonal line include: The current group w The wavefront coordinates of the penalty points corresponding to each diagonal line are initialized 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 each diagonal be expanded into a sequence? If yes, mark the corresponding bit as 1; if not, mark the corresponding bit as 0. Store the result in a vector. middle; The marker vector and vector Perform a bitwise AND operation on the vector and save the result to the marker vector; Perform a vector addition operation between the current wavefront's horizontal and vertical coordinates and the marked vector, and use the result as the calculated wavefront coordinates; Determine if all elements of the marker vector are 0. If not, continue with vectorized parallel sequence expansion calculation; if all elements are 0, obtain the current group. w The wavefront of the penalty points corresponding to each diagonal line.
2. The method according to claim 1, characterized in that, In the current group w Along the diagonal line, through vectorized parallelism, the initial coordinates before the next wave are calculated, including: Set a mask vector; the width of the mask vector is w ; Perform vector logic calculations, and sequentially 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; Using vector instructions, determine the calculation results of the elements marked as 1 and 0 in the mask vector; the calculation results include three vectors, namely the insertion, deletion and mismatch comparison result vectors; The same type of comparison result vectors of the calculation results corresponding to the elements marked as 1 and 0 in the mask vector are subjected to vector addition to obtain the final comparison result vectors of insertion, deletion and mismatch. Calculate the maximum value of the final alignment result vector of mismatches and the final alignment result vector of insertions, and increment the vector by 1 to obtain the result of the current wavefront base insertion component. Calculate the maximum value of the final alignment result vector of mismatches and the final alignment result vector of deletions, and use the result as the result of the current wavefront base deletion component. The maximum value among the results of the current wavefront base deletion component, the current wavefront base insertion component, and the result of adding 1 to the final alignment result vector of the mismatch is selected, and the maximum value is used as the result of the mismatch component of the current wavefront. The result of the mismatch component of the current wavefront is used as the initial coordinate of the next wavefront.
3. The method according to claim 2, characterized in that, The calculation steps for the element marked as 1 in the mask vector include: The alignment results of the previous wavefront insertion, deletion, and mismatch are saved into three intermediate vectors respectively; Perform a bitwise AND operation on each of the three intermediate vectors and the mask vector, and save the results to a vector. In this process, we obtain the calculation results of the elements marked as 1 in the mask vector.
4. The method according to claim 2, characterized in that, The calculation steps for the element marked as 0 in the mask vector include: Assign the value of negative infinity to the three first intermediate vectors; Perform a bitwise inversion on the mask vector and save the result to a vector. middle; The three first intermediate vectors and vectors are respectively... Perform a bitwise AND operation on the vectors and save the results to separate vectors. In this process, we obtain the calculation results of the elements marked as 0 in the mask vector.
5. A parallel alignment device for DNA sequence vectorization based on wavefront algorithm, characterized in that, The device includes: The sequence acquisition module is used to acquire the sequence to be compared and the reference sequence; The parallel alignment initialization module is used to set the initial penalty to 0, the initial wavefront coordinates to (0,0), and the current alignment position to be set to the position of the initial wavefront. The vectorized parallel alignment module is used to query all diagonals involved in the current alignment position and then... w The diagonal line is used as the current group w One diagonal line; w Preset vector width; in the current group w A marker vector is set on each diagonal line. Based on the marker vector, a vectorized parallel sequence expansion calculation is performed on the current alignment position to obtain the current group. w The wavefront of the penalty corresponding to the diagonal line; in the current group w Along the diagonal line, through vectorized parallelism, the initial coordinates before the next wave are calculated; for the next group w For each diagonal, continue calculating the initial coordinates before the next wave until all diagonals have been traversed; based on the penalty score before the next wave, continue calculating the penalty score for the next wave until all bases of both sequences have been traversed. The comparison result determination module is used to obtain the corresponding wavefront coordinates in descending order of penalty score based on the penalty score, and determine the final comparison result. The vectorized parallel alignment module is also used to compare the current group. w The wavefront coordinates of the penalty points corresponding to the diagonals are initialized to the coordinates of the current initial position; a marker vector is set, and the initial value of each element of the marker vector is set to 1; the current group is determined. w Can the elements on each diagonal be expanded into a sequence? If yes, mark the corresponding bit as 1; if not, mark the corresponding bit as 0. Store the result in a vector. In the middle; the marker vector and the vector Perform a bitwise AND operation on the vector and save the result to the marker vector; perform a vector addition operation on the current wavefront's x and y coordinates and the marker vector, and use the result as the calculated wavefront coordinates; determine if all elements of the marker vector are 0. If not all elements are 0, continue with vectorized parallel sequence expansion calculations; if all elements are 0, obtain the current group. w The wavefront of the penalty points corresponding to each diagonal line.
6. The apparatus according to claim 5, 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 sequentially 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; Using vector instructions, the calculation results corresponding to the elements marked as 1 and 0 in the mask vector are determined; the calculation results include three vectors, namely the alignment result vectors for insertion, deletion, and mismatch; the alignment result vectors of the same type corresponding to the calculation results of the elements marked as 1 and 0 in the mask vector are added together to obtain the final alignment result vectors for insertion, deletion, and mismatch; the maximum value of the final alignment result vector for mismatch and the final alignment result vector for insertion is calculated, and the result is incremented by 1 to obtain the result of the current wavefront base insertion component; Calculate the maximum value of the final alignment result vector of mismatches and the final alignment result vector of deletions, and use the result as the result of the current wavefront base deletion component; select the maximum value among the result of the current wavefront base deletion component, the result of the current wavefront base insertion component, and the result of vector increment operation on the final alignment result vector of mismatches, 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.
7. The apparatus according to claim 6, characterized in that, The calculation steps for the element marked as 1 in the mask vector in the vectorized parallel alignment module include: saving the alignment results of the previous wavefront insertion, deletion, and mismatch into three intermediate vectors respectively; Perform a bitwise AND operation on each of the three intermediate vectors and the mask vector, and save the results to a vector. In this process, we obtain the calculation results of the elements marked as 1 in the mask vector.
8. The apparatus according to claim 6, characterized in that, The calculation steps for 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 bitwise inversion operation on the mask vector; and saving the result to a vector. In the middle; respectively, the three first intermediate vectors and vectors are... Perform a bitwise AND operation on the vectors and save the results to separate vectors. In this process, we obtain the calculation results of the elements marked as 0 in the mask vector.