Semantic feature fused single metagenome contig sequence clustering method and system

By pre-processing, feature extraction and fusion of contigs of single-sample metagenomes, combining VAE variational autoencoder and k-mean clustering algorithm, the problem of insufficient clustering accuracy in the existing technology is solved, and more efficient metagenomic clustering is achieved.

CN119513634AInactive Publication Date: 2025-02-25JILIN UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510100996.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-22
Publication Date
2025-02-25
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the absence of coverage characteristics, it is difficult to effectively deal with contigs of single-sample metagenomes, resulting in insufficient clustering accuracy.

Method used

A single metagenomic contiguous sequence clustering method that fuses semantic features is adopted. By pre-processing the original metagenomic data, 4-mer features are extracted and dimensionality reduction is performed, semantic features are extracted in combination with the DNABERT_S model, and the constituent features and semantic features are input into the VAE variational autoencoder for feature fusion reconstruction, and finally clustering is completed through the k-mean clustering algorithm.

Benefits of technology

The clustering effect of single-sample metagenome is improved, and the problem of low clustering accuracy is solved when the coverage characteristics are lacking.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119513634A_ABST
    Figure CN119513634A_ABST
Patent Text Reader

Abstract

The invention discloses a single metagenome contig sequence clustering method and system fused with semantic features. The method comprises the following steps: preprocessing metagenome original data to obtain a DNA contig sequence, extracting 4-mer features from a contig, and performing dimensionality reduction on the 4-mer features to obtain composition features of the DNA contig sequence; selecting a training sequence from the DNA contig sequence, further pre-training the DNABERTS model by using the training sequence, and performing semantic feature extraction to obtain semantic features; inputting the composition features and the semantic features into a pre-constructed VAE variational auto-encoder for feature fusion reconstruction, and calculating a reconstruction error; and when the reconstruction error is stable or reaches a predetermined training round, obtaining potential spatial characteristics of the VAE variational auto-encoder, and according to the potential spatial characteristics, completing clustering of the DNA contig sequence through a k-means clustering algorithm. According to the method, the problem that the clustering precision is low when coverage rate features are lacked is solved, and the clustering effect of the single-sample metagenome is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of bioinformatics data mining, and in particular to a single metagenome contig sequence clustering method, system, terminal and computer-readable storage medium integrating semantic features. Background Art

[0002] Metagenomics uses high-throughput sequencing technology to obtain DNA information in microbial community environments. This information contains DNA sequences from different species. Clustering these sequences is a necessary means to reconstruct microbial genomes, and then study microbial community structure, gene function and other subsequent tasks. Existing technologies mostly rely on the k-mer features and coverage features of DNA sequences in terms of clustering.

[0003] However, single-sample metagenomic data have complex characteristics such as few features, unbalanced categories, and uneven sequence lengths. As a result, in the absence of coverage features, existing clustering methods are difficult to effectively handle these overlapping groups, which in turn affects the quality of genome reconstruction and the analysis of metagenomic genetic information.

[0004] Therefore, the prior art still needs to be improved and developed. Summary of the invention

[0005] The main purpose of the present invention is to provide a single metagenome contig sequence clustering method, system, terminal and computer-readable storage medium that integrate semantic features, aiming to solve the problem in the prior art that in the absence of coverage features, the clustering method is difficult to effectively process these contigs, resulting in insufficient clustering accuracy of the single sample metagenome.

[0006] To achieve the above object, the present invention provides a single metagenome contig sequence clustering method integrating semantic features, the single metagenome contig sequence clustering method integrating semantic features comprising the following steps: Preprocessing the raw data of the metagenomics to obtain a DNA contig sequence, extracting 4-mer features from the DNA contig sequence, reducing the dimension of the 4-mer features, and using the features after dimension reduction as the component features of the DNA contig sequence; Selecting a training sequence from the DNA contig sequence, further pre-training a DNABERT_S model using the training sequence, and extracting semantic features using the further pre-trained DNABERT_S model to obtain semantic features; Input the composition features and the semantic features into a pre-built VAE variational autoencoder for feature fusion reconstruction, and calculate the reconstruction error; When the reconstruction error is stable or reaches a predetermined training round, the latent space features of the VAE variational autoencoder are obtained, and the DNA contig sequences are clustered using a k-means clustering algorithm based on the latent space features.

[0007] Optionally, the single metagenome contig sequence clustering method integrating semantic features, wherein the metagenome raw data is preprocessed to obtain DNA contig sequences, specifically comprising: Acquire the raw metagenome data to be processed, and perform a splitting operation on the raw metagenome data to obtain a splitting result; Performing a quality control operation on the short read sequence in the splitting result to obtain a quality control result, and performing a pruning operation on a preset number of nucleotides before the quality control result to obtain a pruning result after removing unknown bases; The pruning results are assembled using a metagenomic assembly tool to obtain an assembled contig file, and contigs with lengths shorter than a preset length are removed from the DNA contig sequence file to obtain a DNA contig sequence.

[0008] Optionally, the single metagenome contig sequence clustering method integrating semantic features, wherein the step of extracting 4-mer features from the DNA contig sequence, reducing the dimension of the 4-mer features, and using the reduced-dimensional features as the constituent features of the DNA contig sequence specifically comprises: Extracting a first continuous fragment of length 4 from the single strand of the DNA contig sequence by a sliding window technique; Using a reverse complement algorithm and a sliding window technique, a second continuous fragment of length 4 in another single strand of the DNA contig sequence is obtained; The occurrence frequency of 4-mer is calculated according to the first continuous fragment and the second continuous fragment, and the occurrence frequency is used as the 4-mer feature, projected into the standard orthogonal space for dimensionality reduction to obtain the reduced dimension feature, and the reduced dimension feature is used as the component feature of the DNA overlapping group sequence.

