A phylogenetic tree construction method based on metric learning

Through measurement learning and triple network optimization similarity measurement, and combining with the adjacency method to build a phylogenetic tree, the problems of high computational complexity and low accuracy in the existing technology are solved, and efficient and accurate phylogenetic tree construction is achieved, which is suitable for multimodal biological data.

CN120067895BActive Publication Date: 2025-08-08YANGTZE DELTA REGION INST (QUZHOU) UNIV OF ELECTRONIC SCI & TECH OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510533729.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2025-08-08
Estimated Expiration
2045-04-27

AI Technical Summary

Technical Problem

The existing phylogenetic tree construction method has high computational complexity, low efficiency and strong model assumption limitations, resulting in poor construction accuracy and serious error propagation problems.

Method used

Using a metric learning method, we use the method to collect nucleic acid sequences and evolutionary tree data sets, design a triple network model, optimize the similarity metrics, generate a similarity matrix, and use the adjacency method to build a phylogenetic tree, combining branch chief correction and biological verification to improve construction accuracy and efficiency.

Benefits of technology

It realizes efficient and accurate phylogenetic tree construction under large-scale biological data, can process multimodal data, improves the accuracy of biometric similarity measurement and model adaptability, and enhances biological explanatory power.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120067895B_ABST
    Figure CN120067895B_ABST
Patent Text Reader

Abstract

The present invention relates to a phylogenetic tree construction method based on metric learning. It solves the problems of high computational complexity, low efficiency and poor accuracy in phylogenetic tree construction in the prior art. It includes S1, collecting a public data set containing nucleic acid sequences and corresponding constructed evolutionary trees; S2, performing feature extraction on the collected data set; S3, designing and constructing a metric learning model to optimize the similarity measurement between data points; S4, using a training set to train the metric learning model and generate a similarity matrix; S5, based on the generated similarity matrix, using a phylogenetic tree construction algorithm to construct a tree structure and verify the results; S6, application analysis. The advantages of the present invention are: overcoming the problems of low distance measurement accuracy, strong model assumption limitations, high computational complexity, etc. in traditional methods, and realizing efficient construction of phylogenetic trees under large-scale biological data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of bioinformatics and computer science technology, and in particular to a phylogenetic tree construction method based on metric learning. Background Art

[0002] Existing phylogenetic tree construction methods typically rely on molecular sequence alignment and evolutionary models, such as Multiple Sequence Alignment (MSA) and Maximum Likelihood (ML) methods. MSA uses global or local alignments of multiple DNA, RNA, or protein sequences to identify similarities and construct an evolutionary tree. ML, based on the assumption of a specific evolutionary model, seeks an evolutionary tree that maximizes the likelihood of the observed data. Bayesian inference uses Bayesian statistical methods to infer the distribution of evolutionary trees based on sequence data.

[0003] Although existing methods are widely used in phylogenetic tree construction, they still have significant limitations: high computational complexity, multiple sequence alignment and model inference methods are inefficient when processing large-scale data; model assumption limitations, existing models may not accurately reflect the actual evolutionary process; error propagation problem, alignment errors will have a significant impact on the construction of subsequent trees.

[0004] In summary, the current methods for constructing phylogenetic trees have shortcomings in terms of computational efficiency, construction accuracy, and model adaptability. Summary of the Invention

[0005] The purpose of the present invention is to provide a phylogenetic tree construction method based on metric learning to address the above problems.

[0006] To achieve the above objectives, the present invention adopts the following technical solutions: a phylogenetic tree construction method based on metric learning, the method comprising the following steps:

[0007] S1. Collect public datasets containing nucleic acid sequences and corresponding constructed evolutionary trees;

[0008] S2, extract features from the collected data set;

[0009] S3. Design and build a metric learning model to optimize the similarity measure between data points;

[0010] S4. Use the training set to train the metric learning model and generate a similarity matrix;

[0011] S5. Based on the generated similarity matrix, a phylogenetic tree construction algorithm is used to construct a tree structure and verify the results;

[0012] S6. Application analysis.

[0013] In the above-mentioned metric learning-based phylogenetic tree construction method, step S1 specifically includes the following steps:

[0014] S11. Downloading a data set containing nucleic acid sequences and their corresponding evolutionary trees from a public nucleic acid evolution database;

[0015] S12. In the data set, each set of data contains a set of nucleic acid sequences and a corresponding evolutionary tree structure. Each set of data is marked as a group of units. The data set has a total of n groups of units.

[0016] S13. Randomly divide the collected n groups of data units into training sets and test sets.

[0017] In the above-mentioned phylogenetic tree construction method based on metric learning, step S2 specifically includes the following steps:

[0018] S21. For nucleic acid sequence data, a sliding window method is used to extract k-mer features;

[0019] S22. For phenotypic or ecological data, select statistical methods for feature extraction;

[0020] S23, standardizing all extracted features;

[0021] S24. Integrate different types of data features.

[0022] In the above-mentioned phylogenetic tree construction method based on metric learning, step S3 specifically includes the following steps:

[0023] S31. Select the appropriate metric learning model structure: Based on the goal, the triplet network is used as the basic architecture of the metric learning model;

[0024] S32. Design loss function: According to the characteristics of the triplet network, the triplet loss function is used as the objective function of the model. The calculation formula of the triplet loss function is:

[0025] L=max(d(a,p)-d(a,n)+α,0),

[0026] Where d(a, p) represents the distance between the anchor point and the positive sample, d(a, n) represents the distance between the anchor point and the negative sample, and α is a hyperparameter representing the minimum threshold of the distance difference.

