Phylogenetic tree construction method and system based on deep learning and beam search
By employing deep learning and bundle search methods, combined with sliding window and incremental addition strategies, the problem of reconstructing multiple sequence alignment data with non-fixed length and non-fixed sequence number was solved, achieving accurate reconstruction and efficiency improvement of phylogenetic trees, especially in preserving INDEL information.
Patent Information
- Application Number
- CN202310132869.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-09
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2043-02-09
AI Technical Summary
Existing technologies struggle to handle multiple sequence alignment data with varying lengths and numbers of sequences, leading to inaccurate phylogenetic tree reconstruction. Furthermore, traditional methods ignore INDEL information, making it difficult to construct accurate multi-group phylogenetic trees.
We employ a deep learning and beam search approach, constructing a deep learning classifier using convolutional neural networks and long short-term memory neural networks. We combine the sliding window algorithm and an improved stepwise addition method to process multi-sequence alignment data of arbitrary length and number of sequences. The sliding window algorithm is used to divide the data into fixed-length sub-alignments, and the beam search strategy is used to reconstruct the phylogenetic tree.
It achieves accurate reconstruction of multiple sequence alignment data of arbitrary length and number of sequences, preserves INDEL information, improves the accuracy and efficiency of phylogenetic tree reconstruction, and can handle more common evolutionary biology analysis scenarios.
Smart Images

