A method and system for reconstructing a four-sequence phylogenetic tree based on LSTM and Transformer

CN118246484BActive Publication Date: 2026-08-14XI AN JIAOTONG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-13
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0009]本发明所要解决的技术问题在于针对上述现有技术中的不足,提供一种基于LSTM与Transformer的四序列系统发育树重建方法及系统,能够模拟不同类别的序列数据,并为序列匹配最合适的拓扑结构预测模型,进而进行准确的系统发育树重建,用于解决传统统计推断方法无法之间提取特征并且无法考虑InDel信息对系统发育推断的影响的技术问题,同时构建的新的演化场景模型并使用基于Transformer的网络提取特征,模拟数据集更贴近现实,解决了模拟数据集与真实数据集偏差较大以及无法整体提取序列特征的技术问题

Benefits of technology

[0058] This paper presents a four-sequence phylogenetic tree reconstruction method based on LSTM and Transformer. It simulates different categories of data using Indelible software, encodes the sequences into matrices, and simulates multiple sequence alignment data for phylogenetic tree reconstruction based on preset parameters. A deep learning dataset is created and divided into training, validation, and test sets. An LSTM-based deep learning multi-task classifier is constructed to classify the sequence data into their respective categories. The classifier is trained and validated using the training and validation sets, and its accuracy is tested using the test set. A Transformer-based deep learning multi-task classifier is also constructed, trained and validated using the training and validation sets, and its accuracy is tested using the test set. Finally, based on the trained LSTM and Transformer deep learning classifiers, the optimal model is matched to the sequence data of different categories, and phylogenetic tree inference is performed to reconstruct the phylogenetic tree.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118246484B_ABST
    Figure CN118246484B_ABST
Patent Text Reader

Abstract

This invention discloses a method and system for reconstructing a four-sequence phylogenetic tree based on LSTM and Transformer. It generates a four-sequence phylogenetic tree topology using ETE3, simulates multi-sequence alignment data requiring phylogenetic tree reconstruction, and creates a deep learning dataset. A Bi-LSTM-based deep learning multi-task classifier is constructed to classify the sequence data into their respective categories, and a Transformer-based deep learning multi-task classifier is constructed to predict the topological structure of the four-sequence dataset. Based on the trained LSTM and Transformer deep learning classifiers, the optimal TransTree model is matched for different categories of sequence data before phylogenetic tree inference is performed to reconstruct the phylogenetic tree. This invention, based on multi-sequence alignment, infers the category attributes of sequences through deep learning algorithms, then performs phylogenetic tree inference on the sequence data, constructs the phylogenetic tree, and can match the optimal prediction model for different categories of sequence data, resulting in more accurate phylogenetic tree inference.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the fields of computational biology and deep learning technology, specifically relating to a method and system for reconstructing a four-sequence phylogenetic tree based on LSTM and Transformer. Background Technology

[0002] In the 19th century, Charles Darwin's *On the Origin of Species* introduced the concept of evolution and depicted the tree of life, showcasing the genetic evolutionary history of species and influencing evolutionary biology research. A phylogenetic tree is a branching diagram that represents the evolutionary relationships of genes or species in a phylogenetic history. It has a branching structure, and its nodes can be different species, different individuals of the same species, or different genes, visually illustrating the evolutionary relationships between species or genomes. With the rise of sequencing technology, researchers began reconstructing phylogenetic trees using sequence information. Typically, a standard phylogenetic tree is a binary tree, conveying the concept that species evolution is a semi-random division. The reconstruction and analysis of phylogenetic trees are of great significance to biological research, helping to understand the mechanisms of evolution, trace the origin of organisms, and predict the development of viruses or diseases.

[0003] To construct accurate phylogenetic trees, numerous computational models have been proposed over the past few decades. Currently, statistical inference is the primary method for reconstructing phylogenetic trees, with researchers inferring phylogenetic trees based on multiple sequence alignments. Statistical inference algorithms are broadly categorized into distance-based and feature-based algorithms. Common distance-based methods include adjacency-based methods, unweighted group averaging, and weighted group averaging. Common optimization-based methods include maximum parsimony, maximum likelihood estimation, and Bayesian inference. Maximum parsimony involves statistically analyzing the frequency of changes in trait changes in the phylogenetic tree and selecting the phylogenetic tree with the lowest frequency of trait changes from all possible outcomes. Maximum likelihood estimation calculates the likelihood value of the reconstructed phylogenetic tree based on the species' trait evolution model and branch lengths, selecting the topology of the phylogenetic tree with the highest likelihood value. Bayesian phylogenetic inference typically uses algorithms such as random walk Markov chain Monte Carlo or combined sequence Monte Carlo to perform local or sequential searches of the topology and branch lengths. Despite having the aforementioned characteristics, these methods still have the following two drawbacks:

[0004] 1) When using traditional methods to reconstruct phylogenetic trees, the computational complexity is high when dealing with long gene data. When the evolutionary model and parameters deviate from the actual situation, the reconstructed tree will deviate from the true result.

[0005] 2) When using traditional methods to reconstruct phylogenetic trees, most algorithms directly ignore the information carried by the INDEL, which will cause inaccuracies in the phylogenetic tree reconstruction.

[0006] With the development of deep learning, researchers hope to apply deep learning algorithms to the field of phylogenetic tree reconstruction, and currently face two main challenges:

[0007] 1) The training dataset will directly affect the parameters in the model. When the simulated training dataset deviates significantly from the real time, the model will not be able to be accurately applied to the real dataset.

[0008] 2) When faced with long sequences, traditional deep learning algorithms may forget some edge sequence features due to the complexity of the model's internal structure. This will cause the model to be unable to fully extract the sequence features and to be unable to reconstruct the phylogenetic tree better. Summary of the Invention

[0009] The technical problem this invention aims to solve is to address the shortcomings of existing technologies by providing a four-sequence phylogenetic tree reconstruction method and system based on LSTM and Transformer. This method can simulate sequence data of different categories and predict the most suitable topological structure for each sequence, thereby achieving accurate phylogenetic tree reconstruction. It addresses the technical problems of traditional statistical inference methods being unable to extract features directly and failing to consider the influence of InDel information on phylogenetic inference. Furthermore, the newly constructed evolutionary scenario model uses a Transformer-based network to extract features, making the simulated dataset more realistic and solving the problems of large deviations between simulated and real datasets and the inability to extract sequence features holistically. Previous research has mainly focused on statistical inference methods based on distance or maximum likelihood. In recent years, researchers have gradually attempted to use convolutional neural networks for phylogenetic tree reconstruction. This invention provides a four-sequence phylogenetic tree reconstruction method based on LSTM and Transformer, further filling the gap in deep learning research in the field of phylogenetic inference.

[0010] The present invention adopts the following technical solution:

[0011] A four-sequence phylogenetic tree reconstruction method based on LSTM and Transformer is characterized by the following steps:

[0012] The simulated sequence dataset is divided into a training set, a validation set, and a test set;

[0013] Construct a deep learning model for sequence category classification that includes an LSTM structure, and use the training set, validation set, and test set to train, validate, and test the deep learning model for sequence category classification, respectively.