[0009] Optionally, in the single metagenome contig sequence clustering method integrating semantic features, the training sequences are a pair of sequences from the same genome and do not overlap.

[0010] Optionally, the single metagenome contig sequence clustering method integrating semantic features, wherein the composition features and the semantic features are input into a pre-built VAE variational autoencoder for feature fusion reconstruction, and the reconstruction error is calculated, specifically comprising: Input the composition features and the semantic features into a pre-built VAE variational autoencoder for concatenation to obtain a unified tensor; Extract features from the unified tensor through a fully connected encoding layer to obtain intermediate features, and input the intermediate features into a mean layer and a standard deviation layer for processing to generate a mean vector and a standard deviation vector; Obtaining a latent space representation according to the mean vector and the standard deviation vector, inputting the latent space representation into a decoder to restore it layer by layer to the input dimension, and obtaining restored composition features and restored semantic features; A reconstruction error is calculated based on the composition features, the semantic features, the mean vector, the standard deviation vector, the restored composition features and the restored semantic features.

[0011] Optionally, the single metagenome contig sequence clustering method integrating semantic features, wherein the reconstruction error is calculated according to the composition feature, the semantic feature, the mean vector, the standard deviation vector, the restored composition feature and the restored semantic feature, specifically includes: The mean square error is calculated based on the composition features, the semantic features, the restored composition features and the restored semantic features: ; According to the mean vector and the standard deviation vector, the KL divergence is calculated: ; According to the mean square error and the KL divergence, the reconstruction error is calculated: ; in, is the mean square error, is the KL divergence, is the reconstruction error, , and are the first weight, the second weight and the third weight respectively, To restore the composition characteristics, To restore semantic features, For the composition characteristics, is a semantic feature, is the standard deviation vector, is the mean vector.

[0012] Optionally, the method for clustering single metagenome contig sequences integrating semantic features, wherein clustering the DNA contig sequences is completed by a k-means clustering algorithm according to the latent space features, and also includes: The number of single-copy marker genes is obtained using a gene prediction tool, and the initial cluster number of the DNA contig sequence is determined according to the number of single-copy marker genes.

[0013] Optionally, the single metagenome contig sequence clustering method integrating semantic features, wherein the clustering of the DNA contig sequences is completed by a k-means clustering algorithm according to the latent space features, specifically comprising: According to the number of clusters , randomly selected from the DNA contig sequences latent space features as initial cluster centers; Calculate the distance from each latent space feature to the initial cluster center respectively, assign each latent space feature to the nearest initial cluster center according to each distance, and after the assignment is completed, recalculate the center of each cluster according to the average value of the latent space feature in each cluster to obtain the target cluster center; K-means clustering is performed according to the target cluster center and the latent space features to obtain a clustering result of the DNA overlapping group sequence.

[0014] In addition, to achieve the above-mentioned purpose, the present invention also provides a single metagenome contig sequence clustering system integrating semantic features, wherein the single metagenome contig sequence clustering system integrating semantic features comprises: A composition feature extraction module is used to pre-process the metagenomic raw data to obtain a DNA contig sequence, extract 4-mer features from the DNA contig sequence, perform dimension reduction on the 4-mer features, and use the features after dimension reduction as the composition features of the DNA contig sequence; A semantic feature extraction module, used to select a training sequence from the DNA contig sequence, use the training sequence to further pre-train the DNABERT_S model, and extract semantic features through the further pre-trained DNABERT_S model to obtain semantic features; A feature fusion reconstruction module, used for inputting the composition features and the semantic features into a pre-built VAE variational autoencoder for feature fusion reconstruction, and calculating the reconstruction error; The overlapping group sequence clustering module is used to obtain the latent space characteristics of the VAE variational autoencoder when the reconstruction error no longer decreases, and cluster the DNA overlapping group sequences through the k-means clustering algorithm according to the latent space characteristics.

[0015] In addition, to achieve the above-mentioned purpose, the present invention also provides a terminal, wherein the terminal includes: a memory, a processor, and a single metagenome overlap group sequence clustering program with integrated semantic features stored in the memory and run on the processor, and when the single metagenome overlap group sequence clustering program with integrated semantic features is executed by the processor, the steps of the single metagenome overlap group sequence clustering method with integrated semantic features as described above are implemented.

[0016] In addition, to achieve the above-mentioned purpose, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a single metagenome contig sequence clustering program integrating semantic features, and when the single metagenome contig sequence clustering program integrating semantic features is executed by a processor, the steps of the single metagenome contig sequence clustering method integrating semantic features as described above are implemented.