[0027] S33, process training samples and construct triplets: construct the data in the training set into the form of triplets, ensuring that each triplet contains an anchor point, a positive sample and a negative sample;

[0028] S34, model architecture design and training details;

[0029] S35. Regularization and hyperparameter adjustment: In order to prevent overfitting, L2 regularization is used to constrain the network weights. At the same time, the hyperparameters are adjusted through cross-validation method.

[0030] In the above-mentioned metric learning-based phylogenetic tree construction method, the metric learning model training in step S4 specifically includes the following steps:

[0031] S41. Dataset division and preparation: randomly divide the data samples in the training set into subsets for training and validation;

[0032] S42. Select optimization algorithm: Use appropriate optimization algorithm to adjust the parameters of the model; S43. Set learning rate and batch size: Select an appropriate learning rate to control the step size of each parameter update;

[0033] S44. Model training and loss function calculation: During the training process, a triplet sample is obtained from the training set each time and input into the triplet network. The similarity measure of the network output is calculated. The loss value is calculated using the triplet loss function by calculating the distance between the anchor point and the positive sample and the anchor point and the negative sample.

[0034] S45. Monitor the training process and overfitting: During the training process, regularly evaluate the performance of the model on the validation set and calculate indicators such as loss and accuracy.

[0035] S46. Model tuning and hyperparameter optimization: After the initial training is completed, hyperparameters are further optimized through methods such as cross-validation and grid search;

[0036] S47. Model evaluation and stability check: After the training process is completed, the model is finally evaluated using the validation set to check whether its similarity judgment between samples of different categories is accurate.

[0037] Generating the similarity matrix in step S4 specifically includes the following steps:

[0038] S480. Use the trained metric learning model: Apply the metric learning model to the test set and calculate the similarity between each sample.

[0039] S481. Calculate the similarity or distance between samples: For each pair of samples in the test set, calculate the similarity measure between them using the trained metric learning model;

[0040] S482. Construct a similarity matrix: Based on the similarity measure calculated in step S481, construct a symmetric matrix whose dimension is the number of samples n in the test set. test , each element of the matrix Si,j Represents the similarity between sample i and sample j;

[0041] S483, check the symmetry and sparsity of matrices;

[0042] S484, processing outliers and noise;

[0043] S485. Visualize the similarity matrix.

[0044] In step S5, building a tree structure specifically includes the following steps:

[0045] S51. Select the phylogenetic tree construction algorithm: select Neighbor-Joining as the phylogenetic tree construction algorithm;

[0046] S52, using the similarity matrix as input: passing the similarity matrix generated in step S4 as input to the selected phylogenetic tree construction algorithm; each element in the matrix represents the similarity or distance between samples, and the algorithm will gradually merge samples or clusters based on the similarity / distance information to form a tree structure;

[0047] S53, building a tree structure: after the similarity matrix is input, the phylogenetic tree construction algorithm will gradually build the branches of the tree according to the similarity or distance;

[0048] S54. Post-processing and optimization of the tree: By introducing the branch length correction method, the branch length of the tree is optimized to make it consistent with the actual evolutionary distance. The branch length correction adopts the least squares method.

[0049] S55. Verify the rationality and consistency of the tree: Verify the rationality of the constructed phylogenetic tree by comparing it with known biological prior knowledge or standard data sets. Use the tree's RF distance, i.e., Robinson-Foulds distance, as an evaluation indicator to measure the degree of match between the constructed tree and known evolutionary relationships.

[0050] S56, Visualized Phylogenetic Tree: Use the evolutionary tree visualization tool to convert the phylogenetic tree into a graphical form, intuitively displaying the tree's topology, branch lengths, node confidence, and other information;

[0051] In step S51, the specific steps of the phylogenetic tree construction algorithm are as follows:

[0052] S511, calculate the distance matrix: first calculate the evolutionary distance between samples according to the similarity matrix generated in step S4;

[0053] S512, constructing an initial tree structure: Based on the calculated distance matrix, select two samples or clusters with the smallest distance as the initial branches of the tree, then create a new node by merging these two clusters, update the distance matrix, and continue to select clusters with the smallest distance to merge;

[0054] S513, gradual merging of clusters: The algorithm gradually builds the tree topology by repeatedly selecting clusters with the smallest distance and merging them;

[0055] S514. Calculate branch lengths: After the tree is constructed, use the information in the distance matrix to calculate the length of each branch of the tree.

[0056] In step S55, the RF distance of the tree is an indicator used to measure the similarity or difference between two phylogenetic trees. It quantifies the degree of difference between the two trees by comparing their topological structures. The RF distance is calculated based on the number of branches, i.e., cuts, in the tree, reflecting the structural differences between the two trees. Given two phylogenetic trees, the RF distance calculation steps are as follows:

[0057] S551, Tree Cutting: Split a tree into two parts by removing an edge for each edge in the tree;

[0058] S552. Calculate differences: Calculate the comparison between the cut sets of the two trees and determine whether each cut exists in both trees. If a cut exists in only one of the trees, it means that the two trees differ in the cut.

[0059] S553. Calculation of RF distance: RF distance is the number of differences between two tree cut sets; the calculation formula is:

[0060]

[0061] Here, C(T1) and C(T2) are the cut sets of tree T1 and tree T2 respectively, and |C(T1)-C(T2)| represents the number of cuts in T1 but not in T2.

[0062] In step S5, the rationality of the constructed phylogenetic tree is verified to be consistent with the known evolutionary relationships, and the tree information is visually displayed using an evolutionary tree visualization tool. Specifically, the following steps are included:

[0063] S570. Verify using known biological prior knowledge: By comparing the topology and branching relationships of the phylogenetic tree, check whether it conforms to the existing biological consensus. If the constructed tree is highly consistent with the known species relationships, it means that this method has high reliability in constructing the evolutionary tree;

[0064] S571. Calculate the consistency index of the tree: quantitatively evaluate the accuracy of the construction results and calculate the Tree Consistency Index (TCI).

[0065] S572. Comparison with traditional phylogenetic tree construction methods: Compare the phylogenetic tree constructed by this method with the traditional evolutionary tree constructed based on algorithms such as distance matrix or neighbor-joining method;

[0066] S573, cross-validation and multiple validation: Divide the dataset into multiple subsets, use different subsets as training sets and test sets in turn, construct multiple phylogenetic trees, and compare the structural stability and consistency of the trees under different test sets;

[0067] S574. Verify the biological plausibility of the results: In the study of species evolutionary relationships, the constructed phylogenetic tree can be compared with the actual species genome or phenotypic data to check whether the branches in the tree conform to the known laws of species evolution;

[0068] S575. Result visualization and interpretation: By visualizing the constructed phylogenetic tree, the tree structure and node information are displayed, and visualization tools and analysis methods are provided, so that users can intuitively understand the branching relationships of the tree and the similarities / differences between species.

[0069] Step S6 includes the following steps:

[0070] S61. Species Evolution and Gene Function Analysis: Apply the constructed phylogenetic tree to study species evolutionary relationships, predict the evolutionary position of unknown species, and explore the functional evolution of genes or proteins in different species.

[0071] S62. Ecology and Species Conservation: Use phylogenetic trees to analyze the ecological relationships between species and provide a scientific basis for species conservation and environmental management, while also providing feedback for the optimization of evolutionary models.

[0072] Compared with the prior art, the advantages of the present invention are:

[0073] 1. Improved Construction Accuracy: This approach optimizes the similarity metric between biological features by introducing a metric learning model, specifically a triplet network and triplet loss function. Compared to traditional methods, metric learning can better distinguish between similar and different biological samples, thereby improving the accuracy of phylogenetic tree construction.

[0074] 2. Compatibility with multimodal data: This method not only supports nucleic acid sequence data but also phenotypic or ecological data. Through feature extraction, standardization, and fusion, different types of data can be effectively integrated, improving the model's overall performance and adaptability. This is of great significance for complex biological problems involving multiple data sources.

[0075] 3. Flexible phylogenetic tree construction method: By generating a similarity matrix and applying the neighbor-joining algorithm, the construction of the phylogenetic tree is both accurate and efficient. Subsequent branch length correction and tree optimization methods make the tree structure more biologically explanatory, thereby improving the practicality of the model.

[0076] 4. Broad Application: In addition to studying species evolutionary relationships, this solution can also be used in a variety of biological fields, including studies of gene and protein function. The phylogenetic tree it constructs not only reflects the evolutionary relationships between species but also provides a reference for predicting the evolutionary position of unknown species.

[0077] In summary, metric learning models are used to deeply characterize and optimize biological features, generating more reliable similarity matrices. Combined with advanced tree-building algorithms, these models ultimately produce highly biologically meaningful phylogenetic trees. By introducing metric learning techniques, these methods overcome the limitations of traditional methods, such as low distance measurement accuracy, limited model assumptions, and high computational complexity, enabling efficient phylogenetic tree construction for large-scale biological data. This approach holds significant application value in bioinformatics, particularly in analyzing species evolutionary relationships, exploring functional genes, and studying complex biological networks. BRIEF DESCRIPTION OF THE DRAWINGS

[0078] Figure 1 is a flow chart of the method of the present invention;

[0079] Figure 2 Schematic diagram of the triplet neural network architecture in the present invention;

[0080] Figure 3 It is the RF distance result diagram of the phylogenetic tree constructed by different methods in the present invention and the standard tree. DETAILED DESCRIPTION

[0081] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0082] like Figure 1-3 As shown, a phylogenetic tree construction method based on metric learning includes the following steps:

[0083] S1. Collect public datasets containing nucleic acid sequences and corresponding constructed evolutionary trees;

[0084] S2, extract features from the collected data set;

[0085] S3. Design and build a metric learning model to optimize the similarity measure between data points;

[0086] S4. Use the training set to train the metric learning model and generate a similarity matrix;

[0087] S5. Based on the generated similarity matrix, a phylogenetic tree construction algorithm is used to construct a tree structure and verify the results;

[0088] S6. Application analysis.

[0089] Step S1 specifically includes the following steps:

[0090] S11. Downloading a data set containing nucleic acid sequences and their corresponding evolutionary trees from a public nucleic acid evolution database;

[0091] S12. In the data set, each set of data contains a set of nucleic acid sequences and a corresponding evolutionary tree structure. Each set of data is marked as a group of units. The data set has a total of n groups of units.

[0092] Nucleic acid sequences are DNA or RNA sequences. All sequences are preprocessed into standard FASTA files to ensure uniform format. The evolutionary tree is stored in the standardized Newick format.

[0093] In this example, the data set contains n=100 groups of unit data, and each group of units includes multiple nucleic acid sequences and corresponding evolutionary tree structures.

[0094] S13. Randomly divide the collected n groups of data units into training sets and test sets.

[0095] The training set contains at least n train = 80 groups of data units, the test set contains at least n test = 20 groups of data units, and the nucleic acid sequence and evolutionary tree structure of each group of data maintain a paired relationship to ensure the consistency of data during training and testing.