Figure CN115965082B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of bioinformatics and deep learning technology, specifically relating to a method and system for constructing phylogenetic trees based on deep learning and beam search. Background Technology
[0002] A phylogenetic tree is a tree-like branching graph that summarizes the evolutionary relationships between nodes. Nodes can be different species, different individuals of the same species, different genes, etc. It models phylogenetic history, reflecting the evolutionary relationships and processes of species, the kinship of samples within a population, the evolutionary relationships of gene family members, and so on. In most cases, a phylogenetic tree has a binary structure, conveying the concept that species evolution is a semi-random split. However, due to data or methodological limitations, a node may branch into multiple evolutionary branches, making the evolutionary relationships between species derived from that node unclear. Therefore, in most studies, researchers aim to obtain a binary phylogenetic tree. Currently, the main method for reconstructing phylogenetic trees is statistical inference. Researchers have proposed various statistical inference algorithms for inferring phylogenetic trees from multiple sequence alignment (MSA).
[0003] Generally, these algorithms can be divided into two categories:
[0004] 1) Distance-based algorithms infer hierarchical relationships by calculating a distance matrix containing pairwise sequence distance information and then using clustering algorithms. These algorithms include Unweighted Group Average (UPGMA) and Neighborhood Interchange (NJ).
[0005] 2) Search-based algorithms rely on predefined models, parameter sets, and evaluation metrics to evaluate the fit of a candidate phylogenetic tree to a given MSA, search the tree space, and select the phylogenetic tree that best fits the MSA under the given evaluation metrics, such as maximum parsing, maximum likelihood, and Bayesian inference.
[0006] These algorithms typically have the following drawbacks:
[0007] 1) The reconstruction of a phylogenetic tree requires a predefined evolutionary model with relevant parameters based on observed data or theoretical assumptions. However, when the evolutionary model and parameters deviate from the actual situation, the constructed tree will also deviate from the true result.
[0008] 2) It is difficult to find an accurate evolutionary model that can solve the problem of small sequence insertions or deletions (INDELs) in the genome. Many traditional algorithms ignore INDELs when reconstructing the tree, resulting in the omission of some evolutionary information and causing inaccuracies in the reconstruction of the phylogenetic tree.
[0009] 3) Some cross-sequence heterozygosity can lead to the generation of long branches. Therefore, accurately constructing phylogenetic trees of multiple taxa remains a challenging task.
[0010] With the development of deep learning, researchers hope to apply deep learning algorithms to the field of phylogenetic tree inference, and currently face two main challenges:
[0011] 1) To handle multiple sequence alignment (MSA) data of variable length, researchers have used simulated nucleotide training datasets to train and predict phylogenetic tree classifications for MSA data with fixed sequence lengths (1000 bases). However, existing methods cannot solve the problem of inference for non-fixed-length sequences.
[0012] 2) Phylogenetic tree inference for MSA with varying numbers of sequences. To handle more sequences, researchers have proposed a stepwise addition method for phylogenetic tree reconstruction. However, existing algorithms suffer from low efficiency and the potential for generating multi-branch trees. Summary of the Invention
[0013] The technical problem this invention aims to solve is to address the shortcomings of the prior art by providing a phylogenetic tree construction method and system based on deep learning and beam search. This addresses the difficulty of traditional deep learning in handling phylogenetic tree inference involving multiple sequence alignments of non-fixed length and number of sequences, enabling the invention to handle phylogenetic tree reconstruction based on multiple sequence alignments of arbitrary number and length. Furthermore, compared to the traditional maximum likelihood method, this invention can process the crucial evolutionary information INDEL without requiring the setting of difficult-to-estimate evolutionary models and parameters, and can perform data simulation and model training for specific scenarios, thus having greater application potential for specific applications.
[0014] The present invention adopts the following technical solution:
[0015] The phylogenetic tree construction method based on deep learning and beam search includes the following steps:
[0016] S1. Define different evolutionary scenarios, set simulation parameters according to the sequence characteristics of each evolutionary scenario, simulate four-sequence phylogenetic trees and their corresponding fixed-length multiple sequence alignment data based on the simulation parameters, use multiple sequence alignments as supervised learning data, use the corresponding four-sequence phylogenetic tree categories as supervised learning classification labels, and construct a supervised learning dataset. Finally, divide the supervised learning dataset into training set, validation set and test set.
[0017] S2. Using the supervised learning dataset constructed in step S1, construct a three-class deep learning machine with convolutional neural network and long short-term memory neural network as the core. Use the training set, validation set and test set of step S1 as training, validation and testing of the deep learning classifier, respectively, to obtain the trained deep learning classifier.
[0018] S3 divides the non-fixed-length four-sequence alignment data into multiple fixed-length sub-four-sequence alignments using a sliding window algorithm. Then, the three-class deep learning classifier obtained in step S2 is used to classify and predict the sub-four-sequence alignments. The classification prediction result of each sub-four-sequence alignment is a 3-dimensional probability distribution vector. Each dimension of the vector gives the probability corresponding to the three topologies. The sub-four-sequence alignment with the highest probability distribution prediction result is selected to obtain the non-fixed-length four-sequence alignment classification result.
[0019] S4. For non-fixed-length multiple sequence alignment data, first sample all non-fixed-length sub-four sequence alignments, and predict the non-fixed-length four sequence alignment data according to the classification prediction method in step S3 to obtain the prediction results of all four sequence alignments. Finally, based on the results of all four sequence alignments, combine the improved stepwise addition method and the cluster search strategy to reconstruct the phylogenetic tree of non-fixed length and arbitrary number of sequences.
[0020] Specifically, step S1 is as follows:
[0021] S101. Randomly set the number of leaf nodes N0 in the phylogenetic tree, randomly select N sequences, 4≤N0≤40, and use the bioinformatics software package ETE3 to randomly generate a phylogenetic tree topology with N0 leaf nodes.
[0022] S102. Sample a desired average divergence degree d1 from the average divergence degree distribution corresponding to the defined evolution scenario;
[0023] S103. Based on the non-leaf node branch length distribution and leaf node branch length distribution corresponding to the defined evolution scenario, independently sample each branch length of the phylogenetic tree obtained in step S101, and calculate the average divergence degree d2 of the current phylogenetic tree. Scale each branch length by multiplying it by the coefficient d1 / d2 so that the average pairwise divergence degree of the N0 leaf nodes is equal to the expected average divergence degree d1 obtained in step S102. Finally, a phylogenetic tree with N0 leaf nodes and known branch lengths is obtained.
[0024] S104. Randomly select 4 leaf nodes from the phylogenetic tree with N0 leaf nodes obtained in step S103 to obtain a four-sequence tree, and know the corresponding topology and the branch length of each branch.
[0025] S105. Based on other predefined parameters and the topology of the four-sequence tree obtained in step S104 and the branch length of each branch, use bioinformatics software to simulate multiple sequence alignment (MSA) of a given phylogenetic tree. Use multiple sequence alignment as data and the corresponding phylogenetic tree as the label according to the classification of the unrooted tree to create a dataset.
[0026] S106. Divide the dataset obtained in step S105 into a training set, a validation set, and a test set.
[0027] Specifically, the evolutionary scenario is defined as follows:
[0028] Using the regular expression [SCN][1-2][UG], 12 evolution scenarios for simulating sequence data are predefined; for each evolution scenario, the sequence length, non-leaf node branch length distribution, leaf node branch length distribution, average sequence divergence, replacement to INDEL ratio, INDEL length distribution, maximum INDEL length, and immutable site ratio are set.
[0029] Specifically, step S2 is as follows:
[0030] S201. Encode the base information of the original MSA sequences in the dataset. After encoding, the dataset is represented as an M×4×L tensor, where M 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.
[0031] S202. Construct a convolutional neural network for sequence feature extraction and a long short-term memory neural network for MSA sequence feature extraction.
[0032] S203. Flatten the features obtained from the convolutional neural network and long short-term memory neural network constructed in step S202 into one dimension, and then output a three-dimensional probability distribution vector after passing through a fully connected layer, representing the predicted topological probability distribution. Each dimension of the vector represents the predicted probability of the corresponding topology.
[0033] S204. Based on the cross-entropy loss function, optimize and update the parameters of the convolutional neural network and the long short-term memory neural network through gradient descent and backpropagation algorithms, and train the corresponding deep learning classifiers for the evolution scenario data respectively.
[0034] S205. Apply the deep learning model trained in step S204 to the corresponding test sets, and use the classification accuracy index to evaluate the classification accuracy of the deep learning classifier to obtain the trained deep learning classifier.
[0035] Furthermore, in step S204, the loss function Loss used in the optimization process is:
[0036]
[0037] Where N1 is the number of samples, y ij The true distribution for each sample, The distribution predicted by the deep learning classifier.
[0038] Specifically, step S3 is as follows:
[0039] S301. For a four-sequence alignment of length L0, encode it into a 4×L0 tensor.
[0040] S302. Use W sliding windows of length L to sample the original MSA to obtain a tensor W×4×L. Use a deep learning classifier to predict the sampled results to obtain a result of W×3.
[0041] Furthermore, step S302 specifically includes:
[0042] S3021. During the prediction process, a sliding window is used to perform phylogenetic tree inference on the four-sequence trees of each region of the original MSA. Based on the topological structure of each region, the best four-sequence tree of the full-length MSA is selected.
[0043] S3022. For each original MSA subregion, a three-dimensional vector is obtained, and the average of W three-dimensional vectors is calculated to represent the probability distribution of the phylogenetic tree topology classification corresponding to the overall length. The prediction result for four-sequence alignment of arbitrary length is a W×3 three-dimensional vector.
[0044] Specifically, step S4 is as follows:
[0045] S401. For multi-sequence alignment data of arbitrary length and number of sequences, first sample all four-sequence alignments, and encode the sampling results into size. The tensor is given by n, where n is the number of sequences to be aligned, and L0 is the length of the sequence to be aligned. Using the sliding window algorithm from step S3, the tensor is... Sliding window sampling was performed on 4×L0 four-sequence alignment data, and the final sampled data was obtained. For each W×4×240 or W×4×1200 sub-MSA, the sampling results of the sliding window are encoded as... Tensors of size or A tensor of size; using the classifier for fixed-length four-sequence alignment data trained in step S2, deep learning is used to classify and predict the tensor, resulting in a tensor of size. As a result, the 3 in the last dimension represents three possible topologies; The tensor transformation is The tensor, and take the average over the last dimension, that is, take the average of the classification prediction results of W sliding windows, and sample from n sequences. The classification prediction results of each sub-MSA are summed to obtain a... As a result, four sequences were randomly selected from the n sequences, and the predicted topology of the phylogenetic tree exists. In the tensor, the topology with the highest probability is used to construct the initial phylogenetic tree T4;
[0046] S402. Based on the improved stepwise addition method, iteratively add node N5 to the initial phylogenetic tree T4 obtained in step S401 to obtain T5, add node N6 to T5 to obtain T6, and so on until all nodes have been added to obtain the reconstructed phylogenetic tree T. n .
[0047] Furthermore, the improved step-by-step addition method is as follows:
[0048] S4021. Adopt a cluster search strategy, set the hyperparameter cluster size n, and in each iteration of adding new nodes, only retain the top n solutions in the candidate subtrees and proceed to the next node addition.
[0049] S4022. In each iteration, a pruning algorithm is used to accelerate the search process. If the number of remaining edges after pruning is less than or equal to the user-defined bundle size, the next node is added to these edges, the candidate subtree score is no longer calculated, and the process proceeds directly to the next iteration. If the number of remaining edges is greater than the user-defined bundle size, the next node is added to the remaining edges, and bundle search is performed.
[0050] Secondly, embodiments of the present invention provide a phylogenetic tree construction system based on deep learning and beam search, comprising:
[0051] The data module defines different evolutionary scenarios, sets simulation parameters according to the sequence characteristics of each evolutionary scenario, simulates a four-sequence phylogenetic tree and its corresponding fixed-length multiple sequence alignment data based on the simulation parameters, uses the multiple sequence alignment as supervised learning data, and uses the category of the corresponding four-sequence phylogenetic tree as the classification label for supervised learning, thus forming a supervised learning dataset. Finally, the supervised learning dataset is divided into training set, validation set and test set.
[0052] The training module uses the supervised learning dataset built by the data module to construct a three-class deep learner with convolutional neural networks and long short-term memory neural networks as its core. The training set, validation set, and test set of the data module are used as the training, validation, and testing sets of the deep learning classifier, respectively, to obtain the trained deep learning classifier.
[0053] The classification module divides the non-fixed-length four-sequence alignment data into multiple fixed-length sub-four-sequence alignments using a sliding window algorithm. Then, it uses a three-class deep learning classifier obtained from the training module to classify and predict the sub-four-sequence alignments. The classification prediction result of each sub-four-sequence alignment is a 3-dimensional probability distribution vector. Each dimension of the vector gives the probability corresponding to the three topologies. The maximum probability distribution prediction result of all sub-four-sequence alignments is selected to obtain the classification result of the non-fixed-length four-sequence alignment.
[0054] The construction module first samples all non-fixed-length four-sequence alignments for non-fixed-length multiple sequence alignments, and then predicts the classification of the non-fixed-length four-sequence alignments based on the classification prediction method of the classification module to obtain the prediction results of all four-sequence alignments. Finally, based on the results of all four-sequence alignments, the phylogenetic tree reconstruction of non-fixed-length, arbitrary-number sequences is performed by combining the improved stepwise addition method and the bundle search strategy.
[0055] Compared with the prior art, the present invention has at least the following beneficial effects:
[0056] A phylogenetic tree construction method based on deep learning and beam search.
[0057] This invention presents a phylogenetic tree construction method based on deep learning and beam search. It predefines 12 test scenarios to simulate the properties of real-world biological sequences, using simulated sequence data according to preset parameters as the training, validation, and test sets for the model, respectively. A convolutional neural network and a long short-term memory neural network are constructed, and the network is trained, validated, and tested using the simulated dataset. The loss function curve gradually converges in all 12 scenarios. Based on the trained deep learning network and sliding window algorithm, predictions of all sub-quadruple sequence trees are performed on the sequence data. Finally, an improved stepwise addition method is used to perform complete phylogenetic tree inference on the sequence data, yielding a complete reconstruction result.
[0058] Furthermore, by utilizing multiple sequence alignment, deep learning algorithms can be used to infer the topological structure and evolutionary relationships between sequences, thereby performing phylogenetic tree inference on the sequence data, constructing a phylogenetic tree, and simulating new datasets for specific scenarios to train new deep learning classifiers to realize customized phylogenetic tree reconstruction tools for specific scenarios.
[0059] Furthermore, 12 different evolutionary scenarios are defined using the regular expression [SCN][1-2][UG]. The first digit of the regular expression, S, C, and N, represents sequences originating from any region of the genome, a coding region, and a non-coding region, respectively. The second digit, 1 or 2, represents sequence lengths of 240bp or 1200bp in the deep learning classifier, respectively. The third digit, U and G, represents branch lengths of the phylogenetic tree sampled from a uniform distribution and a gamma distribution, respectively. The 12 different evolutionary scenarios are intended to cover most practical phylogenetic tree reconstruction scenarios, thereby training a deep learning classifier capable of handling most common multiple sequence alignments. Simultaneously, multiple parameters are set for each evolutionary scenario, including average sequence divergence, the ratio of substitutions to INDELs, the length distribution of INDELs, the maximum INDEL length, and the ratio of invariant sites. This allows for more refined data simulation. For example, by consulting literature and referring to parameters such as average sequence divergence and the ratio of substitutions to INDELs, the simulation results of this invention are made closer to real biological sequences.
[0060] Furthermore, the deep learning classifiers obtained through training are robust and universal, and can be applied to comparative and population genome data from different biological groups to quantify evolutionary relationships at the genome level. Compared to traditional phylogenetic tree methods, they retain more effective information such as INDELs, making them more suitable for studying evolutionary history in the presence of gene flow.
[0061] Furthermore, the cross-entropy loss function is used as the classification loss function; the smaller the value of this loss function, the smaller the error of the deep learning classifier. Moreover, during training, this invention establishes an iterative loop and uses the stochastic gradient descent algorithm to optimize the neural network parameters in the deep learning classifier, causing the cross-entropy loss function to gradually decrease and eventually converge to a minimum value, resulting in the final deep learning classifier.
[0062] Furthermore, for quad sequence alignments of arbitrary length, directly using a deep learning classifier would be difficult to handle the variable sequence length problem. Therefore, by combining the sliding window algorithm, the original quad sequence alignment data of arbitrary length is divided into multiple sub-quad sequence alignments of fixed length (240bp or 1200bp). Then, a trained deep learning classifier is used to classify these sub-quad sequence alignments. Finally, the classification results of all sub-quad sequence alignments are comprehensively scored to obtain the final classification result.
[0063] Furthermore, for four-sequence alignments of arbitrary length, during the prediction process, a sliding window is used to divide the original four-sequence alignment into multiple sub-four-sequence alignments, and a deep learning classifier is used to predict and classify these sub-four-sequence alignments. Finally, when synthesizing the results, the classification results of all sub-four-sequence alignments are averaged, and the topological distribution with the largest average value is selected to obtain the final classification result for four-sequence alignments of arbitrary length. This result is a three-dimensional vector, where each dimension of the vector represents the score of three possible phylogenetic trees.
[0064] Furthermore, for multiple sequence alignment data of arbitrary length and number of sequences, current algorithms either cannot directly utilize deep learning for inference or require combination with other algorithms (such as quartet puzzling). These other inference algorithms may fail to generate multi-branch phylogenetic trees that conform to evolutionary theory. The inference framework designed in this invention utilizes a deep learning classifier to solve the fixed-length four-sequence alignment classifier problem, combines a sliding window algorithm to handle the classification and scoring of non-fixed-length four-sequence alignments, and finally combines an improved stepwise addition method to reconstruct phylogenetic trees of non-fixed length and arbitrary number of sequences. This design allows this invention to flexibly handle all possible phylogenetic tree construction scenarios, enabling the phylogenetic tree method of this invention to be applied to more common evolutionary biology analyses.
[0065] Furthermore, this invention employs a cluster search strategy, setting a hyperparameter cluster size *n*. In each iteration of adding new nodes, only the top *n* solutions with the highest scores in the candidate subtrees are retained for the next node addition. This operation allows each iteration of the incremental addition algorithm to be computed within polynomial time complexity, ensuring the efficiency of the algorithm. Simultaneously, to accelerate the overall search efficiency, this invention further utilizes a pruning algorithm in each iteration to speed up the search process. The pruning strategy guarantees that if the number of remaining edges after pruning is less than or equal to the user-defined cluster size, the next node is added to these edges, and the score of the candidate subtree is not calculated; the next iteration proceeds directly. If the number of remaining edges after pruning is greater than the user-defined cluster size, cluster search continues. The pruning algorithm of this invention significantly reduces the computational load of reconstructing the phylogenetic tree, achieving time efficiency comparable to the maximum likelihood estimation algorithm.
[0066] 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.
[0067] In summary, this invention proposes a novel deep learning-based phylogenetic tree reconstruction method, capable of reconstructing phylogenetic relationships for multiple sequence alignments with non-fixed lengths and numbers of sequences. This invention designs 12 predefined evolutionary scenarios covering the vast majority of evolutionary situations, sets reasonable evolutionary parameters for different scenarios, and trains a deep learning classifier on a simulated dataset for each scenario. The trained deep learning classifier can solve the phylogenetic tree classification problem for fixed-length (240bp or 1200bp) four-sequence alignments, and it can handle the presence of INDELs in multiple sequence alignments well, rather than ignoring this evolutionary information like traditional maximum likelihood algorithms. To handle non-fixed-length four-sequence alignment data, this invention incorporates a sliding window algorithm. Using a sliding window, the original four-sequence alignment is divided into multiple fixed-length (240bp or 1200bp) four-sequence alignments. The trained deep learning classifier is applied to the fixed-length four-sequence alignments, and finally, the classification results of all sub-four-sequence alignments are averaged to obtain the classification prediction for the non-fixed-length four-sequence alignments. To address the phylogenetic tree reconstruction problem involving multiple sequence alignments with varying numbers and lengths, this invention first samples all possible four-sequence alignments from the original multiple sequence alignments. Then, it uses the previously mentioned method for handling four-sequence alignments of varying lengths to classify and predict all possible alignments. Finally, using these prediction results, combined with a stepwise addition algorithm and a bundle search strategy, it achieves phylogenetic tree reconstruction with an arbitrary number of sequences. Finally, to improve reconstruction efficiency, this invention designs a pruning algorithm, making its final running time comparable to the traditional maximum likelihood algorithm.
[0068] 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
[0069] Figure 1 This is a flowchart of the phylogenetic tree construction method and system based on deep learning in an embodiment of the present invention;
[0070] Figure 2 This is a schematic diagram showing some parameter settings for 12 scenarios defined in the simulation process of this invention;
[0071] Figure 3 This is a schematic diagram of the dataset partitioning in this invention;
[0072] Figure 4 This is a framework diagram of the deep learning classifier in this invention;
[0073] Figure 5 This refers to the data output shape of each layer of the model in this invention;
[0074] Figure 6 This is a schematic diagram of the loss function of the model in this invention;
[0075] Figure 7 This is a schematic diagram showing the classification accuracy of the deep learning classifier in this invention on a simulated dataset of 12 scenarios using 12 predefined scenario parameters.
[0076] Figure 8 This is a schematic diagram of the optimized step-by-step addition method in this invention;
[0077] Figure 9 This is a schematic diagram of pruning in this invention;
[0078] Figure 10 The diagram shows the performance of the model in this invention and the simulated data under the IQ-TREE and RAxML algorithms in six scenarios. From left to right, they are: S1G, S2G, N1G, N2U, C1U, and C2U.
[0079] Figure 11 This is a schematic diagram showing the reconstruction results of the system evolution of the 10 10_leaf nodes subtrees of the UCSC database in this invention, as well as the results of reconstructing the 100taxa tree by combining the model and NJMerge-2.
[0080] Figure 12 This is a schematic diagram showing the results of reconstructing rice and butterfly species using the model and the maximum likelihood method in this invention, where A and C are the phylogenetic trees of rice and butterfly species reconstructed by the model.
[0081] Figure 13 The results of system evolution reconstruction (RF distance) using the algorithm in this invention, the algorithm trained based on parameters estimated from data, the Iqtree and Raxml algorithms;
[0082] Figure 14 The diagram shows the average running time of the phylogenetic tree algorithm, IQ-TREE, and RAxML algorithms on simulated data with 10, 20, 30, and 40 taxa, respectively. Detailed Implementation
[0083] 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.
[0084] This invention provides a phylogenetic tree construction method based on deep learning and beam search. Based on convolutional neural networks and long short-term memory neural networks, it offers a novel phylogenetic tree inference framework based on deep learning and beam search, providing a retrainable toolkit for everyday applications of phylogenetic tree inference. An online server (http: / / fusang.cibr.ac.cn) and a Linux command-line package have been developed. It can reconstruct phylogenetic trees for MSAs with fewer than 40 input sequences and a sequence length of less than 10,000 bases. Furthermore, for specific scenario datasets, new training parameters can be set to obtain new deep learning classifiers, allowing for customized phylogenetic tree reconstruction methods for specific scenarios.
[0085] Please see Figure 1 This invention provides a method for constructing a phylogenetic tree based on deep learning and beam search.
[0086] Twelve evolutionary scenarios are predefined, with evolutionary parameters for each scenario set based on the properties of real-world biological sequences. A deep learning dataset is created by simulating phylogenetic trees and their corresponding multiple sequence alignment data using these predefined parameters. This dataset is then divided into training, validation, and test sets. A deep learning classifier based on convolutional neural networks and long short-term memory neural networks is constructed. The network is trained and validated using the training and validation sets, and the loss function curves gradually converge across all 12 scenarios. The accuracy of the network is tested using the test set. Based on the trained deep learning classifier and the sliding window algorithm, classification predictions are performed on all sub-quadruple trees of the sequence data. A phylogenetic tree reconstruction is then performed on the multiple sequence data using an improved stepwise addition method and the classification prediction results of the sub-quadruple trees, yielding a complete reconstruction result. The phylogenetic tree construction algorithm is validated using both simulated and real sequence data. This invention uses multiple sequence alignment to infer the topological structure and evolutionary relationships between sequences through deep learning algorithms, thereby performing phylogenetic tree inference on the sequence data, constructing a phylogenetic tree, and allowing for the setting of new parameters for specific scenario datasets to train new deep learning classifiers, resulting in a customized deep learning network for constructing phylogenetic trees; the specific steps are as follows:
[0087] S1. Predefine 12 evolutionary scenarios and set simulation parameters according to the sequence characteristics of each evolutionary scenario. Simulate a four-sequence phylogenetic tree and its corresponding fixed-length (preset two multi-sequence alignment lengths: 240 and 1200) multi-sequence alignment data according to the preset simulation parameters. Use the multi-sequence alignment as supervised learning data, and use the category of the corresponding four-sequence phylogenetic tree (a phylogenetic tree with four leaf nodes and no root has three possible topologies) as the classification label for supervised learning. Finally, divide the dataset into training set, validation set and test set.
[0088] Please see Figure 2 To ensure the simulation parameters closely resemble the properties of real-world biological sequences, the regular expression "[SCN][1-2][UG]" was used to predefine 12 scenarios for simulating sequence data. For each scenario, parameters were set including sequence length, non-leaf node branch length distribution, leaf node branch length distribution, average sequence divergence, replacement-to-INDEL ratio, INDEL length distribution, maximum INDEL length, and immutable site ratio. Among these, average sequence divergence and the replacement-to-INDEL ratio are the core indicators distinguishing different evolutionary scenarios. Specifically:
[0089] S101. Use the bioinformatics software package ETE3 to generate a phylogenetic tree topology and randomly select N0 (4≤N0≤40) sequences;
[0090] S102. Sample an expected average divergence degree d1 from the average divergence degree distributions corresponding to the 12 predefined scenarios;
[0091] S103. Based on the non-leaf node branch length distribution and leaf node branch length distribution corresponding to the 12 predefined evolution scenarios, independently sample each branch length (from uniform distribution or gamma distribution), and calculate the average divergence degree d2 of the current phylogenetic tree. Scale each branch length by multiplying it by the coefficient d1 / d2 so that the average pairwise divergence degree of N0 leaf nodes is equal to d1.
[0092] S104. Randomly select 4 species from this phylogenetic tree to obtain the topology of the four-sequence tree and the branch length of each branch;
[0093] S105. Based on other predefined parameters and the phylogenetic tree topology and branch length, use the bioinformatics software Indelible to simulate multiple sequence alignment (MSA) of a given phylogenetic tree, and create a dataset for supervised learning. The MSA data is used as the dataset, and the corresponding phylogenetic tree is labeled according to the unrooted tree classification (there are three categories: ((A,B),C,D) as category 0, ((A,C),B,D) as category 1, and ((A,D),B,C) as category 2). Figure 3 As shown;
[0094] S106. Divide the dataset into training set, validation set and test set.
[0095] Please see Figure 3 The number of training sets, validation sets, and test sets is selected based on the complexity of different predefined evolution scenarios.
[0096] Based on the actual phylogenetic tree data patterns, samples were taken from the S1G, S2G, N1G, N2U, C1U, and C2U datasets for testing, and all showed a long-tailed distribution pattern.
[0097] The beneficial effects of the above technical solution are:
[0098] The simulation parameters are set to closely resemble the properties of real-world biological sequences. By simulating complex evolutionary histories and population structures, the model's generalization and generalization abilities are enhanced, ensuring that the simulation data accurately reflects the distribution of real-world data.
[0099] S2. Construct a deep learning classifier with convolutional neural network and long short-term memory neural network as the core. Use training set, validation set and test set to train, validate and test the network. The classification loss function curve of the validation set gradually converges in 12 scenarios. The test set shows that the model has a high classification accuracy.
[0100] S201. Encode the base information of the original MSA sequences in the dataset. The encoding rule is ('A':'0', 'T':'1', 'C':'2', 'G':'3', '-':'4', 'N':'4'), where '-' and 'N' represent INDELs in MSA. After encoding, the dataset will be represented as an M×4×L tensor, where M 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.
[0101] S202. Construct a convolutional neural network (CNN) for sequence feature extraction and a long short-term memory neural network (LSTM) for MSA sequence feature extraction. The specific model structure is as follows: Figure 4 As shown;
[0102] The features obtained from S203, the convolutional neural network, and the long short-term memory neural network are flattened into one dimension, then passed through a fully connected layer, and finally output as a 3-dimensional vector representing the predicted topological probability distribution. Each dimension of the vector represents the predicted probability of a topology. The output shape of each layer of the algorithm is as follows: Figure 5 As shown;
[0103] S204. Based on the cross-entropy loss function, the neural network parameters are optimized and updated using gradient descent and backpropagation algorithms, so that the loss function gradually converges during training. Specifically, deep learning classifiers are trained for the data from the 12 scenarios "[SCN][1-2][UG]". Figure 6 As shown;
[0104] S2041. Use the backpropagation algorithm to optimize the parameters of the deep learning classifier while minimizing the cross-entropy loss function.
[0105] The loss function for the optimization process is as follows:
[0106] Given N1 samples, the true distribution of each sample is y. i =(y i1 ,y i2 ,y i3 The distribution predicted by the deep learning classifier is The loss function Loss for the optimization process is:
[0107]
[0108] S2042. 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.
[0109] S205. Apply the 12 trained models "[SCN][1-2][UG]" to their respective test sets, and evaluate the classification accuracy of the deep learning classifiers using the classification accuracy metric. The results are as follows: Figure 7 As shown.
[0110] S3. Based on the trained deep learning classifier and sliding window algorithm, classify and predict non-fixed length four-sequence alignment data. The classification prediction result will be a 3-dimensional probability distribution vector, and each dimension of the vector gives the probability corresponding to the three topologies.
[0111] S301. For a four-sequence alignment of length L0, encode it into a 4×L0 tensor.
[0112] For 4, it represents the four sequences in the four-sequence alignment;
[0113] For L0, it represents the sequence length of the original four-sequence MSA;
[0114] For the encoding rules, the following rules are used: ('A':'0','T':'1','C':'2','G':'3','-':'4','N':'4').
[0115] S302. Use W sliding windows of length L to sample the original MSA to obtain tensor W×4×L. Use a deep learning classifier to predict the sampled results to obtain W×3 results.
[0116] S3021. During the prediction process, a sliding window is used to perform phylogenetic tree inference on the four-sequence trees of each region of the MSA. Based on the topological structure of each region, the best four-sequence tree of the full-length MSA is selected.
[0117] The specific method for calculating window functions is as follows:
[0118] If the MSA length is less than 1200bp, use a sliding window of 240bp; if the MSA length is greater than 1200bp but less than 10000bp, use a sliding window of 1200bp.
[0119] The number W of sliding windows is calculated as follows:
[0120]
[0121] Here, C is a hyperparameter that determines the average number of windows that will cover a base; the default value is C = 1. Typically, C can be a positive real number, such as 1, 1.5, 2, etc. For example, if C equals 2, it means that, on average, a base will be covered by 2 sliding windows.
[0122] Once the number of sliding windows W is determined, the sliding step size S of the sliding window is calculated as follows:
[0123]
[0124] After determining the step size S of the sliding window, the sliding window will start from the first base and move backward by S bases each time until the last sliding window exactly covers the last base.
[0125] S3022. For each MSA subregion, a three-dimensional vector is obtained, and the average of W three-dimensional vectors is calculated to represent the probability distribution of the phylogenetic tree topology classification corresponding to the overall length. Finally, the prediction result for four-sequence alignment of arbitrary length is a three-dimensional vector.
[0126] S303. The above method will be used as a fixed module for phylogenetic tree reconstruction with arbitrary nodes and arbitrary sequence lengths.
[0127] S4. For data with more than four sequence alignments, firstly sample all four sequence alignments and perform classification and prediction according to the method in step S3. Finally, combine the improved stepwise addition method and the cluster search strategy to reconstruct the phylogenetic tree with any number of sequences and obtain the complete reconstruction result.
[0128] System evolution reconstruction is to find the optimal evolutionary tree topology τ that maximizes the posterior probability P(τ|M) for a given MSA (abbreviated as M), expressed as:
[0129] T = argmax τ P(τ|M)
[0130] The phylogenetic tree is reconstructed using an improved stepwise addition algorithm for different numbers of species as follows:
[0131] S401. For multiple sequence alignment data of arbitrary length and number of sequences, first sample all four sequence alignments, and encode the sampling results into size... A tensor, where n is the number of sequences in the multiple sequence alignment and L0 is the sequence length of the multiple sequence alignment; using the sliding window algorithm described in step S3, for The four sequence alignment data were sampled using a sliding window to finally sample out For each W×4×240 or W×4×1200 sub-MSA, the sampling results of the sliding window will be encoded as... Tensors of size or A tensor of size; using the algorithm described in step S2, perform deep learning classification prediction on this tensor to obtain a tensor of size. As a result, the 3 in the last dimension represents three possible topologies. The tensor transformation is The tensor is calculated, and the average is taken over the last dimension, i.e., the average of the classification predictions over W sliding windows. This is applied to samples from n sequences. The summation of the classification prediction results of each sub-MSA yields a... As a result, four sequences were randomly selected from the n sequences, and the predicted topology of their phylogenetic trees already existed. In the tensor, the topology with the highest probability is used to construct the initial phylogenetic tree T4.
[0132] S402. Iteratively add node N5 to T4 to obtain T5, then add node N6 to T5 to obtain T6, until all nodes have been added, resulting in the final reconstructed phylogenetic tree T. n .
[0133] Please see Figure 8 The specific method for gradually adding new nodes is as follows:
[0134] Given a four-sequence tree topology T4, we will gradually add sequences from N5 to N to it. n The node, the process is as follows:
[0135] First, define the following symbols according to the step-by-step addition method. (T4, N5) represents adding the fifth node N5 to T4, and the other symbols are represented in the same way.
[0136] (T4, N5) = T5
[0137] (T4, N5, ..., N) i ) = T i
[0138] (T4, N5, ..., N) n ) = T
[0139] Finally, a tree-like topology T is obtained. Adding all n nodes follows the process:
[0140]
[0141] To obtain the correct tree topology T, each sub-process of the stepwise addition should be a process of progressively finding the optimal solution. The calculation process is as follows:
[0142]
[0143] For each sub-process, it is necessary to use and Find the best T i .
[0144] for Use a deep learning classifier to find the optimal four-sequence tree.
[0145] for and If N n* Record the candidate positions for adding a new node on this branch, using τ. n* Record τ n The corresponding candidate trees were obtained. The following results were obtained:
[0146] P(N 5* |τ4,M)=P(τ 5* |M)
[0147] P(N n* |N5,…N n-1 ,τ4,M)=P(τ n* |M)
[0148] Therefore, argmaxP(τ) is used. i* |M) Find the optimal solution for each subproblem, and score it using a tree-like topology. i )Measure its relative value.
[0149] In each iteration of adding a new node, the new node is added to every edge of the original subtree. For example, if the original subtree is T4 and the unrooted tree with 4 nodes has 5 edges, the next node to be added, N5, will be added to every edge of T4, resulting in a candidate T′5 for a five-node subtree. At this point, 5 candidate results are obtained. Each candidate subtree is scored, and the top-scoring T′5 is selected as the final candidate T5. N5 is then added to the corresponding edge, and the next node addition is performed.
[0150] In this process, for a candidate subtree with i nodes, the score of the candidate subtree is calculated as follows:
[0151]
[0152] Among them, T i Let q represent a candidate subtree with i nodes that needs to be scored. i Indicates a from T i The subtree with four leaf nodes is obtained by sampling from the i-th node. This formula shows that the score of a candidate subtree with i nodes is the sum of the probabilities of all four-leaf nodes sampled from it.
[0153] The higher the score of this invention, the better the candidate subtree T. i The higher the probability of it being the correct subtree.
[0154] The specific method for improving the incremental addition method is as follows:
[0155] S4021. As the number of species increases, the search space of the phylogenetic tree gradually expands. Traversing the entire search space would be an NP-hard problem, thus requiring optimization of the search strategy to search only a subset of possible solutions. To address this, a beam search strategy is adopted. The user sets the beam size n (a hyperparameter). In each iteration of adding new nodes, only the top n solutions in the candidate subtree (step S402) are retained for the next node addition.
[0156] In this invention, the default cluster size is equal to 1, which is a greedy search algorithm. The next node is added to the candidate subtree with the highest score until all nodes are added, and the final phylogenetic tree is obtained.
[0157] S4022. In each iteration of the incremental addition method, a pruning algorithm is used to accelerate the search process. That is, during the incremental addition process, some edges with lower probability are pruned. If, after pruning, the number of remaining edges is less than or equal to the user-defined bundle size, the next node is directly added to these edges without calculating their candidate subtree scores, and the process proceeds directly to the next iteration. If the number of remaining edges is greater than the user-defined bundle size, the next node is added to the remaining edges, and the bundle search is performed as described in step S4021.
[0158] The specific pruning strategy is as follows: Assume the nodes currently in the candidate phylogenetic subtrees are 1, 2, ..., n-1, where n is the next node to be added. First, calculate the probability distribution of all possible four-sequence subtrees (where three nodes are selected from 1, 2, ..., n-1, and the fourth node is n). From all these probabilities, select the n subtrees with the highest probabilities (n is a user-defined hyperparameter, defaulting to 10% of the number of four-sequence subtrees). Then, perform edge pruning. The pruning process is illustrated in the diagram below. Figure 9 As shown.
[0159] The beneficial effects of the above technical solution are:
[0160] It can process individual or group data, more effectively reflect the real relationships between groups, and construct phylogenetic trees for sequences of different lengths and numbers of species.
[0161] S5. The phylogenetic tree construction algorithm was tested using simulated sequence data, biological sequence data from public databases, and sequence data obtained from evolutionary experiments. The accuracy and time efficiency of the algorithm were tested, and a customized deep learning classifier was developed for the sequence data obtained from evolutionary experiments. The tests showed that the accuracy of the reconstructed results was improved by the customized classifier.
[0162] S501. When the number of species is less than 40, use simulated data to test the accuracy of the model in reconstructing the phylogenetic tree under the default scenario;
[0163] By default, each parameter setting contains 1160 MSAs, covering 29 multi-species scenes (4-30, 35, and 40 respectively). RF distance is used as the criterion for judging the accuracy of system evolution reconstruction. The results are compared with those of IQ-TREE and RAxML to evaluate the performance of this invention. The overall results are as follows: Figure 10 As shown, the overall RF distance of the system evolution reconstruction results is smaller than that of the other two algorithms.
[0164] S5011. By default, each parameter setting contains 1160 MSAs, covering 29 scenarios with different numbers of sequence types (4-30, 35, and 40 respectively).
[0165] S5012 uses the RF distance as the criterion for judging the accuracy of phylogenetic tree reconstruction and calculates the RF distance of the phylogenetic tree reconstruction results.
[0166] S502. The model is combined with the improved adjacency method NJMerge to reconstruct 100 sequence trees, verifying the model's scalability. Simultaneously, the reconstruction results are compared with those of IQ-TREE and RAxML to determine the model's performance. The results show that the model of this invention (RF distance 8), IQ-TREE (RF distance 12), and RAxML (RF distance 6) exhibit comparable performance.
[0167] S503. Constructing a phylogenetic tree based on the UCSC database;
[0168] S5031. Collect MSAs of 100-leaf nodes from the UCSC database and perform phylogenetic tree inference using chromosome 1 (http: / / hgdownload.cse.ucsc.edu / goldenpath / hg38 / multiz100way / );
[0169] S5032. Test the evolution of the reconstruction system for 10 10-leaf node subtrees. The reconstruction results are as follows: Figure 11 As shown;
[0170] S5033. Combine the model with NJMerge-2 to reconstruct a phylogenetic tree of 100 leaf nodes.
[0171] S504. Phylogenetic tree deduction of rice and butterfly species;
[0172] Phylogenetic tree inferences were performed on rice and butterfly species respectively, and the reconstructed topologies are as follows: Figure 12 As shown.
[0173] S505. Perform phylogenetic tree inference on evolutionary data in the laboratory;
[0174] Performance tests were conducted on the algorithm version based on simulation parameters under 12 predefined scenarios and the algorithm version trained with new parameters for specific scenarios. Compared with the predefined version and the RAxML and IQ-TREE methods, the algorithm with new parameters achieved a smaller RF distance when reconstructing the evolution of the experimental system, demonstrating the algorithm's adaptability. Specific results are shown below. Figure 13 As shown.
[0175] S506. Test the running time of constructing phylogenetic trees with different numbers of species.
[0176] Please see Figure 14 The computational efficiency of Fusang was compared with that of IQ-TREE and RAxML algorithms to determine its computational efficiency. When the number of species is less than 20, the algorithm exhibits good computational efficiency. As the number of species increases, the running time increases slightly due to the stepwise increase in algorithm complexity and the characteristics of beam search.
[0177] The embodiments of this invention utilize a deep learning classifier, which not only has good performance on phylogenetic trees constructed from simulated data, but also on phylogenetic trees of real databases and real species such as rice and butterflies, effectively obtaining the evolutionary relationships between taxa from real data.
[0178] In another embodiment of the present invention, a phylogenetic tree construction system based on deep learning and beam search is provided. This system can be used to implement the above-mentioned phylogenetic tree construction method based on deep learning and beam search. Specifically, the phylogenetic tree construction system based on deep learning and beam search includes a data module, a training module, a classification module, and a construction module.
[0179] The data module defines different evolutionary scenarios, sets simulation parameters according to the sequence characteristics of each evolutionary scenario, simulates a four-sequence phylogenetic tree and its corresponding fixed-length multiple sequence alignment data based on the simulation parameters, uses the multiple sequence alignment as supervised learning data, and uses the category of the corresponding four-sequence phylogenetic tree as the classification label for supervised learning, thus forming a supervised learning dataset. Finally, the supervised learning dataset is divided into a training set, a validation set, and a test set.
[0180] The training module uses the supervised learning dataset built by the data module to construct a three-class deep learner with convolutional neural networks and long short-term memory neural networks as its core. The training set, validation set, and test set of the data module are used as the training, validation, and testing sets of the deep learning classifier, respectively, to obtain the trained deep learning classifier.
[0181] The classification module divides the non-fixed-length four-sequence alignment data into multiple fixed-length sub-four-sequence alignments using a sliding window algorithm. Then, it uses a three-class deep learning classifier obtained from the training module to classify and predict the sub-four-sequence alignments. The classification prediction result of each sub-four-sequence alignment is a 3-dimensional probability distribution vector. Each dimension of the vector gives the probability corresponding to the three topologies. The maximum probability distribution prediction result of all sub-four-sequence alignments is selected to obtain the classification result of the non-fixed-length four-sequence alignment.
[0182] The construction module first samples all non-fixed-length four-sequence alignments for non-fixed-length multiple sequence alignments, and then predicts the classification of the non-fixed-length four-sequence alignments based on the classification prediction method of the classification module to obtain the prediction results of all four-sequence alignments. Finally, based on the results of all four-sequence alignments, the phylogenetic tree reconstruction of non-fixed-length, arbitrary-number sequences is performed by combining the improved stepwise addition method and the bundle search strategy.
[0183] In another embodiment of the present invention, a terminal device is provided, comprising a processor and a memory. The memory stores a computer program, the computer program including program instructions, and 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 implement a corresponding method flow or corresponding function. The processor described in this embodiment of the present invention can be used for the operation of a phylogenetic tree construction method based on deep learning and beam search, including:
[0184] Different evolutionary scenarios are defined, and simulation parameters are set according to the sequence characteristics of each scenario. Based on these parameters, four-sequence phylogenetic trees and their corresponding fixed-length multiple sequence alignments are simulated. Multiple sequence alignments are used as supervised learning data, and the categories of the corresponding four-sequence phylogenetic trees are used as the classification labels for supervised learning, thus forming a supervised learning dataset. This dataset is then divided into training, validation, and test sets. Using this supervised learning dataset, a three-class deep learning machine based on convolutional neural networks and long short-term memory neural networks is constructed. The training, validation, and test sets are used for training, validating, and testing the deep learning classifier, respectively, resulting in a trained deep learning classifier. For non-fixed-length four-sequence alignments, a sliding window algorithm is used to divide the data into multiple... For fixed-length sub-four sequence alignments, a three-class deep learning classifier is used to predict the classification of each sub-four sequence alignment. The classification prediction result of each sub-four sequence alignment is a 3-dimensional probability distribution vector, with each dimension of the vector giving the probability corresponding to each of the three topologies. The sub-four sequence alignment with the highest probability distribution prediction result is selected to obtain the classification result of the non-fixed-length four sequence alignment. For non-fixed-length multi-sequence alignment data, all non-fixed-length four sequence alignments are sampled first, and predictions are made according to the classification prediction method for non-fixed-length four sequence alignment data to obtain the prediction results of all four sequence alignments. Finally, based on the results of all four sequence alignments, a non-fixed-length phylogenetic tree reconstruction with an arbitrary number of sequences is performed by combining an improved stepwise addition method and a bundle search strategy.
[0185] 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.
[0186] 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 phylogenetic tree construction method based on deep learning and beam search 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:
[0187] Different evolutionary scenarios are defined, and simulation parameters are set according to the sequence characteristics of each scenario. Based on these parameters, four-sequence phylogenetic trees and their corresponding fixed-length multiple sequence alignments are simulated. Multiple sequence alignments are used as supervised learning data, and the categories of the corresponding four-sequence phylogenetic trees are used as the classification labels for supervised learning, thus forming a supervised learning dataset. This dataset is then divided into training, validation, and test sets. Using this supervised learning dataset, a three-class deep learning machine based on convolutional neural networks and long short-term memory neural networks is constructed. The training, validation, and test sets are used for training, validating, and testing the deep learning classifier, respectively, resulting in a trained deep learning classifier. For non-fixed-length four-sequence alignments, a sliding window algorithm is used to divide the data into multiple... For fixed-length sub-four sequence alignments, a three-class deep learning classifier is used to predict the classification of each sub-four sequence alignment. The classification prediction result of each sub-four sequence alignment is a 3-dimensional probability distribution vector, with each dimension of the vector giving the probability corresponding to each of the three topologies. The sub-four sequence alignment with the highest probability distribution prediction result is selected to obtain the classification result of the non-fixed-length four sequence alignment. For non-fixed-length multi-sequence alignment data, all non-fixed-length four sequence alignments are sampled first, and predictions are made according to the classification prediction method for non-fixed-length four sequence alignment data to obtain the prediction results of all four sequence alignments. Finally, based on the results of all four sequence alignments, a non-fixed-length phylogenetic tree reconstruction with an arbitrary number of sequences is performed by combining an improved stepwise addition method and a bundle search strategy.
[0188] The advantages of the phylogenetic tree reconstruction results of this invention can be seen from the following aspects.
[0189] First, for a fixed-length four-sequence alignment, the deep learning algorithm can treat it as a three-class classification problem. In this invention, we trained our own deep learning classifier, which achieved a higher classification accuracy than previous methods in the two evolutionary scenarios tested, and also higher accuracy than the maximum likelihood estimation method.
[0190] Second, for non-fixed-length multiple sequence alignment inference, this invention compares its performance with maximum likelihood estimation from two data sources. First, this invention simulates test data from 12 scenarios, and uses this invention along with two other maximum likelihood algorithms, Raxml and Iqtree, to reconstruct phylogenetic trees. RF distance is used as the evaluation metric, and the results are as follows: Figure 10 As shown in the figure, it can be seen that, overall, the method of this invention has a smaller RF distance compared to the maximum likelihood estimation method, indicating that Fusang's tree reconstruction results are more accurate. Secondly, this invention uses real biological data to evaluate the phylogenetic tree reconstruction results. This invention compares the reconstruction results with the maximum likelihood estimation method on the UCSC dataset, as shown in the figure. Figure 11 As shown, data from rice and butterflies are compared with the maximum likelihood estimation method, such as... Figure 12 As shown, the reconstruction results of this invention are close to those of traditional methods on both types of data, indicating that the method of this invention is comparable to the traditional maximum likelihood estimation method. Finally, this invention generated real evolutionary data in the laboratory, and the method of this invention was compared with the maximum likelihood estimation method, as shown in the figure. Figure 13 As shown, the method of the present invention has a smaller estimation error, proving that the method of the present invention has the ability to better handle the phylogenetic tree reconstruction problem of real biological data.
[0191] In summary, this invention provides a phylogenetic tree construction method and system based on deep learning and beam search. First, 12 evolutionary scenarios are predefined to simulate the attributes of real-world biological sequences. Simulated sequence data is used as the training, validation, and test sets for the model based on preset parameters. Second, a convolutional neural network and a long short-term memory neural network are constructed. The network is trained and validated using the simulated dataset, ensuring that the loss function curve gradually converges across the 12 scenarios. The accuracy of the deep learning network algorithm is tested based on the simulated sequence data. Using the trained deep learning network and a sliding window algorithm, all sub-quadruple trees of the sequence data are predicted. A modified stepwise addition method is used to reconstruct the phylogenetic tree from the sequence data, obtaining a complete reconstruction result. This enables the construction of phylogenetic trees under conditions of different species numbers and sequence lengths, exhibiting stable and excellent performance. Finally, the phylogenetic tree construction algorithm is tested using both simulated and real sequence data. The model is applied to both simulated and real-world scenarios, verifying the accuracy and feasibility of this invention.
[0192] 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 phylogenetic tree construction method based on deep learning and beam search, characterized in that, Includes the following steps: data S1. Define 12 evolutionary scenarios. The evolutionary parameters of each scenario are set with reference to the biological sequence attributes in the real world. Simulation parameters are set according to the sequence characteristics of each evolutionary scenario, including sequence length, non-leaf node branch length distribution, leaf node branch length distribution, average sequence divergence, replacement to INDEL ratio, INDEL length distribution, maximum INDEL length, and immutable site ratio. Based on the simulation parameters, simulate a four-sequence phylogenetic tree and its corresponding fixed-length multiple sequence alignment data. Use the multiple sequence alignment as supervised learning data and the corresponding four-sequence phylogenetic tree category as the classification label for supervised learning to form a supervised learning dataset. Finally, divide the supervised learning dataset into training set, validation set, and test set. S2. Using the supervised learning dataset constructed in step S1, construct a three-class deep learning classifier with convolutional neural network and long short-term memory neural network as the core. Use the training set, validation set and test set of step S1 as training, validation and testing of the deep learning classifier, respectively, to obtain the trained deep learning classifier. S3 divides the non-fixed-length four-sequence alignment data into multiple fixed-length sub-four-sequence alignments using a sliding window algorithm. Then, the three-class deep learning classifier obtained in step S2 is used to classify and predict the sub-four-sequence alignments. The classification prediction result of each sub-four-sequence alignment is a 3-dimensional probability distribution vector. Each dimension of the vector gives the probability corresponding to the three topologies. The maximum probability distribution prediction result of all sub-four-sequence alignments is selected to obtain the classification result of the non-fixed-length four-sequence alignment. S4. For non-fixed-length multiple sequence alignment data, first sample all non-fixed-length four-sequence alignments, and predict the classification prediction method for non-fixed-length four-sequence alignment data according to step S3 to obtain the prediction results of all four-sequence alignments. Finally, based on the results of all four-sequence alignments, combine the improved stepwise addition method and the cluster search strategy to reconstruct the phylogenetic tree of non-fixed length and arbitrary number of sequences.
2. The phylogenetic tree construction method based on deep learning and beam search according to claim 1, characterized in that, Step S1 is as follows: S101, Randomly set the number of leaf nodes in the phylogenetic tree. Randomly select N sequences, where 4 ≤ ≤40, use the bioinformatics software package ETE3 to randomly generate a number containing A phylogenetic tree topology with leaf nodes; S102. Sample a desired average divergence from the average divergence distribution corresponding to the defined evolutionary scenario. ; S103. Based on the non-leaf node branch length distribution and leaf node branch length distribution corresponding to the defined evolutionary scenario, independently sample the branch length of each branch of the phylogenetic tree obtained in step S101, and calculate the average divergence degree of the current phylogenetic tree. By multiplying by a coefficient Scaling the length of each branch to make The average pairwise divergence of each leaf node is equal to the expected average divergence obtained in step S102. Ultimately, we obtain a... A phylogenetic tree with a number of leaf nodes and known lengths of all branches; S104, the product obtained from step S103 has Four leaf nodes are randomly selected from the phylogenetic tree of leaf nodes to obtain a four-sequence tree, and the corresponding topology and the branch length of each branch are known. S105. Based on other predefined parameters and the topology of the four-sequence tree obtained in step S104 and the branch length of each branch, use bioinformatics software to simulate multiple sequence alignment (MSA) of a given phylogenetic tree. Use multiple sequence alignment as data and the corresponding phylogenetic tree as the label according to the classification of the unrooted tree to create a dataset. S106. Divide the dataset obtained in step S105 into a training set, a validation set, and a test set.
3. The phylogenetic tree construction method based on deep learning and beam search according to claim 1 or 2, characterized in that, The evolutionary scenario is defined as follows: Using the regular expression [SCN][1-2][UG], 12 evolution scenarios for simulating sequence data are predefined; for each evolution scenario, the sequence length, non-leaf node branch length distribution, leaf node branch length distribution, average sequence divergence, replacement to INDEL ratio, INDEL length distribution, maximum INDEL length, and immutable site ratio are set.
4. The phylogenetic tree construction method based on deep learning and beam search according to claim 1, characterized in that, Step S2 is as follows: S201. Encode the base information of the original MSA sequences in the dataset. After encoding, the dataset appears as a... The tensor is M, where M 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. S202. Construct a convolutional neural network for sequence feature extraction and a long short-term memory neural network for MSA sequence feature extraction. S203. Flatten the features obtained from the convolutional neural network and long short-term memory neural network constructed in step S202 into one dimension, and then output a three-dimensional probability distribution vector after passing through a fully connected layer, representing the predicted topological probability distribution. Each dimension of the vector represents the predicted probability of the corresponding topology. S204. Based on the cross-entropy loss function, optimize and update the parameters of the convolutional neural network and the long short-term memory neural network through gradient descent and backpropagation algorithms, and train the corresponding deep learning classifiers for the evolution scenario data respectively. S205. Apply the deep learning model trained in step S204 to the corresponding test sets, and use the classification accuracy index to evaluate the classification accuracy of the deep learning classifier to obtain the trained deep learning classifier.
5. The phylogenetic tree construction method based on deep learning and beam search according to claim 4, characterized in that, In step S204, the loss function used in the optimization process for: in, For the number of samples, The true distribution for each sample, The distribution predicted by the deep learning classifier.
6. The phylogenetic tree construction method based on deep learning and beam search according to claim 1, characterized in that, Step S3 is as follows: S301, for a length of The four-sequence alignment is used to encode it into a tensor; S302. Use W sliding windows of length L to perform sliding window sampling on the original MSA to obtain the tensor. The sampled results are then used to make predictions using a deep learning classifier. The result.
7. The phylogenetic tree construction method based on deep learning and beam search according to claim 6, characterized in that, Step S302 specifically includes: S3021. During the prediction process, a sliding window is used to perform phylogenetic tree inference on the four-sequence trees of each region of the original MSA. Based on the topological structure of each region, the best four-sequence tree of the full-length MSA is selected. S3022. For each original MSA subregion, a three-dimensional vector is obtained, and the average of W three-dimensional vectors is calculated to represent the probability distribution of the phylogenetic tree topological classification corresponding to the overall length. The prediction result for four-sequence alignment of arbitrary length is a... A three-dimensional vector.
8. The phylogenetic tree construction method based on deep learning and beam search according to claim 1, characterized in that, Step S4 is as follows: S401. For multi-sequence alignment data of arbitrary length and number of sequences, first sample all four-sequence alignments, and encode the sampling results into size. tensor, n This represents the number of sequences in multiple sequence alignments. The sequence length for multiple sequence alignment; using the sliding window algorithm in step S3, for... indivual The four sequence alignment data were sampled using a sliding window to finally sample out indivual or In sub-MSA, the sampling results of the sliding window are encoded as Tensors of size or A tensor of size; using the classifier for fixed-length four-sequence alignment data trained in step S2, deep learning is used to classify and predict the tensor, resulting in a tensor of size. As a result, the 3 in the last dimension represents three possible topologies; The tensor transformation is The tensor, and take the average over the last dimension, that is, take the average of the classification prediction results of W sliding windows, and sample from n sequences. The classification prediction results of each sub-MSA are summed to obtain a... As a result, four sequences were randomly selected from the n sequences, and the predicted topology of the phylogenetic tree exists. In the tensor, the topology with the highest probability is used to construct the initial phylogenetic tree. ; S402. Based on the improved step-by-step addition method, nodes are iteratively added. Add to the initial phylogenetic tree obtained in step S401 ,get , will node Add to ,get Continue until all nodes have been added, resulting in a reconstructed phylogenetic tree. .
9. The phylogenetic tree construction method based on deep learning and beam search according to claim 8, characterized in that, The improved step-by-step addition method is as follows: S4021. Adopt a cluster search strategy, set the hyperparameter cluster size n, and in each iteration of adding new nodes, only retain the top n solutions in the candidate subtrees and proceed to the next node addition. S4022. In each iteration, a pruning algorithm is used to accelerate the search process. If the number of remaining edges after pruning is less than or equal to the user-defined bundle size, the next node is added to these edges, the candidate subtree score is no longer calculated, and the process proceeds directly to the next iteration. If the number of remaining edges is greater than the user-defined bundle size, the next node is added to the remaining edges, and bundle search is performed.
10. A phylogenetic tree construction system based on deep learning and beam search, characterized in that, include: The data module defines different evolutionary scenarios and sets simulation parameters based on the sequence characteristics of each scenario, including sequence length, non-leaf node branch length distribution, leaf node branch length distribution, average sequence divergence, replacement to INDEL ratio, INDEL length distribution, maximum INDEL length, and immutable site ratio. Based on the simulation parameters, it simulates a four-sequence phylogenetic tree and its corresponding fixed-length multiple sequence alignment data. The multiple sequence alignment is used as supervised learning data, and the corresponding four-sequence phylogenetic tree category is used as the classification label for supervised learning, thus forming a supervised learning dataset. Finally, the supervised learning dataset is divided into training set, validation set, and test set. The training module uses the supervised learning dataset constructed by the data module to build a three-class deep learning classifier with convolutional neural network and long short-term memory neural network as the core. The training set, validation set and test set of the data module are used as the training, validation and testing sets of the deep learning classifier, respectively, to obtain the trained deep learning classifier. The classification module divides the non-fixed-length four-sequence alignment data into multiple fixed-length sub-four-sequence alignments using a sliding window algorithm. Then, it uses a three-class deep learning classifier obtained from the training module to classify and predict the sub-four-sequence alignments. The classification prediction result of each sub-four-sequence alignment is a 3-dimensional probability distribution vector. Each dimension of the vector gives the probability corresponding to the three topologies. The maximum probability distribution prediction result of all sub-four-sequence alignments is selected to obtain the classification result of the non-fixed-length four-sequence alignment. The construction module first samples all non-fixed-length four-sequence alignments for non-fixed-length multiple sequence alignments, and then predicts the classification of the non-fixed-length four-sequence alignments based on the classification prediction method of the classification module to obtain the prediction results of all four-sequence alignments. Finally, based on the results of all four-sequence alignments, the phylogenetic tree reconstruction of non-fixed-length, arbitrary-number sequences is performed by combining the improved stepwise addition method and the bundle search strategy.
Citation Information
Patent Citations
Deep learning-based techniques for training deep convolutional neural networks
CN110832596A
Automatic analysis method and system for virus sequencing sequence
CN112863599A