[0017] In the present invention, the raw data of the metagenomics is preprocessed to obtain a DNA overlapping group sequence, 4-mer features are extracted from the overlapping group, and the 4-mer features are reduced in dimension to obtain the composition features of the DNA overlapping group sequence; a training sequence is selected from the DNA overlapping group sequence, and a DNABERT_S model is further pre-trained using the training sequence to extract semantic features to obtain semantic features; the composition features and the semantic features are input into a pre-constructed VAE variational autoencoder for feature fusion reconstruction, and the reconstruction error is calculated; when the reconstruction error is no longer reduced, the latent space features of the VAE variational autoencoder are obtained, and according to the latent space features, the DNA overlapping group sequence is clustered by a k-means clustering algorithm. The present invention solves the problem of low clustering accuracy when there is a lack of coverage features, and improves the clustering effect of a single sample metagenomics. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 It is a flow chart of a preferred embodiment of the single metagenome contig sequence clustering method integrating semantic features of the present invention; Figure 2 It is a schematic diagram of data preprocessing and feature extraction in the single metagenome contig sequence clustering method integrating semantic features of the present invention; Figure 3 It is a schematic diagram of feature fusion reconstruction in the single metagenome contig sequence clustering method integrating semantic features of the present invention; Figure 4 It is a comparison diagram of Checkm2 results of the SRR1785159 data set using four methods in the single metagenome contig sequence clustering method integrating semantic features of the present invention; Figure 5 It is a comparison diagram of Checkm2 results of the SRR17635658 data set using four methods in the single metagenome contig sequence clustering method integrating semantic features of the present invention; Figure 6 It is a comparison diagram of Checkm2 results of the SRR17635503 data set using four methods in the single metagenome contig sequence clustering method integrating semantic features of the present invention; Figure 7It is a comparison diagram of Checkm2 results of the SRR17635647 data set using four methods in the single metagenome contig sequence clustering method integrating semantic features of the present invention; Figure 8 It is a comparison diagram of the number of high and medium quality clusters of four methods in the single metagenome contig sequence clustering method integrating semantic features in the present invention in the SRR1785159 data set; Fig. 9 It is a comparison diagram of the number of high and medium quality clusters of four methods in the single metagenome contig sequence clustering method integrating semantic features in the present invention in the SRR17635658 data set; Fig.10 It is a comparison diagram of the number of high and medium quality clusters of four methods in the single metagenome contig sequence clustering method integrating semantic features in the present invention in the SRR17635503 data set; Fig.11 It is a comparison diagram of the number of high and medium quality clusters of four methods in the single metagenome contig sequence clustering method integrating semantic features in the present invention in the SRR17635647 data set; Fig.12 It is a structural diagram of a preferred embodiment of a single metagenome contig sequence clustering system integrating semantic features of the present invention; Fig.13 It is a structural diagram of a preferred embodiment of the terminal of the present invention. DETAILED DESCRIPTION

[0019] The present application provides a method, system and terminal for clustering single metagenome contig sequences integrating semantic features. In order to make the purpose, technical solution and effect of the present application clearer and more specific, the present application is further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0020] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art to which this application belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with those in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as here.

[0021] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present invention, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0022] The single metagenome contig sequence clustering method integrating semantic features described in the preferred embodiment of the present invention is as follows: Figure 1 As shown, the single metagenome contig sequence clustering method integrating semantic features comprises the following steps: Step S10, preprocessing the metagenomic raw data to obtain a DNA contig sequence, extracting 4-mer features from the DNA contig sequence, reducing the dimension of the 4-mer features, and using the reduced-dimensional features as the constituent features of the DNA contig sequence.

[0023] The preprocessing of the raw metagenome data to obtain DNA contig sequences specifically includes: Acquire the raw metagenome data to be processed, and perform a splitting operation on the raw metagenome data to obtain a splitting result; Performing a quality control operation on the short read sequence in the splitting result to obtain a quality control result, and performing a pruning operation on a preset number of nucleotides before the quality control result to obtain a pruning result after removing unknown bases; The pruning results are assembled using a metagenomic assembly tool to obtain an assembled contig file, and contigs with lengths shorter than a preset length are removed from the DNA contig sequence file to obtain a DNA contig sequence.

[0024] like Figure 2As shown, in this embodiment, the metagenomic raw data is preprocessed, and first the data set (metagenomic raw data) is downloaded from the data processing tool provided on the Biotechnology Information Center, and the initially downloaded data set is SRA (Sequence Read Archive format). The raw data is split using the data splitting tool fasterq-dump in the kit, and finally a fastq (fastq is a text format that stores biological sequences and corresponding quality evaluations) format file is obtained. Then a quality control operation is performed, and the bbduk software in the common sequence quality control tool BBTools kit is used to perform quality control on the original short read sequence, and then the first ten nucleotides of each short read sequence are pruned using bbduk. The purpose of quality control and pruning is to remove the unknown base N present in the short read sequence.

[0025] Furthermore, after quality control and pruning of the original short-read sequence, the metagenomic assembly tool MetaSpades was used to assemble it, and the parameters were used to finally obtain the assembled contig file. In the clustering process, shorter sequence fragments, such as less than 2kbp (kilobase pairs), may not contain enough information for reliable genome clustering. In addition, short sequences are prone to mismatching during the alignment process, and such errors will have a negative impact on the clustering analysis, thereby affecting the accuracy of the overall analysis. Therefore, contigs with a length less than a preset length (2kbp) are removed from the DNA contig sequence file.

[0026] Furthermore, the extracting of 4-mer features from the DNA contig sequence, reducing the dimension of the 4-mer features, and using the reduced-dimensional features as the constituent features of the DNA contig sequence specifically includes: Extracting a first continuous fragment of length 4 from the single strand of the DNA contig sequence by a sliding window technique; Using a reverse complement algorithm and a sliding window technique, a second continuous fragment of length 4 in another single strand of the DNA contig sequence is obtained; The occurrence frequency of 4-mer is calculated according to the first continuous fragment and the second continuous fragment, and the occurrence frequency is used as the 4-mer feature, which is projected into the standard orthogonal space for dimensionality reduction to obtain the reduced dimension feature, and the reduced dimension feature is used as the component feature (node ​​feature) of the DNA overlapping group sequence.

[0027] It can be understood that the continuous fragments of fixed length extracted from the sequence by sliding window technology are called k-mer, and 4-mer is the case when k=4, which means that the length selected in the sliding window is 4, and the sequence is slid and intercepted in units of 4 bases and a step size of one base. In the present invention, the frequency of occurrence of k-mer is calculated as the composition feature of the sequence.

