A three-generation metagenome binning method using self-supervised feature learning

By employing a self-supervised feature learning method, and utilizing convolutional neural networks and gated recurrent units to extract features from long reads, the problem of inaccurate binning of low-abundance species in existing tools is solved, achieving more accurate metagenomic binning and pre-assembly.

CN116364192BActive Publication Date: 2025-12-30NANJING AGRICULTURAL UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310216689.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-08
Publication Date
2025-12-30
Estimated Expiration
2043-03-08

AI Technical Summary

Technical Problem

Existing long-read binning tools struggle to effectively utilize the sequence features of long reads, especially for low-abundance species where binning accuracy is insufficient, and unsupervised learning suffers from blindness.

Method used

A self-supervised feature learning method is adopted, which uses convolutional neural networks and gated recurrent units with attention mechanisms to extract long reads features, and performs binning through clustering layers, combined with existing database information for semi-supervised learning.

Benefits of technology

By effectively utilizing the sequence characteristics of long reads, the binning accuracy of low-abundance species is improved, the blindness of unsupervised learning is reduced, and metagenomic binning and pre-assembly are supported, which has broad application prospects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116364192B_ABST
    Figure CN116364192B_ABST
Patent Text Reader

Abstract

The application discloses a three-generation metagenome binning method using self-supervised feature learning, which comprises the following steps: step one, generating simulated long reads on the basis of sequenced genomic data; step two, feeding the long reads into a self-supervised feature representation model for training, and saving the optimal model parameters; and step three, after the model training, feeding three-generation reads into the model to extract features, and inputting the metagenome long read sequence converted into a feature vector by the feature representation model into a clustering layer for binning. The application avoids the shortcomings of most previous methods that only emphasize nucleotide frequency and coverage and ignore sequence characteristics of the long reads, and the contrast learning with semi-supervised characteristics used by the application can effectively utilize existing database information and avoid the blindness of previous unsupervised learning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to a third-generation metagenomic binning method using self-supervised feature learning, belonging to the field of bioinformatics engineering. Background Technology

[0002] Metagenomic binning is a crucial step in the characterization of microbial community species. Third-generation sequencing provides longer reads, similar to contigs assembled from shorter reads. However, existing binning tools struggle to apply to long reads due to the lack of abundance information and high error rates. The few existing long-read binning tools primarily rely on k-mer frequency and abundance information, which may overlook bins corresponding to low-abundance species. With the increasing application of deep learning in the biological field, we propose a self-supervised feature learning-based third-generation metagenomic binning method that extracts complete long read information based on techniques such as embedding, attention mechanisms, and GRU. Summary of the Invention

[0003] The purpose of this invention is to provide a third-generation metagenomic binning method using self-supervised feature learning, overcoming the shortcomings of existing long-read binning tools.

[0004] To achieve the above objectives, the technical solution adopted by this invention is: a third-generation metagenomic binning method using self-supervised feature learning, which includes the following steps:

[0005] Step 1: Generate simulated long reads based on the sequenced genome data;

[0006] Step 2: Feed the long reads into the self-supervised feature representation model for training and save the optimal model parameters;

[0007] Step 3: After model training, the three generations of reads are fed into the model to extract features. Metagenomic long read sequences are converted into feature vectors through the feature representation model and then input into the clustering layer for binning.

[0008] Furthermore, in step one, assuming the genome contains N data points, each represented by X... i Let i = 1...N; use the reads simulation software pbsim to process X. i Generate long reads, each long read using R. i,j Indicate that j = 1...M; then cut each long read into 5 disjoint segments of length 2005bp. For long reads less than 10025bp, add the character "N"; for long reads exceeding 10025bp, truncate them; for reads Ri,j The five segments of are denoted as R. i,j,1 ,R i,j,2 ,R i,j,3 ,R i,j,4 ,R i,j,5 .

[0009] Furthermore, the self-supervised feature representation model includes an input branch, an embedding layer, a convolutional layer, a max pooling layer, a fusion layer, a BN layer, a GRU layer, and a fully connected layer.

[0010] Furthermore, the self-supervised feature representation model has five input branches, each processing R... i,j,1 ,R i,j,2 ,R i,j,3 ,R i,j,4 ,R i,j,5 Each input branch has a dimension of 1×2000, R i,j,t Before input, a sliding window with a step size of 1 and a length of 6 is used to create a one-hot encoded index, transforming it into a 1×2000-dimensional vector.