[0014] A deep learning model for predicting the topology of a four-sequence phylogenetic tree with a Transformer structure containing an Encoder module was constructed. The model was trained, validated, and tested using training, validation, and test sets, respectively, and the evaluation metrics of the prediction model were obtained.

[0015] Based on a trained deep learning model for sequence category classification and a deep learning model for four-sequence phylogenetic tree topology prediction, the optimal model is matched to sequence data of different categories, and four-sequence phylogenetic tree inference is performed to reconstruct the four-sequence phylogenetic tree.

[0016] Preferably, dividing the simulated sequence dataset into a training set, a validation set, and a test set is specifically as follows:

[0017] S101. The number of simulated sequence groups is fixed at four sequences, and a phylogenetic tree topology of random four sequences is generated.

[0018] S102. Based on the category of the simulated sequence data (long or short sequence) and whether the sequence data belongs to the coded, non-coded, or standard defined category, sample an expected average divergence degree d1 from the average divergence degree distribution corresponding to the six predefined sequence category scenarios. The coded sequence is sampled from (0.03, 0.2), the standard sequence is sampled from (0.03, 0.3), and the non-coded sequence is sampled from (0.15, 0.3).

[0019] S103. Sample the branch length of each leaf node and non-leaf node from the six predefined sequence categories in a uniformly distributed sampling manner, calculate the average divergence degree d2 of the current phylogenetic tree, and scale each branch length by multiplying it by the coefficient d1 / d2 to obtain the branch length of each branch of the topology of the four-sequence tree.

[0020] S104. Based on the topology of the four-sequence phylogenetic tree, branch length, and other predefined parameters, simulate a simulated sequence dataset of a given phylogenetic tree and create a dataset for supervised learning. Use the sequence data of multiple sequence alignment as the supervised learning data, the category to which the corresponding four-sequence phylogenetic tree topology belongs as the supervised learning classification label of the deep learning algorithm, and the scene category to which the corresponding four sequences belong as the supervised learning classification label of the deep learning algorithm to create the dataset.

[0021] S105. Divide the obtained dataset into training set, validation set and test set according to the ratio of 6:1:3.

[0022] Preferably, the sequence category classification deep learning model is trained, validated, and tested using a training set, a validation set, and a test set, respectively, as follows:

[0023] S201. Encode the base information of the original simulated sequences in the dataset. The encoding rule is 'A':'0', 'T':'1', 'C':'2', 'G':'3', '-':'4', 'N':'4'. '-' and 'N' represent INDEL and missing information in the sequence data. After encoding, the size of each group of sequences in the dataset is 4×L, where 4 is the 4 sequences in the multiple sequence alignment, L is the length of the multiple sequence alignment, and the dataset label is the category to which each group of sequences belongs in the simulation.

[0024] S202. The structure based on the long short-term memory neural network model is composed of forward LSTM and backward LSTM, which are used to construct a deep learning classifier with three hidden layers.

[0025] S203. Using the training set, validation set and test set obtained after processing in step S201, classify them according to sequence length, long sequences and short sequences, and use them to simulate a long short-term memory neural network model for sequence classification.

[0026] S204. After the dataset is input into the deep learning classifier, the features extracted by LSTM are flattened into one dimension. After passing through the fully connected layer, the final output prediction sequence data is classified as encoded, non-encoded, or standard.

[0027] S205. Based on the cross-entropy loss function, the neural network parameters are optimized and updated through gradient descent and backpropagation algorithms, so that the loss function gradually converges during the training process. For the simulated sequence data, the category to which it belongs is predicted, and a deep learning classifier model is trained.

[0028] S206. Apply the deep learning classifier model trained in step S205 to the corresponding test sets, and use the accuracy to evaluate the classification accuracy of the deep learning classifier to obtain the trained deep learning classifier.

[0029] More preferably, step S205 specifically includes:

[0030] The parameters of the DL network are optimized by using the cross-entropy loss function and minimizing the cross-entropy loss function.

[0031] The Adam optimizer is used to minimize the loss function, and a label smoothing strategy is used to smooth the target distribution during the learning process.

[0032] More preferably, in step S206, the accuracy rate is specifically:

[0033]

[0034] Among them, TP represents the number of true positives, TN represents the number of true negatives, FP represents the number of false positives, and FN represents the number of false negatives.

[0035] Preferably, the evaluation index results of the prediction model are as follows:

[0036] S301. Similar to step S201, the base information of the original simulated sequences in the dataset is encoded. The encoding rule is ('A':'0','T':'1','C':'2','G':'3','-':'4','N':'4'), where '-' and 'N' represent INDEL and missing information in the sequence data. After encoding, the dataset will be represented as an N×4×L tensor, where N is the size of the dataset, 4 is the 4 sequences in the multiple sequence alignment, and L is the length of the multiple sequence alignment.

[0037] S302. Encode the labels in the dataset. Each group of four sequences has a phylogenetic tree topology structure. The topologies of the unrooted phylogenetic trees are (1, 2(3, 4)), (1, 3(2, 4)), and (1, 4(3, 2)). The order of the sequences within each set of parentheses does not affect the topology structure. The encoding rule is ('(1, 2(3, 4))':'0', '(1, 3(2, 4))':'1', '(1, 4(3, 2))':'2').

[0038] S303. By defining classes, data and labels are packaged to construct a dataset, and a deep neural network based on the Transformer of the Encoder module is constructed for overall sequence feature extraction.

[0039] S304. The features extracted by the Transformer with 6 Encoder modules are flattened into one dimension, passed through a fully connected layer, and finally output the predicted topology type (0, 1, 2).

[0040] S305. Using the SGD optimizer and based on the cross-entropy loss function, the neural network parameters are optimized and updated through gradient descent and backpropagation algorithms, so that the loss function gradually converges during the training process. For simulated sequence data that are long or short sequences and belong to six sequence categories (coded, non-coded, or standard), the corresponding deep learning models are trained respectively.

[0041] S306. Apply the deep learning models for the six sequence categories trained in step S305 to the corresponding test sets, and evaluate the classification accuracy of the deep learning classifiers using classification accuracy and other metrics to obtain the trained deep learning classifiers.

[0042] More preferably, step S305 specifically includes:

[0043] The parameters of the DL network are optimized by using the cross-entropy loss function and minimizing the cross-entropy loss function.

[0044] The SGD optimizer is used to minimize the loss function, and batch data is used to accelerate the training process of deep learning models.

[0045] Preferably, the reconstruction of the four-sequence phylogenetic tree is specifically as follows:

[0046] The four-sequence alignment data are classified and predicted. The optimal deep learning model for predicting the topology of the four-sequence phylogenetic tree is selected. The four-sequence alignment data are input into the optimal deep learning model for predicting the topology of the four-sequence phylogenetic tree to obtain the prediction results, thereby realizing the reconstruction of the four-sequence phylogenetic tree. The Robinson-Foz distance is used as the evaluation criterion to test the performance of the algorithm for reconstructing the four-sequence phylogenetic tree.

[0047] More preferably, the Robinson-Foz distance RF(T1,T2) is calculated as follows:

[0048] RF(T1,T2)=|split(T1)|+|split(T2)|-2|split(t1)∩split(T2)|

[0049] Where |split(tree)| is the number of subtree sets of the tree, and split(T1)∩split(T2) means that T1 and T2 have the same number of subtree sets.