[0028] DNA is a double-stranded structure. However, in metagenomics, only a single strand can be sequenced and the reverse complement algorithm can be used to obtain the information of the other single strand. In k-mer calculation, the dimension of the k-mer feature vector is obtained by calculating the single strand and reverse complement of the base. When k=4, this method can greatly reduce the time complexity by performing a sliding window on a single strand of the DNA overlap group and then reverse complementing the information of the other strand. for: ; The larger the k value, the more complete the representation of sequence species information. However, as the k value increases, the dimension of the feature vector also increases. Related studies have shown that when k=4, the k-mer frequency can represent the complete information of the sequence, and the clustering performance on the sequence is better.

[0029] It is understandable that since k-mer frequencies are not completely independent, some constraints are designed in this example to reduce the final dimension: (1) Frequency sum constraint, the sum of all k-mer frequencies must be equal to 1. (2) Complementary symmetry constraint, the frequency of a k-mer should be the same as the frequency of its complementary k-mer. (3) Edge probability consistency constraint, all edge probabilities should be consistent in different k-mer combinations.

[0030] Based on the above three constraints, a matrix equation can be formed ,in is a coefficient matrix, representing the constraint relationship, is the original frequency vector, is a constant vector. Then by calculating the matrix The null space of is obtained to obtain a set of orthogonal vectors, which form a new independent feature space. Through the above spatial transformation, the 4-mer frequency is projected into the 103-dimensional standard orthogonal space to reduce the dimension of the feature space to 103 dimensions. In summary, the 4-mer feature frequency of the single-sample metagenomic DNA contigs is extracted and the dimension is reduced as the component features of the contigs.

[0031] Step S20: selecting a training sequence from the DNA overlapping group sequence, using the training sequence to pre-train the DNABERT_S model, and extracting semantic features through the trained DNABERT_S model to obtain semantic features.

[0032] The DNABERT_S model is a genomic-based model specifically designed to generate DNA embeddings. Like most language models, DNABERT_S was initially pre-trained on a large-scale general dataset to learn a wide range of feature representations. However, for specific tasks, general models may not be able to capture the details required for the task. Therefore, the present invention trains the model on data that is more relevant to the target task to obtain more targeted feature representations.

[0033] like Figure 2 As shown, the training of the DNABERT_S model includes two stages. The first stage distinguishes similar sequences from dissimilar sequences, and the second stage forms more differentiated contrast anchors to continue differentiation. This basic model can well extract the semantic features of the sequence and distinguish the similarity of the sequence. In the present invention, this feature is extracted as a supplement to the 4-mer feature to construct the sequence feature together.

[0034] Furthermore, due to model requirements, the data set for further pre-training is a pair of sequences from the same genome that do not overlap, and the effect is better when the length is 10kbp. The script is written to allow only data with a length greater than 20kbp to participate in further pre-training, and each sequence is divided into multiple parts according to the length of 10kbp, and then combined in pairs to complete data amplification. After the data set is constructed, the model is further pre-trained by selecting appropriate hyperparameters based on the performance of the device. After obtaining the trained model, the semantic features of all the original sequences are extracted. The dimension of the semantic feature vector is 768 dimensions, and the semantic features of the overlapping group sequences are obtained.

[0035] Step S30: input the composition features and the semantic features into a pre-built VAE variational autoencoder for feature fusion reconstruction, and calculate the reconstruction error.

[0036] It is understandable that before clustering the DNA overlap groups, the extracted features need to be fused and reconstructed. Therefore, the composition features and the semantic features are input into the pre-built VAE (variational auto-encoder) variational autoencoder for feature fusion and reconstruction. As a form of deep generative model, VAE can learn the potential distribution of data and generate new data samples by sampling from the latent space. Compared with traditional deep generative networks, VAE has two most prominent advantages: one is to avoid directly calculating complex marginal likelihood probabilities by introducing variational lower bounds, and the other is to avoid complex Markov chain sampling processes through parameter transformation.

[0037] The design idea of ​​the VAE encoder is as follows: (1) Input data preprocessing and concatenation. The encoder receives the composition features and the semantic features, and concatenates the composition features and the semantic features into a unified tensor in the feature dimension, so that the model can process multiple features. (2) Layer-by-layer encoding feature extraction. The dimension of the input data is gradually reduced through multiple hidden layers to extract more representative features. The LeakyReLU activation function is used in each layer to introduce nonlinear characteristics, and batch normalization is used to stabilize the training process. At the same time, the Dropout regularization technique is used to prevent overfitting. (3) Latent space representation and reparameterization sampling. The output of the encoder is finally mapped to the latent space. In order to ensure that VAE can generate new data through random sampling, the reparameterization technique is used to obtain a latent vector with randomness, making the generation process more generalizable. (4) Decoding and reconstructing the output. The latent vector is input to the decoder and restored to the input dimension layer by layer. The decoder restores the representation of the latent space to the various features of the input data through layer-by-layer linear transformation, activation, batch normalization and regularization operations to ensure that the generated output can be close to the original input.

[0038] Specifically, the composition features and the semantic features are input into a pre-built VAE variational autoencoder for concatenation to obtain a unified tensor, including; Extract features from the unified tensor through a fully connected encoding layer to obtain intermediate features, and input the intermediate features into a mean layer and a standard deviation layer for processing to generate a mean vector and a standard deviation vector; Obtaining a latent space representation according to the mean vector and the standard deviation vector, inputting the latent space representation into a decoder to restore it layer by layer to the input dimension, and obtaining restored composition features and restored semantic features; A reconstruction error is calculated based on the composition features, the semantic features, the mean vector, the standard deviation vector, the restored composition features and the restored semantic features.