[0011] Furthermore, the input branches are connected to a single embedding layer in the model, with a dimension of 4097×100. After the embedding layer, there is a one-dimensional convolutional layer with five branches, each branch having 100 input channels and 64 output channels, with a filter shape of 40×40 and a stride of 1. Next is a one-dimensional max pooling layer with five branches, with a pooling kernel shape of 20×20 and a stride of 1 for each branch. The outputs of the five branches are concatenated together in a fusion layer, normalized by a BN layer, and then obtained by a bidirectional GRU with 50 hidden layers and an attention mechanism to obtain fused features. After the GRU layer, there is a 1×100-dimensional fully connected layer for further feature extraction.

[0012] Furthermore, the feature vectors output by the fully connected layer have the following properties: those belonging to the same group have the smallest possible Euclidean distance, while those belonging to different groups have the largest possible Euclidean distance; that is, the Euclidean distance is used as a measure of the similarity between feature vectors, and the higher the similarity, the smaller the Euclidean distance. Here, the following loss function is used to optimize the feature learning model:

[0013]

[0014] Among them, z i z j These are the features extracted by the feature learning model. Y represents whether two longreads belong to the same group (1 if they belong, 0 otherwise). d is the feature extracted by the model. i z j The Euclidean distance is m, where m is the set safety distance.

[0015] Furthermore, in the training of the self-supervised feature representation model, the input data and labels are first constructed, and R is arbitrarily extracted. i,j For each context long read, six long reads from the same row are selected, and these six long reads are cross-referenced to form six pairs of input samples, labeled as positive samples. Six different long reads from other rows are selected, and these six pairs of input samples are cross-referenced to form six pairs of input samples, labeled as negative samples. Each context long read forms 12 pairs of positive and negative samples. A total of 12*500 samples are extracted from all rows to form a batch for training. This training batch is then fed into the self-supervised feature representation model for training. The parameters are obtained iteratively through gradient descent using the backpropagation algorithm.

[0016] Furthermore, the clustering layer includes an initialization layer and a final clustering layer. The initialization layer provides the number of species k in the metagenomic data and uses k-means to provide the cluster centers. The number of species k and the cluster centers are used to initialize the final clustering layer. After the final clustering layer is initialized, it is connected to a pre-trained feature representation model and trained together with the feature representation model. The trained final clustering layer is used for the final binning, which can directly provide the group to which longreads belong.

[0017] Furthermore, the training method for the final clustering layer and feature representation model as a whole is as follows:

[0018] The sequencing long reads are fed into a pre-trained feature representation model and an initialized final clustering layer. The final clustering layer will give the probability of each long read sequence belonging to each group based on the auxiliary target distribution, i.e., soft label, and assign the long reads to the group with the highest probability. The cluster center points of the final clustering layer and the parameters of the feature representation model will be fine-tuned repeatedly until the iteration period is reached or the cluster change is less than the set threshold.

[0019] Furthermore, the loss function used to calculate the feature representation model and the final clustering layer as a whole is as follows:

[0020]

[0021] Where, q ij p is the soft label, p is the probability that read i is assigned to group j. ij To assist in target distribution;

[0022] The formula for calculating soft tags is as follows:

[0023]

[0024] z i It is a feature, u j It is the cluster center point, and α is a constant;

[0025] The formula for calculating the distribution of auxiliary targets is as follows:

[0026]

[0027] Among them, f j =Σ i q ij It represents the frequency of soft clustering.

[0028] Compared with existing technologies, the beneficial effects of this invention are as follows: First, based on the characteristic that third-generation sequencing long reads carry more sequence information than second-generation sequencing short reads, this method uses convolutional neural networks and gated recurrent units with attention mechanisms to mine the sequence features of long reads belonging to different microorganisms, avoiding the shortcomings of most previous methods that only focus on statistical features such as nucleotide frequency and coverage while ignoring the sequence features of the long reads themselves. Second, the semi-supervised contrastive learning used in this method can effectively utilize existing database information, avoiding the blindness of previous unsupervised learning. The improvement and promotion of this method can effectively perform metagenomic binning, metagenomic pre-assembly, and guide downstream analyses such as metagenomic assembly, which has broad prospects and extraordinary significance. Attached Figure Description

[0029] Figure 1 This is a schematic diagram of the box-separation process of the present invention;

[0030] Figure 2 This is a network architecture diagram of the present invention;

[0031] Figure 3 This is a feature representation model structure diagram of the present invention. Detailed Implementation

[0032] The present invention will now be described in detail with reference to the accompanying drawings.