[0050] Secondly, embodiments of the present invention provide a four-sequence phylogenetic tree reconstruction system based on LSTM and Transformer, comprising:

[0051] The data module divides the simulated sequence dataset into training, validation, and test sets.

[0052] The classification module constructs a deep learning model for sequence category classification that includes an LSTM structure. The training set, validation set, and test set are used to train, validate, and test the deep learning model for sequence category classification, respectively.

[0053] The prediction module constructs a deep learning model for predicting the topology of a four-sequence phylogenetic tree with a Transformer structure that includes an Encoder module. The deep learning model for predicting the topology of a four-sequence phylogenetic tree is trained, validated, and tested using training, validation, and test sets, respectively, and the evaluation index results of the prediction model are obtained.

[0054] The reconstruction module uses a pre-trained deep learning model for sequence category classification and a deep learning model for four-sequence phylogenetic tree topology prediction to match the optimal model for sequence data of different categories and perform four-sequence phylogenetic tree inference to reconstruct the four-sequence phylogenetic tree.

[0055] Thirdly, a chip includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the above-described LSTM and Transformer-based four-sequence phylogenetic tree reconstruction method.

[0056] Fourthly, embodiments of the present invention provide an electronic device, including a computer program, which, when executed by the electronic device, implements the steps of the above-described method for reconstructing a four-sequence phylogenetic tree based on LSTM and Transformer.

[0057] Compared with the prior art, the present invention has at least the following beneficial effects:

[0058] This paper presents a four-sequence phylogenetic tree reconstruction method based on LSTM and Transformer. It simulates different categories of data using Indelible software, encodes the sequences into matrices, and simulates multiple sequence alignment data for phylogenetic tree reconstruction based on preset parameters. A deep learning dataset is created and divided into training, validation, and test sets. An LSTM-based deep learning multi-task classifier is constructed to classify the sequence data into their respective categories. The classifier is trained and validated using the training and validation sets, and its accuracy is tested using the test set. A Transformer-based deep learning multi-task classifier is also constructed, trained and validated using the training and validation sets, and its accuracy is tested using the test set. Finally, based on the trained LSTM and Transformer deep learning classifiers, the optimal model is matched to the sequence data of different categories, and phylogenetic tree inference is performed to reconstruct the phylogenetic tree.

[0059] Furthermore, by utilizing multiple sequence alignment, a deep learning algorithm is used to predict the topology of a four-sequence phylogenetic tree. Phylogenetic tree inference is performed on the sequence data. An LSTM-based sequence classification algorithm can be used to match the most suitable model to the input data. A new deep learning model classifier can be trained on data with other model parameter settings to reconstruct the phylogenetic tree. Indelible software is used to simulate sequence data, and a deep learning algorithm is used to match the optimal algorithm and predict the phylogenetic tree topology of the sequence data, thus reconstructing a four-sequence phylogenetic tree. Additionally, a new deep learning classifier can be trained on a new dataset constructed from specific sequence data to implement a customized four-sequence phylogenetic tree topology prediction model for sequence data of specific categories.

[0060] Furthermore, simulated sequence encoding is performed according to the rule ('A':'0', 'T':'1', 'C':'2', 'G':'3', '-':'4', 'N':'4'), which is concise and clear, and also considers the impact of INDEL and missing data on the tree construction results. This concise and clear encoding method comprehensively considers the feature information carried by the sequence data, enabling the deep learning classifier to better extract the features in the sequence data, thereby resulting in better model performance.

[0061] Furthermore, the deep learning classifier obtained through training exhibits robustness and universality, making it applicable to diverse sequence data. Compared to traditional phylogenetic tree reconstruction algorithms, it extracts more features, such as features of complete sequence data, features of INDELs and missing bases, and features of inter-sequence correlations, which is more conducive to improving the accuracy of phylogenetic tree reconstruction.

[0062] It is understandable that the beneficial effects of the second aspect mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here.

[0063] In summary, this invention enables phylogenetic tree reconstruction of four sequences of fixed length. Different models were trained for long and short sequences, and a wide range of sequence categories were designed. Deep learning classifiers were trained for different sequence categories, enabling phylogenetic tree reconstruction for different four sequences. Furthermore, a sequence category classifier was trained to match the optimal model selection for the sequence data used in phylogenetic tree reconstruction. Based on multiple sequence alignment, six sequence category scenarios were constructed. Deep learning algorithms were used to infer the topological structure and evolutionary relationships between sequences, thereby performing phylogenetic tree inference on the sequence data. This allows for the reconstruction of four-sequence phylogenetic trees and the matching of the optimal model to different sequence category scenarios, yielding the optimal solution for reconstructing the phylogenetic tree.

[0064] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0065] Figure 1 This is a flowchart of the four-sequence phylogenetic tree reconstruction method and system based on LSTM and Transformer in an embodiment of the present invention;

[0066] Figure 2 This is a schematic diagram of the four-sequence data simulation process in this invention;

[0067] Figure 3 This is a schematic diagram of the calculation process for the most important simulation parameters in the process of simulating sequence data in this invention;

[0068] Figure 4This is a schematic diagram of the overall branch length distribution of the simulated dataset in this invention;

[0069] Figure 5 This is a schematic diagram of data encoding for a sequence data classification and matching model using an LSTM deep learning model in this invention.

[0070] Figure 6 This is a framework diagram for using the LSTM deep learning model for sequence data classification and matching in this invention;

[0071] Figure 7 This is a schematic diagram illustrating data encoding using a Transformer deep learning model containing an Encoder module in this invention.

[0072] Figure 8 This is a framework diagram of the Transformer deep learning model containing the Encoder module used in this invention;

[0073] Figure 9 This is a schematic diagram showing the prediction accuracy of the Transformer deep learning model containing the Encoder module in this invention for the topology of four-sequence phylogenetic trees under six different types of sequence data.

[0074] Figure 10 This is a flowchart illustrating the verification and application of the LSTM deep learning model for sequence data classification and matching, and the Transformer deep learning model containing an Encoder module for predicting the topology of a four-sequence phylogenetic tree and reconstructing a four-sequence phylogenetic tree.

[0075] Figure 11 A schematic diagram of a computer device provided in an embodiment of the present invention;

[0076] Figure 12 This is a schematic diagram of the chip frame according to an embodiment of the present invention. Detailed Implementation

[0077] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0078] In the description of this invention, it should be understood that the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0079] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0080] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Additionally, the character " / " in this invention generally indicates that the preceding and following objects have an "or" relationship.

[0081] It should be understood that although terms such as first, second, third, etc., may be used in the embodiments of the present invention to describe the preset range, these preset ranges should not be limited to these terms. These terms are only used to distinguish the preset ranges from one another. For example, without departing from the scope of the embodiments of the present invention, the first preset range may also be referred to as the second preset range, and similarly, the second preset range may also be referred to as the first preset range.

[0082] Depending on the context, the word "if" as used here can be interpreted as "when," "when," "in response to determination," or "in response to detection." Similarly, depending on the context, the phrase "if determination" or "if detection (of the stated condition or event)" can be interpreted as "when determination," "in response to determination," "when detection (of the stated condition or event)," or "in response to detection (of the stated condition or event)."