[0039] like Figure 3As shown, the features are jointly input into the constructed VAE encoder, from left to right: input composition features and semantic features , for example, the input consists of features of size 103 and semantic features of size 768 , these vectors are concatenated into a 103+768-dimensional vector and then passed through a fully connected encoding layer. The last layer passes the output to two different fully connected layers, called the mean layer and the standard deviation layer, which generate the mean vector respectively. and the standard deviation vector Each element of these two vectors corresponds to the mean and standard deviation of a variable in the latent space. In the latent space, assuming that the latent variables of each dimension obey an independent Gaussian distribution, that is, each dimension has a corresponding mean and standard deviation, the representation of the entire latent space can be regarded as a multivariate Gaussian distribution. The latent representation can be obtained by sampling a length of A vector is created where each element is from a multivariate Gaussian distribution The number of neurons in the latent layer is set to 32, and the dimension of the latent space extracted from the data by the final model is 32. For the decoder, the latent representation passes through the same fully connected layers as the encoding hidden layer, but in the opposite order, resulting in a 103+768-dimensional vector, which is split into two vector outputs, which are the restored component features and restore semantic features .

[0040] Further, the reconstruction error is calculated according to the composition feature, the semantic feature, the mean vector, the standard deviation vector, the restored composition feature and the restored semantic feature, specifically including: The mean square error is calculated based on the composition features, the semantic features, the restored composition features and the restored semantic features: ; According to the mean vector and the standard deviation vector, the KL divergence is calculated: ; According to the mean square error and the KL divergence, the reconstruction error is calculated: ; in, is the mean square error, is the KL divergence, is the reconstruction error, , and are the first weight, the second weight and the third weight respectively, To restore the composition characteristics, To restore semantic features, For the composition characteristics, is a semantic feature, is the standard deviation vector, is the mean vector.

[0041] It can be understood that the mean square error makes the model more accurate at output by minimizing the square difference between each output and the true value. The KL (Kullback-Leibler) divergence is used to measure the difference between two probability distributions. Adding KL divergence to the error function to regularize the model is used to control the complexity of the model. It is used to control the influence of the regularization term. It can be seen that by calculating the reconstruction error and minimizing the difference, the potential distribution of the model tends to the standard normal distribution, thereby achieving regularization.

[0042] Step S40: When the reconstruction error is stable or reaches a predetermined training round, the latent space features of the VAE variational autoencoder are obtained, and the DNA contig sequences are clustered by a k-means clustering algorithm according to the latent space features.

[0043] Specifically, the reconstruction error is the error function of the VAE variational autoencoder model, which is used to control model training. The process of model training is to reduce the error as much as possible. When the reconstruction error is stable or reaches a predetermined training round, the VAE variational autoencoder model training is completed, and the latent space features of the VAE variational autoencoder are obtained, and the latent space features are used as the final input of the k-means clustering algorithm.

[0044] The method further comprises clustering the DNA contig sequences according to the latent space features by using a k-means clustering algorithm: The number of single-copy marker genes is obtained using a gene prediction tool, and the initial cluster number of the DNA contig sequence is determined according to the number of single-copy marker genes.

[0045] It is understandable that before performing the clustering task, the initial number of clusters needs to be determined. For metagenomic contigs, the initial number of clusters The determination of the impact on clustering performance is very important. Most methods for determining the initial number of clusters of overlapping groups are to select 0.2% of the total number of overlapping groups. However, for the same community, the number of species between different overlapping groups varies greatly, so this method cannot accurately obtain the number of clusters of overlapping groups. Generally speaking, a single-copy marker gene may only appear once in each overlapping group. Ideally, the number of clusters should be equal to the number of overlapping groups containing the same single-copy marker gene. Therefore, this embodiment uses the gene prediction tool FragGeneScan to obtain the number of single-copy marker genes, and then determine the initial number of clusters of overlapping groups. .

[0046] Furthermore, according to the number of clusters , randomly selected from the DNA contig sequences latent space features as the initial cluster center; respectively calculating the distance from each latent space feature to the initial cluster center, assigning each latent space feature to the nearest initial cluster center according to each distance, and after the assignment is completed, recalculating the center of each cluster according to the average value of the latent space features in each cluster to obtain the target cluster center; In this embodiment, after determining the initial number of clusters, k-means is used for clustering. K-means is a commonly used unsupervised learning algorithm that randomly selects multiple latent space features (data points) in the data set as the initial cluster centers. For each latent space feature, its distance to each cluster center is calculated (usually using Euclidean distance), and each latent space feature is assigned to the cluster with the closest cluster center. By minimizing the intra-class distance, points in the same cluster are made as close as possible. After the latent space feature assignment is completed, the center of each cluster is recalculated to obtain the target cluster center.

[0047] For each initial cluster center , its new center is the feature of all latent spaces in the cluster The average value of: ; in, is the number of latent space features of the initial cluster centers.

[0048] The goal of the k-means algorithm is to minimize the intra-class squared error, which is the sum of the squared distances between all data points and the center of their cluster: ; in, is the intra-class squared error, is the ordinal number of the cluster.

[0049] Further, k-means clustering is performed according to the target cluster center and the latent space features to obtain the clustering result of the DNA contig sequence. In this embodiment, the k-means clustering algorithm continuously repeats the allocation and update steps until the cluster center remains unchanged in continuous iterations or the set maximum number of iterations is reached. Finally, clusters, each cluster contains similar data points, and each cluster has a cluster center.

