Method and apparatus for classifying nanopore sequencing time series electrical signals
By directly performing sequence classification based on time series signals and applying the MultiRocket algorithm, the problems of high computational complexity and feature concentration in nanopore sequencing time series electrical signal classification are solved, and efficient and accurate signal classification is achieved.
Patent Information
- Application Number
- CN202310865681.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-13
- Publication Date
- 2025-01-14
AI Technical Summary
The prior art has high computational complexity and long training time in the classification of electrical signals in nanopore sequencing time series, and most methods focus on a single type of features, making it difficult to effectively process high noise or crosstalk signals.
By directly performing sequence classification based on time series signals, omitting the intermediate process, the MultiRocket algorithm is used for feature extraction and linear classification model training, thereby isolating clean sequencing signals and improving classification efficiency and accuracy.
It achieves the separation of clean sequencing signals from nanopore sequencing signals, significantly improves the accuracy and efficiency of signal classification, and has good adaptability.
Smart Images

Figure CN119312122A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of time series classification, and more specifically, to a method and device for classifying nanopore sequencing time series electrical signals and a method and device for training a classification model. Background Art
[0002] Most time series classification methods that achieve state-of-the-art accuracy have high computational complexity, requiring extensive training time even for smaller datasets and prohibitive computation time for larger datasets. Furthermore, many existing methods focus on a single type of feature, such as shape or frequency.
[0003] Therefore, the present disclosure proposes to perform sequence classification tasks directly based on time series signals, which can omit many intermediate processes and greatly improve efficiency. Summary of the invention
[0004] According to the embodiments of the present disclosure, the classification problem of sequencing results can be solved by moving forward to the stage of processing time series signals, and the application of the advanced time series classification algorithm MultiRocket achieves high efficiency and extremely high accuracy, separating clean sequencing signals from nanopore sequencing time series electrical signals.
[0005] Specifically, embodiments of the present disclosure provide a method and apparatus for classifying nanopore sequencing time series electrical signals.
[0006] One aspect of the present disclosure provides a method for classifying nanopore sequencing time series electrical signals, the method comprising: acquiring nanopore sequencing time series electrical signals; separating sequencing signals from the nanopore sequencing time series electrical signals; performing feature extraction on the sequencing signals to obtain feature values, the feature values comprising at least one of the proportion of positive values (PPV), the mean value of positive values (MPV), the mean value of positive value indexes (MIPV), and the maximum number of consecutive positive value occurrences (LSPV); and inputting the obtained feature values into a linear classification model to classify the sequencing signals.
[0007] According to an embodiment of the present disclosure, separating the sequencing signal from the nanopore sequencing time series electrical signal includes: determining a point group according to the signal value of the nanopore sequencing time series electrical signal, the point group including a starting point and an end point; separating the sequencing signal from the nanopore sequencing time series electrical signal according to the point group.
[0008] According to an embodiment of the present disclosure, determining a point group based on the signal value of the nanopore sequencing time series electrical signal includes: acquiring the signal value of the current signal point one by one from the nanopore sequencing time series electrical signal; calculating a first fitting mean of the current signal point based on the signal value of the current signal point; calculating a first fitting variance of the current signal point based on the signal value of the current signal point and the first fitting mean of the current signal point; calculating a starting point threshold of the current signal point and an ending point threshold of the current signal point based on the fitting mean of the current signal point and the first fitting variance of the current signal point; determining whether the current signal point is the starting point of the point group based on the starting point threshold of the current signal point, and / or determining whether the current signal point is the ending point of the point group based on the ending point threshold of the current signal point.
[0009] According to an embodiment of the present disclosure, the method further includes: filtering the sequencing signal and / or removing abnormal signals.
[0010] According to an embodiment of the present disclosure, the method further includes: extracting features from the sequencing signal using a MultiRocket algorithm.
[0011] According to an embodiment of the present disclosure, the linear classification model is a ridge regression model.
[0012] According to an embodiment of the present disclosure, the feature extraction and the linear classification model are also included in training, wherein the training includes: labeling the sequencing signal to generate training data; iteratively extracting features from the training data and inputting the extracted feature values into the linear classification model for classification so that the classification result matches the labeling result; and storing the linear classification model and the parameters used in the feature extraction.
[0013] According to an embodiment of the present disclosure, the labeling further includes: converting the sequencing signal into a base sequence; for each base sequence, intercepting the first M bases and the last N bases to compare and score with the corresponding barcode based on a predetermined rule, wherein M and N are natural numbers greater than 0; and marking the sequencing signal whose barcode comparison score exceeds the predetermined score with a corresponding barcode label.
[0014] One aspect of the present disclosure provides a device for classifying nanopore sequencing time series electrical signals, the device comprising a processing circuit and a memory, the memory storing instructions, which, when executed by the processing circuit, cause the device to perform the above-mentioned method for classifying nanopore sequencing time series electrical signals.
[0015] One aspect of the present disclosure provides a device for training a classification model, the device comprising a processing circuit and a memory, the processor storing instructions, which, when executed by the processing circuit, enable the device to perform the above-mentioned method for training a classification model.
[0016] One aspect of the present disclosure is a non-transitory computer-readable medium storing a computer program, the computer program comprising instructions which, when executed by a processing circuit, cause the processing circuit to perform any of the methods disclosed herein.
[0017] According to the embodiments of the present disclosure, the present disclosure can separate clean sequencing signals from nanopore sequencing time series electrical signals, effectively improve the accuracy and efficiency of nanopore sequencing signal classification, and has good adaptability to scenarios with constantly changing features. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Other objects, features and advantages will be apparent from the following detailed description of the embodiments made with reference to the accompanying drawings, in which:
[0019] Figure 1 A flowchart of a method for classifying nanopore sequencing time series electrical signals according to an embodiment of the present disclosure is shown.
[0020] Figure 2 The diagram shows a sequencing signal separated from a nanopore sequencing time series electrical signal according to an embodiment of the present disclosure.
[0021] Figure 3 The figure shows the sequencing signal after the abnormal signal is removed according to the embodiment of the present disclosure, wherein the shaded background is the separated sequencing signal.
[0022] Figure 4 The average ranking of classification accuracy of different algorithms in 109 UCR datasets is shown.
[0023] Figure 5 The total training time of different algorithms to complete 112 UCR data classification tasks is shown.
[0024] Figure 6 A schematic diagram of dilated convolution and padding terms according to an embodiment of the present disclosure is shown.
[0025] Figure 7 A schematic diagram of sequence data according to an embodiment of the present disclosure is shown.
[0026] Figure 8 The signals generated by three different hole states according to the embodiment of the present disclosure are shown.
[0027] Fig. 9A flowchart of a method 700 for training a classification model according to an embodiment of the present disclosure is shown.
[0028] Fig.10 A schematic diagram of adding a characteristic sequence to the end of a sequencing library according to an embodiment of the present disclosure is shown.
[0029] Fig.11 The classification accuracy of sequencing signals obtained from two different motor proteins according to an embodiment of the present disclosure is shown.
[0030] Fig.12 A distribution histogram of comparison and scoring results according to an embodiment of the present disclosure is shown.
[0031] Fig.13 A schematic diagram showing the result of comparing and scoring the predicted barcode sequence with the sequences of four barcodes according to an embodiment of the present disclosure is shown.
[0032] Fig.14 A schematic block diagram of a device 1200 for executing methods 100 and 700 according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0033] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0034] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The words "a", "an (kind)" and "the" used herein should also include the meanings of "multiple" and "multiple", unless the context clearly indicates otherwise. In addition, the terms "including", "comprising" and the like used herein indicate the presence of the features, steps, operations and / or components, but do not exclude the presence or addition of one or more other features, steps, operations or components.
[0035] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.
[0036] Nanopore sequencing is to immerse a synthetic polymer membrane in an ion solution. The polymer membrane is covered with modified transmembrane channel proteins (nanopores). Different voltages are applied on both sides of the membrane to generate a voltage difference. Under the traction of the motor protein, the DNA chain unwinds and passes through the nanopore protein. Different bases will form specific ion current change signals. The nanopore electrical signal is a one-dimensional time series signal. If it is necessary to perform meaningful classification or abnormality detection on the nanopore sequencing signal, it is often necessary to convert the nanopore signal into a base sequence through base calling technology and then use machine learning or deep learning methods to classify the sequence data. The existing technology has great limitations. It is necessary to convert the electrical signal generated by sequencing into a base sequence through base calling, and base calling often uses complex deep learning models. The training and reasoning of these models are extremely time-consuming and require better hardware equipment. There will also be certain errors in the training results. Based on the recent success of convolutional neural networks in time series classification, the MultiRocket algorithm can be used to extract features using a large number of convolution kernels, and then a simple linear classifier can be used to achieve the most advanced accuracy. Compared with complex algorithms with the same accuracy, the computational time is greatly reduced. In addition, how to separate clean sequencing signals from nanopore electrical signals (nanopore sequencing time series electrical signals) is a difficult problem. For nanopore electrical signals with high noise or crosstalk, it is difficult for existing algorithms to accurately extract sequencing signals from nanopore electrical signals.
[0037] To address some of the above problems, the present disclosure proposes a method 100 for classifying nanopore sequencing time series electrical signals. Figure 1 A flowchart of a method 100 for classifying nanopore sequencing time series electrical signals according to an embodiment of the present disclosure is shown.
[0038] like Figure 1 As shown, in step S102, a nanopore sequencing time series electrical signal is acquired.
[0039] Nanopore sequencing time series electrical signal data containing target signals can be collected, that is, each sequence contains several target signal fragments, and the target signal can theoretically be in any form (for example, it can be found by naked eyes). The target signal can include sequencing signals, pore current signals, etc.
[0040] In step S104, the sequencing signal is separated from the nanopore sequencing time series electrical signal.
[0041] According to an embodiment of the present disclosure, separating the sequencing signal from the nanopore sequencing time series electrical signal includes: determining a point group according to the signal value of the nanopore sequencing time series electrical signal, the point group including a start point and an end point; separating the sequencing signal from the nanopore sequencing time series electrical signal according to the point group.
[0042] A plurality of point groups may be determined based on the signal value of the nanopore sequencing time series electrical signal, each point group including a starting point and an ending point corresponding to each other. The starting point of a point group may correspond to the first signal point of a sequencing signal, and the ending point of the point group may correspond to the last signal point of the sequencing signal. The sequencing signal corresponding to the point group may be separated from the nanopore sequencing time series electrical signal based on the starting point and the ending point of the point group.
[0043] According to an embodiment of the present disclosure, determining a point group based on the signal value of a nanopore sequencing time series electrical signal includes: acquiring the signal value of a current signal point one by one from the nanopore sequencing time series electrical signal; calculating a first fitting mean of the current signal point based on the signal value of the current signal point; calculating a first fitting variance of the current signal point based on the signal value of the current signal point and the first fitting mean of the current signal point; calculating a starting point threshold of the current signal point and an ending point threshold of the current signal point based on the fitting mean of the current signal point and the first fitting variance of the current signal point; determining whether the current signal point is the starting point of the point group based on the starting point threshold of the current signal point, and / or determining whether the current signal point is the ending point of the point group based on the ending point threshold of the current signal point.
[0044] Understandably, the signal values of the nanopore sequencing time series electrical signal can be obtained one by one, that is, the signal value of each signal point of the nanopore sequencing time series electrical signal is read in time order to determine whether the signal point is the starting point or the ending point of the sequencing signal, and then the sequencing signal is obtained according to the position of a group of starting points and ending points. According to an embodiment of the present disclosure, one or more point groups can be determined to obtain one or more sequencing signals.
[0045] Specifically, the signal value i(k) of the kth signal point can be obtained from the nanopore sequencing time series electrical signal; the first fitting mean μ(k) of the kth signal point is calculated based on i(k), and the calculation formula is μ(k)=aμ(k-1)+(1-a)i(k), where μ(k-1) is the first fitting mean of the k-1th signal point; the first fitting variance σ of the kth signal point is calculated based on i(k) and μ(k) 2 (k), calculated as σ 2 (k) = aσ 2 (k-1)+(1-a)(i(k)-μ(k)) 2 ; According to μ(k) and σ of the current signal point 2 (k) Calculate the starting point threshold ηS(k) and the ending point threshold ηE(k) of the current signal point. The calculation formulas are η S (k)=μ(k)-Sσ(k),η E (k) = μ(k) - Eσ(k); when the signal value of the kth signal point is less than ηS (k), determine the kth signal point as the starting point of the point group; and / or when the signal value of the kth signal point is greater than η E (k), and when the variable bal is greater than the preset value of bal, the kth signal point is determined as the end point of the point group.
[0046] Optionally, a is momentum, a can be taken as 0.95; S can be taken as 2.7; E can be taken as 0.1: When calculating the first point or encountering the end point, μ(k-1) is set as openpore, and the initial openpore value is 220; the default value of bal can be 5.
[0047] Optionally, the updating method of the variable bal at each signal point includes: the initial value of the variable bal is 0; judging whether the variable bal is greater than the end point threshold of the current signal point; if the variable bal is greater than the end point threshold of the current signal point, bal=bal+1; if the variable bal is less than or equal to the end point threshold of the current signal point, bal=max(0,bal-1).
[0048] According to the embodiments of the present disclosure, the signal value of each signal point of the nanopore sequencing time series electrical signal can be read in time sequence; first find the starting point of the point group, and after finding the starting point of the point group that meets the conditions, start looking for the end point of the point group after the starting point of the point group, and after finding the end point of the point group that meets the conditions, this pair of points (i.e., point group) is the starting and ending point of a read. After finding the end point of the point group that meets the conditions, set the value of the variable bal to 0. Then continue to find the starting point and end point of the next point group in time sequence, that is, find the next read (the read corresponding to the next point group).
[0049] According to an embodiment of the present disclosure, a first fitting mean of the current signal point is calculated according to the signal value of the current signal point and the fitting mean of historical signal points. A first fitting variance of the current signal point is calculated according to the signal value of the current signal point, the first fitting mean of the current signal point, and the fitting variance of historical signal points.
[0050] Figure 2 The figure shows the sequencing signal separated from the nanopore sequencing time series electrical signal according to the embodiment of the present disclosure, wherein the shaded background is the separated sequencing signal.
[0051] According to an embodiment of the present disclosure, the sequencing signal may be filtered and / or abnormal signals may be removed.
[0052] Specifically, the sequencing signal may be further processed, such as noise reduction, filtering or cutting off the degating (sequencing abnormal processing) signal. Cutting off the degating (sequencing abnormal processing) signal means cutting off the abnormal signal.
[0053] According to an embodiment of the present disclosure, sequencing signals with a length less than a preset length threshold of 1000, an average value less than a preset average threshold, and / or a median less than a preset median threshold can be filtered. The preset length threshold can be 900 or 1000, and the preset average threshold and the preset median threshold can be 30pA or 31pA.
[0054] According to the embodiments of the present disclosure, starting from the preset position of the sequencing signal, it is possible to determine whether the current signal point is a cutting point one by one in a time sequence; if the current signal point is determined to be a cutting point, the sequencing signal after the cutting point is cut off. The preset position may be a signal point at the 3 / 4 position or the 4 / 5 position of the sequencing signal, which is not specifically limited in this embodiment.
[0055] Specifically, determining whether the current signal point is a cutting point may include: calculating a second fitting mean and a second fitting variance of the current signal point; and determining whether the current signal point is a cutting point according to the second fitting mean and the second fitting variance of the current signal.
[0056] The second fitting mean μ′(k) and the second fitting variance σ′ of the kth signal point in the sequencing signal can be obtained 2 (k), where μ′(k)=bμ′(k-1)+(1-b)i(k),σ′ 2 (k) = bσ′ 2 (k-1)+(1-b)(i(k)-μ′(k)) 2 . b is momentum, and the value of b can be 0.995; μ′(0) is the average value of the first preset number of signal points starting from the preset position of the sequencing signal, and the first preset number can be 5 or 6, etc.; σ′(0) is the standard deviation of the second preset number of signal points starting from the preset position of the sequencing signal, and the second preset number can be 5 or 6, etc. If i(k) is less than μ′(k-1)-5σ′(k-1), the kth signal point in the sequencing signal is the cutting point; if i(k) is greater than or equal to μ′(k-1)-5σ′(k-1), the kth signal point in the sequencing signal is not the cutting point.
[0057] Figure 3 The figure shows the sequencing signal after the abnormal signal is removed according to the embodiment of the present disclosure, wherein the shaded background is the separated sequencing signal.
[0058] In step S106, feature extraction is performed on the sequencing signal to obtain a feature value. The feature value may include at least one of the feature values described below. In one embodiment, feature extraction is performed on the nanopore sequencing time series electrical signal, for example, using a MultiRocket algorithm.
[0059] According to an embodiment of the present disclosure, feature extraction may be performed on the sequencing signal after filtering and / or removing the abnormal signal to obtain a feature value.
[0060] In the present disclosure, the MultiRocket algorithm is used directly to obtain characteristic values of nanopore sequencing time series electrical signals without converting them into base sequences. This compresses the sequencing signal classification process so that it can be classified from the original electrical signals without base interpretation, greatly improving efficiency.
[0061] MultiRocket shares the general architecture of MiniRocket, which uses convolutional kernels to transform time series and computes features based on the convolution output (which can then be fed into a linear classifier for classification). Figure 4 The figure shows the average ranking of classification accuracy of different algorithms in 109 UCR datasets. The thick horizontal line indicates that there is no significant difference in the accuracy of the two algorithms. Figure 4 As shown, MultiRocket is much more accurate than MiniRocket, and its accuracy is not much worse than the most accurate TSC method to date (e.g., HIVE-COTE 2.0). Figure 5 The total training time of different algorithms to complete 112 UCR data classification tasks is shown. Figure 5 As shown in Figure 2, MultiRocket is only 3 times slower than MiniRocket with the same number of 50,000 features. However, MultiRocket is still much faster than all other algorithmic approaches.
[0062] The MultiRocket algorithm uses a large number of convolutions, combined with engineering techniques such as dilated convolutions and random bias terms, to extract some potentially important eigenvalues, and then imports these eigenvalues into a linear classification machine learning model to complete the time series classification task.
[0063] Specifically, using the MultiRocket algorithm for sequence classification can have the following advantages:
[0064] 1) Regarding the limitations and robustness issues of existing technologies:
[0065] a. The time series classification method based on MultiRocket solves the problem through data. In theory, it can identify target signals of any form as long as the training set is prepared, so the application scenarios are much wider than traditional solutions.
[0066] b. The time series classification model trained based on data naturally has good robustness and generalization ability. Even if it is not robust in some cases, this problem can be solved by adding such data back into the training set and retraining the model.
[0067] 2) Addressing the low efficiency of existing technologies
[0068] a. Most traditional time series classification methods require complex feature engineering or data preprocessing. MultiRocket uses random convolution kernels to automatically extract features, greatly improving problem-solving efficiency.
[0069] b. Many advanced time series classification methods achieve high classification accuracy by designing very complex learning models. The time complexity and scalability of these solutions are very poor. The method used in the present invention uses a random convolution kernel of fixed length to extract features and only uses a very simple linear model for classification. The time efficiency and scalability of this method are incomparable to those of complex models.
[0070] In an embodiment of the present disclosure, feature extraction using the MultiRocket algorithm may include the following aspects that may be used alone or in combination:
[0071] First-order difference: Use the original sequence and the first-order difference sequence as input sequences to obtain different features. For example, the first-order difference sequence of the {1, 2, 3, 4, 5} sequence signal is {2-1, 3-2, 4-3, 5-4} = {1, 1, 1, 1}.
[0072] Convolution kernel: Use a convolution kernel of fixed length. For example, the length of the convolution kernel can be set to 9, and the weights can be, for example, {-1, -1, -1, -1, -1, -1, 2, 2, 2}. In the case of a fixed length, the weight value of the convolution kernel can remain unchanged, but the arrangement can be changed. For example, {2, -1, -1, -1, -1, -1, 2, 2, -1} or {2, 2, -1, -1, -1, -1, 2, -1, -1} can be set, and there are 84 weight arrangements.
[0073] As an example, assuming the convolution kernel is {-1, -1, -1, -1, -1, -1, 2, 2, 2}, and the sequence data is {1, 1, 1, 1, 1, 1, 1, 1, 1}, then the result is (-1*1)+(-1*1)+(-1*1)+(-1*1)+(-1*1)+(-1*1)+(2*1)+(2*1)+(2*1)=0.
[0074] Dilated convolution: Add dilated convolution to obtain receptive fields of different scales.
[0075] Padding: You can use 0 as standard padding, and the padding is done alternately, that is, half of the weight / dilated convolution combinations are not padded, and half of the combinations are padded.
[0076] Figure 6FIG. 4 is a schematic diagram showing a dilated convolution and padding terms according to an embodiment of the present disclosure. Figure 6 In the example shown, the dilation distance is 2 and the receptive field length is increased to 5. In addition, Figure 6 An example of padding with zeros is also given.
[0077] Bias term: Randomly select some samples and use the quartile of their convolution output as bias. The bias term is the only random processing process in the feature extraction process.
[0078] In some embodiments, the feature sequence obtained through the above feature extraction stage is subjected to a pooling operation. For example, a total of 4 pooling operators may be provided, wherein the 4 pooling operators are calculated in parallel, and each feature sequence is calculated by the pooling operator to generate the following 4 independent feature values, which can be input into the linear classification model.
[0079] PPV: the proportion of positive values in the sequence
[0080] MPV: the mean of the positive values in the series
[0081] MIPV: the average of the positive indexes in the sequence
[0082] LSPV: Maximum number of consecutive positive values
[0083] Table 1. Calculation of four eigenvalues using the pooling operator
[0084]
[0085] Table 1 shows an example of using the pooling operator to calculate 4 eigenvalues in MultiRocket. For example, in Table 1, the feature sequence is {0, 0, 0, 0, 0, 0, 1, 1, 1, 1}, where there are 4 consecutive positive values, then PPV = 0.4, MPV = 1, MIPV = 7.5, and LSPV = 4. It should be understood that the number of eigenvalues to be calculated is not limited to 4, and other eigenvalues may be calculated in addition or alternatively.
[0086] Back to Figure 1 ,exist Figure 1 In step S108, the obtained feature values are input into a linear classification model to classify the sequencing signals. In some examples, the linear classification model may be a ridge regression model.
[0087] According to an embodiment of the present disclosure, method 100 may further include: sequencing data acquisition: acquiring nanopore sequencing time series electrical signal data containing target signals, that is, each sequence contains a number of target signal fragments, and the target signal can theoretically be in any form (for example, detectable by naked eyes). Figure 7A schematic diagram of sequence data according to an embodiment of the present disclosure is shown. Figure 7 In the figure, the sequence data contains two mode signals, 1 is the sequencing signal and 2 is the pore opening current signal.
[0088] According to an embodiment of the present disclosure, method 100 may further include: preprocessing the nanopore sequencing time series electrical signal or sequencing signal to convert it into a sequence of predetermined length. For example, sequencing data preprocessing may include converting one-dimensional sequencing data containing the target signal into a fixed-length signal, which may generally be truncated or zero-filled, or other resampling methods may be used, such as nearest neighbor interpolation, bilinear interpolation, and cubic convolution interpolation, etc. The input format of the classifier (i.e., classification model) may be a signal of the same length. For these two test cases, in embodiment 1, the characteristic signal is at the tail, and after obtaining the sequencing signal, the number of points (signal points) of the fixed length of the tail is taken. For embodiment 2, since the barcode sequence may be connected to the head or the tail, the fixed number of points at the head and the fixed number of points at the tail are spliced into a signal of fixed length. For sequencing signals of uncertain length, it is generally necessary to roughly determine the location of the characteristic signal or, based on the characteristic signal situation, use truncation, zero-filling or resampling to make the signal of the final input model fixed length.
[0089] According to an embodiment of the present disclosure, method 100 may further include training a feature extraction and linear classification model, wherein the training includes:
[0090] - Annotate sequencing signals to generate training data;
[0091] - Iteratively (e.g., by using the MultiRocket algorithm) extract features from the training data and input the extracted feature values into a linear classification model for classification, so that the classification result matches the annotation result; and
[0092] -Stores parameters used in linear classification models and feature extraction (e.g. MultiRocket algorithm).
[0093] The above steps can save a linear classification model and feature extraction parameters. The saved parameters and model can then be used to perform time series classification tasks in combination with specific sequencing work, for example:
[0094] Refer to the above data preprocessing logic to preprocess the unknown sequence first;
[0095] Input the preprocessed sequence data into the trained model for feature extraction and linear model classification.
[0096] In some embodiments, training data generation can be performed. A two-dimensional line graph can be drawn using the sequenced electrical signal, such as Figure 8shown. Figure 8 The signal generated by three different pore states according to the embodiment of the present disclosure is shown, wherein each data point of the sequencing signal is a voltage value in picoamperes (pA), the horizontal axis is the index of the data point, the sampling rate is 5000 sample / s, and a total of 1s of data is captured in the figure. An experienced sequencing engineer is asked to label the sequencing signal, as shown in the figure, normal is a normal sequencing signal, unstable and inactive represent unstable or inactive electrical signals; or after the sequencing data is converted into a base sequence through basecall software (base calling technology), the label of the sequencing signal is made by analyzing the base sequence.
[0097] In some embodiments, the sequencing signal includes unstable and inactive signals.
[0098] DNA barcodes are short, standard DNA fragments that enable rapid, accurate, and standardized identification of species. When connecting libraries with different barcode sequences, it is necessary to classify which signals in the sequencing signals correspond to which barcodes. Since not every sequencing signal can be connected to a barcode, a specific strategy for barcode annotation of sequencing signals is proposed. Because the barcode sequence may be connected to the head or the tail, it is necessary to align the head and the tail once, and take the highest score of the two alignments as the score.
[0099] According to an embodiment of the present disclosure, labeling the sequencing signal may further include:
[0100] -Convert sequencing signals into base sequences;
[0101] - For each base sequence, the first M bases and the last N bases are cut off to compare with the corresponding barcode barcode based on the predetermined rules, and the highest score of the two comparisons is taken as the score, where M and N are appropriate values estimated according to the sequencing speed and the size of the adapter, so that the cut bases completely cover the connected barcode sequence; and
[0102] - The sequencing signals whose barcode matching scores exceed the predetermined score are labeled with the corresponding barcode tags.
[0103] The present disclosure also proposes a method for training a classification model. Fig. 9 A flowchart of a method 700 for training a classification model according to an embodiment of the present disclosure is shown.
[0104] According to an embodiment of the present disclosure, the classification model may include: MultiRocket feature extraction and a linear classification model, wherein the linear classification model may be a ridge regression model.
[0105] like Fig. 9 As shown, in step S702, the sequencing signal is converted into a base sequence.
[0106] exist Fig. 9 In step S704, for each base sequence, the first M bases and the last N bases are cut off to compare and score with the corresponding barcode barcode based on a predetermined rule, and the highest score of the two comparisons is taken as the score, wherein M and N are appropriate values estimated according to the sequencing speed and the size of the adapter, so that the cut bases completely cover the connected barcode sequence.
[0107] According to an embodiment of the present disclosure, the predetermined rules include: adding 2 points for matching a base; subtracting 1 point for mismatching a base; a penalty of 0.5 points for initial gaps; and a penalty of 0.1 points for extended gaps.
[0108] exist Fig. 9 In step S706, the sequencing signals whose barcode comparison scores exceed a predetermined score are labeled with corresponding barcode tags.
[0109] According to an embodiment of the present disclosure, the predetermined score may be 45 points.
[0110] exist Fig. 9 In step S708, the sequencing signal with the barcode label may be preprocessed to obtain training data.
[0111] According to an embodiment of the present disclosure, preprocessing may include: intercepting data of the first m seconds and the last n seconds of all sequencing signals with barcode labels, and using the data as training data, where m>0, n>0.
[0112] exist Fig. 9 In step S710, the training data is input into the classification model to train the classification model.
[0113] The present invention will be further explained in detail below in conjunction with actual examples. Technicians and relevant developers can fully understand and practice the content of the present invention through detailed examples. Without departing from the main purpose of the present invention, logical, implementation and other changes can be flexibly made to the implementation. Therefore, the following detailed examples and descriptions are not so-called limiting meanings, and the scope of the invention is defined by the claims.
[0114] 1. Build hardware and software development environment
[0115] The present invention can be implemented based on the development environment shown in Table 2. Although the present invention can run stably on a machine with a general CPU configuration, the algorithm module involves the reading, writing and storage of a large amount of data as well as the training and testing of the model, which requires a large amount of data calculation and operation. Running in a high-performance C software and hardware environment can significantly improve efficiency and stability.
[0116] Table 2. Development environment
[0117]
[0118] 2. Data pre-collection and extraction
[0119] The data were collected using a single-channel nanopore sequencing device and a PC. The target library data was collected using the nanopore sequencing device, and the collected signal data and other information were saved as an h5 file structure and stored in real time in the PC hard disk.
[0120] 3. Algorithm
[0121] The time series classification algorithm used in the present invention is the open source MultiRocket algorithm (the input is a 1-dimensional time series. Assuming that there are 4 classification items required, then the output of each time series is one of {0, 1, 2, 3}, which is the result of model judgment). MultiRocket uses a large number of convolutions, combined with the engineering techniques of dilated convolution and random bias terms, to extract some potentially important eigenvalues, which can be imported into the machine learning model of linear classification to complete the classification task of time series.
[0122] 4. Example 1: Sequencing integrity analysis
[0123] Fig.10 A schematic diagram of adding a characteristic sequence to the end of a sequencing library according to an embodiment of the present disclosure is shown. As shown in the figure, a characteristic sequence is added to the end of a sequencing library, which generates a specific signal feature during the sequencing process, thereby being used to determine the integrity of the sequencing.
[0124] 1) Data collection, labeling and preprocessing
[0125] The complete nanopore electrical signal of each channel collected is used to extract the sequencing signal through the separation algorithm described above, and each collected sequencing signal is plotted and then handed over to a professional sequencing engineer for data annotation. Since the characteristic signal is at the tail, the data of the tail 1 second can be intercepted. All data can be divided into a test set and a training set.
[0126] 2) Feature extraction
[0127] Select the sequencing signals of the training set, and use the feature extraction method mentioned in the technical solution to extract features. Here, the number of features is set to 50,000. And retain the corresponding feature extraction parameters (for example, the coefficient and bias of the dilated convolution).
[0128] 3) Model training
[0129] Use the feature values extracted in the previous step and the known labels to input into the ridge regression model for iterative training. Save the model after training.
[0130] 4) Testing
[0131] The data of the test set is extracted using the saved feature extraction parameters, input into the model in the previous step for prediction, and the accuracy of the prediction results is calculated. Different parameters can be used to improve the classification effect according to the test results or application scenarios, for example, different linear models can be used or different numbers of features can be set.
[0132] Fig.11 The classification accuracy of sequencing signals obtained by two different motor proteins according to the embodiment of the present disclosure is shown. As shown in the figure, the same model has a good accuracy under different usage conditions, indicating that the algorithm is very robust.
[0133] 5. Example 2: barcode sequence classification
[0134] When connecting libraries using different barcode sequences, it is necessary to classify which signals in the sequencing signals correspond to which barcode.
[0135] 1) Data labeling
[0136] Since not every sequencing signal can be connected to a barcode, the strategy of the present invention is to perform base interpretation on the sequence of each barcode signal and then use a comparison algorithm to calculate the score, wherein the extraction and preprocessing of the sequencing signal are completed by the separation algorithm described above, and the first 150 bases and the last 100 bases can be intercepted and compared with the corresponding barcode for scoring. Based on the above predetermined rules, 2 points are added for matching a base, 1 point is deducted for mismatching a base, 0.5 points are penalized for initial gaps, and 0.1 points are penalized for extended gaps. Fig.12 The distribution histogram of the comparison score calculation results according to the embodiment of the present disclosure is shown. As shown in the figure, only the sequence connected to the corresponding barcode can get a high score of more than 45 points, so the signal with a barcode matching score of more than 45 points can be selected and marked with the corresponding barcode label.
[0137] 2) Data preprocessing
[0138] The data before 1s and after 0.5s of all labeled signals can be intercepted, and all the data can be used as training sets.
[0139] 3) Feature extraction and model training
[0140] The MultiRocket algorithm is used for feature extraction and model training, where the number of feature extraction can be set to 50,000, and the linear classification model can use the ridge regression model.
[0141] 4) Prediction and effect analysis
[0142] The data was preprocessed using signals mixed with four different barcodes and then imported into the model. After the sequence classification was completed, the classified sequences were base-read and compared with the sequences of the four barcodes for scoring. Fig.13 The schematic diagram of the result of comparing the predicted barcode sequence with the four barcode sequences according to the embodiment of the present disclosure is shown. As shown in the figure, the result shows that the score of the predicted barcode sequence and the corresponding barcode is significantly higher than that of other groups, indicating that the classification of the model is effective.
[0143] Fig.14 A schematic block diagram of an apparatus 1200 for performing methods 100 and 700 according to an example embodiment is schematically shown. Fig.14 The device shown can be any device with processing capability. Fig.14 The device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0144] like Fig.14 As shown, the device 1200 according to this embodiment includes a central processing unit (CPU) 1201, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1202 or a program loaded from a storage part 1208 into a random access memory (RAM) 1203. In the RAM 1203, various programs and data required for the operation of the device 1200 are also stored. The CPU 1201, the ROM 1202, and the RAM 1203 are connected to each other via a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.
[0145] The device 1200 may further include one or more of the following components connected to the I / O interface 1205: an input section 1206 including a keyboard or a mouse, etc.; an output section 1207 including a cathode ray tube (CRT) or a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 1208 including a hard disk, etc.; and a communication section 1209 including a network interface card such as a LAN card or a modem, etc. The communication section 1209 performs communication processing via a network such as the Internet. A drive 1210 is also connected to the I / O interface 1205 as needed. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, etc., is installed on the drive 1210 as needed, so that a computer program read therefrom is installed into the storage section 1208 as needed.
[0146] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part 1209, and / or installed from a removable medium 1211. When the computer program is executed by a central processing unit (CPU) 1201, the above-mentioned functions defined in the device of the embodiment of the present application are executed.
[0147] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable or RF, etc., or any suitable combination of the above.
[0148] The method of the present invention and the equipment involved have been described above in conjunction with the preferred embodiments. It will be appreciated by those skilled in the art that the method shown above is exemplary only. The method of the present invention is not limited to the steps and sequence shown above. The equipment shown above may include more modules, for example, modules that can be developed or developed in the future and can be used for the equipment, etc. The various identifiers shown above are exemplary only and not restrictive, and the present invention is not limited to the specific information elements that are examples of these identifiers. Those skilled in the art may make many changes and modifications based on the teachings of the illustrated embodiments.
[0149] The sampling method, feature extraction algorithm, classification model, data conversion into pictures, etc. used in the present disclosure can be improved, deformed, or replaced. The present disclosure can also be extended to the fields of time series clustering, automatic time series annotation, or anomaly detection.
[0150] The program running on the device according to the present disclosure may be a program that enables a computer to implement the functions of the embodiments of the present disclosure by controlling a central processing unit (CPU). The program or information processed by the program may be temporarily stored in a volatile memory (such as a random access memory RAM), a hard disk drive (HDD), a non-volatile memory (such as a flash memory), or other memory systems.
[0151] The program for realizing the functions of each embodiment of the present disclosure can be recorded on a computer-readable recording medium. The corresponding functions can be realized by making a computer system read the program recorded on the recording medium and executing these programs. The so-called "computer system" herein can be a computer system embedded in the device, and can include an operating system or hardware (such as a peripheral device). "Computer-readable recording medium" can be a semiconductor recording medium, an optical recording medium, a magnetic recording medium, a recording medium of a short-term dynamic storage program, or any other recording medium readable by a computer.
[0152] The various features or functional modules of the devices used in the above embodiments can be implemented or executed by circuits (e.g., monolithic or multi-chip integrated circuits). Circuits designed to perform the functions described in this specification may include general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic, discrete hardware components, or any combination of the above devices. The general-purpose processor may be a microprocessor, or any existing processor, controller, microcontroller, or state machine. The above circuits may be digital circuits or analog circuits. In the case where new integrated circuit technologies have emerged to replace existing integrated circuits due to advances in semiconductor technology, one or more embodiments of the present disclosure may also be implemented using these new integrated circuit technologies.
[0153] As mentioned above, the embodiments of the present disclosure have been described in detail with reference to the accompanying drawings. However, the specific structure is not limited to the above embodiments, and the present disclosure also includes any design changes that do not deviate from the main purpose of the present disclosure. In addition, various changes can be made to the present disclosure within the scope of the claims, and the embodiments obtained by appropriately combining the technical means disclosed in different embodiments are also included in the technical scope of the present disclosure. In addition, the components with the same effect described in the above embodiments can be replaced by each other.
Claims
1. A method for classifying nanopore sequencing time series electrical signals, the method comprising: Acquire nanopore sequencing time series electrical signals; Separating a sequencing signal from the nanopore sequencing time series electrical signal; Performing feature extraction on the sequencing signal to obtain a feature value, wherein the feature value includes at least one of a proportion of positive values (PPV), a mean value of positive values (MPV), a mean value of positive value indexes (MIPV), and a maximum number of consecutive positive values (LSPV); as well as The obtained feature values are input into a linear classification model to classify the sequencing signals.
2. The method according to claim 1, wherein separating the sequencing signal from the nanopore sequencing time series electrical signal comprises: Determine a point group according to the signal value of the nanopore sequencing time series electrical signal, wherein the point group includes a start point and an end point; Sequencing signals are separated from the nanopore sequencing time series electrical signals according to the point groups.
3. The method according to claim 2, wherein determining a point group according to a signal value of the nanopore sequencing time series electrical signal comprises: Acquire the signal value of the current signal point one by one from the nanopore sequencing time series electrical signal; Calculating a first fitting mean value of the current signal point according to the signal value of the current signal point; Calculating a first fitting variance of the current signal point according to the signal value of the current signal point and the first fitting mean of the current signal point; Calculate a starting point threshold of the current signal point and an ending point threshold of the current signal point according to a fitting mean of the current signal point and a first fitting variance of the current signal point; Determine whether the current signal point is the starting point of the point group according to the starting point threshold of the current signal point, and / or determine whether the current signal point is the ending point of the point group according to the ending point threshold of the current signal point.
4. The method according to claim 1, further comprising: The sequencing signals are filtered and / or abnormal signals are removed.
5. The method according to claim 1, further comprising: The sequencing signal is subjected to feature extraction by the MultiRocket algorithm.
6. The method according to claim 1, wherein: The linear classification model is a ridge regression model.
7. The method according to claim 1, further comprising training the feature extraction and the linear classification model, wherein: The training includes: Annotate sequencing signals to generate training data; Iteratively extracting features from the training data and inputting the extracted feature values into the linear classification model for classification, so that the classification result matches the annotation result; and The linear classification model and parameters used in feature extraction are stored.
8. The method according to claim 7, wherein the annotation comprises: Converting the sequencing signal into a base sequence; For each base sequence, the first M bases and the last N bases are cut off to compare with the corresponding barcode barcode based on the predetermined rules, and the highest score of the two comparisons is taken as the score, where M and N are appropriate values estimated according to the sequencing speed and the size of the adapter, so that the cut bases completely cover the connected barcode sequence; and The sequencing signals whose barcode matching scores exceed the predetermined score are marked with corresponding barcode tags.
9. A device for classifying nanopore sequencing time series electrical signals, the device comprising: Processing circuit; as well as A memory storing instructions, which, when executed by the processing circuit, cause the device to perform the method according to any one of claims 1 to 8.
10. A non-transitory computer readable medium storing a computer program, the computer program comprising instructions which, when executed by a processing circuit, cause the processing circuit to perform the method according to any one of claims 1 to 8.