[0083] The accompanying drawings illustrate various structural schematic diagrams according to embodiments disclosed in this invention. These drawings are not to scale, and some details have been enlarged for clarity, and some details may have been omitted. The shapes of the various regions and layers shown in the drawings, as well as their relative sizes and positional relationships, are merely exemplary and may deviate from reality due to manufacturing tolerances or technical limitations. Furthermore, those skilled in the art can design regions / layers with different shapes, sizes, and relative positions as needed.

[0084] This invention provides a four-sequence phylogenetic tree reconstruction method based on LSTM and Transformer. Based on the LSTM neural network, it offers a novel framework for classifying sequence data and matching the optimal tree construction model. Based on the Transformer neural network with an Encoder module, it provides a new framework for phylogenetic tree reconstruction of sequence data. It can reconstruct phylogenetic trees from input four-sequence alignment data. Furthermore, it allows for setting new training parameters and resimulating training data for different situations, resulting in new deep learning classifiers to customize phylogenetic tree reconstruction methods for specific scenarios. This invention demonstrates good performance in reconstructing four-sequence phylogenetic trees and can match the most suitable model for different sequence groups. The Transformer deep learning classifier with an Encoder module can completely extract sequence features, overcoming the limitation of feature forgetting. Overall, the model exhibits good generalization performance and has high practical application value.

[0085] Please see Figure 1 This invention presents a four-sequence phylogenetic tree reconstruction method based on LSTM and Transformer. The method involves feature encoding of sequence data, classification of sequences using a sequence category prediction model, and then using a deep learning algorithm to infer the phylogenetic tree topology, thereby reconstructing the four-sequence phylogenetic tree. New parameters can be set for sequence datasets constructed for specific categories, and new deep learning classifiers can be trained to obtain customized deep learning networks for reconstructing four-sequence phylogenetic trees. Phylogenetic trees are a classic and fundamental task in evolutionary biology, inferring evolutionary relationships between sequences based on multiple sequence alignment (MSA). Reconstructing phylogenetic trees is significant for understanding evolutionary transitions, inferring the origin of new genes, understanding morphological evolution, and reconstructing divergent species. This invention uses deep learning algorithms to reconstruct phylogenetic trees, further promoting the application of deep learning algorithms in phylogenetic inference. The successful reconstruction of a four-sequence phylogenetic tree using a Transformer-based network lays the foundation for more accurate construction of phylogenetic trees for more sequences and also for the application of large language models in phylogenetic tree reconstruction. The specific steps are as follows:

[0086] S1. Simulate four-sequence data for multiple sequence alignment. For detailed procedures, please refer to [link / reference needed]. Figure 2 Based on whether the simulated sequence data is a long or short sequence, and whether the sequence data belongs to coding, non-coding, or standard definition, six sequence categories are predefined, and simulated sequence scenarios of different categories are constructed according to indicators such as average divergence degree and Indel ratio; finally, the dataset is divided into training set, validation set, and test set.

[0087] S101. The number of simulated sequence groups is fixed at four sequences. A random phylogenetic tree topology of four sequences is generated using the bioinformatics software package ETE3.

[0088] S102, Sequence Category Definition

[0089] Based on whether the simulated sequence data is a long or short sequence, and whether the sequence data belongs to encoded, non-coded, or standard definition, six simulated sequence data categories are predefined, and simulation parameters are set according to the sequence characteristics of each category. For specific parameter settings, please refer to Table 1.

[0090] Table 1. Main parameter settings for the simulated sequence model

[0091]

[0092] S103, Sequence Data Simulation and Partitioning

[0093] The topology of a four-sequence phylogenetic tree and its corresponding multiple sequence alignment data are simulated based on preset simulation parameters. The sequence data of the multiple sequence alignments are used as supervised learning data, the category of the corresponding four sequences is used as the classification label for supervised learning by the deep learning algorithm, and the category of the corresponding four-sequence phylogenetic tree topology is used as the classification label for supervised learning by the deep learning algorithm. A total of 500,000 sets of simulation data are used for each sequence scenario, which are divided into training set, validation set and test set in a 6:1:3 ratio.

[0094] Please see Figure 3 The implementation process is as follows:

[0095] Based on the category of the simulated sequence data (long or short sequence) and whether the sequence data belongs to the encoded, non-coded, or standard-defined category, a desired average divergence degree d1 is sampled from the average divergence degree distribution corresponding to the six predefined sequence category scenarios. The branch lengths of each leaf node and non-leaf node are independently sampled from the six predefined sequence category scenarios using a uniform sampling method, and the average divergence degree d2 of the current phylogenetic tree is calculated. Each branch length is scaled by multiplying by a coefficient d1 / d2 to obtain the branch length of each branch in the topology of the four-sequence tree.

[0096] S104. Using the bioinformatics software Indelible, a simulated sequence dataset is created to simulate the topology, branch length, and other predefined parameters of a four-sequence phylogenetic tree. This dataset is then used for supervised learning. The simulated sequence data is used as the original input data. The corresponding phylogenetic tree is classified according to the unrooted tree classification as the label for the deep learning algorithm. The category to which the simulated sequence data belongs—whether it is a long or short sequence—and whether the sequence data belongs to the coding, non-coding, or standard classification are used as the labels for the classification algorithm.

[0097] S105. The dataset is divided into training, validation, and test sets in a 6:1:3 ratio, as shown in Table 2. Based on the data pattern of the real phylogenetic tree, samples from the datasets of each of the six categories are tested. All samples exhibit a long-tailed distribution pattern, as shown in Table 2. Figure 4 As shown.

[0098] Table 2. Training set, validation set, and test set for the six sequence categories.

[0099]

[0100] The beneficial effects of the above technical solution are: by utilizing the combination of different classification results, the sequence categories are fully covered, ensuring that the simulated data can correctly reflect the data distribution of the real situation, which helps to improve the accuracy of classification tasks.

[0101] S2. For simulated sequence data from different categories, construct a multi-task multi-class deep learning ensemble classifier with LSTM as the core. Use the training set, validation set, and test set from step S1 as the training, validation, and testing sets of the deep learning classifier, respectively. Use the cross-entropy loss function to obtain the trained sequence category deep learning classifier and predict the category of the input sequence data.

[0102] Please see Figures 5 to 6 The specific steps are as follows:

[0103] S201, Data Encoding

[0104] The base information of the original simulated sequences in the dataset is encoded according to the following encoding rule: ('A':'0','T':'1','C':'2','G':'3','-':'4','N':'4'). Here, '-' and 'N' represent INDELs and missing information in the sequence data. After encoding, a set of data in the dataset will be represented as a 4×L tensor, where N is the size of the dataset, 4 represents the 4 sequences in the multiple sequence alignment, and L is the length of the multiple sequence alignment. The specific encoding details are as follows... Figure 6 As shown;

[0105] S202. Construction and Training of Deep Learning Classifier Model for Sequence Data Classification. A Long Short-Term Memory (LSTM) neural network model for simulating sequence classification is used, consisting of a forward LSTM and a backward LSTM. The specific model structure is as follows... Figure 7As shown, both the long sequence and short sequence classification modules consist of three forward and backward LSTM networks, with each unidirectional unit set to 128. The result of each module is input into the next module until the last module outputs the final result. The complete LSTM consists of three hidden layers. The features extracted by the LSTM are flattened into one dimension, passed through a fully connected layer, and finally output the predicted category as standard, encoded, or non-encoded.