[0033] like Figure 1 and 2This paper presents a third-generation metagenomic binning method using self-supervised feature learning. It primarily leverages an auxiliary task to mine supervisory information from a large amount of unlabeled genomic data, where each read belongs to a single genome. This constructed supervisory information is used to train a feature representation network, learning representations with genome affiliation and sequence context information. Binning is then achieved through a clustering algorithm. The method first generates simulated long reads based on sequenced genomic data, feeds them into a self-supervised feature representation model for training, and saves the optimal model parameters. During binning, three generations of reads are fed into the model to extract features, and clustering is performed through a clustering layer to achieve binning.

[0034] I. Feature Learning

[0035] Let the genome set contain N data points, each labeled X. i Let i = 1...N. Use the reads simulation software pbsim to process X. i Generate long reads, each long read using R. i,j This indicates that j = 1...M. Each long read is then divided into five disjoint segments of length 2005bp. Long reads shorter than 10025bp are padded with the character "N", and long reads longer than 10025bp are truncated. For reads R... i,j Its five segments are denoted as R. i,j,1 ,R i,j,2 ,R i,j,3 ,R i,j,4 ,R i,j,5 .

[0036] Train a self-supervised feature representation learning model using long reads. Figure 2 The structure of the feature model is as follows Figure 3 :

[0037] This feature model has 5 input branches, each processing R... i,j,1 ,R i,j,2 ,R i,j,3 ,R i,j,4 ,R i,j,5 Each input branch has a dimension of 1×2000. (R) i,j,tBefore input, a sliding window with a stride of 1 and a length of 6 is used to generate a 6mer vector and one-hot encoded index, transforming it into a 1×2000-dimensional vector. The five input branches are each connected to a single embedding layer of the network, with a dimension of 4097×100. Following the embedding layer is a 1×1 convolutional layer with five branches, each branch having 100 input channels and 64 output channels, with a 40×40 filter shape and a stride of 1. Next is a 1×1 max-pooling layer with five branches, each branch having a 20×20 pooling kernel shape and a stride of 1. The outputs of the five branches are concatenated in the subsequent fusion layer, normalized by a Batch Normalization (BN) layer, and then passed through a bidirectional GRU with 50 hidden layers and an attention mechanism to obtain fused features. After the GRU layer is a 1×100-dimensional fully connected layer for further feature extraction. This fully connected layer is also the output layer of the feature representation model, and its extracted features will be used as long reads for binning feature vectors.

[0038] The feature vectors output by the fully connected layer of the feature representation model should possess the following properties: feature vectors belonging to the same group should have the smallest possible Euclidean distance, while feature vectors belonging to different groups should have the largest possible Euclidean distance. In other words, using Euclidean distance as a measure of similarity between feature vectors, higher similarity results in a smaller Euclidean distance. Therefore, the following loss function is used to optimize the feature learning model:

[0039]

[0040] Among them, z i z j These are the features extracted by the feature learning model. Y indicates whether two longreads belong to the same group; 1 indicates they belong to the same group, and 0 indicates they belong to the same group. d is the feature extracted by the feature learning model. i z j The Euclidean distance, m is the set safety distance (boundary).

[0041] As can be seen from the above formula, when zi and zj belong to the same group, the label of Y is 1, and the contrasive loss only takes effect on the left half, with only z... i ,z j When the Euclidean distance is as small as possible (approaching 0), L(z) i ,z j This allows the loss to be as small as possible (approaching 0). When the label of Y is 0, the contrasive loss only applies to the right half; in this case, only z... i ,z j For the Euclidean distance to be greater than m, L(zi,zj) can be minimized (equal to 0).

[0042] Pre-learning training of feature representation models: First, construct the input data and labels, and arbitrarily extract R... i,jFor each context longread, six longreads from the same row are selected, and these are cross-referenced to form six pairs of input samples, labeled as positive samples. Six different longreads from other rows are also selected, and these are cross-referenced to form six pairs of input samples, labeled as negative samples. Each context longread generates 12 pairs of positive and negative samples. A total of 12*500 samples are extracted from all rows to form a batch for training. This training sample set is then fed into a self-supervised feature representation model for training, with parameters obtained iteratively using gradient descent via backpropagation.

[0043] II. Boxing