[0096] Step S2 specifically includes the following steps:

[0097] S21. For nucleic acid sequence data, a sliding window method is used to extract k-mer features;

[0098] Specifically, a window size k is set to segment the nucleic acid sequence into subsequences of length k. The frequency of occurrence of each k-mer in the sequence is then counted. These frequency values form a feature vector for each sequence, representing the local structural characteristics of the sequence. If the dataset contains sequences of various lengths, k-mer features can be extracted separately for each length to ensure comprehensiveness.

[0099] S22. For phenotypic or ecological data, select statistical methods for feature extraction;

[0100] Common methods include using basic statistics such as mean, variance, skewness, and kurtosis, or dimensionality reduction through principal component analysis, which maps high-dimensional data into a low-dimensional space and extracts the most representative features. These features are often able to effectively capture the distribution characteristics of phenotypic or ecological data.

[0101] S23, standardizing all extracted features;

[0102] For the extracted feature vectors, normalization methods, such as z-score normalization, are used to ensure that all features have the same scale. This step helps eliminate the effects caused by different dimensions of different features, allowing subsequent metric learning models to process various features more accurately.

[0103] S24. Integrate different types of data features.

[0104] If a dataset contains both sequence data and phenotypic or ecological data, the extracted features need to be fused. Through methods such as concatenation or weighted averaging, features from different sources are combined into a unified feature vector, which serves as input to the subsequent metric learning model. This step helps enhance the model's performance when processing multimodal data.

[0105] Step S3 specifically includes the following steps:

[0106] S31. Select the appropriate metric learning model structure: Based on the goal, the triplet network is used as the basic architecture of the metric learning model;

[0107] The triplet network takes three samples as input: an anchor, a positive sample, and a negative sample. It learns the similarities and differences between samples, thereby optimizing the model's distance metric. The core idea of the triplet network is to minimize the distance between the anchor and the positive sample, and maximize the distance between the anchor and the negative sample.

[0108] S32. Design loss function: According to the characteristics of the triplet network, the triplet loss function is used as the objective function of the model. The calculation formula of the triplet loss function is:

[0109] L=max(d(a,p)-d(a,n)+α,0),

[0110] Where d(a, p) represents the distance between the anchor point and the positive sample, d(a, n) represents the distance between the anchor point and the negative sample, and α is a hyperparameter representing the minimum threshold of the distance difference.

[0111] The goal of the loss function is to make the distance between the anchor point and the positive sample smaller than the distance between the anchor point and the negative sample, while ensuring that the gap between the two is greater than the threshold α, thereby improving the model's ability to distinguish similar samples from different samples.

[0112] S33, process training samples and construct triplets: construct the data in the training set into the form of triplets, ensuring that each triplet contains an anchor point, a positive sample and a negative sample;

[0113] Specifically, anchor points and positive samples should belong to similar categories or have similar biological characteristics, while negative samples should belong to different categories or have significantly different biological characteristics. In this way, the model can learn the distance relationship between similar and different samples during training and optimize the similarity metric.

[0114] S34, model architecture design and training details;

[0115] Triple networks typically consist of neural networks with shared weights. The specific network structure can be selected based on the characteristics of the dataset. For example, a convolutional neural network (CNN) can be used to process sequence data, or a multilayer perceptron (MLP) can be used to process phenotypic data. When building the network, it is important to select an appropriate activation function, such as ReLU or Sigmoid, and an optimization method, such as Adam or SGD, and ensure that the network converges effectively during training.

[0116] S35. Regularization and Hyperparameter Adjustment: To prevent overfitting, L2 regularization is used to constrain the network weights. At the same time, cross-validation is used to adjust hyperparameters, such as the α value in the triplet loss function, the network learning rate, and the batch size, to ensure that the model achieves optimal performance.

[0117] The metric learning model training in step S4 specifically includes the following steps:

[0118] S41. Dataset division and preparation: randomly divide the data samples in the training set into subsets for training and validation;

[0119] The training set is used to optimize model parameters, while the validation set is used to evaluate the model's generalization ability during training and prevent overfitting. The triplets (anchor, positive, and negative samples) in each subset are kept consistent to ensure data reliability during training and validation.

[0120] S42. Select an optimization algorithm: Use an appropriate optimization algorithm to adjust the model parameters; commonly used optimization algorithms include the Adam optimizer and stochastic gradient descent (SGD). In this invention, the Adam optimizer is used because it has good convergence and can automatically adjust the learning rate to adapt to the update speed of different parameters. During training, the optimization algorithm gradually adjusts the model weights based on the gradient information calculated by the triplet loss function to minimize the loss function value.

[0121] S43. Set learning rate and batch size: Choose an appropriate learning rate to control the step size of each parameter update; in this example, it is set to 1e-3;

[0122] A learning rate that is too large can lead to unstable training, while a learning rate that is too small can lead to slow convergence. Furthermore, batch size is an important hyperparameter that influences the training process. In this example, it is set to 64. An appropriate batch size can balance training time and model convergence speed.

[0123] S44. Model training and loss function calculation: During the training process, a triplet sample is obtained from the training set each time and input into the triplet network. The similarity measure of the network output is calculated. The loss value is calculated using the triplet loss function by calculating the distance between the anchor point and the positive sample and the anchor point and the negative sample.

[0124] The model will adjust parameters according to the loss value and continuously optimize the similarity measurement, thereby improving the ability to distinguish similar samples from different samples.

[0125] S45. Monitor the training process and overfitting: During the training process, regularly evaluate the performance of the model on the validation set and calculate indicators such as loss and accuracy.