[0050] Furthermore, the present invention uses the current mainstream metagenomic evaluation software Checkm2 to evaluate the clustering results, and counts the number of assembled genomes of different completeness when the contamination is less than 5%. The assembled genome is obtained by clustering. After the Checkm2 operation, the more high-complete assembled genomes there are, the better the clustering performance of the model. The clustering results of the method in the present invention (ourmethod) and three mainstream methods (metadecoder, metabat2 and vamb) on four data sets (SRR1785159, SRR17635658, SRR17635503 and SRR 17635647) are compared, and the results are as follows: Figure 4 , Figure 5 , Figure 6 and Figure 7 As shown, for the SRR17858159 dataset and the SRR17635658 dataset, the total number of assembled genomes obtained by the present invention is the largest among the four methods, as is metabat2, but the method of the present invention has a larger number of assembled genomes with a completeness greater than 90%, and can obtain more high-quality genomes. On the SRR17635503 dataset and the SRR17635647 dataset, although metadecoder and metabat2 obtained a larger number of total assembled genomes, most of their assembled genomes were distributed in areas with a completeness of less than 90%, and the method of the present invention obtained more assembled genomes with high completeness.

[0051] In order to further verify the clustering performance of the present invention, the number of high-quality and medium-quality bins was counted according to the MAGs (Metagenome-Assembled Genomes) evaluation criteria. It should be noted that metagenome clustering is to divide DNA contig sequences into different groups, each of which is a bin. The evaluation results of the above four methods on the four data sets are shown in Figure 2. Figure 8 , Fig. 9 , Fig.10 and Fig.11As shown, it can be seen that on the SRR17858159 dataset, the method of the present invention has the largest number of high- and medium-quality assembled genomes. On the other three datasets, the method of the present invention obtains the most high-quality assembled genomes. For medium-quality assembled genomes, metabat2 and metadecoder methods are more advantageous. In summary, the present invention can effectively capture effective feature information by further pre-training the DNA language model to extract the semantic features of the sequence and optimizing and reconstructing the features through VAE, thereby improving the clustering performance of single metagenome DNA contigs.

[0052] It can be seen that the present invention completes further pre-training of the basic model by selecting a sequence of specific length and designing a data augmentation method, thereby supplementing new sequence features for subsequent clustering. At the same time, a feature reconstruction optimization model based on the VAE variational autoencoder is constructed, and feature fusion reconstruction is performed on the extracted semantic features and the component features after dimensionality reduction, and a reconstruction error function is designed based on the two features to guide model training. During use, the user only needs to adjust the model parameters according to the selected data set size and sequence length to obtain the final clustering result. After verification of real data sets and simulated data sets and comparison with the clustering results of various other existing methods, the effectiveness of this method has been confirmed, and better clustering results can be obtained.

[0053] Furthermore, if Fig.12 As shown, based on the above-mentioned single metagenome contig sequence clustering method integrating semantic features, the present invention also provides a single metagenome contig sequence clustering system integrating semantic features, wherein the single metagenome contig sequence clustering system integrating semantic features includes: The composition feature extraction module 51 is used to pre-process the metagenomic raw data to obtain a DNA contig sequence, extract 4-mer features from the DNA contig sequence, reduce the dimension of the 4-mer features, and use the features after dimension reduction as the composition features of the DNA contig sequence; A semantic feature extraction module 52, for selecting a training sequence from the DNA contig sequence, using the training sequence to pre-train the DNABERT_S model, and performing semantic feature extraction through the trained DNABERT_S model to obtain a semantic feature; A feature fusion reconstruction module 53 is used to input the composition features and the semantic features into a pre-built VAE variational autoencoder for feature fusion reconstruction and calculate the reconstruction error; The contig sequence clustering module 54 is used to obtain the latent space features of the VAE variational autoencoder when the reconstruction error no longer decreases, and cluster the DNA contig sequences using a k-means clustering algorithm based on the latent space features.

[0054] Furthermore, if Fig.13 As shown, based on the above-mentioned single metagenome contig sequence clustering method and system integrating semantic features, the present invention also provides a terminal accordingly, and the terminal includes a processor 10, a memory 20 and a display 30. Fig.13 Only some components of the terminal are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.

[0055] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory of the terminal. In other embodiments, the memory 20 may also be an external storage device of the terminal, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the terminal. Further, the memory 20 may also include both an internal storage unit of the terminal and an external storage device. The memory 20 is used to store application software and various types of data installed on the terminal, such as the program code of the installation terminal. The memory 20 may also be used to temporarily store data that has been output or is to be output. In one embodiment, a single metagenome contig sequence clustering program 40 fused with semantic features is stored on the memory 20, and the single metagenome contig sequence clustering program 40 fused with semantic features can be executed by the processor 10, thereby realizing the single metagenome contig sequence clustering method fused with semantic features in the present application.

[0056] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run the program code or process data stored in the memory 20, such as executing the single metagenome contig sequence clustering method integrating semantic features.

[0057] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 30 is used to display information on the terminal and to display a visual user interface. The components of the terminal communicate with each other via a system bus.

[0058] In one embodiment, when the processor 10 executes the single metagenome contig sequence clustering program 40 integrating semantic features in the memory 20, the following steps are implemented: Preprocessing the raw data of the metagenomics to obtain a DNA contig sequence, extracting 4-mer features from the DNA contig sequence, reducing the dimension of the 4-mer features, and using the features after dimension reduction as the component features of the DNA contig sequence; Selecting a training sequence from the DNA contig sequence, further pre-training a DNABERT_S model using the training sequence, and extracting semantic features using the further pre-trained DNABERT_S model to obtain semantic features; Input the composition features and the semantic features into a pre-built VAE variational autoencoder for feature fusion reconstruction, and calculate the reconstruction error; When the reconstruction error no longer decreases, the latent space features of the VAE variational autoencoder are obtained, and the DNA contig sequences are clustered using a k-means clustering algorithm based on the latent space features.

