A method, system, device, and medium for demultiplexing hybrid-length barcode sequencing data
Patent Information
- Application Number
- CN202611382432.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-08
- Publication Date
- 2026-10-09
AI Technical Summary
[0009]为了解决多样本长读长测序,自定义条形码数量较多、长度不完全一致且方向不确定导致拆样难度大的技术问题,本申请的目的是在长读长读段的头端和尾端进行快速、容错的条形码识别,并在同一流程中对不同长度候选进行归一化竞争比较,根据单端或双端实验模式完成拆样判定,从而减少全量逐一比对或按长度分组多次运行带来的计算开销和后处理复杂度,同时降低近似条形码和读段方向不确定带来的不稳定分配风险
Smart Images

Figure CN122885262A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of sequencing data preprocessing technology, and in particular to a method, system, device and medium for splitting mixed-length barcode sequencing data. Background Technology
[0002] In multi-sample long-read sequencing, sample barcodes are typically introduced into library adapters, primer regions, or other predetermined locations in different samples. After sequencing, the reads need to be assigned to their corresponding samples based on the barcode sequences appearing in the reads; this process is called sample splitting. Compared to short-read sequencing, long-read sequencing data typically have characteristics such as a large range of read lengths, fluctuating end quality, a higher proportion of insertion / deletion errors, and uncertain read orientation.
[0003] Meanwhile, in some custom experimental systems, the barcode set is not derived from a fixed commercial reagent kit but is designed by the user. Such barcode sets may be characterized by a large number of barcodes, inconsistent lengths, barcodes appearing at the beginning or end of the read segment, and diverse experimental design patterns. For example, the same barcode library may contain barcodes of different lengths such as 24bp, 27bp, 28bp, and 30bp; the experimental design may require single-end recognition, recognition of identical barcodes at both ends, or recognition of combinations of different barcodes at both ends. Therefore, the sample splitting procedure needs to balance running speed, fault tolerance, and rules for determining barcodes at both ends.
[0004] Existing tools can perform joint detection, barcode recognition, or barcode splitting under certain conditions. For example, Cutadapt can be used for joint trimming and barcode splitting, Porechop can be used for joint detection, trimming, and barcode splitting at the ends of long-read segments, and Dorado supports barcode classification and custom barcode arrangement.
[0005] However, for the above application scenarios, the tool adaptation methods have the following main drawbacks: (1) The computational cost of full-scale, one-to-one fault-tolerant comparison is relatively large. If the beginning and end of each read segment are compared with all barcodes and their reverse complementary sequences one by one, the number of candidates is twice the number of barcodes. The comparison computation at the end of each read segment will increase significantly with the number of barcodes. When the number of barcodes reaches hundreds, one-to-one fault-tolerant comparison will significantly increase the running time.
[0006] (2) Running multiple times in groups by length introduces the complexity of multiple scans and result merging. Some tools or configurations are more suitable for handling barcodes of equal length. If barcodes of different lengths are split into multiple independent processes and run separately, the input file needs to be scanned repeatedly, and multiple results need to be merged, deduplicated, conflict-handled, and the highest score selected, which increases the post-processing complexity and the risk of errors.
[0007] (3) There is a lack of a unified and fair competition and comparison mechanism among candidates of different lengths. When candidates of different lengths make a match at the same end of the reading segment, the longer barcode usually has a higher original match score. If the original match scores are directly compared, length bias is likely to occur; if thresholds are set for different lengths, the difficulty of parameter maintenance and result merging will increase.
[0008] (4) Judging solely by the highest score at a single end is not stable enough in scenarios with approximate barcodes and uncertain orientation. When two or more approximate barcodes produce close alignment scores at the same end, sequencing noise or fluctuations in end quality may cause unstable switching of sample tags between approximate barcodes. The orientation of long read segments is also uncertain, and if the orientation relationship between the head and tail ends is not used in conjunction, the risk of misassignment will also increase. Summary of the Invention
[0009] To address the challenges of large numbers of custom barcodes with varying lengths and uncertain orientations in multi-sample long-read sequencing, leading to difficulties in sample splitting, this application aims to perform rapid, fault-tolerant barcode recognition at the beginning and end of long-read segments. It also involves normalized competitive comparison of candidates of different lengths within the same workflow, and completes sample splitting determination based on single-end or double-end experimental modes. This reduces the computational overhead and post-processing complexity associated with full-scale, one-by-one alignment or multiple runs grouped by length, while mitigating the risk of unstable allocation due to approximate barcodes and uncertain read orientations. The technical solution adopted in this application is as follows: One aspect of this application provides a method for desampling sequencing data containing mixed-length barcodes, comprising the following steps: Obtain a barcode library corresponding to the sequencing data. The barcode library includes barcodes of at least two lengths. Generate the forward sequence and the reverse complementary sequence of each barcode based on the sequence of each barcode, and form directional candidates respectively to obtain a directional candidate library. Determine a preset end length, a preset step size, and a preset length segment length. The preset end length is not less than the maximum value of all barcode lengths in the barcode library, and the sum of the preset step size and the preset length segment length is not greater than the minimum value of all barcode lengths in the barcode library. For each read in the sequencing data, an end window of the preset end length is extracted from the head and / or tail ends; For each end window, a fixed-length segment is obtained by scanning according to the preset step size and the preset fixed-length segment length. Based on the directional candidate library, directional candidates that are hit by each fixed-length segment are obtained. Voting counts are performed on all directional candidates that are hit by the fixed-length segments in the end window to obtain the two directional candidates with the highest and second highest vote counts. The two directional candidates are compared with the end window respectively to obtain the comparison score of each directional candidate. The comparison score is further normalized based on the length of the directional candidate to obtain a normalized score. If the two directional candidates correspond to different barcodes and the absolute value of the difference in the normalized scores is less than the minimum difference threshold, it is determined that the barcode of the end window cannot be determined. Otherwise, the barcode of the end window is determined according to the directional candidate with the highest vote count. Reads are classified based on the barcodes determined by the end windows at the head and / or tail. If a read cannot be classified because the barcodes at the end windows at the head and / or tail cannot be determined, the read is discarded, thus completing the unpacking of the sequencing data.
[0010] Because the sequencing throughput of sequencing instruments often far exceeds the number of test samples, multiple samples are typically sequenced simultaneously in a single run to avoid wasting equipment. To distinguish the sequences of different samples, it is necessary to attach specific "tags" to each sample so that the data from different samples can be separated during subsequent data analysis. This "tag" is the barcode. The process of separating sequences based on barcodes is called sample splitting.
[0011] In this application, the sequencing data containing mixed-length barcodes refers to the presence of at least two different lengths of barcodes in the barcode library during library construction.
[0012] It should be noted that if the preset end length is too small, one or more barcodes may not be within the extracted end window, making sample splitting impossible. Those skilled in the art will understand that barcode length is variable and varies depending on the experimental system. To ensure that the end window always includes a barcode, a sufficiently large preset end length is usually required. In some embodiments of this application, where the sequencing data is third-generation long-read sequencing data, the preset end length is 100~500bp, preferably 300bp.
[0013] In this application, the formula for calculating the theoretical hit count for a directional candidate is as follows: N = floor((Lk) / s) + 1, Where N represents the theoretical hit count, L represents the length of the directional candidate, k represents the preset length of the segment, s represents the preset step size, and floor represents the floor operator.
[0014] In some embodiments of this application, in order to ensure that shorter barcodes are not skipped, it is necessary to control the preset step size and the preset fixed-length segment length. Specifically, the sum of the preset step size and the fixed-length segment length is controlled to be no greater than the minimum length of all barcodes in the barcode library. This ensures that any barcode area in the end window is scanned at least once.
[0015] In some specific embodiments of this application, the ratio of the preset step size to the preset length of the segment is 1:1 to 9.
[0016] In this application, the term "hit" means that the query sequence can be precisely matched to the target sequence, that is, there exists a sequence in the target sequence that is exactly the same as the query sequence. Therefore, a certain length segment hitting a certain directional candidate means that the directional candidate includes a sequence that is exactly the same as the fixed-length segment. In some embodiments of this application, in the directional candidate library, a fixed-length segment inverted index is first established based on the directional candidates to map a fixed-length segment to one or more directional candidates. Specifically, for each directional candidate sequence, all its continuous subsequences (fixed-length segments) with a length equal to the preset fixed-length segment length (k) are extracted, and a mapping relationship from the fixed-length segment to the directional candidate is established. After obtaining the fixed-length segment from the end window, the directional candidates that the fixed-length segment can hit can be directly obtained according to the mapping relationship. For example, when k is 5, the sequence of a fixed-length segment is ACGTACA, and the directional candidates for mapping include B1, B2 and B3 (that is, the sequence of ACGTACA can be extracted from the sequences of these 3 directional candidates). Furthermore, if a fixed-length segment obtained from scanning an end window is also ACGTACA, then the directional candidates that the fixed-length segment hits can be directly determined to be B1, B2 and B3.
[0017] In some specific embodiments of this application, the normalized score = alignment score / (barcode length × matching score), where the barcode length is the number of bases in the current directional candidate, and the matching score is the unit score when the bases match in the scoring matrix. In this embodiment, a match is +2 points, a mismatch is -4 points, opening a gap is -2 points, and gap extension is -1 point.
[0018] In some specific embodiments of this application, for an end window, if the number of votes for the directional candidate with the highest number of votes is lower than the minimum number of votes threshold, it is determined that the end window cannot confirm the barcode. The minimum number of votes threshold is less than the minimum of the theoretical hits of all directional candidates in the directional candidate library, so as to filter out occasional hits of a single fixed-length fragment and retain candidates containing sequencing errors.
[0019] In some specific embodiments of this application, for an end window, if the normalized score of the directional candidate with the highest number of votes is lower than the score threshold, it is determined that the end window cannot confirm the barcode.
[0020] In some embodiments of this application, the classification of read segments based on the end windows of the head and / or tail ends includes three modes: single-end mode, same-code-at-both-end mode, and combination mode of different-code-at-both-ends, wherein: In single-ended mode, the end window corresponding to the head or tail end has a identifiable barcode, which can be used for classification. In the dual-end same code mode, the barcodes determined by the corresponding end windows at the head and tail ends are reverse complementary sequences, which can be used for classification based on the corresponding barcodes; In the dual-end heterogeneous code combination mode, among the barcodes determined by the end windows at the head and tail ends, one of the sequences is a forward sequence of a barcode, and the other sequence is a reverse complementary sequence of another barcode. Then, the barcodes are classified according to the corresponding barcode combinations.
[0021] A second aspect of this application provides a system for splitting sequencing data containing mixed-length barcodes, comprising the following modules: Data input module: used to input sequencing data and the corresponding barcode library, wherein the barcode library includes barcodes of at least two lengths; A directional candidate generation module, connected to the data input module, is used to generate the forward sequence and the reverse complementary sequence of each barcode based on the sequence of each barcode, and form directional candidates respectively to obtain a directional candidate library; An end window extraction module, connected to the data input module, is used to extract an end window of a preset end length at the head and / or tail end of each read in the sequencing data, wherein the preset end length is not less than the maximum value of the length of all barcodes in the barcode library; The end-window barcode determination module is connected to the directional candidate generation module and the end-window extraction module, respectively. For each end-window, it scans according to a preset step size and a preset length segment to obtain a fixed-length segment. The sum of the preset step size and the preset length segment length is not greater than the minimum length of all barcodes in the barcode library. Further, it obtains directional candidates that match each fixed-length segment based on the directional candidate library. It then performs a vote count on all directional candidates that match the fixed-length segments in the end-window to obtain the two directional candidates with the highest and second-highest vote counts. These two directional candidates are compared with the end-window to obtain a comparison score for each directional candidate. The comparison score is then normalized based on the length of the directional candidate to obtain a normalized score. If the two directional candidates correspond to different barcodes, and the absolute value of the difference in normalized scores is less than the minimum difference threshold, then it is determined that the end-window cannot determine a barcode; otherwise, the barcode of the end-window is determined based on the directional candidate with the highest vote count. The read segment classification determination module is connected to the end window barcode determination module. It is used to classify read segments according to the barcode determined by the end window at the head and / or tail. If the end window at the head and / or tail of a read segment cannot be determined to determine the barcode, resulting in the read segment being unclassifiable, the read segment is discarded, thereby completing the unpacking of sequencing data.
[0022] In some embodiments of this application, in the directional candidate generation module, for each directional candidate sequence in the directional candidate library, all fixed-length segments with a preset length are extracted, and a mapping relationship from the fixed-length segments to the directional candidates is established. In the end window barcode determination module, after obtaining the fixed-length segments by scanning from the end window, the hit directional candidates can be obtained directly based on the mapping relationship.
[0023] A third aspect of this application provides an electronic device, comprising: At least one processor; and a memory communicatively connected to said at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform any of the methods described in the first aspect of this application.
[0024] A fourth aspect of this application provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform any of the methods described in the first aspect of this application.
[0025] Compared with the prior art, this application has the following advantages: Improving computational efficiency: By establishing a fixed-length segment inverted index, the end window scanning and candidate comparison are transformed into fast index hits and voting counts, avoiding the traditional global fault-tolerant comparison of barcodes one by one. In the actual test data of 768 mixed-length barcodes and 137,000 read segments, this method completed the desampling in only 16.53 seconds, which is 3.74 times faster than the BLAST-based reference method; on a larger dataset (9.32 GiB, 1.1 million read segments), the speedup reaches 5.75 times, and the highest speedup can reach 10.82 times (see Example 2, Table 1, and...). Figure 2 In adaptation comparisons with publicly available tools such as Cutadapt, Porechop, and Dorado, this method processed 1000 reads in just 0.89 seconds, faster than the control groups (29-76 seconds) (see Example 3, Table 2, and...). Figure 3 ).
[0026] This application addresses the issue of inconsistent processing of mixed-length barcodes, avoiding multiple runs and result merging. While Dorado supports custom barcodes, its official documentation explicitly requires all barcode sequence lengths to match. When the barcode library contains various lengths such as 24bp, 27bp, 28bp, and 30bp, multiple runs by length are necessary before merging the results, increasing complexity and error risk. This application stores forward and reverse sequences of all barcode lengths in the same inverted index. By scanning fixed-length segments and comparing length-normalized scores, different length candidates are fairly judged within the same competitive system. This eliminates the need for multiple runs by length, saving the overhead of multiple rounds of result merging, deduplication, and conflict handling, thus reducing complexity and error risk.
[0027] The length normalization competition mechanism eliminates length bias: To address the issue of large differences in the original comparison scores of barcodes of different lengths, the normalization score is mapped to a unified scale using the formula "normalized score = comparison score / (barcode length × matching score)". A fixed minimum score difference threshold is used as the basis for ambiguity judgment, ensuring that longer barcodes are not naturally superior and shorter barcodes are not underestimated, thus achieving objective and fair cross-length candidate comparison.
[0028] To improve the allocation stability of near-edge barcodes and under uncertain reading segment directions: By using multi-position voting counting within the end window, combined with normalized secondary confirmation of the highest score, and minimum difference discrimination among the top candidates, misjudgments caused by end noise and random mismatches can be effectively suppressed. Simultaneously, it supports both identical and different code combinations at both ends, and can utilize the directional relationship between the head and tail ends for cross-validation, significantly reducing the risk of confusion between similar barcodes. In five datasets of different sizes, the consistency of sample labels between this method and the BLAST reference method on successfully split reading segments reached 99.65%~99.88% (see Table 1), demonstrating the reliability and consistency of its splitting results.
[0029] Flexible adaptation to various experimental design modes: This method has three built-in classification modes: single-end, double-end same code, and double-end different code combination. It can meet the different library building strategies commonly used by users in custom barcode libraries. There is no need to develop separate processes for different modes, which has wide applicability and ease of use.
[0030] Low resource consumption: In a large-scale test with 768 barcodes and 137,000 read segments, the maximum resident memory set was only 347.6MB, indicating that the method in this application has low memory requirements while ensuring high performance, and is suitable for running under normal computing resources.
[0031] In summary, this application provides a fast, accurate, robust, and easy-to-integrate solution for the problem of splitting samples from mixed-length, high-throughput, and custom barcode libraries in long-read sequencing, which is superior to existing tools or adaptation solutions.
[0032] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description
[0033] The above and other objects, features, and advantages of exemplary embodiments of this application will become readily apparent from the following detailed description taken in conjunction with the accompanying drawings. Several embodiments of this application are illustrated in the drawings by way of example and not limitation, in which: Figure 1 This document illustrates a flowchart of a method for determining barcodes and performing sample splitting based on vote counts in Embodiment 1 of this application. Figure 2 The comparison of analysis time and speedup ratio between the method of the present invention and the reference method based on BLAST in Embodiment 2 of this application is shown; Figure 3 The comparison of the time taken for sample splitting and the number of successfully read segments in different methods in Embodiment 3 of this application is shown. Detailed Implementation
[0034] Unless otherwise stated, implied from the context, or as is customary in the art, all parts and percentages in this application are based on weight, and all testing and characterization methods used are concurrent with the filing date of this application. Where applicable, any patent, patent application, or disclosure relating to this application is incorporated herein by reference in its entirety, and its equivalent patent families are also incorporated herein by reference, particularly the definitions of relevant terms in the art disclosed in such documents. If any definition of a specific term disclosed in the prior art is inconsistent with any definition provided in this application, the definition provided in this application shall prevail.
[0035] To make the technical problems, technical solutions and beneficial effects solved by this application clearer, the following detailed description is provided in conjunction with embodiments.
[0036] The following examples are used to illustrate preferred embodiments of this application. Those skilled in the art will understand that the techniques disclosed in the examples represent technologies discovered by the inventors that can be used to implement this application, and therefore can be considered preferred embodiments of this application. However, those skilled in the art should understand from this specification that many modifications can be made to the specific embodiments disclosed herein, still yielding the same or similar results, without departing from the spirit or scope of this application.
[0037] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains, and all materials cited herein and referenced by them are incorporated herein by reference.
[0038] Those skilled in the art will recognize, or can learn through routine experimentation, many equivalents of specific embodiments of the invention described herein. These equivalents will be included in the claims.
[0039] Unless otherwise specified, the experimental methods used in the following examples are conventional methods. Unless otherwise specified, the instruments and equipment used in the following examples are all conventional laboratory instruments and equipment; unless otherwise specified, the experimental materials used in the following examples were all purchased from conventional biochemical reagent stores.
[0040] Example 1: A method for determining barcodes and performing sample splitting based on vote counting refer to Figure 1 This embodiment provides a method for splitting sequencing data containing mixed-length barcodes, including the following steps: 1. Obtaining sequencing data Multiple samples were mixed for library construction and sequenced using third-generation sequencing technology to obtain sequencing data in FASTQ format or its compressed format.
[0041] At the same time, a barcode library corresponding to the sequencing data is obtained, which is applicable to barcode libraries including at least two lengths.
[0042] 2. Construction of Directional Candidates For the corresponding barcode library, the forward sequence and the reverse complementary sequence are generated based on the sequence of each barcode, and directional candidates are formed respectively to obtain the directional candidate library.
[0043] Each directional candidate includes at least a barcode number, a direction field, and a candidate sequence. The direction field may include a forward direction and a reverse complementary direction.
[0044] 3. Build a fixed-length segment inverted index A fixed-length segment inverted index is built based on directional candidates to map a fixed-length segment to one or more directional candidates.
[0045] For each directional candidate sequence, extract all its continuous subsequences (fixed-length segments) of length k, and establish a mapping relationship from fixed-length segments to directional candidates. When multiple fixed-length segments of the same directional candidate are mapped to the same index entry, deduplication or cumulative counting can be performed on that candidate. Directional candidates corresponding to barcodes of different lengths are stored together in the same inverted index, thus avoiding the need to create multiple independent indexes based on barcode length.
[0046] 4. Extract the end window For each read in the sequencing data, an end window of a preset end length is extracted from the head and / or tail ends; The length of the end window can be from 100bp to 500bp, preferably 300bp, and can also be adaptively adjusted according to the longest barcode length or end quality.
[0047] 5. Determination of the barcode at the end window For each end window, a fixed-length segment is obtained by scanning according to a preset step size and a preset fixed-length segment length. Based on the directional candidate library, directional candidates that are matched by each fixed-length segment are obtained. Voting is counted for all directional candidates matched by the fixed-length segments in the end window, and the two directional candidates with the highest and second highest vote counts are obtained. The two directional candidates are compared with the end window respectively to obtain the comparison score of each directional candidate. The comparison score is further normalized based on the length of the directional candidate to obtain a normalized score. If the two directional candidates correspond to different barcodes and the absolute value of the difference in the normalized scores is less than the minimum difference threshold, it is determined that the barcode of the end window cannot be determined. Otherwise, the barcode of the end window is determined according to the directional candidate with the highest vote count.
[0048] The formula for calculating the normalized score includes: Normalized score = Alignment score / (Barcode length × Match score). Wherein, the barcode length is the number of bases in the current directional candidate, and the match score is the unit score when the bases match in the scoring matrix. In this embodiment, a match is +2 points, a mismatch is -4 points, opening a gap is -2 points, and gap extension is -1 point.
[0049] By normalizing the length, the alignment scores of candidates with different lengths are mapped to the same scale, which facilitates judgment and competitive comparison under a unified threshold system.
[0050] Furthermore, if the number of votes for the directional candidate with the highest number of votes is lower than the minimum number of votes threshold, then the end window is determined to be unable to confirm the barcode; the minimum number of votes threshold is less than the minimum of the theoretical hit counts of all directional candidates in the directional candidate library. For a directional candidate, the formula for calculating its theoretical hit count is as follows: N = floor((Lk) / s) + 1, Where N represents the theoretical hit count, L represents the length of the directional candidate, k represents the preset length of the segment, s represents the preset step size, and floor represents the floor operator.
[0051] Furthermore, if the normalized score of the directional candidate with the highest number of votes is lower than the score threshold, then the end window is determined to be unable to confirm the barcode.
[0052] Furthermore, if the directional candidate with the highest number of votes and the directional candidate with the second highest number of votes correspond to different barcode numbers, and the difference in their normalized scores is lower than the minimum difference threshold, then it is determined that the end window cannot confirm the barcode; otherwise, the barcode number, direction, and normalized score of the highest candidate are taken as the recognition result of the end.
[0053] 6. Sequencing read classification (sample splitting) Reads are classified based on the barcodes determined by the end windows at the head and / or tail ends. If a read cannot be classified because the end windows at the head and / or tail ends cannot determine a barcode, the read is discarded, thus completing the sequencing data splitting. Three modes are included: single-end mode, paired-end same-code mode, and paired-end different-code combination mode. In single-ended mode, the end window corresponding to the head or tail end has a identifiable barcode, which can be used for classification. In the dual-end same code mode, the barcodes determined by the corresponding end windows at the head and tail ends are reverse complementary sequences, which can be used for classification based on the corresponding barcodes; In the dual-end heterogeneous code combination mode, among the barcodes determined by the end windows at the head and tail ends, one of the sequences is a forward sequence of a barcode, and the other sequence is a reverse complementary sequence of another barcode. Then, the barcodes are classified according to the corresponding barcode combinations.
[0054] For successfully desampled reads, the output can be sent to the corresponding sample sequence file; for unsuccessfully desampled or ambiguous reads, the output can be sent to an unclassified file. Of course, for successfully desampled reads, the ends can be trimmed based on the semi-global alignment endpoint and a preset fixed-end compensation length to remove barcodes or connector sequences. The preset fixed-end compensation length is calculated from the lengths of the fixed sequences located on both sides of the variable region; for example, the prefix fixed region length is 5 bp, and the suffix fixed region length is 19 bp.
[0055] Example 2: Sampling of a mixed library of 768 barcodes of different lengths In this embodiment, a third-generation long-read sequencing dataset (20260602_result) was split. The sequencing data is 1.35 GiB in size, with a total of 137,604 reads, a total base count of 710,579,492 bp, an average read length of 5,163.95 bp, an N50 of 5,550 bp, and a maximum read length of 116,922 bp. N50 refers to the read length value that, after arranging the reads in descending order of length, the cumulative length reaches 50% of the total length.
[0056] The barcode library corresponding to this sequencing data includes 768 barcodes with lengths of 24bp, 27bp, 28bp, and 30bp. Among them, there are 410 24bp barcodes, 96 27bp barcodes, 255 28bp barcodes, and 7 30bp barcodes.
[0057] First, the forward and reverse complementary sequences of all barcodes of all lengths are placed into the inverted index of the same fixed-length segment as directional candidates, without splitting them into multiple independent processes according to the barcode length.
[0058] The splitting process operates in single-end mode with the following main parameters: a 300bp head window, a 300bp tail window, a fixed-length segment length of 7, a preset step size of 3 for the fixed-length segment, 2 candidates to retain, a minimum number of votes of 2, and a minimum normalized score difference threshold of 0.05 when the first and second candidates belong to different barcode numbers. After comparison, the comparison scores of the directional candidates are normalized according to the formula "Normalized Score = Original Comparison Score / (Barcode Length × Matching Score)". The test implementation uses 30 threads and enables end-pruning for successful read segments.
[0059] A total of 118,661 read segments were successfully sampled, with a success rate of 86.23%; the actual running time was 16.53 seconds, and the maximum resident memory set size (RSS) was 347.6 MB.
[0060] The above results show that, when 768 mixed-length barcodes coexist, this embodiment can complete one-pass processing using the method of Embodiment 2 through the same index, the same candidate competition process, and the same splitting and determination process.
[0061] To confirm the usability of the output sample labels, this embodiment also performs a segment-level regression comparison with a BLAST-based alignment and recognition method. BLAST is a basic local alignment search tool. This method identifies barcodes by comparing the sequence similarity of the end sequences of the read segments with a barcode reference library, and is suitable as a reference for barcode recognition accuracy. The BLAST-based reference method successfully desampled 121,322 read segments; among the read segments successfully desampled by both methods, 110,141 samples had the same label, and 386 samples had different labels, resulting in a sample consistency of 99.65% when both methods were successful.
[0062] To further illustrate the stability of the above parameters on different input data, the invention used five sets of sequencing data for supplementary runs, all of which were split using single-end mode with the main parameters, and were compared with the BLAST-based reference method at the read level. The results are shown in Table 1.
[0063] Table 1: Results of the five sets of sequencing data .
[0064] As shown in Table 1, the method of this invention successfully desampled all five sequencing data sets. Among the reads where both sides were successfully desampled, the sample tag consistency was 99.65% to 99.88%, and it achieved a speedup of 1.85 to 10.82 times compared to the BLAST-based reference method. Figure 2 .
[0065] Example 3: Comparative Experiment of Public Tool Adaptation for Sampling 1000 Read Segments This embodiment uses the first 1000 read segments from the 20260602_result dataset in Embodiment 2 to assist in comparing the adaptability of the method of this embodiment with the publicly available tools. The test uses 4 threads. The method of this invention directly processes 1000 complete read segments in 0.89 seconds, with an internal timer of 0.79 seconds, and successfully samples 849 read segments.
[0066] Cutadapt comparison uses a window configuration: each read segment is first split into two inputs, a 300bp head end and a 300bp tail end, and then Cutadapt is run separately for each. The barcode reference contains 768 barcodes and their inverse complementary sequences, totaling 1536 connector entries. Porechop's built-in barcode pattern could not be directly desampled on this barcode set; to perform a closer algorithm rationality check, a local Porechop custom connector table was generated during testing, and the same batch of 768 barcodes was added to the local test package. This processing is only for comparison and does not indicate that Porechop natively supports this barcode set. Dorado 2.0.0 supports custom barcode arrangements, but this requires the barcodes to be of consistent length; for auxiliary comparison, the 768 barcodes were split into four groups according to length: 24bp, 27bp, 28bp, and 30bp. Dorado was run on each group separately, and then the read segment level results were merged according to the highest barcode score. The results are shown in Table 2 and... Figure 3 As shown: Table 2: Results of Public Tool Adaptation Comparison of 1000 Sample Reading Segments .
[0067] From Table 2 and Figure 3 It can be seen that the runtime of the analysis varies significantly among different methods. The method of this invention takes only 0.89 seconds, which is shorter than other methods. The number of successful read segments obtained by different methods does not differ significantly.
[0068] In the read-level comparison, the Porechop custom test yielded 809 reads where both sides were successful and the samples were identical, 5 reads where both sides were successful but the samples were different, and 35 reads that appeared only in the splitting results of the method of this invention. The Porechop custom test only had 96 successful reads, and both sides failed 55 reads. Compared with the method of this invention, the Dorado grouping scheme yielded 777 reads where both sides were successful and the samples were identical, 10 reads where both sides were successful but the samples were different, the method of this invention only had 62 successful reads, and the Dorado grouping scheme only had 86 successful reads, and both sides failed 65 reads.
[0069] This sampling comparison experiment demonstrates that Cutadapt, Porechop, and Dorado can all be used to assist in consistency checks with certain modifications or adaptations. However, in the mixed-length, high-throughput, and custom barcode library scenarios addressed in this invention, Cutadapt's window configuration requires splitting the head and tail windows and merging the results; Porechop's custom configuration requires generating a local connector table; and Dorado's grouping configuration requires running the test by barcode length and merging the segment-level results. In the mixed-length (24bp, 27bp, 28bp, and 30bp coexisting), high-throughput (768 barcodes), and custom barcode library scenarios addressed in this embodiment, each control tool requires additional adaptation: Cutadapt needs to split each segment into head and tail windows for separate runs and does not support simplified representations of variable-length barcodes; Porechop's splitting function is primarily for ONT's official barcode kits and does not natively support custom barcodes; Dorado requires that custom barcode sequence lengths be consistent and requires grouping by length before merging the results. The method of this invention processes barcodes of different lengths in the same index and the same candidate competition process, and directly completes the head and tail pattern determination and result output in the same process.
[0070] Furthermore, it should be understood that after reading the foregoing contents of this application, those skilled in the art can make various alterations or modifications to this application, and these equivalent forms also fall within the scope defined by the appended claims.
Claims
1. A method for splitting sequencing data containing mixed-length barcodes, characterized in that, Includes the following steps: Obtain a barcode library corresponding to the sequencing data. The barcode library includes barcodes of at least two lengths. Generate the forward sequence and the reverse complementary sequence of each barcode based on the sequence of each barcode, and form directional candidates respectively to obtain a directional candidate library. Determine a preset end length, a preset step size, and a preset length segment length. The preset end length is not less than the maximum value of all barcode lengths in the barcode library, and the sum of the preset step size and the preset length segment length is not greater than the minimum value of all barcode lengths in the barcode library. For each read in the sequencing data, an end window of the preset end length is extracted from the head and / or tail ends; For each end window, a fixed-length segment is obtained by scanning according to the preset step size and the preset fixed-length segment length. Based on the directional candidate library, directional candidates that are hit by each fixed-length segment are obtained. Voting counts are performed on all directional candidates that are hit by the fixed-length segments in the end window to obtain the two directional candidates with the highest and second highest vote counts. The two directional candidates are compared with the end window respectively to obtain the comparison score of each directional candidate. The comparison score is further normalized based on the length of the directional candidate to obtain a normalized score. If the two directional candidates correspond to different barcodes and the absolute value of the difference in the normalized scores is less than the minimum difference threshold, it is determined that the barcode of the end window cannot be determined. Otherwise, the barcode of the end window is determined according to the directional candidate with the highest vote count. Reads are classified based on the barcodes determined by the end windows at the head and / or tail. If a read cannot be classified because the barcodes at the end windows at the head and / or tail cannot be determined, the read is discarded, thus completing the unpacking of the sequencing data.
2. The method according to claim 1, characterized in that, The ratio of the preset step size to the preset length of the segment is 1:1 to 9.
3. The method according to claim 1, characterized in that, For an end window, if the number of votes for the directional candidate with the highest number of votes is lower than the minimum number of votes threshold, then the end window is determined to be unable to confirm the barcode. The minimum number of votes threshold is less than the minimum theoretical hit count of all directional candidates in the directional candidate library. The formula for calculating the theoretical hit count of a directional candidate is as follows: N = floor((Lk) / s) + 1, Where N represents the theoretical hit count, L represents the length of the directional candidate, k represents the preset length of the segment, s represents the preset step size, and floor represents the floor operator.
4. The method according to claim 1, characterized in that, In the directional candidate library, for each directional candidate sequence, all fixed-length segments with a preset length are extracted, and a mapping relationship from fixed-length segments to directional candidates is established. After obtaining fixed-length segments by scanning from the end window, the hit directional candidates can be obtained directly based on the mapping relationship.
5. The method according to any one of claims 1 to 4, characterized in that, The classification of read segments based on the end windows of the head and / or tail ends includes three modes: single-end mode, same code at both ends mode, and combination of different codes at both ends mode, wherein: In single-ended mode, the end window corresponding to the head or tail end has a identifiable barcode, which can be used for classification. In the dual-end same code mode, the barcodes determined by the end windows at the head end and the tail end are reverse complementary sequences, which can be used to classify the corresponding barcodes. In the dual-end heterogeneous code combination mode, among the barcodes determined by the end windows at the head and tail ends, one of the sequences is a forward sequence of a barcode, and the other sequence is a reverse complementary sequence of another barcode. Then, the barcodes are classified according to the corresponding barcode combinations.
6. A system for splitting sequencing data containing mixed-length barcodes, characterized in that, Includes the following modules: Data input module: used to input sequencing data and the corresponding barcode library, wherein the barcode library includes barcodes of at least two lengths; A directional candidate generation module, connected to the data input module, is used to generate the forward sequence and the reverse complementary sequence of each barcode based on the sequence of each barcode, and form directional candidates respectively to obtain a directional candidate library; An end window extraction module, connected to the data input module, is used to extract an end window of a preset end length at the head and / or tail end of each read in the sequencing data, wherein the preset end length is not less than the maximum value of the length of all barcodes in the barcode library; The end-window barcode determination module is connected to the directional candidate generation module and the end-window extraction module, respectively. For each end-window, it scans according to a preset step size and a preset length segment to obtain a fixed-length segment. The sum of the preset step size and the preset length segment length is not greater than the minimum length of all barcodes in the barcode library. Further, it obtains directional candidates that match each fixed-length segment based on the directional candidate library. It then performs a vote count on all directional candidates that match the fixed-length segments in the end-window to obtain the two directional candidates with the highest and second-highest vote counts. These two directional candidates are compared with the end-window to obtain a comparison score for each directional candidate. The comparison score is then normalized based on the length of the directional candidate to obtain a normalized score. If the two directional candidates correspond to different barcodes, and the absolute value of the difference in normalized scores is less than the minimum difference threshold, then it is determined that the end-window cannot determine a barcode; otherwise, the barcode of the end-window is determined based on the directional candidate with the highest vote count. The read segment classification determination module is connected to the end window barcode determination module. It is used to classify read segments according to the barcode determined by the end window at the head and / or tail. If the end window at the head and / or tail of a read segment cannot be determined to determine the barcode, resulting in the read segment being unclassifiable, the read segment is discarded, thereby completing the unpacking of sequencing data.
7. The system according to claim 6, characterized in that, In the end-window barcode determination module, for an end window, if the number of votes for the directional candidate with the highest number of votes is lower than the minimum number of votes threshold, it is determined that the end window cannot confirm the barcode. The minimum number of votes threshold is less than the minimum theoretical hit count of all directional candidates in the directional candidate library. The formula for calculating the theoretical hit count of a directional candidate is as follows: N = floor((Lk) / s) + 1, Where N represents the theoretical hit count, L represents the length of the directional candidate, k represents the preset length of the segment, s represents the preset step size, and floor represents the floor operator.
8. The system according to claim 6 or 7, characterized in that, In the directional candidate generation module, for each directional candidate sequence in the directional candidate library, all fixed-length segments with a preset length are extracted, and a mapping relationship from the fixed-length segments to the directional candidates is established. In the end window barcode determination module, after obtaining the fixed-length segments by scanning from the end window, the hit directional candidates can be obtained directly based on the mapping relationship.
9. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 5.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 5.