[0126] If you find that the loss on the training set is decreasing while the loss on the validation set is plateauing or increasing, you may be experiencing overfitting. You can prevent overfitting by using early stopping techniques, stopping training when the performance on the validation set no longer improves, or by using dropout or L2 regularization to further control model complexity.

[0127] S46. Model tuning and hyperparameter optimization: After the initial training is completed, hyperparameters are further optimized through methods such as cross-validation and grid search;

[0128] For example, you can adjust parameters such as the triplet loss threshold, learning rate, and batch size, and try different network architectures and activation functions to find the configuration that best suits your dataset. These tuning techniques can improve the model's performance on both the training and validation sets.

[0129] S47. Model evaluation and stability check: After the training process is completed, the model is finally evaluated using the validation set to check whether its similarity judgment between samples of different categories is accurate.

[0130] At the same time, the stability of the model can be checked by repeated training to ensure that it has consistent performance in different initialization and training processes.

[0131] Generating the similarity matrix in step S4 specifically includes the following steps:

[0132] S480. Use the trained metric learning model: Apply the metric learning model to the test set and calculate the similarity between each sample.

[0133] In step S4, the fully trained metric learning model has the ability to distinguish the similarities and differences of biological features. The input of the metric learning model is the data in the test set, and the metric learning model will output the similarity or distance between each pair of samples.

[0134] S481. Calculate the similarity or distance between samples: For each pair of samples in the test set, calculate the similarity measure between them using the trained metric learning model;

[0135] Typically, metric learning models output a numerical value representing the distance or similarity between two samples. A smaller distance indicates more similar samples, while a larger distance indicates more different samples. Each element in the similarity matrix represents the similarity between two samples in the test set.

[0136] S482. Construct a similarity matrix: Based on the similarity measure calculated in step S481, construct a symmetric matrix whose dimension is the number of samples n in the test set. test , each element of the matrix S i,j Represents the similarity between sample i and sample j; for each pair of samples (i, j), S i,j The value range is usually 0 to 1, or it is normalized according to the output of the model. i,i Usually it is 1, indicating that the sample has the greatest similarity with itself.

[0137] S483, check the symmetry and sparsity of matrices;

[0138] Since the similarity matrix is symmetric, that is, S i,j =S j,i , you need to check whether the matrix meets this condition. At the same time, if the number of samples is large, the matrix may be very sparse. In this case, sparse matrix storage can be used to improve computational efficiency and avoid excessive memory consumption.

[0139] S484, processing outliers and noise;

[0140] After the similarity matrix is generated, there may be some outliers or noise, such as the similarity calculated for some samples being too high or too low. These outliers can be processed by setting a threshold or using smoothing techniques such as Gaussian filtering to ensure the quality of the similarity matrix.

[0141] For example, if the similarity of a pair of samples is much higher or lower than the normal range, it can be adjusted to a reasonable value to avoid affecting the accuracy of subsequent phylogenetic tree construction.

[0142] S485. Visualize the similarity matrix.

[0143] To facilitate subsequent analysis and verification, the generated similarity matrix was visualized using a heat map to display its structure. By varying the color depth, we can visually observe the similarity distribution between samples and further analyze which samples are more similar and which are more different.

[0144] In step S5, constructing the tree structure specifically includes the following steps:

[0145] S51. Select the phylogenetic tree construction algorithm: select Neighbor-Joining as the phylogenetic tree construction algorithm;

[0146] The neighbor-joining method is a commonly used distance-based tree construction method that constructs a phylogenetic tree by gradually merging the most similar samples or clusters. It is suitable for large-scale sequence data sets.

[0147] The basic idea of the neighbor joining method is to select the two clusters with the smallest distance as new parent clusters in each merging process until all samples or clusters are merged into a complete tree.

[0148] S52, using the similarity matrix as input: passing the similarity matrix generated in step S4 as input to the selected phylogenetic tree construction algorithm; each element in the matrix represents the similarity or distance between samples, and the algorithm will gradually merge samples or clusters based on the similarity / distance information to form a tree structure;

[0149] For the neighbor joining method, the "minimum distance" strategy is usually adopted, and the samples or clusters with the smallest distance are selected for merging in each merging process.

[0150] S53, building a tree structure: after the similarity matrix is input, the phylogenetic tree construction algorithm will gradually build the branches of the tree according to the similarity or distance;

[0151] Each branch represents a group of similar samples, and the length of the tree branches reflects the similarity or evolutionary distance between samples. Shorter branches indicate greater similarity between samples, while longer branches indicate greater differences between samples.

[0152] S54. Post-processing and optimization of the tree: The initially constructed phylogenetic tree may require further post-processing and optimization, especially branch length correction, to improve the accuracy and biological significance of the tree. By introducing a branch length correction method, the branch length of the tree is optimized to make it consistent with the actual evolutionary distance. Branch length correction uses the least squares method.

[0153] The least squares method is a commonly used branch length correction method. This method adjusts the branch lengths of the tree by minimizing the differences in branch lengths across all nodes in the evolutionary tree. Specifically, the least squares method calculates the error between the actual distances in the tree and the distances predicted by the model, with the goal of minimizing these errors by adjusting branch lengths. This method is suitable for addressing branch length deviations caused by sequencing errors or preliminary tree construction methods (such as the Newton-Jackson algorithm).

[0154] S55. Verify the rationality and consistency of the tree: Verify the rationality of the constructed phylogenetic tree by comparing it with known biological prior knowledge or standard data sets. Use the tree's RF distance, i.e., Robinson-Foulds distance, as an evaluation indicator to measure the degree of match between the constructed tree and known evolutionary relationships.