[0059] The preprocessing of the raw metagenome data to obtain DNA contig sequences specifically includes: Acquire the raw metagenome data to be processed, and perform a splitting operation on the raw metagenome data to obtain a splitting result; Performing a quality control operation on the short read sequence in the splitting result to obtain a quality control result, and performing a pruning operation on a preset number of nucleotides before the quality control result to obtain a pruning result after removing unknown bases; The pruning results are assembled using a metagenomic assembly tool to obtain an assembled contig file, and contigs with lengths shorter than a preset length are removed from the DNA contig sequence file to obtain a DNA contig sequence.

[0060] The step of extracting 4-mer features from the DNA contig sequence, reducing the dimension of the 4-mer features, and using the features after dimension reduction as the constituent features of the DNA contig sequence specifically includes: Extracting a first continuous fragment of length 4 from the single strand of the DNA contig sequence by a sliding window technique; Using a reverse complement algorithm and a sliding window technique, a second continuous fragment of length 4 in another single strand of the DNA contig sequence is obtained; The occurrence frequency of 4-mer is calculated according to the first continuous fragment and the second continuous fragment, and the occurrence frequency is used as the 4-mer feature, projected into the standard orthogonal space for dimensionality reduction to obtain the reduced dimension feature, and the reduced dimension feature is used as the component feature of the DNA overlapping group sequence.

[0061] The training sequences are a pair of sequences from the same genome and do not overlap.

[0062] The step of inputting the composition features and the semantic features into a pre-built VAE variational autoencoder for feature fusion reconstruction and calculating the reconstruction error specifically includes: Input the composition features and the semantic features into a pre-built VAE variational autoencoder for concatenation to obtain a unified tensor; Extract features from the unified tensor through a fully connected encoding layer to obtain intermediate features, and input the intermediate features into a mean layer and a standard deviation layer for processing to generate a mean vector and a standard deviation vector; Obtaining a latent space representation according to the mean vector and the standard deviation vector, inputting the latent space representation into a decoder to restore it layer by layer to the input dimension, and obtaining restored composition features and restored semantic features; A reconstruction error is calculated based on the composition features, the semantic features, the mean vector, the standard deviation vector, the restored composition features and the restored semantic features.

[0063] The step of calculating the reconstruction error according to the composition feature, the semantic feature, the mean vector, the standard deviation vector, the restored composition feature and the restored semantic feature specifically includes: The mean square error is calculated based on the composition features, the semantic features, the restored composition features and the restored semantic features: ; According to the mean vector and the standard deviation vector, the KL divergence is calculated: ; According to the mean square error and the KL divergence, the reconstruction error is calculated: ; in, is the mean square error, is the KL divergence, is the reconstruction error, , and are the first weight, the second weight and the third weight respectively, To restore the composition characteristics, To restore semantic features, For the composition characteristics, is a semantic feature, is the standard deviation vector, is the mean vector.

[0064] Wherein, clustering the DNA overlapping group sequences is completed by using a k-means clustering algorithm according to the latent space features, and the method also includes: The number of single-copy marker genes is obtained using a gene prediction tool, and the initial cluster number of the DNA contig sequence is determined according to the number of single-copy marker genes.

[0065] The step of clustering the DNA contig sequences according to the latent space features by using a k-means clustering algorithm specifically includes: According to the number of clusters , randomly selected from the DNA contig sequences latent space features as initial cluster centers; Calculate the distance from each latent space feature to the initial cluster center respectively, assign each latent space feature to the nearest initial cluster center according to each distance, and after the assignment is completed, recalculate the center of each cluster according to the average value of the latent space feature in each cluster to obtain the target cluster center; K-means clustering is performed according to the target cluster center and the latent space features to obtain a clustering result of the DNA overlapping group sequence.

[0066] The present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a single metagenome contig sequence clustering program integrating semantic features, and when the single metagenome contig sequence clustering program integrating semantic features is executed by a processor, the steps of the single metagenome contig sequence clustering method integrating semantic features as described above are implemented.

[0067] In summary, this article provides a single metagenome contig sequence clustering method and system integrating semantic features. The method includes: preprocessing the raw data of the metagenome to obtain DNA contig sequences, extracting 4-mer features from the contigs, reducing the dimension of the 4-mer features, and obtaining the composition features of the DNA contig sequences; selecting training sequences from the DNA contig sequences, and using the training sequences to further pre-train the DNABERT_S model and then extracting semantic features to obtain semantic features; inputting the composition features and semantic features into the pre-constructed VAE variational autoencoder for feature fusion reconstruction, and calculating the reconstruction error; when the reconstruction error is stable or reaches a predetermined training round, obtaining the latent space features of the VAE variational autoencoder, and according to the latent space features, completing the clustering of the DNA contig sequences by the k-means clustering algorithm. The present invention solves the problem of low clustering accuracy in the absence of coverage features, and improves the clustering effect of the single sample metagenome.

[0068] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or terminal including the element.

[0069] Of course, those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0070] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.

Claims

1. A method for clustering single metagenome contig sequences integrating semantic features, characterized in that: The single metagenome contig sequence clustering method integrating semantic features includes: Preprocessing the raw data of the metagenomics to obtain a DNA contig sequence, extracting 4-mer features from the DNA contig sequence, reducing the dimension of the 4-mer features, and using the features after dimension reduction as the component features of the DNA contig sequence; Selecting a training sequence from the DNA contig sequence, further pre-training a DNABERT_S model using the training sequence, and extracting semantic features using the further pre-trained DNABERT_S model to obtain semantic features; Input the composition features and the semantic features into a pre-built VAE variational autoencoder for feature fusion reconstruction, and calculate the reconstruction error; When the reconstruction error is stable or reaches a predetermined training round, the latent space features of the VAE variational autoencoder are obtained, and the DNA contig sequences are clustered using a k-means clustering algorithm based on the latent space features.

