Methods for classifying nucleic acid sequences using machine learning
By dividing the nucleic acid sequence database into short sequences and using neural network classifiers for classification, the problem of inaccurate classification of emerging sequences and high computational complexity is solved, and accurate and rapid classification and reliability assessment of nucleic acid sequences are achieved, which is suitable for ordinary computers. .
Patent Information
- Application Number
- CN202110378157.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-12-21
- Filing Date
- 2021-04-08
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-04-08
AI Technical Summary
In the existing technology, there are problems in the classification of nucleic acid sequences, such as inaccurate classification of new sequences, low discrimination of short sequences, and excessive calculations caused by imbalanced databases, which are especially difficult to complete on ordinary computers.
By dividing all nucleic acid sequences in the nucleic acid sequence database into short sequences of equal length, construct a Kmer dictionary and use a neural network classifier for multi-classification, train and save the classification for the sequence to be detected, and display the reliability score of each label .
It achieves accurate and rapid classification of nucleic acid sequences to be detected, reduces the storage space and computing resource requirements of the model, expands the scope of application of machine learning in nucleic acid sequence classification, and provides a reference for the reliability of each label.
Smart Images

Figure CN113096740B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of biotechnology, and in particular to a method for classifying nucleic acid sequences using machine learning. Background Art
[0002] At present, the classification of nucleic acid sequences mostly adopts the method of sequence comparison. First, nucleic acid sequences with clear labels are obtained to build a database, and then the nucleic acid sequence to be detected is compared with the nucleic acid sequences in the database one by one to find the sequence with the highest similarity. Finally, the label of the sequence with the highest similarity will be assigned to the sequence to be detected as its category.
[0003] Although sequence alignment methods are widely used, their limitations are also very obvious. Since the current databases are all constructed based on known classification sequences, the sequence alignment method cannot correctly classify newly emerged nucleic acid sequences; at the same time, in the process of gene sequence determination, due to technical and financial limitations, the nucleic acid sequence obtained may only be a part of its complete genome sequence, sometimes even shorter than 1000bp, and the sequence alignment method has a lower degree of discrimination for short sequences; as the number of reference sequences in the database continues to increase, the amount of calculation required to detect the target sequence will continue to increase, and it may even be difficult to complete on an ordinary computer. Summary of the invention
[0004] In order to solve the above problems, the present invention provides a method for classifying nucleic acid sequences using machine learning, the method comprising the following steps: S0: collecting nucleic acid sequences with accurate classification labels to construct a nucleic acid sequence database; S1: dividing all nucleic acid sequences in the nucleic acid sequence database into short sequences of equal length, thereby forming a balanced sample of short nucleic acid sequences, the length of which is 4 bp to the length of the shortest sequence in the nucleic acid sequence database, the balanced sample of short nucleic acid sequences is suitable for machine learning, and the balanced sample of short nucleic acid sequences refers to the number N of short nucleic acid sequences with the largest number of classification labels. most The number of short nucleic acid sequences with the minimum number of classification labels N least: a short nucleic acid sequence sample when the ratio of is not more than 5, preferably the ratio is not more than 2; S2: according to the nucleic acid sequence in the nucleic acid sequence database, extract the nucleic acid Kmer, the nucleic acid Kmer length is 4≤Kmer length≤the length of the short sequence, and form a Kmer dictionary of the nucleic acid sequence; S3: use the Kmer dictionary in S2 to convert the short nucleic acid sequence balanced samples in S1 into digital signals; S4: use the digital signal in S3 to train a neural network classifier that can perform multiple classifications on nucleic acid sequences with classification labels, and the neural network classifier is used to identify and judge the classification of the nucleic acid sequence to be detected in the nucleic acid database; S5: use the Kmer dictionary in S2 to convert the nucleic acid sequence to be detected into a digital signal; S6: input the digital signal in S5 into the trained neural network classifier in S4 to classify the nucleic acid sequence to be detected.
[0005] In one embodiment, the method of the present invention further includes step S7: displaying the classification results of the nucleic acid sequence to be detected.
[0006] In one embodiment, S7 displays the ID of each sequence and possible classification labels of the ID sequence; and displays the reliability score of the classification label, wherein the higher the score, the higher the reliability of the classification label of the ID sequence.
[0007] In one embodiment, the S1 comprises the following steps:
[0008] S1-1: Determine whether all nucleic acid sequences in the nucleic acid sequence database are balanced;
[0009] S1-2-1: If balanced, all nucleic acid sequences in the nucleic acid sequence database are divided into short sequences of equal length using the same segmentation step length, wherein the same segmentation step length is the shift length during segmentation, and the shift length is not greater than the length of the short sequence, and all nucleic acid sequences in the nucleic acid sequence database are divided to obtain short sequence samples;
[0010] S1-2-2: If there is an imbalance, each type of label nucleic acid sequence in the nucleic acid sequence database is divided into short sequences of equal length using its own segmentation step length. The segmentation step length of each type of label nucleic acid sequence is the shift length when segmenting each type of label nucleic acid sequence. The shift length is not greater than the length of the short sequence. All nucleic acid sequences in the nucleic acid sequence database are segmented to obtain short sequence samples.
[0011] S1-3: Determine whether the sample of short nucleic acid sequences obtained by S1-2-1 or S1-2-2 is a balanced sample suitable for machine learning. If so, stop S1-2-1 or S1-2-2. If not, repeat S1-2-1 or S1-2-2 until a balanced sample of short nucleic acid sequences suitable for machine learning is obtained.
[0012] In one embodiment, S1-2-2 includes the following steps: (1) obtaining the ratio of the number of each type of nucleic acid sequence in the nucleic acid sequence database with accurate classification labels to a specific value, wherein the selection range of the specific value is the number N of nucleic acid sequences with the largest number of labels in the nucleic acid sequence database; most The number of nucleic acid sequences with the minimum number of tags N least any value between the ratio value = specific value ÷ number of each type of nucleic acid, if the ratio value is less than 1, the ratio value is artificially set to 1; and (2) according to the ratio value of each type of nucleic acid, the segmentation step length of such nucleic acid is obtained, segmentation step length = short sequence length ÷ ratio value.
[0013] In one embodiment, S2 includes: S2-1: using software to extract all Kmer composition sets in the nucleic acid sequence database; and, S2-2: constructing a Kmer dictionary, sorting all Kmers in S2-1 in alphabetical order from small to large, and inserting the first position of the sorted Kmer into <unk>Indicates a Kmer that does not exist in the dictionary.
[0014] In one embodiment, the dictionary is queried in the manner of Kmer:Kmer's position in the dictionary.
[0015] In one embodiment, the software in S2-1 is jellyfish software.
[0016] In one embodiment, S4 includes the following steps: S4-1: building a model containing an input layer, an embedding layer, a maximum pooling layer, an average pooling layer, an intermediate merging layer, a fully connected layer one, a fully connected layer two, and an output layer; S4-2: inputting the digital signal obtained in S3 into the model built in S4-1 for training until the neural network becomes a neural network classifier for multi-classification of the input nucleic acid sequence, and the classification label is the classification label in the S0 nucleic acid database; S4-3: saving the trained model in S4-2 for subsequent analysis of the sequence to be detected.
[0017] In one embodiment, 50%-90% of the digital signals in S3 are used as a training set, and 10%-50% of the digital signals in S3 are used as a test set. The training set is input into the neural network constructed in S4-2, and the network is repeatedly trained and continuously tested using the test set until the classification performance of the network meets the requirements of becoming a neural network classifier for multi-classification of the input nucleic acid sequence, and its classification label is the classification label of the nucleic acid sequence in the nucleic acid database.
[0018] In the method of the present invention, in step S1, the corresponding step length is set according to the number of nucleic acids in each category in the database to segment the nucleic acids of each category, so as to obtain short sequence balanced samples, which are suitable for machine learning and obtain a reliable neural network classifier. The length of the short sequence can be flexibly selected according to the length of the subsequent sample to be detected.
[0019] In step S2, Kmer extraction software is used to directly extract all Kmers in the database to form a dictionary, which can reduce the amount of calculation of the Embedding array corresponding to the dictionary in subsequent steps, reduce the storage space of the model, and increase the portability of the model.
[0020] In step S4, a nucleic acid sequence classifier is trained and saved, which can quickly classify the nucleic acid sequence to be detected into corresponding nucleic acid sequence tags in the database.
[0021] In step S7, the display part is the ID of each sequence and multiple possible classification labels of the ID sequence; and the reliability score of the possible classification label is displayed. The higher the score, the more reliable the ID sequence is for this classification label, which provides a reference for studying the relationship between the ID sequence and multiple categories of labels.
[0022] Through the method of the present invention, the nucleic acid sequence to be detected can be accurately and quickly classified into corresponding nucleic acid sequence tags in the database, and the reliability score of each tag can be displayed, providing a reference for subsequent research and increasing the use value of the model.
[0023] When the nucleic acid sequences in the database are unbalanced, the method of the present invention uses the respective segmentation step sizes for each type of label nucleic acid sequence in the nucleic acid sequence database to segment each type of label nucleic acid sequence into short sequences of equal length to form a balanced sample of short nucleic acid sequences, thereby avoiding the phenomenon that the database is unavailable or additional efforts are needed to increase nucleic acid samples due to the imbalance of nucleic acid sequences in the database, and increasing the scope of application of machine learning for classification of nucleic acid sequences.
[0024] Since the total number of Kmers of a certain length is 4 k / 2+1 (k value is the length of Kmer), so when k value is large enough, the total number of Kmer will become very large and difficult to handle with local computer resources. For example, when k=20, the number of Kmer is about 549.7 billion, and the corresponding Embedding array will store even more data. The method of the present invention uses Kmer extraction software to directly extract all Kmers in the database to form a dictionary, which can reduce the amount of calculation of the Embedding array corresponding to the dictionary in the subsequent steps, reduce the storage space of the model, and increase the portability of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0026] Figure 1 is a flow chart of the method of the present invention;
[0027] Figure 2 It is a schematic diagram of the number corresponding to each subtype in the nucleic acid sequence database of the embodiment of the present invention. There are 184 subtypes in total, which are sorted from large to small according to the number of subtypes, and the names and numbers of the first 26 subtypes are intercepted;
[0028] Figure 3 The ratio result diagram of each subtype compared to a specific value is obtained by the number of each subtype in the nucleic acid database of the embodiment of the present invention. The ratio values of 184 subtypes are sorted from large to small according to the ratio values, and the names and ratio values of the top 20 subtypes are intercepted;
[0029] Figure 4 It is a schematic diagram of the result of sorting the full-length DNA sequences of the genomes of 184 subtypes in the nucleic acid database of the embodiment of the present invention according to the number of subtypes in short sequences, and intercepting the names of the first 21 subtypes and the corresponding number of short sequences;
[0030] Figure 5 It is a schematic diagram of a txt file formed by extracting all 20mers in the nucleic acid database of the present invention using the jellyfish software in an embodiment of the present invention, and the first 13 20mers and their numbers are intercepted, and '>49' represents the number of the following 20mer ('AAAAAAAAAAAAAAAAAAAA') sequence in the database;
[0031] Figure 6 The present invention arranges the 20mer set in alphabetical order from small to large to form a 20mer dictionary schematic diagram, and the non-existent 20mer sequence is marked as <unk>, the number of dictionaries extracted from the nucleic acid database of the present invention totals 6,942,463 different 20mer sequences, and the first 25 20mers are intercepted;
[0032] Figure 7 A schematic diagram showing the digital signals of the first 20 1000 bp DNA sequences of the present embodiment, wherein the signal length of each sequence after conversion is 981, and 9284 represents the sequence represented by the 9824th 20mer in the 20mer dictionary;
[0033] Figure 8 is a flow chart of model construction in an embodiment of the present invention;
[0034] Fig. 9 is a schematic diagram of the model training process of an embodiment of the present invention;
[0035] Fig.10 This is a schematic diagram showing a portion of the fasta file of a nucleic acid sequence sample to be detected according to an embodiment of the present invention, where '>1' represents the name of the sequence, and the following is its nucleic acid sequence. This figure shows the names ('>1' and '>14') and nucleic acid sequences of two sequences to be detected;
[0036] Fig.11 : It is a schematic diagram of the classification result after the nucleic acid sequence to be detected in an embodiment of the present invention is input into the model, ID is the name of each sequence in the fasta file, Top-1 to Top-5 are the top 5 possible subtypes of this ID sequence, and the value in brackets is the reliability score of this subtype. The higher the score, the higher the reliability of this ID sequence for this subtype. DETAILED DESCRIPTION
[0037] In order to enable those skilled in the art to better understand the technical solutions in the present application, the present invention will be further described below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work should belong to the scope of protection of the present application. The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0038] like Figure 1 As shown, the purpose of the present invention is to classify nucleic acid sequences using machine learning. This embodiment targets HIV-1 virus, and the specific method is as follows:
[0039] S0: Collect nucleic acid sequences with accurate classification labels to build a nucleic acid sequence database: Collect HIV genomic DNA data with accurate classification labels to build a basic database. In this embodiment, the classification labels are various HIV subtype labels.
[0040] This database is derived from 12,825 complete HIV-1 DNA sequences (as of September 6, 2020) in the HIV sequence database (https: / / www.hiv.lanl.gov / components / sequence / HIV / search / search.html), and then a nucleic acid sequence database is constructed using genomic DNA sequences in which each subtype contains more than 2 DNA sequences, for a total of 184 subtypes.
[0041] S1: Divide all nucleic acid sequences in the nucleic acid sequence database into short sequences of equal length to form a balanced sample of short nucleic acid sequences. The length of the short sequence is 4bp to the length of the shortest sequence in the nucleic acid sequence database. The balanced sample of short nucleic acid sequences is suitable for machine learning. The balanced sample of short nucleic acid sequences refers to the number of short nucleic acid sequences with the largest number of classification labels N. most The number of short nucleic acid sequences with the minimum number of classification labels N least A short nucleic acid sequence sample when the ratio of is not more than 5, preferably the ratio is not more than 2;
[0042] S1-1: Determine whether all nucleic acid sequences in the nucleic acid sequence database are balanced. In the embodiment of the present invention, since there are 5703 sequences with HIV-1_B subtype tags and 2 sequences with HIV-1_AHJU subtype tags (not shown), the data is unbalanced. Figure 2 shown.
[0043] S1-2-2: For each type of label nucleic acid sequence in the nucleic acid sequence database, each type of label nucleic acid sequence is divided into short sequences of equal length using its own segmentation step. The segmentation step of each type of label nucleic acid sequence is the shift length when dividing each type of label nucleic acid sequence, and the shift length is not greater than the length of the short sequence. All nucleic acid sequences in the nucleic acid sequence database are divided to obtain short sequence samples.
[0044] (1) Obtaining the ratio of the number of each type of nucleic acid sequence in the nucleic acid sequence database with accurate classification labels to a specific value, wherein the specific value is selected within the number N of nucleic acid sequences with the largest number of labels in the nucleic acid sequence database. most The number of nucleic acid sequences with the minimum number of tags N least Any value between , ratio value = specific value ÷ number of nucleic acids of each type, if the ratio value is less than 1, the ratio value is artificially set to 1;
[0045] (2) The segmentation step length of each type of nucleic acid is calculated based on the ratio value of the nucleic acid. The segmentation step length = short sequence length / ratio value.
[0046] In this embodiment, the short sequence length is 1000 bp, and the calculation method of different step lengths is as follows:
[0047] (1) The ratio of each subtype to a specific value is calculated by the number of each subtype in the nucleic acid sequence database. The specific value is selected within the range of the number of tags containing the largest number of nucleic acid sequences in the database (N most ) and the number of tags with the least nucleic acid sequence (N least ) between (N least ≤Specific value≤N most ), in this embodiment, the number of HIV-1_A1 subtypes in the database is selected as a specific value, which is 497. Figure 1 Then the ratio of the number of each subtype to 497 is calculated to form a txt file. The ratio value = 497 ÷ the number of subtypes. If the ratio value is less than 1, the ratio value is set to 1. For example, if the number of HIV-1_01BC subtypes in the database is 50, then the ratio ratio = 497 / 50 = 9.94. Figure 3 shown.
[0048] (2) According to the ratio value of each type of nucleic acid, the segmentation step length of this type of nucleic acid is obtained, and the segmentation step length = short sequence length ÷ ratio value. For example, the step length of HIV-1_B subtype is step = 1000bp ÷ 1.0 = 1000bp, and the step length of HIV-1_01BC subtype is step = 1000bp ÷ 9.94 = 100.603 ≈ 100bp.
[0049] According to the step length of each subtype, the full-length genomic DNA sequence of the corresponding subtype in the nucleic acid sequence database is divided into 1000bp short DNA sequences. After dividing the nucleic acid sequence database, it can be found that HIV-1_C subtype contains the most 1000bp short DNA sequences, with a number of 5066; HIV-1_AHJU subtype contains the least 1000bp short DNA sequences, with a number of 2954 (not shown in the figure), as shown in the figure. Figure 4 shown.
[0050] S1-3: Determine whether the sample of short nucleic acid sequence obtained by S1-2-1 or S1-2-2 is a balanced sample suitable for machine learning. If yes, stop S1-2-1 or S1-2-2. If no, repeat S1-2-1 or S1-2-2 until a balanced sample of short nucleic acid sequence suitable for machine learning is obtained. most ÷N least ≤2, so the split samples are balanced.
[0051] S2-1: Use software to extract all Kmers in the nucleic acid sequence database to form a set. In this embodiment, the jellyfish software is used to extract all 20mers in the database. The value range of Kmer is: 4≤Kmer length≤short sequence length. In this embodiment, the short sequence length is 1000bp. Kmer selects 20mer, such as Figure 5 shown.
[0052] S2-2: Construct a Kmer dictionary, sort all Kmers in S2-1 in alphabetical order from small to large, and insert the first position of the sorted Kmer into <unk>Indicates a Kmer that does not exist in the dictionary.
[0053] In this embodiment, a 20mer dictionary is constructed. All 20mers in S2-1 are formed into a set and sorted in alphabetical order from small to large. Considering that the 20mer in the sequence to be detected may not exist in the 20mer set in S2-1, the first position of the sorted 20mer is inserted. <unk>Indicates a 20mer that does not exist in the dictionary. The dictionary query method is 20mer: the position of the 20mer in the dictionary. Figure 6 shown.
[0054] S3: Use the Kmer dictionary in S2 to convert the balanced samples of the short nucleic acid sequences in S1 into digital signals. In this embodiment, the balanced samples in S1-3 are converted into digital signals using the 20mer dictionary, and the samples are converted into digital signals according to the positions of the Kmers of the sample sequences in the Kmer dictionary, such as Figure 7 shown.
[0055] S4: Use the digital signal in S3 to train a neural network classifier that can perform multi-classification on nucleic acid sequences with classification labels. The neural network classifier is used to identify and determine the nucleic acid classification of the nucleic acid sequence to be detected in the nucleic acid database.
[0056] S4-1: Build a model with input layer, embedding layer, maximum pooling layer, averaging layer, intermediate merging layer, fully connected layer 1, fully connected layer 2, and output layer. In S4-1, the input layer dimension is 1×981, and the dimension calculation formula is: short DNA sequence length-Kmer+1, and the signal length obtained in this embodiment is 1000-20+1=981; the Embedding layer dimension is 6942463×100, where 6942463 is the type of Kmer in the constructed dictionary; the maximum pooling layer is to obtain the maximum value of each column in embs (981×100) to obtain a one-dimensional array max_pool (1×100); the average pooling layer is to obtain the average value of each column in embs to obtain a one-dimensional array avg_pool (1×100); the intermediate merging layer is to concatenate max_pool and avg_pool through the concatenate function in the numpy module to obtain a one-dimensional array input (1×200); the fully connected layer 1 contains 150 neurons; the fully connected layer 2 contains 150 neurons; the output layer contains 184 neurons, and finally the softmax activation function is used to convert the value of each neuron in the output layer into a probability value. like Figure 8 shown.
[0057] S4-2: Take 80% of the data in the S3 dataset as the training set, and the remaining 20% as the test set. When selecting, it is necessary to ensure that the proportion of each subtype in the training set and the test set is approximately the same. Send the training set to the neural network built in S4-1, train the network repeatedly, and test it continuously with the test set. Until the classification performance of the network meets the requirements, such as Fig. 9 shown.
[0058] S4-3: Save the model classifier trained in the previous step to the disk. Analyze the nucleic acid sequence to be detected later.
[0059] S5: Use the Kmer dictionary in S2 to convert the sequence to be detected into a digital signal.
[0060] S5-1: 65 HIV nucleic acid sequences to be tested are obtained, with a length of about 1000 bp, such as Fig.10 shown.
[0061] S5-2: Use the 20mer dictionary in S2-2 to convert the 65 HIV nucleic acid sequences in S5-1 into digital signals.
[0062] S6: Input the digital signal in S5 into the neural network classifier trained in S4 to classify the nucleic acid sequence to be detected.
[0063] S7: Display the classification results of the nucleic acid sequence to be detected. Display the results as follows Fig.11 As shown in the figure, ID is the ID of each sequence in the fasta file, and Top-1 to Top-5 are the top 5 possible subtypes of this ID sequence. The value in brackets is the reliability score of this subtype. The higher the score, the higher the reliability of this ID sequence for this subtype.
[0064] This embodiment uses a local computer for analysis, and the local computer configuration is: processor Intel (R) Core (TM) i5-9400 CPU @ 2.90GHz, memory 8.00GB. After the neural network is trained, 60,000 nucleic acid sequences can be classified within 9 seconds, and the classification result kappa coefficient = 0.982. And since the first five possible subtypes of the detected nucleic acid sequence can be seen in the output stage, it can be evaluated whether it is recombined by multiple subtypes according to the distribution of its probability value. If the probability values of the first two subtypes are both above 0.4, it can be determined that this sequence is recombined by the first two subtypes.
[0065] It should be understood that the disclosed invention is not limited only to the specific method, scheme and material of description, because these all can change.It should also be understood that the terminology used herein is only for the purpose of describing specific embodiment scheme, rather than being intended to limit the scope of the present invention, and the scope of the present invention is only limited to the appended claims.
[0066] Those skilled in the art will also recognize, or be able to ascertain using no more than routine experimentation, many equivalents to the specific embodiments of the invention described herein. Such equivalents are also intended to be encompassed by the appended claims.< / unk> < / unk> < / unk> < / unk>
Claims
1. A method for classifying nucleic acid sequences using machine learning, characterized in that: The method comprises the following steps: S0: Collect nucleic acid sequences with accurate classification labels to build a nucleic acid sequence database; S1: Divide all nucleic acid sequences in the nucleic acid sequence database into short sequences of equal length to form a balanced sample of short nucleic acid sequences. The length of the short sequence is 4bp to the length of the shortest sequence in the nucleic acid sequence database. The balanced sample of short nucleic acid sequences is suitable for machine learning. The balanced sample of short nucleic acid sequences refers to the number of short nucleic acid sequences with the largest number of classification labels N. most The number of short nucleic acid sequences with the minimum number of classification labels N least Short nucleic acid sequence samples when the ratio does not exceed 5; S2: extracting nucleic acid Kmers according to the nucleic acid sequences in the nucleic acid sequence database, wherein the nucleic acid Kmer length is 4≤Kmer length≤the length of the short sequence, and forming a Kmer dictionary of the nucleic acid sequence; S3: Use the Kmer dictionary in S2 to convert the short nucleic acid sequence balanced samples in S1 into digital signals; S4: using the digital signal in S3 to train a neural network classifier capable of multi-classifying nucleic acid sequences with classification labels, the neural network classifier is used to identify and determine the nucleic acid classification of the nucleic acid sequence to be detected in the nucleic acid database; S5: using the Kmer dictionary in S2 to convert the nucleic acid sequence to be detected into a digital signal; S6: input the digital signal in S5 into the neural network classifier trained in S4 to classify the nucleic acid sequence to be detected; The S1 comprises the following steps: S1-1: Determine whether all nucleic acid sequences in the nucleic acid sequence database are balanced; S1-2-1: If balanced, all nucleic acid sequences in the nucleic acid sequence database are divided into short sequences of equal length using the same segmentation step length, wherein the same segmentation step length is the shift length during segmentation, and the shift length is not greater than the length of the short sequence, and all nucleic acid sequences in the nucleic acid sequence database are divided to obtain short sequence samples; S1-2-2: If there is an imbalance, each type of label nucleic acid sequence in the nucleic acid sequence database is divided into short sequences of equal length using its own segmentation step length. The segmentation step length of each type of label nucleic acid sequence is the shift length when segmenting each type of label nucleic acid sequence. The shift length is not greater than the length of the short sequence. All nucleic acid sequences in the nucleic acid sequence database are segmented to obtain short sequence samples. S1-3: Determine whether the sample of short nucleic acid sequence obtained by S1-2-1 or S1-2-2 is a balanced sample suitable for machine learning. If yes, stop S1-2-1 or S1-2-2. If not, repeat S1-2-1 or S1-2-2 until a balanced sample of short nucleic acid sequence suitable for machine learning is obtained. The S4 comprises the following steps: S4-1: Build a model with input layer, embedding layer, maximum pooling layer, average pooling layer, intermediate merging layer, fully connected layer 1, fully connected layer 2, and output layer; S4-2: Input the digital signal obtained in S3 into the model built in S4-1 for training until the neural network becomes a neural network classifier for multi-classification of the input nucleic acid sequence, and the classification label is the classification label in the S0 nucleic acid database; S4-3: Save the model trained in S4-2 for subsequent analysis of the nucleic acid sequence to be detected.
2. The method according to claim 1, characterized in that The balanced sample of short nucleic acid sequences refers to the number of short nucleic acid sequences with the largest number of classification labels N. most The number of short nucleic acid sequences with the minimum number of classification labels N least Short nucleic acid sequence samples when the ratio does not exceed 2.
3. The method according to claim 1, characterized in that The method also includes step S7: displaying the classification results of the nucleic acid sequence to be detected.
4. The method according to claim 3, characterized in that S7 displays the ID of each sequence and the possible classification labels of the ID sequence; and displays the reliability scores of the possible classification labels. The higher the score, the higher the reliability of the classification label of the ID sequence.
5. The method according to claim 1, characterized in that The S1-2-2 includes the following steps: (1) Obtaining the ratio of the number of each type of nucleic acid sequences in the nucleic acid sequence database with accurate classification labels to a specific value, wherein the specific value is selected within the number N of nucleic acid sequences with the largest number of labels in the nucleic acid sequence database. most The number of nucleic acid sequences with the minimum number of tags N least Any value between , ratio value = specific value ÷ number of nucleic acids of each type, if the ratio value is less than 1, the ratio value is artificially set to 1; (2) The segmentation step length of each type of nucleic acid is calculated based on the ratio value of the nucleic acid. The segmentation step length = short sequence length / ratio value.
6. The method according to claim 1, characterized in that S2 include: S2-1: Use software to extract all Kmer component sets in the nucleic acid sequence database; S2-2: Construct a Kmer dictionary, sort all Kmers in S2-1 in alphabetical order from small to large, and insert the first position in the sorted Kmer <unk> Indicates a Kmer that does not exist in the dictionary.< / unk> 7. The method according to claim 6, characterized in that The query method of the dictionary is Kmer:Kmer's position in the dictionary.
8. The method according to claim 7, characterized in that The software in S2-1 is jellyfish software.
9. The method according to claim 1, characterized in that: Use 50%-90% of the digital signals in S3 as a training set, and 10%-50% of the digital signals in S3 as a test set, input the training set into the neural network constructed in S4-2, and repeatedly train the network, and continuously test it with the test set until the classification performance of the network reaches the requirements of becoming a neural network classifier for multi-classification of the input nucleic acid sequence, and its classification label is the classification label of the nucleic acid sequence in the nucleic acid database.