[0155] If the evaluation results show that the tree structure is reasonable and conforms to known biological laws, it indicates that the constructed tree has good accuracy and reliability.

[0156] S56. Visualizing Phylogenetic Trees: Phylogenetic trees are often visualized to facilitate subsequent analysis and application. Using tree visualization tools, such as FigTree, phylogenetic trees can be converted into graphical form to intuitively display information such as tree topology, branch lengths, and node confidence.

[0157] The visualization results can help researchers understand the evolutionary relationships between species more clearly and provide strong support for further biological research.

[0158] In step S51, the specific steps of the phylogenetic tree construction algorithm are as follows:

[0159] S511, calculate the distance matrix: first calculate the evolutionary distance between samples according to the similarity matrix generated in step S4;

[0160] Since the similarity matrix represents the similarity or similarity between samples, the adjacency algorithm converts these similarities into a distance matrix, which is usually calculated using the distance d(i,j)=1-S(i,j), where S(i,j) is the similarity value between sample i and sample j.

[0161] S512, constructing an initial tree structure: Based on the calculated distance matrix, select two samples or clusters with the smallest distance as the initial branches of the tree, then create a new node by merging these two clusters, update the distance matrix, and continue to select clusters with the smallest distance to merge;

[0162] S513, gradual merging of clusters: The algorithm gradually builds the tree topology by repeatedly selecting clusters with the smallest distance and merging them;

[0163] At each merge, the distance matrix is updated to ensure that the distance between each new cluster and the remaining clusters is recalculated.

[0164] S514. Calculate branch lengths: After the tree is constructed, use the information in the distance matrix to calculate the length of each branch of the tree.

[0165] The length of the branches reflects the evolutionary distance between samples. Shorter branches indicate high similarity between samples, while longer branches indicate greater differences.

[0166] By using the neighbor-joining algorithm, phylogenetic trees can be constructed quickly and efficiently, especially for large biological datasets. In practical applications, the neighbor-joining algorithm has low computational complexity and can provide a more reasonable tree structure.

[0167] In step S55, the RF distance of the tree is an indicator used to measure the similarity or difference between two phylogenetic trees. It quantifies the degree of difference between the two trees by comparing their topological structures. The RF distance is calculated based on the number of branches, i.e., cuts, in the tree, reflecting the structural differences between the two trees. Given two phylogenetic trees, the RF distance calculation steps are as follows:

[0168] S551, Tree Cutting: Split a tree into two parts by removing an edge for each edge in the tree;

[0169] S552. Calculate differences: Calculate the comparison between the cut sets of the two trees and determine whether each cut exists in both trees. If a cut exists in only one of the trees, it means that the two trees differ in the cut.

[0170] S553. Calculation of RF distance: RF distance is the number of differences between two tree cut sets; the calculation formula is:

[0171]

[0172] Here, C(T1) and C(T2) are the cut sets of tree T1 and tree T2 respectively, and |C(T1)-C(T2)| represents the number of cuts in T1 but not in T2.

[0173] RF distance values range from 0 to a maximum value, which is the number of cut differences that would indicate that the two trees are completely different. A value of 0 indicates that the two trees are identical, with identical topology. RF distance is used to compare the similarity of two trees and is often used to assess the differences between phylogenetic tree construction results and those of known trees or those constructed using other methods. For example, in algorithm performance evaluation, RF distance can quantify the accuracy of phylogenetic trees constructed using different methods.

[0174] In step S5, the rationality of the constructed phylogenetic tree is verified to be consistent with the known evolutionary relationships, and the tree information is visually displayed using an evolutionary tree visualization tool. Specifically, the following steps are included:

[0175] S570. Verify using known biological prior knowledge: By comparing the topology and branching relationships of the phylogenetic tree, check whether it conforms to the existing biological consensus. If the constructed tree is highly consistent with the known species relationships, it means that this method has high reliability in constructing the evolutionary tree;

[0176] In order to evaluate the results of phylogenetic tree construction, it is necessary to compare the constructed phylogenetic tree with existing biological prior knowledge. This biological prior knowledge can come from known species taxonomy information, traditional phylogenetic research results or evolutionary trees in public databases.

[0177] S571. Calculate the consistency index of the tree: quantitatively evaluate the accuracy of the construction results and calculate the Tree Consistency Index (TCI).

[0178] TCI is used to measure the similarity between a phylogenetic tree and known evolutionary trees. The closer the value is to 1, the more consistent the constructed tree is with the known tree. In addition, other evaluation criteria, such as the F1 score, can be used to further verify the accuracy of the tree structure by comparing the predicted results of the phylogenetic tree with the actual evolutionary relationships.

[0179] S572. Comparison with traditional phylogenetic tree construction methods: Compare the phylogenetic tree constructed by this method with the traditional evolutionary tree constructed based on algorithms such as distance matrix or neighbor-joining method;

[0180] By quantitatively comparing metrics such as tree consistency, tree depth, and branch stability, we evaluate the advantages of our method in terms of accuracy and stability. If the results of our method outperform those of traditional methods in these evaluation metrics, it indicates that the method, through the introduction of metric learning, can better improve the accuracy and biological significance of phylogenetic trees.

[0181] S573, cross-validation and multiple validation: Divide the dataset into multiple subsets, use different subsets as training sets and test sets in turn, construct multiple phylogenetic trees, and compare the structural stability and consistency of the trees under different test sets;