[0106] S203. The sequence data simulated in step S1 is used to optimize and update the neural network parameters according to the cross-entropy loss function, through gradient descent and backpropagation algorithms, so that the loss function gradually converges during the training process.

[0107] S204. After the dataset is input into the deep learning classifier, the features extracted by LSTM are flattened into one dimension. After passing through a fully connected layer, the final output predicts whether the sequence data belongs to the encoded, non-encoded, or standard category. The deep learning model is trained by predicting the category of the simulated sequence data.

[0108] S205. Based on the cross-entropy loss function, the neural network parameters are optimized and updated through gradient descent and backpropagation algorithms, so that the loss function gradually converges during the training process. Among them, for the simulated sequence data to predict the category to which it belongs, a deep learning classifier model is trained.

[0109] S2051. The optimization process uses the cross-entropy loss function. The specific loss function used in optimizing the parameters of the DL network during the process of minimizing the cross-entropy loss function is as follows:

[0110] Loss=-∑y i log(p i ) = -log(p c )

[0111] Where p = [p0,…,p c-1 ] is a probability distribution, where each element p i Let y represent the probability that a sample belongs to the i-th class; y = [y0, ..., y1] c-1 ] is the one-hot representation of the sample label.

[0112] S2052. Use the Adam optimizer to minimize the loss function and use a label smoothing strategy to smooth the target distribution during the learning process to reduce extreme bias.

[0113] S206. Apply the deep learning model trained in step S205 to the corresponding test sets, and evaluate the classification accuracy of the deep learning classifier using metrics such as classification accuracy and others, to obtain the trained deep learning classifier; the specific accuracy metrics for network evaluation are:

[0114]

[0115] Where TP = true positives, TN = true negatives, FP = false positives, and FN = false negatives.

[0116] The trained sequence classification deep learning model was tested using the simulated sequence data test set obtained in step S1. The classification prediction structures for long sequences and short sequences were compared and evaluated with the test results. The average model classification accuracy was above 80%.

[0117] S3. Using the established supervised learning dataset, construct a multi-task, multi-class deep learning ensemble classifier with a Transformer containing an Encoder module as its core. Use the training set, validation set, and test set from step S1 as the training, validation, and testing sets of the deep learning classifier, respectively. Employ the cross-entropy loss function to obtain the trained topology deep learning classifier.

[0118] Please see Figures 7 to 9 The specific steps are as follows:

[0119] S301, Data Encoding

[0120] Similar to step S201, the base information of the original simulated sequences in the dataset is encoded using the following encoding rule: ('A':'0','T':'1','C':'2','G':'3','-':'4','N':'4'). Here, '-' and 'N' represent INDELs and missing information in the sequence data. After encoding, a set of data in the dataset will be represented as a 4×L tensor, where N is the size of the dataset, 4 represents the four sequences in the multiple sequence alignment, and L is the length of the multiple sequence alignment. Simultaneously, the corresponding topology is one-hot encoded, as shown in the following figure. Figure 7 As shown;

[0121] S302. Construction and training of the prediction model for the topology of the four-sequence phylogenetic tree reconstruction. The labels in the dataset are encoded. In step S1, each group of four sequences will have a four-sequence phylogenetic tree topology. There are three types of topologies for the rootless phylogenetic tree: (1,2(3,4)), (1,3(2,4)), and (1,4(3,2)). The order of the sequences within each set of parentheses does not affect the topology. The encoding rule is ('(1,2(3,4))':'0','(1,3(2,4))':'1','(1,4(3,2))':'2').

[0122] S303. By defining classes, data and labels are packaged to construct the dataset. A deep neural network based on a Transformer using only the Encoder module is constructed for overall sequence feature extraction. The specific model structure is as follows: Figure 8 As shown, first, a class is defined to construct the dataset, which is then encapsulated as a Tensor. The num_labels parameter is set to 3. The final Encoder consists of 6 EncoderLayers, which are then passed through a fully connected layer, resulting in an output dimension of 1.

[0123] S304. After the complete sequence data passes through 6 encoder modules, the features extracted by the Transformer are flattened into one dimension. After passing through a fully connected layer, the predicted topology type (0,1,2) is finally output.

[0124] S305. Using the SGD optimizer and based on the cross-entropy loss function, the neural network parameters are optimized and updated through gradient descent and backpropagation algorithms, so that the loss function gradually converges during training. Simulated sequence data of 6 categories are used to train corresponding deep learning models.

[0125] S3051. The optimization process uses the cross-entropy loss function. The specific loss function used in optimizing the parameters of the DL network during the process of minimizing the cross-entropy loss function is as follows:

[0126]

[0127] Where y is the true value. This is a predicted value;

[0128] S3052. Using the SGD optimizer to minimize the loss function and using batch data accelerates the model training process and reduces the loss of accuracy.

[0129] S306. Apply the deep learning models for the six sequence categories trained in step S305 to the corresponding test sets, and evaluate the classification accuracy of the deep learning classifiers using classification accuracy metrics, thus obtaining the trained deep learning classifiers. The accuracy of the deep learning models is as follows: Figure 9 As shown. The accuracy of the model is calculated as follows:

[0130]

[0131] Where TP = true positives, TN = true negatives, FP = false positives, and FN = false negatives.

[0132] The beneficial effects of the above technical solution are:

[0133] While simplifying sequence alignment encoding information, the feature information carried by the sequence data is fully considered. Complete sequence features are extracted to predict the topology of the four-sequence phylogenetic tree, thereby further improving the accuracy of tree construction. The cross-entropy loss function is used, and the neural network parameters are optimized and updated through gradient descent and backpropagation algorithms.

[0134] S4. Using the sequence classification deep learning model obtained in step S2, combined with the phylogenetic tree topology prediction model obtained in step S3, first, the four-sequence alignment data is classified and predicted to select the optimal deep learning model. Then, the four-sequence alignment data is input into the optimal deep learning model to obtain the prediction results, thus realizing the reconstruction of the four-sequence phylogenetic tree. The complete process of using the sequence classification model and the four-sequence phylogenetic tree topology prediction deep learning model to reconstruct the four-sequence phylogenetic tree is as follows: Figure 10 As shown in Table 3, the performance of the algorithm for reconstructing a four-sequence phylogenetic tree using a matching model was tested based on simulated data with accuracy as the evaluation criterion. The results, obtained through testing with non-coded simulated sequences, show that the TransTree model, which uses matching, achieved the highest accuracy.

[0135] Table 3 Comparison of topology prediction accuracy of non-coding models for different types of sequence data

[0136]

[0137] The method in step S1 is used to obtain more simulated data in addition to the training data. Based on this simulated data, the performance of the algorithm for reconstructing four-sequence phylogenetic trees is evaluated using the Robinson-Fuz distance (RF distance) as the evaluation criterion. The RF distance is a method for calculating the distance between phylogenetic trees, and its formula is as follows:

[0138] RF(T1,T2)=|split(T1)|+|split(T2)|-2|split(T1)∩split(T2)|

[0139] Here, |split(tree)| represents the number of subtree sets in a tree, and split(T1)∩split(T2) indicates the number of subtree sets that are the same in T1 and T2. Therefore, the more similar the topologies of two trees are, the smaller the RF distance is, and vice versa.