[0044] After the feature representation model is pre-trained, it can be used to extract features from long reads. Note that the feature vectors obtained by the feature representation model at this point already possess the characteristics of small Euclidean distance (high similarity) between groups and large Euclidean distance (low similarity) between different groups. After the metagenomic long read sequences are converted into feature vectors by the feature representation model, they are input into a clustering layer for binning. The clustering layer contains one initialization layer and one final clustering layer. Due to the existing characteristics of the feature vectors, the initialization layer can easily use community detection algorithms for preliminary clustering, providing the number of species k in the metagenomic data, and then using k-means to provide the cluster centers. The number of species k and the cluster centers are used to initialize the final clustering layer. After initialization, the final clustering layer is connected to the pre-trained feature representation model (the final clustering layer is connected after the output layer of the feature representation model), and together with the feature learning model, it continues to be trained as a whole. The trained final clustering layer is used for final binning, which can directly determine the group to which the long reads belong.

[0045] The training method for the final clustering layer and feature representation model as a whole is as follows: Sequencing long reads are fed into the pre-trained feature representation model and the initialized final clustering layer. The final clustering layer will assign the probability (soft label) of each long read sequence belonging to each group based on the auxiliary target distribution, and then assign the long reads to the group with the highest probability. The cluster centers of the final clustering layer and the parameters of the feature representation model will be repeatedly fine-tuned until the iteration period is reached or the clustering change is less than a set threshold.

[0046] The loss function used to calculate the feature representation model and the final clustering layer as a whole is as follows:

[0047]

[0048] Where, q ij p is the soft label, p is the probability that read i is assigned to group j. ij To assist in target distribution, the soft tag calculation formula is as follows:

[0049]

[0050] z i It is a feature, u j α is the cluster center point, and α is a constant.

[0051] The formula for calculating the distribution of auxiliary targets is as follows:

[0052]

[0053] Among them, f j =Σ i q ij It represents the frequency of soft clustering.

[0054] The following uses the above method with specific examples to further illustrate:

[0055] Pre-training

[0056] Data Preparation: Taking the human anorectal genome as an example, 4744 genome drafts were downloaded from NCBI. Contigs longer than 20000 bp were extracted and fed into the pbsim long read generator to split them into long reads between 1000 bp and 12000 bp. The simulated long reads and contigs shorter than 1000 bp were merged, resulting in 2,311,975 gene sequences. Positive and negative samples were labeled, and 12*500 samples were extracted to form a batch for the training sample set.

[0057] Training: Set up a PyTorch development environment under Python. Download the following libraries: python==3.7, pytorch==1.12.1, pyyaml==6.0, torchvision==0.13.1, sckit-learn==1.1.2, igraph==0.10.1. Set network parameters: input layer input size = input_size1=input_size2=input_size3=input_size4=input_size5=(,2000), embedding layer C parameters num_embedding=4079, embedding_dim=100. For each branch of the CNN, set in_channels=100, out_channel=64, kernel_size=40, trim=1. For each max pooling layer, set kernel_size=20, stride=20. The Batch Normalization (BN) layer is configured with num_feature=64, the GRU layer with in_channel=64, hidden_size=50, and bidirectional=True, and the output layer with in_channel=100 and out_channel=50. The training parameters are set to bach_size=500, and the optimizer Adam is configured with lr=0.001 and weight_decay=0.0001.

[0058] After 10,000 iterations, the network reaches a good state, and the corresponding parameters are saved for feature extraction.

[0059] Packing

[0060] Download 100 genomes from NCBI (not included in the training set and with less than 50% similarity). Input each genome into pbsim separately, setting the depth (genomes should differ) and length range to obtain simulated third-generation sequencing long reads with ground truth. Combine the simulated long reads from each genome to simulate metagenomic long read data, then feed it into a trained feature representation model to extract features. The obtained features are processed through a clustering layer, initially clustered using a community detection algorithm, resulting in the number of clusters k. Then, k-means is used to determine the k cluster centers as the initial weights for the final clustering layer. Fine-tune the training parameters for the feature representation layer and the final clustering layer, setting batch_size to 3000, using the SGD optimizer with lr = 0.1, momentum = 0.9, and a clustering threshold tol = 0.001. After iteration, the binning results are obtained, assigning each long read to a specific group.

[0061] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the above embodiments do not limit the scope of protection of the present invention in any way, and all technical solutions obtained by equivalent substitution or other means fall within the scope of protection of the present invention. Parts not covered in this invention are the same as or can be implemented using existing technology.

Claims

