Semi-supervised metagenomic binning method based on twin neural network
The semi-supervised metagenomic binning method based on twin neural networks solves the problems of low annotation accuracy and high noise in SolidBin, improves the accuracy of binning results and information learning capabilities, and achieves higher quality genome binning. .
Patent Information
- Application Number
- CN202210066573.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-20
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2042-01-20
AI Technical Summary
The existing semi-supervised metagenomic binning tool SolidBin has low species annotation accuracy and is difficult to obtain accurate must-link constraints and cannot-link constraints. The data is noisy and it is difficult to learn valuable information from a large amount of input data.
A semi-supervised metagenomic binning method based on twin neural networks is used to segment long contigs into must-link constraints, use species annotation tools to obtain cannot-link constraints, extract k-mer frequency features and abundance features, and combine comparisons Loss function and mean square error loss function are used to learn, and a sparse network is constructed for community detection to obtain binning results.
It improves the accuracy of species annotation, reduces data noise, enhances the accuracy of binning results, and can effectively learn data information under different sample numbers.
Smart Images

Figure CN114400043B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of metagenomics, and in particular relates to a semi-supervised metagenomic binning method based on twin neural networks. Background Art
[0002] Metagenomic sequencing technology can be used to obtain the genome of microorganisms without culturing them, so it has been widely used in the study of environmental microorganisms. Many studies have used metagenomic sequencing technology to reconstruct a large number of genomes (MAGs) from samples such as humans, animals, and the environment. The standard metagenomic analysis process is to first use an assembly tool to assemble the short read fragments (reads) obtained from metagenomic sequencing into long read fragments (contigs), and then use a binning tool (Binning) to cluster the contigs into bins, assuming that each bin contains only sequences from a single genome.
[0003] Metagenome binning algorithms can be divided into two categories, depending on whether the algorithm relies on a reference genome. Algorithms that rely on a reference genome can only find genomes that exist in the reference genome, that is, known species, which means that such methods cannot discover new species. Methods that do not rely on a reference genome are completely unsupervised algorithms, so such methods can discover new species.
[0004] At present, mainstream metagenomic binning tools are all methods that do not rely on reference genomes, such as Metabat2, Maxbin2, VAMB and COCACOLA. SolidBin is currently the only semi-supervised metagenomic binning tool. This method has two problems. First, the accuracy of species annotation is low, and it is difficult to obtain accurate must-link constraints and cannot-link constraints, especially must-link constraints, and there will be a lot of noise in the data; second, semi-supervised spectral clustering is difficult to learn valuable information from a large amount of input data. Therefore, a new binning method is needed to reduce data noise while improving the accuracy of binning results. Summary of the invention
[0005] The purpose of the present invention is to provide a semi-supervised metagenome binning method based on a twin neural network to solve the problems in the background technology.
[0006] The purpose of the present invention can be achieved by the following technical solution: A semi-supervised metagenome binning method based on a twin neural network comprises the following steps:
[0007] Step 1: Input and split the longer contig, consider the two separated short sequences as a must-link pair, or obtain must-link constraints by splitting different contig positions;
[0008] Use species annotation tools or databases to perform species annotation, consider the contigs annotated to different species and genera as a cannot-link pair, and obtain cannot-link constraints.
[0009] Step 2: Extract k-mer frequency features and abundance features, set k = 4, that is, the k-mer frequency feature is defined as the frequency of 4-mer fragments appearing in a contig, and 4-mer is a short sequence fragment consisting of four bases similar to ATCG;
[0010] Assume that the number of times a certain 4-mer fragment appears on a contig is k. i , then the k-mer frequency feature (k′ i ) is defined as:
[0011]
[0012] The abundance feature is defined as the average number of reads mapped to a certain position on the contig; if the number of samples used in the binning process is ≥5, the software will make the abundance feature and the k-mer frequency feature at the same order of magnitude to facilitate subsequent training; if the number of samples used is <5, it is assumed that the number of reads mapped to each position on the contig follows a Gaussian distribution on the entire contig, and then the KL divergence is used to calculate the similarity between the Gaussian distributions as the similarity between contigs, and the final abundance feature is obtained by combining the information of the existing reference genome.
[0013] Step 3: Use the twin neural network model to learn from the input must-link constraints and cannot-link constraints;
[0014] The twin neural network model uses a contrastive loss function for learning. The feature representation distance in the must-link constraint is close, while the feature representation distance in the cannot-link constraint is far. In order to ensure the characteristics of the original input features themselves and not be affected by the noise in the data, a mean square error loss function is added to reconstruct the input so that the representation features can contain the input information.
[0015] The contrastive loss function is as follows:
[0016]
[0017] Among them, Mx Indicates a must-link constraint, C x Indicates a cannot-link constraint, (x 1 , x 2 ) represents the input data, d(x 1 , x 2 ) means (x 1 , x 2 );y represents the Euclidean distance between (x 1 , x 2 ) in the indicator variable, if (x 1 , x 2 )∈M x , then the value is 1 if (x 1 , x 2 )∈C x , then the value is 0;
[0018] The mean square error loss function is as follows:
[0019]
[0020] Where x represents input data and x′ represents output data.
[0021] Step 4: If the number of samples used is ≥ 5, and the input of the twin neural network is the k-mer frequency feature and abundance feature, the Euclidean distance of the feature representation of the twin network can be directly calculated as the similarity between contigs;
[0022] If the number of samples used is less than 5 and the input of the twin neural network is only the k-mer frequency feature, only the Euclidean distance represented by the k-mer frequency feature is calculated. Then, it is assumed that the number of reads aligned to each position on the contig follows a Gaussian distribution on the entire contig. The KL divergence is used to calculate the similarity between the Gaussian distributions as the similarity between contigs. Combined with the information of the existing reference genome, the final similarity between contigs is obtained.
[0023] Step 5: After calculating the similarity between contigs, treat each contig as a node, and then use the similarity between contigs as the weight of the node. For each contig, only the 200 edges with the largest weight are considered to construct a sparse network. Use the community detection algorithm for clustering to obtain the binning results from the sparse network.
[0024] Furthermore, the model training in step 3 uses the Adam optimizer, a batch size of 2048, and training for 20 epochs; after the training is completed, the new feature representation obtained will be used in the subsequent clustering steps.
[0025] Furthermore, the community detection algorithm is any one of Infomap, GN, louvain and label propagation algorithm.
[0026] Beneficial effects of the present invention:
[0027] This semi-supervised metagenomic binning method based on twin neural networks proposes a new method for generating must-link constraints and cannot-link constraints. By adding a mean square error loss function to explain the noise in the data, it is beneficial to improve the accuracy of species annotation. The use of twin neural networks to process must-link constraints and cannot-link constraints improves the binning results, and proposes a method for calculating the similarity of different contigs under different sample numbers, which facilitates learning valuable information from a large amount of input data. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The present invention will be further described below in conjunction with the accompanying drawings.
[0029] Figure 1 is a flow chart of a semi-supervised metagenome binning method based on a twin neural network of the present invention;
[0030] Figure 2 This is a comparison chart of the binning results in Example 3. DETAILED DESCRIPTION
[0031] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0032] Example 1
[0033] See also Figure 1 , a semi-supervised metagenomic binning method based on twin neural networks, including the following steps:
[0034] Step 1: Split the longer contig and consider the two separated short sequences as a must-link pair to obtain the must-link constraint;
[0035] Use the GTDB reference database for species annotation, consider the contigs annotated to different species and genera as a cannot-link pair, and obtain the cannot-link constraint;
[0036] Step 2: Set k = 4, that is, the k-mer frequency feature is defined as the frequency of 4-mer fragments appearing in a contig, and 4-mer is a short sequence fragment similar to four bases;
[0037] Assume that the number of times a certain 4-mer fragment appears on a contig is k. i , then the k-mer frequency feature is defined as:
[0038]
[0039] The abundance feature is defined as the average number of reads mapped to a certain position on the contig; if the number of samples used in the binning process is ≥5, the software will make the abundance feature and the k-mer frequency feature at the same order of magnitude to facilitate subsequent training; if the number of samples used is <5, it is assumed that the number of reads mapped to each position on the contig follows a Gaussian distribution on the entire contig, and then the KL divergence is used to calculate the similarity between Gaussian distributions as the similarity between contigs, and the final abundance feature is obtained by combining the information of the existing reference genome;
[0040] Step 3: Use the twin neural network model to learn from the input must-link constraints and cannot-link constraints; the twin neural network is a classic framework in contrastive learning. It is a neural network with two contributing weights. The purpose of learning is to learn a new mapping so that samples in the same class are close to each other and samples in different classes are far apart;
[0041] The twin neural network model uses the contrast loss function to learn features that make the distance between must-link features closer and that between cannot-link features farther away. In order to preserve the characteristics of the original input features as much as possible and not be affected by noise in the data, a mean square error loss function is added to reconstruct the input so that the representation features can contain as much information as possible about the input.
[0042] The contrastive loss function is as follows:
[0043]
[0044] Among them, M x Indicates a must-link constraint, C x Indicates a cannot-link constraint, (x 1 , x 2 ) represents the input data, d(x 1 , x 2 ) means (x 1 , x 2);y represents the Euclidean distance between (x 1 , x 2 ) in the indicator variable, if (x 1 , x 2 )∈M x , then the value is 1 if (x 1 , x 2 )∈C x , the value is 0.
[0045] The mean square error loss function is as follows:
[0046]
[0047] Where x represents input data, and x′ represents output data;
[0048] The model was trained using the Adam optimizer, a batch size of 2048, and 20 epochs. After training, the new feature representations were used for subsequent clustering steps.
[0049] Step 4: Calculate the abundance similarity. The specific method is as follows: if the number of samples used is ≥ 5, the input of the twin neural network is the k-mer frequency feature and the abundance feature, so the Euclidean distance of the feature representation of the twin network can be directly calculated as the similarity between contigs;
[0050] If the number of samples used is less than 5, the input of the twin neural network is only the k-mer frequency feature, and then only the Euclidean distance represented by the k-mer frequency feature is calculated. It is assumed that the number of reads aligned to each position on the contig follows a Gaussian distribution on the entire contig, and then the KL divergence is used to calculate the similarity between the Gaussian distributions, combined with the information of the existing reference genome, to obtain the final similarity between the contigs;
[0051] Step 5: After calculating the similarity between contigs, treat each contig as a node, and then use the similarity between contigs as the weight of the node. For each contig, only the 200 edges with the largest weight are considered to construct a sparse network. Use the Infomap community detection algorithm for clustering to obtain the binning results from the sparse network.
[0052] Example 2
[0053] See also Figure 1 , a semi-supervised metagenomic binning method based on twin neural networks, including the following steps:
[0054] Step 1: Split different contig positions to obtain must-link constraints;
[0055] Use the GTDB reference database for species annotation, consider the contigs annotated to different species and genera as a cannot-link pair, and obtain the cannot-link constraint;
[0056] Step 2: Set k = 4, that is, the k-mer frequency feature is defined as the frequency of 4-mer fragments appearing in a contig, and 4-mer is a short sequence fragment similar to four bases;
[0057] Assume that the number of times a certain 4-mer fragment appears on a contig is k. i , then the k-mer frequency feature is defined as:
[0058]
[0059] The abundance feature is defined as the average number of reads mapped to a certain position on the contig; if the number of samples used in the binning process is ≥5, the software will make the abundance feature and the k-mer frequency feature at the same order of magnitude to facilitate subsequent training; if the number of samples used is <5, it is assumed that the number of reads mapped to each position on the contig follows a Gaussian distribution on the entire contig, and then the KL divergence is used to calculate the similarity between Gaussian distributions as the similarity between contigs, and the final abundance feature is obtained by combining the information of the existing reference genome;
[0060] Step 3: Use the twin neural network model to learn from the input must-link constraints and cannot-link constraints; the twin neural network is a classic framework in contrastive learning. It is a neural network with two contributing weights. The purpose of learning is to learn a new mapping so that samples in the same class are close to each other and samples in different classes are far apart;
[0061] The twin neural network model uses the contrast loss function to learn features that make the distance between must-link features closer and that between cannot-link features farther away. In order to preserve the characteristics of the original input features as much as possible and not be affected by noise in the data, a mean square error loss function is added to reconstruct the input so that the representation features can contain as much information as possible about the input.
[0062] The contrastive loss function is as follows:
[0063]
[0064] Among them, M x Indicates a must-link constraint, Cx Indicates a cannot-link constraint, (x 1 , x 2 ) represents the input data, d(x 1 , x 2 ) means (x 1 , x 2 );y represents the Euclidean distance between (x 1 , x 2 ) in the indicator variable, if (x 1 , x 2 )∈M x , then the value is 1 if (x 1 , x 2 )∈C x , the value is 0.
[0065] The mean square error loss function is as follows:
[0066]
[0067] Where x represents input data, and x′ represents output data;
[0068] The model training uses the Adam optimizer, a batch size of 2048, and 20 epochs. After the training, the new feature representation obtained will be used in the subsequent clustering steps;
[0069] Step 4: Calculate the abundance similarity. The specific method is as follows: if the number of samples used is ≥ 5, the input of the twin neural network is the k-mer frequency feature and the abundance feature, so the Euclidean distance of the feature representation of the twin network can be directly calculated as the similarity between contigs;
[0070] If the number of samples used is less than 5, the input of the twin neural network is only the k-mer frequency feature, and then only the Euclidean distance represented by the k-mer frequency feature is calculated. It is assumed that the number of reads aligned to each position on the contig follows a Gaussian distribution on the entire contig, and then the KL divergence is used to calculate the similarity between the Gaussian distributions, combined with the information of the existing reference genome, to obtain the final similarity between the contigs;
[0071] Step 5: After calculating the similarity between contigs, treat each contig as a node, and then use the similarity between contigs as the weight of the node. For each contig, only the 200 edges with the largest weight are considered to construct a sparse network. Use the Infomap community detection algorithm for clustering to obtain the binning results from the sparse network.
[0072] Example 3
[0073] The CAMI I and CAMI II datasets from the Toy Human Microbiome Project Dataset were selected. The CAMI I dataset includes different numbers of microorganisms, including low complexity (40 genomes, 1 sample), medium complexity (132 genes, 2 samples) and high complexity (596 genes, 5 samples); the CAMI I dataset simulates different human body parts and includes multiple simulated metagenomes from the same environment.
[0074] The data were processed according to the method in Example 1, and the semi-supervised metagenome binning method based on the twin neural network (marked as a) was compared with the method without using the twin neural network learning (marked as b). The results showed that the semi-supervised metagenome binning method based on the twin neural network can reconstruct more high-quality genomes and perform better in more complex environments (see Figure 2 shown).
[0075] It should be noted that, in this article, terms such as "comprises", "includes" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or apparatus that includes 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 apparatus.
[0076] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A semi-supervised metagenome binning method based on twin neural networks, characterized in that: The steps include: Step 1: Obtain must-link constraints through contigs; perform species annotation, and use contigs annotated to different species and genera as a cannot-link pair to obtain cannot-link constraints; Step 2: Extract the k-mer frequency and abundance features of each contig; Step 3: Use the mean square error loss function to reconstruct the must-link constraint and cannot-link constraint, and input them into the twin neural network model using the contrast loss function for learning; Step 4: Calculate the similarity between contigs, construct a sparse network, and then use the community detection algorithm for clustering to obtain the binning results from the sparse network; In step 2, the abundance feature is defined as the average number of reads mapped to a certain position on the contig. When the number of samples used in the binning process is ≥5, the software makes the abundance feature and the k-mer frequency feature at the same order of magnitude. When the number of samples is <5, it is assumed that the number of reads mapped to each position on the contig follows a Gaussian distribution on the entire contig. Then, the KL divergence is used to calculate the similarity between Gaussian distributions as the similarity between contigs, and the final abundance feature is obtained by combining the information of the existing reference genome. The specific method for calculating the similarity between contigs is as follows: when the number of samples used is ≥5, the input of the twin neural network is the k-mer frequency feature and the abundance feature, and the Euclidean distance of the feature representation of the twin network is directly calculated to obtain the similarity between contigs; When the number of samples is less than 5, the input of the twin neural network is only the k-mer frequency feature, and only the Euclidean distance represented by the k-mer frequency feature is calculated. Then, assuming that the number of reads aligned to each position on the contig follows a Gaussian distribution on the entire contig, the KL divergence is used to calculate the similarity between the Gaussian distributions, and the final similarity between contigs is obtained by combining the information of the existing reference genome.
2. The semi-supervised metagenome binning method based on twin neural networks according to claim 1, characterized in that: Contrastive loss function L Con As shown below: Mean square error loss function L MSE As shown below: In the contrast loss function, M x Indicates a must-link constraint, C x represents the cannot-link constraint. In the mean square error loss function, x represents the input data, x′ represents the output data, (x1, x2) represents the input data, d(x1, x2) represents the Euclidean distance between (x1, x2), and y represents the indicator variable in (x1, x2). If (x1, x2)∈M x , then the value is 1 if (x1, x2)∈C x , the value is 0.