[0140] Table 4 shows the RF distances between phylogenetic tree reconstructions using the matching model TransTree and those using traditional algorithms. The final average RF distance was calculated for all results, with TransTree at 0.25, Iqtree at 0.29, and Raxml at 0.30. Overall, using the matching model TransTree to construct phylogenetic trees achieves comparable or better performance than traditional algorithms.

[0141] Table 4. Results of reconstructing four-sequence phylogenetic trees using simulated data from different models.

[0142]

[0143] The beneficial effects of the above technical solution are:

[0144] The embodiments of the present invention utilize a deep learning model, which not only has good performance in reconstructing four-sequence phylogenetic trees by simulating sequence data that matches real-world scenarios, but also can match the most suitable tree-building model based on the input data, thereby effectively obtaining the optimal solution for reconstructing the phylogenetic tree.

[0145] In another embodiment of the present invention, a four-sequence phylogenetic tree reconstruction system based on LSTM and Transformer is provided. This system can be used to implement the above-mentioned four-sequence phylogenetic tree reconstruction method based on LSTM and Transformer. Specifically, the four-sequence phylogenetic tree reconstruction system based on LSTM and Transformer includes a data module, a classification module, a prediction module, and a reconstruction module.

[0146] The data module divides the simulated sequence dataset into a training set, a validation set, and a test set.

[0147] The classification module constructs a deep learning model for sequence category classification that includes an LSTM structure. The training set, validation set, and test set are used to train, validate, and test the deep learning model for sequence category classification, respectively.

[0148] The prediction module constructs a deep learning model for predicting the topology of a four-sequence phylogenetic tree with a Transformer structure that includes an Encoder module. The deep learning model for predicting the topology of a four-sequence phylogenetic tree is trained, validated, and tested using training, validation, and test sets, respectively, and the evaluation index results of the prediction model are obtained.

[0149] The reconstruction module uses a pre-trained deep learning model for sequence category classification and a deep learning model for four-sequence phylogenetic tree topology prediction to match the optimal model for sequence data of different categories and perform four-sequence phylogenetic tree inference to reconstruct the four-sequence phylogenetic tree.

[0150] In another embodiment of the present invention, a terminal device is provided, comprising a processor and a memory. The memory stores a computer program, which includes program instructions. The processor executes the program instructions stored in the computer storage medium. The processor may be a Central Processing Unit (CPU), or other 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 devices, discrete hardware components, etc. It is the computing and control core of the terminal, suitable for implementing one or more instructions, specifically suitable for loading and executing one or more instructions to achieve a corresponding method flow or corresponding function. The processor described in this embodiment can be used for the operation of a four-sequence phylogenetic tree reconstruction method based on LSTM and Transformer, including:

[0151] The simulated sequence dataset was divided into training, validation, and test sets. A deep learning model for sequence classification with an LSTM structure was constructed, and the training, validation, and test sets were used to train, validate, and test the deep learning model for sequence classification, respectively. A deep learning model for predicting the topology of a four-sequence phylogenetic tree with a Transformer structure containing an Encoder module was constructed, and the training, validation, and test sets were used to train, validate, and test the deep learning model for predicting the topology of the four-sequence phylogenetic tree, respectively, and the evaluation index results of the prediction model were obtained. Based on the trained deep learning model for sequence classification and the deep learning model for predicting the topology of the four-sequence phylogenetic tree, the optimal model was matched to the sequence data of different categories, and the four-sequence phylogenetic tree inference was performed to realize the reconstruction of the four-sequence phylogenetic tree.

[0152] In another embodiment of the present invention, a storage medium is also provided, specifically a computer-readable storage medium (memory). This computer-readable storage medium is a memory device in a terminal device used to store programs and data. It is understood that the computer-readable storage medium here can include both the built-in storage medium in the terminal device and extended storage media supported by the terminal device. The computer-readable storage medium provides storage space that stores the terminal's operating system. Furthermore, this storage space also stores one or more instructions suitable for loading and execution by a processor. These instructions can be one or more computer programs (including program code). It should be noted that the computer-readable storage medium here can be high-speed RAM or non-volatile memory, such as at least one disk storage device.

[0153] One or more instructions stored in a computer-readable storage medium can be loaded and executed by a processor to implement the corresponding steps of the four-sequence phylogenetic tree reconstruction method based on LSTM and Transformer in the above embodiments; one or more instructions in the computer-readable storage medium are loaded and executed by the processor to perform the following steps:

[0154] The simulated sequence dataset was divided into training, validation, and test sets. A deep learning model for sequence classification with an LSTM structure was constructed, and the training, validation, and test sets were used to train, validate, and test the deep learning model for sequence classification, respectively. A deep learning model for predicting the topology of a four-sequence phylogenetic tree with a Transformer structure containing an Encoder module was constructed, and the training, validation, and test sets were used to train, validate, and test the deep learning model for predicting the topology of the four-sequence phylogenetic tree, respectively, and the evaluation index results of the prediction model were obtained. Based on the trained deep learning model for sequence classification and the deep learning model for predicting the topology of the four-sequence phylogenetic tree, the optimal model was matched to the sequence data of different categories, and the four-sequence phylogenetic tree inference was performed to realize the reconstruction of the four-sequence phylogenetic tree.

[0155] Please see Figure 11 The terminal device is a computer device. In this embodiment, the computer device 60 includes a processor 61, a memory 62, and a computer program 63 stored in the memory 62 and executable on the processor 61. When executed by the processor 61, the computer program 63 implements the fluid composition calculation method in the reservoir stimulation wellbore of this embodiment. To avoid repetition, these details are not elaborated here. Alternatively, when executed by the processor 61, the computer program 63 implements the functions of each model / unit in the fluid composition calculation system in the reservoir stimulation wellbore of this embodiment. To avoid repetition, these details are not elaborated here.

[0156] Computer device 60 can be a desktop computer, laptop, handheld computer, cloud server, or other computing device. Computer device 60 may include, but is not limited to, a processor 61 and a memory 62. Those skilled in the art will understand that... Figure 11 This is merely an example of computer device 60 and does not constitute a limitation on computer device 60. It may include more or fewer components than shown, or combine certain components, or different components. For example, computer device may also include input / output devices, network access devices, buses, etc.

[0157] The processor 61 may be a Central Processing Unit (CPU), or other 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 devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0158] The memory 62 can be an internal storage unit of the computer device 60, such as a hard disk or RAM of the computer device 60. The memory 62 can also be an external storage device of the computer device 60, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. equipped on the computer device 60.

[0159] Furthermore, the memory 62 may include both internal storage units of the computer device 60 and external storage devices. The memory 62 is used to store computer programs and other programs and data required by the computer device. The memory 62 can also be used to temporarily store data that has been output or will be output.

[0160] Please see Figure 12 The terminal device is a chip. In this embodiment, the chip 600 includes a processor 622, which may be one or more, and a memory 632 for storing computer programs executable by the processor 622. The computer program stored in the memory 632 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processor 622 may be configured to execute the computer program to perform the generalizable monocular absolute depth map estimation method described above.