1. A three-generation metagenomic binning method using self-supervised feature learning, characterized in that The method comprises the following steps: Step 1: generating simulated long reads based on sequenced genomic data; Step 2: sending the long reads into a self-supervised feature representation model for training, and saving the optimal model parameters; Step 3: after the model is trained, sending the third-generation reads into the model to extract features, and after the metagenomic long reads sequence is converted into a feature vector by the feature representation model, inputting the feature vector into a clustering layer for binning; The clustering layer comprises an initialization layer and a final clustering layer, the initialization layer gives the number k of species contained in the metagenomic data, and the k-means is used to give the clustering center point, the number k of species and the clustering center point are used to initialize the final clustering layer, after the final clustering layer is initialized, a pre-trained feature representation model is connected, and the feature representation model and the final clustering layer are trained as a whole, the trained final clustering layer is used for final binning, and directly gives the group to which the long reads belong; the training method of the final clustering layer and the feature representation model as a whole is as follows: the sequenced long reads sequence is sent into the pre-trained feature representation model and the initialized final clustering layer, the final clustering layer gives the probability of each long reads sequence belonging to each group according to the auxiliary target distribution, that is, the soft label, and the long reads are attributed to the group with the maximum probability; the clustering center point of the final clustering layer and the parameters of the feature representation model are repeatedly fine-tuned until the iteration period or the clustering change is less than the set threshold; the loss function calculation formula of the feature representation model and the final clustering layer as a whole is as follows: , Where, q ij Let p be the soft label, and let p be the probability that read i is assigned to group j. ij To assist in target distribution; the soft label calculation formula is as follows: , z i is a feature, u j is a cluster center point, is a constant; the auxiliary target distribution calculation formula is as follows: , where f j = is the frequency of soft clustering.

2. The method of claim 1, wherein, The step one, set the genome has N data, each with X i , i = 1...N; X i , is processed by reads simulation software pbsim i,j , to generate long reads, each long reads with R i,j , j = 1...M; each long reads is cut into 5 non-intersecting length 2005bp fragments, for less than 10025bp long reads, fill character "N", for more than 10025bp long reads, cut off; for the 5 cut fragments of reads R i,j,1 , i,j,2 , i,j,3 , i,j,4 , i,j,5 .

3. The method of claim 1, wherein, The self-supervised feature representation model comprises an input branch, an embedding layer, a convolution layer, a maximum pooling layer, a fusion layer, a BN layer, a GRU layer and a full connection layer.

4. The method of claim 2 or 3, wherein, The self-supervised feature representation model has 5 input branches, respectively processing R i,j,1 i,j,2 i,j,3 i,j,4 i,j,5 The dimension of each input branch is 1x2000, R i,j,t 6mers are taken with a sliding window length of 6 before inputting and one-hot encoding index is established to convert into a 1x2000-dimensional vector.​​​​ 5. The method of claim 3, wherein, The input branch is connected to the only one embedding layer of the model, and the dimension of the embedding layer is 4097x100; after the embedding layer, one-dimensional convolution layers with five branches are arranged, each branch has 100 input channels, 64 output channels, and a filter shape of 40x40 with a step of 1; then one-dimensional maximum pooling layers with five branches are arranged, and the pooling kernel shape of each branch is 20x20 with a step of 1; the outputs of the five branches are spliced in the fusion layer, standardized by the BN layer, and fused features are obtained by the bidirectional GRU with an attention mechanism and a hidden layer of 50, and after the GRU layer, a 1x100-dimensional full connection layer is arranged to further extract features.

6. The method of claim 3 or 5, wherein, The feature vector output by the full connection layer has the following properties: the Euclidean distance between the feature vectors belonging to the same group is as small as possible, and the Euclidean distance between the feature vectors belonging to different groups is as large as possible; that is, the Euclidean distance is used as a measure of the similarity between the feature vectors, and the higher the similarity, the smaller the Euclidean distance; here, the following loss function is used to optimize the feature learning model: , where z i , z j are the features extracted by the feature learning model, Y indicates whether the two long reads are in the same group, 1 if yes, otherwise 0, d is the Euclidean distance of z i , z j , and m is the set safety distance.

7. The method of claim 1, wherein, In the training of the self-supervised feature representation model, first, the input data and the label are constructed, R i,j One context long read, 6 long reads of the same group are selected from the row where the long read is located, the context long read and the long read of the same group cross to form 6 pairs of input samples, which are marked as positive samples; 6 long reads of different groups are selected from the row other than the long read, the context long read and the long read of the same group cross to form 6 pairs of input samples, which are marked as negative samples; one context long read forms 12 pairs of positive and negative samples, a total of 12*500 groups are extracted from all rows to form a batch of training sample set, the training sample set is sent into the self-supervised feature representation model for training, and the parameters are obtained through gradient descent method by iteration of the back propagation algorithm.

Citation Information

Patent Citations

  • Metagenome contigs classification method based on self-supervised learning

    CN113393898A

  • Metagenomics binning method and system in combination with prior knowledge of reference library

    CN114664383A