2. The method for clustering single metagenome contig sequences integrating semantic features according to claim 1, characterized in that: The preprocessing of the raw metagenome data to obtain DNA contig sequences specifically includes: Acquire the raw metagenome data to be processed, and perform a splitting operation on the raw metagenome data to obtain a splitting result; Performing a quality control operation on the short read sequence in the splitting result to obtain a quality control result, and performing a pruning operation on a preset number of nucleotides before the quality control result to obtain a pruning result after removing unknown bases; The pruning results are assembled using a metagenomic assembly tool to obtain an assembled contig file, and contigs with lengths shorter than a preset length are removed from the DNA contig sequence file to obtain a DNA contig sequence.

3. The method for clustering single metagenome contig sequences integrating semantic features according to claim 1, characterized in that: The step of extracting 4-mer features from the DNA contig sequence, reducing the dimension of the 4-mer features, and using the features after the dimension reduction as the constituent features of the DNA contig sequence specifically includes: Extracting a first continuous fragment of length 4 from the single strand of the DNA contig sequence by a sliding window technique; Using a reverse complement algorithm and a sliding window technique, a second continuous fragment of length 4 in another single strand of the DNA contig sequence is obtained; The occurrence frequency of 4-mer is calculated according to the first continuous fragment and the second continuous fragment, and the occurrence frequency is used as the 4-mer feature, projected into the standard orthogonal space for dimensionality reduction to obtain the reduced dimension feature, and the reduced dimension feature is used as the component feature of the DNA overlapping group sequence.

4. The method for clustering single metagenome contig sequences integrating semantic features according to claim 1, characterized in that: The training sequences are a pair of sequences that are from the same genome and do not overlap.

5. The method for clustering single metagenome contig sequences integrating semantic features according to claim 1, characterized in that: The step of inputting the composition features and the semantic features into a pre-built VAE variational autoencoder for feature fusion reconstruction and calculating the reconstruction error specifically includes: Input the composition features and the semantic features into a pre-built VAE variational autoencoder for concatenation to obtain a unified tensor; Extract features from the unified tensor through a fully connected encoding layer to obtain intermediate features, and input the intermediate features into a mean layer and a standard deviation layer for processing to generate a mean vector and a standard deviation vector; Obtaining a latent space representation according to the mean vector and the standard deviation vector, inputting the latent space representation into a decoder to restore it layer by layer to the input dimension, and obtaining restored composition features and restored semantic features; A reconstruction error is calculated based on the composition features, the semantic features, the mean vector, the standard deviation vector, the restored composition features and the restored semantic features.

6. The method for clustering single metagenome contig sequences integrating semantic features according to claim 5, characterized in that: The calculating the reconstruction error according to the composition feature, the semantic feature, the mean vector, the standard deviation vector, the restored composition feature and the restored semantic feature specifically includes: The mean square error is calculated based on the composition features, the semantic features, the restored composition features and the restored semantic features: ; According to the mean vector and the standard deviation vector, the KL divergence is calculated: ; According to the mean square error and the KL divergence, the reconstruction error is calculated: ; in, is the mean square error, is the KL divergence, is the reconstruction error, , and are the first weight, the second weight and the third weight respectively, To restore the composition characteristics, To restore semantic features, For the composition characteristics, is a semantic feature, is the standard deviation vector, is the mean vector.

7. The method for clustering single metagenome contig sequences integrating semantic features according to claim 1, characterized in that: The method further comprises clustering the DNA contig sequences according to the latent space features by using a k-means clustering algorithm: The number of single-copy marker genes is obtained using a gene prediction tool, and the initial cluster number of the DNA contig sequence is determined according to the number of single-copy marker genes.

8. The method for clustering single metagenome contig sequences integrating semantic features according to claim 7, characterized in that: The step of clustering the DNA contig sequences according to the latent space features by using a k-means clustering algorithm specifically includes: According to the number of clusters , randomly selected from the DNA contig sequences latent space features as initial cluster centers; Calculate the distance from each latent space feature to the initial cluster center respectively, assign each latent space feature to the nearest initial cluster center according to each distance, and after the assignment is completed, recalculate the center of each cluster according to the average value of the latent space feature in each cluster to obtain the target cluster center; K-means clustering is performed according to the target cluster center and the latent space features to obtain a clustering result of the DNA overlapping group sequence.

9. A single metagenome contig sequence clustering system integrating semantic features, characterized in that: The single metagenome contig sequence clustering system integrating semantic features includes: A composition feature extraction module is used to pre-process the metagenomic raw data to obtain a DNA contig sequence, extract 4-mer features from the DNA contig sequence, perform dimension reduction on the 4-mer features, and use the features after dimension reduction as the composition features of the DNA contig sequence; A semantic feature extraction module, used to select a training sequence from the DNA contig sequence, use the training sequence to further pre-train the DNABERT_S model, and extract semantic features through the further pre-trained DNABERT_S model to obtain semantic features; A feature fusion reconstruction module, used for inputting the composition features and the semantic features into a pre-built VAE variational autoencoder for feature fusion reconstruction, and calculating the reconstruction error; The overlapping group sequence clustering module is used to obtain the latent space features of the VAE variational autoencoder when the reconstruction error is stable or reaches a predetermined training round, and complete the clustering of the DNA overlapping group sequences through the k-means clustering algorithm based on the latent space features.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a single metagenome contig sequence clustering program integrating semantic features. When the single metagenome contig sequence clustering program integrating semantic features is executed by a processor, the steps of the single metagenome contig sequence clustering method integrating semantic features as described in any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Graph embedded metagenome binning method and system based on view enhancement

    CN118609662A

  • Assembly process for constructing high-quality microbial genomes on basis of stlfr metagenomic sequencing data

    WO2024187428A1