[0161] Additionally, chip 600 may also include a power supply component 626 and a communication component 650. The power supply component 626 can be configured to perform power management of chip 600, and the communication component 650 can be configured to enable communication of chip 600, such as wired or wireless communication. Furthermore, chip 600 may also include an input / output interface 658. Chip 600 can operate on an operating system stored in memory 632.

[0162] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0163] Compared with traditional phylogenetic tree reconstruction algorithms, the four-sequence phylogenetic tree reconstruction method based on LSTM and Transformer can fully extract sequence features and select the optimal model. Deep learning algorithms can be viewed as a multi-task, multi-classification problem; therefore, this invention has trained its own deep learning classifier. Model testing using non-coding simulated sequence data shows that the TransTree method provided by this invention achieves an accuracy of 90.1% in reconstructing phylogenetic trees from 10 groups of 100 sequences each. Further analysis of phylogenetic tree reconstruction using this method yields an average RF distance of 0.25, which is superior to the traditional methods Iqtree (0.29) and Raxml (0.30).

[0164] In addition, the model involves six sequence categories. When faced with a new category, a deep learning classifier can be further trained based on the new data to obtain a new model that matches the data and construct a four-sequence phylogenetic tree.

[0165] In summary, this invention provides a method and system for reconstructing a four-sequence phylogenetic tree based on LSTM and Transformer. This involves simulating different categories of data using Indelible software, encoding the sequences into matrices, simulating multi-sequence alignment data for phylogenetic tree reconstruction based on preset parameters, and creating a deep learning dataset. This dataset is then divided into training, validation, and test sets. An LSTM-based deep learning multi-task classifier is constructed to classify the sequence data into their respective categories. The training and validation sets are used to train and validate the deep learning classifier, and the test set is used to test its accuracy. A Transformer-based deep learning multi-task classifier is then constructed to predict the classification of the four-sequence data set. The training and validation sets are used to train and validate the deep learning classifier, and the test set is used to test its accuracy. Finally, based on the trained LSTM and Transformer deep learning classifiers, the optimal model is matched to the sequence data of different categories, and phylogenetic tree inference is performed to reconstruct the phylogenetic tree. This invention is based on multiple sequence alignment and uses deep learning algorithms to infer the topological structure and evolutionary relationship between sequences. It then performs phylogenetic tree inference on four-sequence data, constructs a phylogenetic tree, and can match the optimal model to different types of sequence scenario data to obtain the optimal solution for reconstructing the four-sequence phylogenetic tree.

[0166] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0167] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0168] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0169] In the embodiments provided by this invention, it should be understood that the disclosed devices / terminals and methods can be implemented in other ways. For example, the device / terminal embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0170] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0171] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0172] If the integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.

[0173] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0174] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0175] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0176] The above content is only for illustrating the technical concept of the present invention and should not be construed as limiting the scope of protection of the present invention. Any modifications made to the technical solution based on the technical concept proposed in this invention shall fall within the scope of protection of the claims of this invention.

Claims

1. A method for reconstructing a four-sequence phylogenetic tree based on LSTM and Transformer, characterized in that, Includes the following steps: The simulated sequence dataset is divided into a training set, a validation set, and a test set; A deep learning model for sequence category classification, incorporating an LSTM structure, is constructed. The model is then trained, validated, and tested using training, validation, and test sets, respectively. Specifically: S201. Encode the base information of the original simulated sequences in the dataset. The encoding rule is 'A':'0', 'T':'1', 'C':'2', 'G':'3', '-':'4', 'N':'4'. '-' and 'N' represent INDEL and missing information in the sequence data. After encoding, the size of each group of sequences in the dataset is 4×L, where 4 is the 4 sequences in the multiple sequence alignment, L is the length of the multiple sequence alignment, and the dataset label is the category to which each group of sequences belongs in the simulation. S202. The structure based on the long short-term memory neural network model is composed of forward LSTM and backward LSTM, which are used to construct a deep learning classifier with three hidden layers. S203. Using the training set, validation set and test set obtained after processing in step S201, classify them according to sequence length, long sequences and short sequences, and use them to simulate a long short-term memory neural network model for sequence classification. S204. After the dataset is input into the deep learning classifier, the features extracted by LSTM are flattened into one dimension. After passing through the fully connected layer, the final output prediction sequence data is classified as encoded, non-encoded, or standard. S205. Based on the cross-entropy loss function, the neural network parameters are optimized and updated through gradient descent and backpropagation algorithms, so that the loss function gradually converges during the training process. For the simulated sequence data, the category to which it belongs is predicted, and a deep learning classifier model is trained. S206. Apply the deep learning classifier model trained in step S205 to the corresponding test sets, and use the accuracy to evaluate the classification accuracy of the deep learning classifier to obtain the trained deep learning classifier. A deep learning model for predicting the topology of a four-sequence phylogenetic tree with a Transformer structure including an Encoder module was constructed. The model was trained, validated, and tested using training, validation, and test sets, respectively. The evaluation metrics for the prediction model were obtained, as follows: S301, similar to step S201, encodes the base information of the original simulated sequences in the dataset. The encoding rule is ('A': '0', 'T': '1', 'C': '2', 'G': '3', '-': '4', 'N': '4'), where '-' and 'N' represent INDELs and missing information in the sequence data. After encoding, the dataset will appear as a... N ×4× L The tensor, in which N 4 represents the size of the dataset, and 4 represents the four sequences in the multiple sequence alignment. L The length of the multiple sequence alignment; S302. Encode the labels in the dataset. Each group of four sequences has a phylogenetic tree topology structure. The topologies of the unrooted phylogenetic trees are (1, 2(3, 4)), (1, 3(2, 4)), and (1, 4(3, 2)). The order of the sequences within each set of parentheses does not affect the topology structure. The encoding rule is ('(1, 2(3, 4))': '0', '(1, 3(2, 4))': '1', '(1, 4(3, 2))': '2'). S303. By defining classes, data and labels are packaged to construct a dataset, and a deep neural network based on the Transformer of the Encoder module is constructed for overall sequence feature extraction. S304. The features extracted by the Transformer with 6 Encoder modules are flattened into one dimension, passed through a fully connected layer, and finally output the predicted topology type (0, 1, 2). S305. Using the SGD optimizer and based on the cross-entropy loss function, the neural network parameters are optimized and updated through gradient descent and backpropagation algorithms, so that the loss function gradually converges during the training process. For simulated sequence data that are long or short sequences and belong to six sequence categories (coded, non-coded, or standard), the corresponding deep learning models are trained respectively. S306. Apply the deep learning models for the six sequence categories trained in step S305 to the corresponding test sets, and evaluate the classification accuracy of the deep learning classifiers using classification accuracy and other metrics to obtain the trained deep learning classifiers. Based on a trained deep learning model for sequence category classification and a deep learning model for four-sequence phylogenetic tree topology prediction, the optimal model is matched to sequence data of different categories, and four-sequence phylogenetic tree inference is performed to realize the reconstruction of the four-sequence phylogenetic tree deep learning network.