[0182] In order to further verify the robustness of the model, cross-validation and other techniques were used to verify the model, which helps to evaluate whether the constructed phylogenetic tree has good generalization ability and avoid tree structure deviation caused by data overfitting.

[0183] S574. Verify the biological plausibility of the results: In the study of species evolutionary relationships, the constructed phylogenetic tree can be compared with the actual species genome or phenotypic data to check whether the branches in the tree conform to the known laws of species evolution;

[0184] If the branches of the tree are consistent with the known evolutionary relationships between species, it means that the constructed tree has strong biological significance.

[0185] S575. Result visualization and interpretation: By visualizing the constructed phylogenetic tree, the tree structure and node information are displayed, and visualization tools and analysis methods are provided, so that users can intuitively understand the branching relationships of the tree and the similarities / differences between species.

[0186] In addition, the nodes of the tree can be annotated to display relevant biological information (such as genomic, phenotypic or functional data), helping researchers to further analyze the evolutionary process of species or genes in the tree.

[0187] Step S6 includes the following steps:

[0188] S61. Species Evolution and Gene Function Analysis: Apply the constructed phylogenetic tree to study species evolutionary relationships, predict the evolutionary position of unknown species, and explore the functional evolution of genes or proteins in different species.

[0189] S62. Ecology and Species Conservation: Use phylogenetic trees to analyze the ecological relationships between species and provide a scientific basis for species conservation and environmental management, while also providing feedback for the optimization of evolutionary models.

[0190] In summary, the principle of this embodiment is: through the metric learning model, the similarity measure between biological features is optimized, thereby improving the accuracy and biological significance of the phylogenetic tree; secondly, a triplet network is used as the metric learning model, and the similarity measure between samples is optimized through the triplet loss function, so that the model can more accurately distinguish similar and different biological features; and the neighbor joining method is used as the main algorithm for constructing the phylogenetic tree, combined with the similarity matrix to construct the tree structure; at the same time, the accuracy of the tree is optimized through post-processing steps such as branch length correction and Bootstrap test.

[0191] The specific embodiments described herein are merely illustrative of the spirit of the present invention. Persons skilled in the art may make various modifications, additions, or substitutions to the described specific embodiments without departing from the spirit of the present invention or exceeding the scope of the appended claims.

Claims

1. A phylogenetic tree construction method based on metric learning, characterized in that: This method comprises the following steps: S1. Collect a public dataset containing nucleic acid sequences and corresponding constructed evolutionary trees, and randomly divide the collected data into training and test sets; S2. Extract features from the collected data set and perform standardization to integrate data features; S3. Design and build a metric learning model, design a loss function, optimize the similarity measure between data points, process training samples and construct triplets, and adjust hyperparameters through cross-validation methods; S4. Divide and prepare the data set, select an optimization algorithm for model training and loss function calculation, monitor the model training process and overfitting, tune the model and optimize hyperparameters, evaluate the model and check its stability, and finally generate a similarity matrix based on the model; S5. Based on the generated similarity matrix, use the similarity matrix as input to construct the branches of the tree. By introducing the branch length correction method, the branch length of the tree is optimized. The rationality of the constructed phylogenetic tree is verified to verify the degree of match between the known evolutionary relationships, and the tree information is intuitively displayed through the evolutionary tree visualization tool. S6. Apply the constructed phylogenetic tree to the study of species evolutionary relationships and ecological species conservation.

2. A phylogenetic tree construction method based on metric learning according to claim 1, characterized in that: Step S1 specifically includes the following steps: S11. Downloading a data set containing nucleic acid sequences and their corresponding evolutionary trees from a public nucleic acid evolution database; S12. In the data set, each set of data contains a set of nucleic acid sequences and a corresponding evolutionary tree structure. Each set of data is marked as a group of units. The data set has a total of n groups of units. S13. Randomly divide the collected n groups of data units into training sets and test sets.

3. A phylogenetic tree construction method based on metric learning according to claim 2, characterized in that: Step S2 specifically includes the following steps: S21. For nucleic acid sequence data, a sliding window method is used to extract k-mer features; S22. For phenotypic or ecological data, select statistical methods for feature extraction; S23, standardizing all extracted features; S24. Integrate different types of data features.

4. A phylogenetic tree construction method based on metric learning according to claim 3, characterized in that: Step S3 specifically includes the following steps: S31. Select the appropriate metric learning model structure: Based on the goal, the triplet network is used as the basic architecture of the metric learning model; S32. Design loss function: According to the characteristics of the triplet network, the triplet loss function is used as the objective function of the model. The calculation formula of the triplet loss function is: L=max(d(α,p)-d(α,n)+α,0), Where d(a,p) represents the distance between the anchor point and the positive sample, d(a,n) represents the distance between the anchor point and the negative sample, and α is a hyperparameter representing the minimum threshold of the distance difference. S33, process training samples and construct triplets: construct the data in the training set into the form of triplets, ensuring that each triplet contains an anchor point, a positive sample and a negative sample; S34, model architecture design and training details; S35. Regularization and hyperparameter adjustment: In order to prevent overfitting, L2 regularization is used to constrain the network weights. At the same time, the hyperparameters are adjusted through cross-validation method.