2. The method for reconstructing a four-sequence phylogenetic tree based on LSTM and Transformer according to claim 1, characterized in that, The simulated sequence dataset is divided into a training set, a validation set, and a test set, specifically as follows: S101. The number of simulated sequence groups is fixed at four sequences, and a phylogenetic tree topology of random four sequences is generated. S102. Based on the category to which the simulated sequence data belongs (long or short sequence), and whether the sequence data belongs to the encoded, non-coded, or standard-defined category, sample a desired average divergence degree from the average divergence degree distribution corresponding to the six predefined sequence category scenarios. The encoded sequence was sampled from (0.03, 0.2), the standard sequence from (0.03, 0.3), and the non-coding sequence from (0.15, 0.3). S103. Sample the branch lengths of each leaf node and non-leaf node from the six predefined sequence categories using a uniform sampling method, and calculate the average divergence degree of the current phylogenetic tree. By multiplying by a coefficient Scaling each branch length yields the branch length of each branch in the topology of the four-sequence tree; S104. Based on the topology of the four-sequence phylogenetic tree, branch length, and other predefined parameters, simulate a simulated sequence dataset of a given phylogenetic tree and create a dataset for supervised learning. Use the sequence data of multiple sequence alignment as the supervised learning data, the category to which the corresponding four-sequence phylogenetic tree topology belongs as the supervised learning classification label of the deep learning algorithm, and the scene category to which the corresponding four sequences belong as the supervised learning classification label of the deep learning algorithm to create the dataset. S105. Divide the obtained dataset into training set, validation set and test set according to the ratio of 6:1:

3.

3. The method for reconstructing a four-sequence phylogenetic tree based on LSTM and Transformer according to claim 1, characterized in that, Step S205 specifically involves: The parameters of the DL network are optimized by using the cross-entropy loss function and minimizing the cross-entropy loss function. The Adam optimizer is used to minimize the loss function, and a label smoothing strategy is used to smooth the target distribution during the learning process.

4. The method for reconstructing a four-sequence phylogenetic tree based on LSTM and Transformer according to claim 1, characterized in that, In step S206, the accuracy rate is specifically as follows: in, The number of true positives It is a true negative number. The number of false positives The number is a false negative.

5. The method for reconstructing a four-sequence phylogenetic tree based on LSTM and Transformer according to claim 1, characterized in that, Step S305 specifically includes: The parameters of the DL network are optimized by using the cross-entropy loss function and minimizing the cross-entropy loss function. The SGD optimizer is used to minimize the loss function, and batch data is used to accelerate the training process of deep learning models.

6. The method for reconstructing a four-sequence phylogenetic tree based on LSTM and Transformer according to claim 1, characterized in that, The reconstruction of the four-sequence phylogenetic tree is as follows: The four-sequence alignment data are classified and predicted. The optimal deep learning model for predicting the topology of the four-sequence phylogenetic tree is selected. The four-sequence alignment data are input into the optimal deep learning model for predicting the topology of the four-sequence phylogenetic tree to obtain the prediction results, thereby realizing the reconstruction of the four-sequence phylogenetic tree. The Robinson-Foz distance is used as the evaluation criterion to test the performance of the algorithm for reconstructing the four-sequence phylogenetic tree.

7. The method for reconstructing a four-sequence phylogenetic tree based on LSTM and Transformer according to claim 6, characterized in that, Robinson-Foz Distance The calculation is as follows: in, Let be the number of subtree sets of the tree. refer to and The number of identical subtree sets.

8. A four-sequence phylogenetic tree reconstruction system based on LSTM and Transformer, characterized in that, include: The data module divides the simulated sequence dataset into training, validation, and test sets. The classification module constructs a deep learning model for sequence category classification, incorporating an LSTM structure. It trains, validates, and tests the model using training, validation, and test sets, respectively. Specifically: The base information of the original simulated sequences in the dataset is encoded according to the following rules: 'A':'0', 'T':'1', 'C':'2', 'G':'3', '-':'4', 'N':'4'. '-' and 'N' represent INDEL and missing information in the sequence data. After encoding, the size of each sequence group in the dataset is 4×L, where 4 represents the 4 sequences in the multiple sequence alignment, L represents the length of the multiple sequence alignment, and the dataset label represents the category to which each sequence group belongs in the simulation. Based on the structure of the Long Short-Term Memory Neural Network model, it is composed of forward LSTM and backward LSTM to construct a deep learning classifier with three hidden layers. Using the processed training set, validation set, and test set, and classifying them according to sequence length (long sequences and short sequences), they are used to simulate a long short-term memory-based neural network model for sequence classification. After the dataset is input into the deep learning classifier, the features extracted by LSTM are flattened into one dimension. After passing through a fully connected layer, the final output predicts whether the sequence data belongs to encoded, non-encoded, or standard. Based on the cross-entropy loss function, the neural network parameters are optimized and updated through gradient descent and backpropagation algorithms, so that the loss function gradually converges during the training process. A deep learning classifier model is trained to predict the category of simulated sequence data. The trained deep learning classifier model is applied to the corresponding test set, and the classification accuracy of the deep learning classifier is evaluated by the accuracy rate to obtain the trained deep learning classifier. The prediction module constructs a deep learning model for predicting the topology of a four-sequence phylogenetic tree using a Transformer structure that includes an Encoder module. The model is trained, validated, and tested using training, validation, and test sets, respectively, to obtain evaluation metrics for the prediction model. Similar to encoding the base information of the original simulated sequences in the dataset, the encoding rule is ('A': '0', 'T': '1', 'C': '2', 'G': '3', '-': '4', 'N': '4'), where '-' and 'N' represent INDELs and missing information in the sequence data. After encoding, the dataset will appear as a... N ×4× L The tensor, in which N 4 represents the size of the dataset, and 4 represents the four sequences in the multiple sequence alignment. L The length of the multiple sequence alignment; The labels in the dataset are encoded, and each group of four sequences has a phylogenetic tree topology structure. The topologies of the unrooted phylogenetic trees are (1, 2(3, 4)), (1, 3(2, 4)), and (1, 4(3, 2)). The order of the sequences within each set of parentheses does not affect the topology structure. The encoding rule is ('(1, 2(3, 4))': '0', '(1, 3(2, 4))': '1', '(1, 4(3, 2))': '2'). By defining classes, data and labels are packaged to construct a dataset, and a deep neural network based on the Transformer of the Encoder module is constructed for overall sequence feature extraction. The features extracted by the Transformer with 6 Encoder modules are flattened into one dimension, passed through a fully connected layer, and finally output the predicted topology type (0, 1, 2). The SGD optimizer is used, and the parameters of the neural network are optimized and updated by gradient descent and backpropagation algorithms based on the cross-entropy loss function, so that the loss function gradually converges during the training process. For simulated sequence data that are long or short sequences and belong to six sequence categories (coded, non-coded, or standard), the corresponding deep learning models are trained respectively. The trained deep learning models for the six sequence categories are applied to the corresponding test sets, and the classification accuracy of the deep learning classifiers is evaluated using classification accuracy and other metrics to obtain the trained deep learning classifiers. The reconstruction module uses a pre-trained deep learning model for sequence category classification and a deep learning model for four-sequence phylogenetic tree topology prediction to match the optimal model for sequence data of different categories and perform four-sequence phylogenetic tree inference to reconstruct the four-sequence phylogenetic tree.

Citation Information

Patent Citations

  • Complex evolution history analysis method based on deep learning

    CN115641913A

  • Genome short variation deep learning detection method and system based on third-generation sequencing

    CN116959560A