5. A phylogenetic tree construction method based on metric learning according to claim 4, characterized in that: The metric learning model training described in step S4 specifically includes the following steps: S41. Dataset division and preparation: randomly divide the data samples in the training set into subsets for training and validation; S42. Select optimization algorithm: use appropriate optimization algorithm to adjust the parameters of the model; S43. Set learning rate and batch size: Choose an appropriate learning rate to control the step size of each parameter update; S44. Model training and loss function calculation: During the training process, a triplet sample is obtained from the training set each time and input into the triplet network. The similarity measure of the network output is calculated. The loss value is calculated using the triplet loss function by calculating the distance between the anchor point and the positive sample and the anchor point and the negative sample. S45. Monitor the training process and overfitting: During the training process, regularly evaluate the performance of the model on the validation set and calculate indicators such as loss and accuracy. S46. Model tuning and hyperparameter optimization: After the initial training is completed, hyperparameters are further optimized through methods such as cross-validation and grid search; S47. Model evaluation and stability check: After the training process is completed, the model is finally evaluated using the validation set to check whether its similarity judgment between samples of different categories is accurate.

6. A phylogenetic tree construction method based on metric learning according to claim 5, characterized in that: The generation of the similarity matrix described in step S4 specifically includes the following steps: S480, using the trained metric learning model: applying the metric learning model to the test set and calculating the similarity between each sample; S481. Calculate the similarity or distance between samples: For each pair of samples in the test set, calculate the similarity measure between them using the trained metric learning model; S482. Construct a similarity matrix: Based on the similarity measure calculated in step S481, construct a symmetric matrix whose dimension is the number of samples n in the test set. test , each element of the matrix S i,j Represents the similarity between sample i and sample j; S483, check the symmetry and sparsity of matrices; S484, processing outliers and noise; S485. Visualize the similarity matrix.

7. A phylogenetic tree construction method based on metric learning according to claim 6, characterized in that: In step S5, building a tree structure specifically includes the following steps: S51. Select the phylogenetic tree construction algorithm: select Neighbor-Joining as the phylogenetic tree construction algorithm; S52, using the similarity matrix as input: passing the similarity matrix generated in step S4 as input to the selected phylogenetic tree construction algorithm; S53, building a tree structure: after the similarity matrix is input, the phylogenetic tree construction algorithm will gradually build the branches of the tree according to the similarity or distance; S54. Post-processing and optimization of the tree: By introducing the branch length correction method, the branch length of the tree is optimized; S55. Verify the rationality and consistency of the tree: Verify the rationality of the constructed phylogenetic tree by comparing it with known biological prior knowledge or standard data sets, and use the RF distance of the tree to measure the degree of match between the constructed tree and known evolutionary relationships; S56. Visualize phylogenetic tree: Use evolutionary tree visualization tools to convert phylogenetic tree into graphical form.

8. The method for constructing a phylogenetic tree based on metric learning according to claim 7, wherein: In step S55, the RF distance of the tree is an indicator used to measure the similarity or difference between two phylogenetic trees. The degree of difference between the two trees is quantified by comparing their topological structures. The RF distance is calculated based on the number of branches, i.e., cuts, in the tree, reflecting the structural differences between the two trees. Given two phylogenetic trees, the RF distance calculation steps are as follows: S551, Tree Cutting: Split a tree into two parts by removing an edge for each edge in the tree; S552. Calculate differences: Calculate the comparison between the cut sets of the two trees and determine whether each cut exists in both trees. If a cut exists in only one of the trees, it means that the two trees differ in the cut. S553. Calculation of RF distance: RF distance is the number of differences between two tree cut sets; the calculation formula is: Here, C(T1) and C(T2) are the cut sets of tree T1 and tree T2 respectively, and |C(T1)-C(T2)| represents the number of cuts in T1 but not in T2.

9. The method for constructing a phylogenetic tree based on metric learning according to claim 6, wherein: In step S5, the verification of the rationality of the constructed phylogenetic tree and the degree of matching between the known evolutionary relationships and the intuitive display of the tree information through the evolutionary tree visualization tool specifically includes the following steps: S570. Verify using known biological prior knowledge: By comparing the topology and branching relationships of the phylogenetic tree, check whether it conforms to the existing biological consensus. If the constructed tree is highly consistent with the known species relationships, it means that this method has high reliability in constructing the evolutionary tree; S571. Compute tree consistency index: Quantitatively evaluate the accuracy of the construction results and calculate the tree consistency index (TCI). S572. Comparison with traditional phylogenetic tree construction methods: Compare the phylogenetic tree constructed by this method with the traditional evolutionary tree constructed based on algorithms such as distance matrix or neighbor-joining method; S573, cross-validation and multiple validation: Divide the dataset into multiple subsets, use different subsets as training sets and test sets in turn, construct multiple phylogenetic trees, and compare the structural stability and consistency of the trees under different test sets; S574. Verify the biological plausibility of the results: In the study of species evolutionary relationships, the constructed phylogenetic tree can be compared with the actual species genome or phenotypic data to check whether the branches in the tree conform to the known laws of species evolution; S575. Result visualization and interpretation: By visualizing the constructed phylogenetic tree, the tree structure and node information are displayed, and visualization tools and analysis methods are provided, so that users can intuitively understand the branching relationships of the tree and the similarities / differences between species.

10. A phylogenetic tree construction method based on metric learning according to claim 9, characterized in that: Step S6 includes the following steps: S61. Species Evolution and Gene Function Analysis: Apply the constructed phylogenetic tree to study species evolutionary relationships, predict the evolutionary position of unknown species, and explore the functional evolution of genes or proteins in different species. S62. Ecology and Species Conservation: Use phylogenetic trees to analyze the ecological relationships between species and provide a scientific basis for species conservation and environmental management, while also providing feedback for the optimization of evolutionary models.

Citation Information

Patent Citations

  • Method for constructing model for classifying nucleic acid sequences and application thereof

    CN112599196A

  • System and method for statistical mapping between genetic information and facial image data

    US20110206246A1