A multimodal attention deep learning method for enhancing virus identification in metagenomic data

By employing a multimodal attention deep learning approach, combining graph attention networks, autoencoders, convolutional long short-term memory networks, and Transformer models, the accuracy and efficiency issues of virus identification in metagenomic data were addressed, achieving more efficient virus sequence identification.

CN118918954BActive Publication Date: 2026-05-15HARBIN INST OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411025662.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2026-05-15
Estimated Expiration
2044-07-30

AI Technical Summary

Technical Problem

Existing methods based on alignment, genes, and k-mer have problems such as long execution time, high memory consumption, poor performance, or insufficient accuracy when identifying viruses in metagenomic data. Deep learning methods still need improvement when processing short viral sequences.

Method used

A multimodal attention deep learning approach is adopted, combining graph attention networks, autoencoders, convolutional long short-term memory networks, and Transformer models. Through dynamic feature fusion and self-attention mechanisms, the contribution weights of each path are adaptively adjusted, hyperparameters and training strategies are optimized, and the ability to identify virus sequences is improved.

Benefits of technology

It improves the accuracy and robustness of virus sequence identification, enhances the model's comprehensive understanding of virus sequences, and improves the accuracy of feature fusion and model performance through the combination of multiple deep learning model paths.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118918954B_ABST
    Figure CN118918954B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of data processing, and discloses a multi-modal attention deep learning method for enhancing virus identification in metagenomic data, which comprises five main steps of data preprocessing, sequence embedding, multi-modal feature extraction, dynamic feature fusion and prediction, and hyperparameter optimization and training; through four model paths of GAT, a self-encoder, a convolutional long short-term memory network and a Transformer, the graph structure features, the latent features, the space-time features and the global features of sequences are respectively extracted, the self-attention mechanism is introduced, the contribution weights of the paths are adaptively adjusted according to the features of the input sequences, the sequence embedding is carried out by using the GAT and the self-encoder, the long-distance dependence relationship and the latent features are captured, the space-time and global features are extracted by using the ConvLSTM and the Transformer model paths, and the hyperparameter optimization and the training strategy optimization are carried out; the application improves the virus sequence identification capability, improves the feature fusion accuracy, and further improves the performance and the robustness of the model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, specifically to a multimodal attention deep learning method for enhancing virus identification in metagenomic data. Background Technology

[0002] Viruses are among the most common and abundant biological entities on Earth, playing a crucial role in the function of microbial communities, such as regulating bacterial populations and influencing host metabolism. Many viruses can cause serious diseases, and their frequency and infectivity pose a significant threat to human health. In recent years, with the development of next-generation sequencing (NGS) technology and advanced computing techniques, scientists have been able to identify viruses in large metagenomic datasets. Unlike traditional methods of isolating viruses through laboratory culture, NGS technology can efficiently sequence all types of genetic material in a microbial community, regardless of its culturability, thus revealing the true viral diversity of the sample. Furthermore, NGS studies on human enteroviruses have revealed important links between viruses and human diseases such as inflammatory bowel disease (IBD), severe acute malnutrition (SAM), and type II diabetes. Identifying viral sequences from metagenomic samples is the first critical step in all downstream viral analyses. Several methods have been developed to address the problem of virus identification in metagenomic samples. However, identifying viral sequences from metagenomic samples remains a challenging task because viruses constitute a small proportion of the metagenomic genome and have a high mutation rate.

[0003] To accurately identify viral sequences in metagenomics, researchers have proposed various methods, primarily including alignment-based, gene-based, k-mer-based, and deep learning-based approaches. Alignment-based methods, such as ProViDE, Metavir, and DIAMOND, identify viral sequences by matching the similarity between the query sequence and a known viral reference genome. However, these methods suffer from long execution times and high memory consumption during database construction and sequence mapping. Gene-based methods identify viral sequences by comparing genes in the query sequence with a viral gene database, but they perform poorly when predicting short sequences. k-mer-based methods utilize k-mer frequencies as sequence features and can identify short viral sequences, but their overall performance is low when identifying short viral sequences. With the significant success of deep learning methods in recent years, several deep learning-based methods have been proposed. For virus identification from metagenomics, Long Short-Term Memory (LSTM) networks and Convolutional Neural Networks (CNNs) are the most commonly used models, such as DeepVirFinder, ViraMiner, and PPR-Meta. Utilizing different deep learning neural networks, more high-level features can be learned from the sequences, improving the detection performance of short viral sequences. However, these methods still have accuracy issues when processing short sequences. To further improve the performance of identifying short viral sequences from metagenomic data, this application proposes a multimodal attention deep learning method (VirIDNet) for enhancing virus identification in metagenomic data.

[0004] Application content

[0005] The purpose of this application is to provide a multimodal attention deep learning method for enhancing virus identification in metagenomic data. This method combines multiple deep learning model paths, improves the ability to identify viral sequences, and improves the accuracy of feature fusion by adaptively adjusting the contribution weights of each path through dynamic feature fusion and self-attention mechanism. Furthermore, it enhances the performance and robustness of the model by utilizing hyperparameter tuning and training strategy optimization.

[0006] To achieve the above objectives, the present invention adopts the following technical solution:

[0007] The present invention provides a multimodal attention deep learning method for enhancing virus identification in metagenomic data, comprising the following steps:

[0008] S1. Extract a training dataset containing viral and host sequences from a genome database;

[0009] S2. Perform one-hot encoding and segmentation on all viral and host sequences;

[0010] S3. Construct the graph structure of the 3-mer fragments of each sequence, calculate the weight of each node, and obtain the graph structure features of the sequence;

[0011] S4. The input sequence is mapped to a low-dimensional latent space by the encoder, and then the original sequence is reconstructed by the decoder to obtain the latent features of the sequence.

[0012] S5. Align and stitch together the graph structure features and latent features;

[0013] S6. The structural features and latent features of the spliced ​​and aligned structures are fused to obtain the fused features;

[0014] S7. The fused features are processed by a convolutional long short-term memory network to obtain the spatiotemporal features of the sequence;

[0015] S8. The fused features are processed using the Transformer model to obtain the global features of the sequence;

[0016] S9. Combine the spatiotemporal features and the global features;

[0017] S10. By dynamically adjusting the contribution weights of spatiotemporal features and global features, the spliced ​​spatiotemporal features and global features are fused.

[0018] S11. The fused features are processed through several fully connected layers;

[0019] S12. Input the fused features processed by several fully connected layers into the Softmax layer to generate prediction results;

[0020] S13. Perform comprehensive optimization of the key hyperparameters from steps S3 to S12 using Bayesian optimization with Keras Tuner.

[0021] S14. Reduce the sensitivity of steps S3 to S12 to training data noise by using a hybrid loss function and label smoothing algorithm;

[0022] S15. Train steps S3 to S12 using the optimal hyperparameter configuration.

[0023] Furthermore, step S3 includes: each sequence's 3-mer segment is a node, and the co-occurrence relationship between segments is an edge;

[0024] By introducing an attention mechanism, for each node i, the attention weight α between it and its neighbor node j is calculated using Equation 1. ij :

[0025]

[0026] Where W is the weight matrix, It is an attention vector. It is the set of neighbors of node i, representing the join operation;

[0027] The calculated attention weight α ij The feature representation of weighted neighbor node j is used to update the feature representation h′ of node i using Equation 2. i :

[0028]

[0029] Where σ is the activation function.

[0030] Furthermore, step S4 includes the encoder converting the input sequence X into a low-dimensional representation z using Equation 3:

[0031] z=σ(W e X+b e ), Formula 3;

[0032] Among them, W e It is the encoder's weight matrix, b e σ is the bias term, and σ is the activation function;

[0033] The decoder reconstructs the input sequence from the feature vector z using Equation 4.

[0034]

[0035] Among them, W d It is the weight matrix of the decoder, b d It is a bias term;

[0036] The autoencoder is trained by minimizing the reconstruction error using Equation 5:

[0037]

[0038] Where N is the number of samples.

[0039] Furthermore, step S5 includes aligning the graph structure features and latent features using linear transformations via Equations 6 and 7:

[0040] Z′ GAT =W GAT Z GAT +b GAT , Formula 6;

[0041] Z′ Autencoder =W Autoencoder Z Autoender +b Autoencoder , Formula 7;

[0042] Among them, W GA T and WAutoencoder It is the weight matrix of the linear transformation, b GA T and b Autoencoder It is a bias term.

[0043] Furthermore, step 6 includes fusing the aligned graph structure features and latent features using formula 8 to obtain a high-dimensional feature vector Z. fusion :

[0044] Z fusion =Concat(Z′) GAT Z′ Autoencode ), formula 8;

[0045] Using a self-attention mechanism, the high-dimensional feature vector is processed through Equations 9 and 10:

[0046] O attention =Attention(Z) fusion ), Formula 9;

[0047]

[0048] Where Q, K, and V represent the query matrix, key matrix, and value matrix, respectively, and d k The dimension of the key.

[0049] Furthermore, step S7 includes inputting the fused features into formula 11 and performing a series of convolution operations to extract the local spatial features of the sequence:

[0050] O conv =ReLU(W conv *X+b conv ), Formula 11;

[0051] Where * represents the convolution operation, W conv and b conv These are the weights and biases of the convolutional layer, respectively, and ReLU is the activation function.

[0052] The extracted spatial features are input into the LSTM unit to process temporal information, including controlling the amount of input information through the input gate in Equation 12:

[0053]

[0054] Where σ is the sigmoid activation function, W xi W hi and W ci X is the weight matrix of the input gate. t It is the input at the current moment, H t-1 It is the hidden state from the previous moment, C t-1 It represents the cell state at the previous moment, bi It is a bias term. Represents the Hadamard product;

[0055] Using Equations 13 and 14, the forget gate determines how much of the previous state is forgotten:

[0056]

[0057] Formula 15 determines how much of the previous state is forgotten:

[0058]

[0059] The final hidden state is Equation 16:

[0060]

[0061] Further, step S8 includes calculating the attention score among the query matrix, key matrix, and value matrix using Equation 17 to generate a feature representation containing global dependencies:

[0062]

[0063] Where Q, K, and V represent the query matrix, key matrix, and value matrix, respectively, and d k The dimension of the key;

[0064] The feedforward neural network processes the attention output through a linear transformation and activation function as shown in Equation 18:

[0065] FFN(x) = max(0, xW1+b1)W2+b2, Formula 18;

[0066] Where W1 and W2 are the weight matrices of the feedforward neural network, b1 and b2 are the bias terms, and max(0, x) represents the ReLU activation function;

[0067] Layer normalization and residual connections are performed using Equations 19 and 20 to stabilize the training process and improve model performance.

[0068] LayerNorm(x+Attention(Q, K, V)), Equation 19;

[0069] LayerNorm(x+FFN(x)), Formula 20;

[0070] LayerNorm represents the layer normalization operation.

[0071] Furthermore, step S9 includes: concatenating the spatiotemporal features with the global features using formula 21 to obtain the high-dimensional feature vector Z:

[0072] Z = Concat(H) ConvLSTM H Transformer ), Formula 21;

[0073] Step S10 includes performing self-attention calculation on the high-dimensional feature vector, dynamically adjusting the contribution weights of each path using formula 22, and fusing spatiotemporal features with global features:

[0074] O attention =Attention(Z), Formula 22;

[0075] Step S11 includes further processing the feature vector output by the self-attention mechanism through several fully connected layers using Equation 23:

[0076] O fusion =Dense(O attetion ), Formula 23;

[0077] Step S12 includes generating prediction results using the Softmax layer of Formula 24:

[0078]

[0079] Further, step 13 includes: defining the hyperparameter search space, including the hidden layer size of the ConvLSTM ranging from 50 to 150, with a stride of 10; the number of convolutional filters ranging from 16 to 64 for the first layer, with a stride of 16; from 32 to 128 for the second layer, with a stride of 32; and from 64 to 256 for the third layer, with a stride of 64; the dropout rate ranging from 0.3 to 0.5, with a stride of 0.1; and the learning rate ranging from 0.001 to 0.01, using a logarithmic scale for the search.

[0080] By iteratively searching multiple times, the accuracy of the validation set is optimized to obtain the optimal hyperparameter configuration;

[0081] Step 14 includes enhancing the model's ability to distinguish sequence features using the mixture loss function in Equation 25:

[0082] L custom =αL cross_enttopy +(1-α)L contrastive , Formula 25;

[0083] Among them, L cross_entropy L represents the cross-entropy loss. contrastive This represents the contrast loss, where α is the weighting coefficient.

[0084] Classification is performed using cross-entropy, formula 26:

[0085]

[0086] The similarity between samples is compared using Formula 27 to measure the loss:

[0087]

[0088] Where, d i This represents the Euclidean distance between samples, where m is the boundary threshold, and y... i For tags;

[0089] Combining the two can improve the model's discriminative ability;

[0090] The target labels are adjusted using the label smoothing algorithm in Formula 28 to reduce the model's sensitivity to noise in the training data.

[0091]

[0092] Among them, g true The original labels are ∈, the smoothing factor is K, and the number of categories is K.

[0093] The target label was adjusted from 0 and 1 to a value between 0 and 1.

[0094] Furthermore, step S15 includes optimizing the model using mini-batch stochastic gradient descent, combined with a custom hybrid loss function and label smoothing technique to further improve the robustness and accuracy of the model; monitoring the loss and accuracy of the validation set and preventing overfitting through an early stopping strategy; and terminating training early when the performance of the validation set no longer improves.

[0095] Compared with the prior art, the beneficial effects of this application are:

[0096] This application combines four model paths: Graph Attention Network (GAT), Autoencoder, Convolutional Long Short-Term Memory (ConvLSTM), and Transformer, to extract graph structure features, latent features, spatiotemporal features, and global features of sequences, providing a more comprehensive and detailed feature representation. By introducing a self-attention mechanism, the model can adaptively adjust the contribution weights of each path according to the features of the input sequence, thereby improving the accuracy of feature fusion. In the sequence embedding stage, GAT and autoencoder are used for sequence embedding to capture long-distance dependencies and latent features, making the embedding representation richer and more accurate. In the multimodal feature extraction stage, ConvLSTM and Transformer model paths are used to extract spatiotemporal and global features, enhancing the model's comprehensive understanding of sequences. Hyperparameter tuning and training strategy optimization further improve the model's performance and robustness. This application combines multiple deep learning model paths to improve the ability to identify virus sequences. Through dynamic feature fusion and self-attention mechanisms, the contribution weights of each path are adaptively adjusted to improve the accuracy of feature fusion. Hyperparameter tuning and training strategy optimization further improve the model's performance and robustness. Attached Figure Description

[0097] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained from these drawings without creative effort.

[0098] Figure 1 This is a flowchart of the method in this application;

[0099] Figure 2 This is a flowchart of steps S3 to S12 of this application;

[0100] Figure 3 This is a summary table of the datasets used in this application;

[0101] Figure 4 This is a comparison chart of experimental results using the method of this application and existing methods on the CAMI dataset;

[0102] Figure 5 This is a comparison chart of experimental results conducted on the NCBI_RefSeq test set using the method of this application and existing methods;

[0103] Figure 6 This is a comparison chart of experimental results conducted using the method of this application and existing methods on a human gut metagenomic dataset;

[0104] Figure 7 yes Figure 4 The corresponding data table;

[0105] Figure 8 yes Figure 5 The corresponding data table;

[0106] Figure 9 yes Figure 6 The corresponding data table. Detailed Implementation

[0107] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.

[0108] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Therefore, the drawings only show the layers related to the present invention and are not drawn according to the actual number, shape and size of the layers in the actual implementation. In the actual implementation, the form, number and proportion of each layer can be arbitrarily changed, and the layer layout may also be more complex.

[0109] Numerous details are explored in the following description to provide a more thorough explanation of embodiments of the invention; however, it will be apparent to those skilled in the art that embodiments of the invention may be practiced without these specific details.

[0110] Please see Figure 1 and Figure 2 This paper presents a multimodal attention deep learning method for enhancing virus identification in metagenomic data. It employs a multimodal hybrid deep learning model to accurately identify viral sequences from metagenomic data. Its workflow includes five main steps: data preprocessing, sequence embedding, multimodal feature extraction, dynamic feature fusion and prediction, and hyperparameter tuning and training. The steps include:

[0111] S1. Extract a training dataset containing viral and host sequences from a genome database;

[0112] S2. Perform one-hot encoding and segmentation on all viral and host sequences;

[0113] A summary of the datasets used in this application can be found in [link to application]. Figure 3The training and testing datasets contain 9,000 and 1,000 sequences of 500 bp in length, respectively. The CAMI dataset consists of 46 viral sequences and 1,051 host sequences ranging from 100 bp to 500 bp in length. The real human gut metagenomic dataset consists of sequences ranging from 500 bp to 5,000 bp in length.

[0114] Genomic data from VirFinder (a comparative experiment) was collected from the NCBI RefSeq database, containing 1562 viral RefSeq genomes infecting prokaryotes and 4410 prokaryotic host RefSeq genomes. All RefSeq genomes were split into several 500bp non-overlapping fragments to simulate fragmented short metagenomic sequences. Due to personal computer memory limitations, 5000 viral fragments and 5000 host fragments were randomly selected from these fragments. The baseline dataset was then divided into two subsets, containing 9000 fragments and 1000 fragments respectively, with an equal number of viral and host fragments. The subset of 9000 fragments was called the training set, and the subset of 1000 fragments was called the test set.

[0115] To ensure objectivity, VirIDNet was evaluated on the public benchmark dataset CAMI dataset 3CAMI_high. BLAST (Basic Local Alignment Search Tool) was used. These sequences were mapped to viral reference genome sequences using default parameters. 8431 sequences shorter than 500 bp, 7087 sequences between 500-1000 bp, 7915 sequences between 1000-3000 bp, and 12518 sequences longer than 3000 bp were identified as viral sequences. An equal number of non-viral short sequences were also randomly selected from the remaining sequences of each length. These 71902 mixed sequences were then included in a metagenomic dataset for testing.

[0116] To further validate VirIDNet's capabilities, a simple real-world metagenomic dataset was constructed from a real human gut metagenomic sample, with reads from the NCBI Short Read Archive. BLAST processing was performed using default parameters with the CAMI public benchmark dataset, generating 385 viral sequences shorter than 500 bp, 409 sequences between 500 and 1000 bp, 728 sequences between 1000 and 3000 bp, and 915 sequences longer than 3000 bp. Similarly, an equal number of non-viral short sequences of each length were randomly selected from the remaining non-viral sequences. A total of 4,874 mixed sequences were used for testing.

[0117] S3. Construct the graph structure of the 3-mer fragments of each sequence, calculate the weight of each node, and obtain the graph structure features of the sequence;

[0118] S4. The input sequence is mapped to a low-dimensional latent space by the encoder, and then the original sequence is reconstructed by the decoder to obtain the latent features of the sequence.

[0119] S5. Align and stitch together the graph structure features and latent features;

[0120] S6. The structural features and latent features of the spliced ​​and aligned structures are fused to obtain the fused features;

[0121] In the sequence embedding stage, this application utilizes a Graph Attention Network (GAT) and an autoencoder model for sequence embedding. GAT constructs a graph structure of 3-mer segments for each sequence and uses an attention mechanism to calculate the weight of each node, capturing local and global structural information in the sequence. The autoencoder path maps the input sequence to a low-dimensional latent space through an encoder, and then reconstructs the original sequence through a decoder, learning the latent feature representation of the sequence.

[0122] S7. The fused features are processed by a convolutional long short-term memory network to obtain the spatiotemporal features of the sequence;

[0123] S8. The fused features are processed using the Transformer model to obtain the global features of the sequence;

[0124] In the multimodal feature extraction stage, a Convolutional Long Short-Term Memory (ConvLSTM) network and a Transformer model path are combined. ConvLSTM combines the advantages of Convolutional Neural Networks (CNN) and Long Short-Term Memory (LSTM) networks, simultaneously capturing spatial and temporal dependencies in the sequence. The Transformer path employs a multi-head attention mechanism and a feedforward neural network to capture long-distance dependencies by calculating the correlations between positions in the input sequence and generating a global feature representation.

[0125] S9. Combine the spatiotemporal features and the global features;

[0126] S10. By dynamically adjusting the contribution weights of spatiotemporal features and global features, the spliced ​​spatiotemporal features and global features are fused.

[0127] S11. The fused features are processed through several fully connected layers;

[0128] S12. Input the fused features processed by several fully connected layers into the Softmax layer to generate prediction results;

[0129] In the dynamic feature fusion and prediction stage, a self-attention mechanism is used to adaptively adjust the contribution weights of each path based on the features of the input sequence. The feature vectors generated by multimodal feature extraction are concatenated and further processed using the self-attention mechanism to enhance the expressiveness and accuracy of feature fusion. Then, the fused features are processed through several fully connected layers, and finally, a softmax layer is used to generate the prediction result.

[0130] S13. Perform comprehensive optimization of the key hyperparameters from steps S3 to S12 using Bayesian optimization with Keras Tuner.

[0131] S14. Reduce the sensitivity of steps S3 to S12 to training data noise by using a hybrid loss function and label smoothing algorithm;

[0132] To optimize model performance, this application employs Keras Tuner for Bayesian optimization, comprehensively tuning key hyperparameters such as hidden layer size, number of convolutional filters, dropout rate, and learning rate of the ConvLSTM unit. Bayesian optimization effectively explores and utilizes the search space to find the optimal configuration by constructing a surrogate model and maximizing the expected improvement. To enhance the model's ability to distinguish sequence features, this application designs a custom hybrid loss function combining cross-entropy loss and contrastive loss. Label smoothing techniques are applied to reduce the model's sensitivity to noise in the training data.

[0133] S15. Train steps S3 to S12 using the optimal hyperparameter configuration.

[0134] After hyperparameter tuning and loss function design, the VirIDNet model was trained using the optimal hyperparameter configuration. During training, mini-batch stochastic gradient descent (SGD) was employed for optimization, combined with a custom hybrid loss function and label smoothing techniques to further improve the model's robustness and accuracy. The loss and accuracy on the validation set were monitored during training, and an early stopping strategy was used to prevent overfitting. This comprehensive tuning and training strategy ensured efficient model training and optimal performance.

[0135] This application combines four model paths: Graph Attention Network (GAT), Autoencoder, Convolutional Long Short-Term Memory (ConvLSTM), and Transformer, to extract graph structure features, latent features, spatiotemporal features, and global features of sequences, providing a more comprehensive and detailed feature representation. By introducing a self-attention mechanism, the model can adaptively adjust the contribution weights of each path according to the features of the input sequence, thereby improving the accuracy of feature fusion. In the sequence embedding stage, GAT and autoencoder are used for sequence embedding to capture long-distance dependencies and latent features, making the embedding representation richer and more accurate. In the multimodal feature extraction stage, ConvLSTM and Transformer model paths are used to extract spatiotemporal and global features, enhancing the model's comprehensive understanding of sequences. Hyperparameter tuning and training strategy optimization further improve the model's performance and robustness. This application combines multiple deep learning model paths to improve the ability to identify virus sequences. Through dynamic feature fusion and self-attention mechanisms, the contribution weights of each path are adaptively adjusted to improve the accuracy of feature fusion. Hyperparameter tuning and training strategy optimization further improve the model's performance and robustness.

[0136] Step S3 involves treating each sequence's 3-mer fragment as a node and the co-occurrence relationships between fragments as edges. GAT captures graph structural information between nucleotide fragments by constructing a graph structure of the 3-mer fragments for each sequence. For example, the sequence 'AGCTGATCC' will be segmented into multiple 3-mer fragments: 'AGC GCT CTG TGA GAT ATC TCC'. Each 3-mer fragment is represented as a node in the graph, and the co-occurrence relationships between fragments are represented as edges. For example, if the nodes in the previous example are 'AGC, GCT, CTG, TGA, GAT, ATC, TCC', then the edges of this graph are 'AGC-GCT, GCT-CTG, CTG-TGA, TGA-GAT, GATATC, ATC-TCC'.

[0137] By introducing an attention mechanism, GAT calculates the importance weights of each node with its neighboring nodes, thereby dynamically adjusting the combination of node features. Assuming this application calculates the attention weights of node GCT with its neighbors AGC and CTG, for each node i, the attention weight α with neighboring node j is calculated using Equation 1. ij :

[0138]

[0139] Where W is the weight matrix, It is an attention vector. It is the set of neighbors of node i, representing the join operation;

[0140] The calculated attention weight α ij The feature representation of weighted neighbor node j is used to update the feature representation h′ of node i using Equation 2. i :

[0141]

[0142] Where σ is the activation function, such as ReLU. Assuming the neighbors of node GCT are AGC and CTG, then the updated features of GCT are represented as:

[0143] h′ GCT =σ(α) GCT,AGC Wh AGC +α GCTCTG Wh CTG ),

[0144] In VirIDNet, GAT is set to two layers, with each layer using the LeakyReLU activation function to extract local structural features from the sequence.

[0145] Autoencoders extract useful low-dimensional feature representations from data through unsupervised learning. An autoencoder consists of an encoder and a decoder. The encoder compresses the input sequence into a low-dimensional representation, while the decoder attempts to reconstruct the input sequence. For example, the one-hot encoded representation of the sequence AGCTGATCC is: [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1],[0,1,0,0],[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,1,0]]. In the autoencoder path, the input sequence is first converted into a low-dimensional representation z by the encoder. The above 9 nucleotide sequence is compressed into a 3-dimensional representation z = [z1, z2, z3]. Then, the low-dimensional representation z is reconstructed by the decoder. Step S4 includes the encoder converting the input sequence X into a low-dimensional representation z using Equation 3:

[0146] z=σ(W e X+b e ), Formula 3;

[0147] Among them, W e It is the encoder's weight matrix, b e σ is the bias term, and σ is the activation function, such as ReLU;

[0148] The decoder reconstructs the input sequence from the feature vector z using Equation 4.

[0149]

[0150] Among them, W d It is the weight matrix of the decoder, b d It is a bias term;

[0151] The autoencoder is trained by minimizing the reconstruction error using Equation 5. The commonly used loss function is the mean squared error.

[0152]

[0153] Where N is the number of samples. In this way, the autoencoder can effectively extract useful low-dimensional feature representations from the data, reduce noise, and retain important information.

[0154] As can be seen from the above specific examples, GAT and Autoencoder each have different working methods and advantages, and complement each other. GAT captures local and global dependencies in the sequence through graph structure, while Autoencoder extracts latent features of the sequence through unsupervised learning. The combination of the two can provide the model with a more comprehensive and accurate feature representation, which helps to improve the performance and robustness of virus identification.

[0155] The feature vectors obtained through the GAT path and the Autoencoder path are then concatenated. To ensure that the concatenated feature vectors have the same dimension, a linear transformation can be used to align the features. Step S5 includes aligning the graph structure features and latent features using linear transformations, through Equations 6 and 7:

[0156] Z′ GAT =W GAT Z GAT +b GAT , Formula 6;

[0157] Z′ Autoencodeer =W Autoencoder Z Autoencoder +b Antoencoder , Formula 7;

[0158] Among them, W GAT and W Autoencoder It is the weight matrix of the linear transformation, b GAT and b Autoencoder This is the bias term. In this way, the feature vectors obtained from the two paths can be transformed to the same dimension, which facilitates subsequent processing.

[0159] Step 6 includes fusing the aligned graph structure features and latent features using Equation 8 to obtain the high-dimensional feature vector Z. fusion :

[0160] Z fusion =Concat(Z′)GAT Z′ Autoencoder ), formula 8;

[0161] Using a self-attention mechanism, the high-dimensional feature vector is processed through Equations 9 and 10:

[0162] O attention =Attention(Z) fusion ), Formula 9;

[0163]

[0164] Where Q, K, and V represent the query matrix, key matrix, and value matrix, respectively, and d k The dimension is the key. This method allows for the calculation of correlations between feature vectors and dynamic adjustment of weights, improving the effectiveness of feature fusion.

[0165] Step S7 includes inputting the fused features into Formula 11 and performing a series of convolution operations to extract the local spatial features of the sequence:

[0166] O conv =ReLU(W conv *X+b conv ), Formula 11;

[0167] Where * represents the convolution operation, W conv and b conv These are the weights and biases of the convolutional layer, respectively, and ReLU is the activation function.

[0168] The extracted spatial features are input into an LSTM unit to process temporal information. The LSTM unit controls the information flow through input gates, forget gates, and output gates. This includes controlling the amount of input information through the input gate, as specified in Equation 12.

[0169]

[0170] Where σ is the sigmoid activation function, W xi W hi and W ci X is the weight matrix of the input gate. t It is the input at the current moment, H t-1 It is the hidden state from the previous moment, C t-1 It represents the cell state at the previous moment, b i It is a bias term. Represents the Hadamard product;

[0171] Using Equations 13 and 14, the forget gate determines how much of the previous state is forgotten:

[0172]

[0173] The current cell status is updated as follows:

[0174]

[0175] Formula 15 determines how much of the previous state is forgotten:

[0176]

[0177] The final hidden state is Equation 16:

[0178]

[0179] Through these gating mechanisms, ConvLSTM can effectively capture sequence dependencies while preserving important spatial features, making it suitable for processing complex sequence features in metagenomic data.

[0180] The ConvLSTM path combines the advantages of convolutional neural networks (CNN) and long short-term memory networks (LSTM) to capture both spatial and temporal dependencies in sequences, thus effectively processing sequence data with spatial characteristics.

[0181] Step S8 includes calculating the attention score among the query matrix, key matrix, and value matrix using Equation 17 to generate a feature representation containing global dependencies:

[0182]

[0183] Where Q, K, and V represent the query matrix, key matrix, and value matrix, respectively, and d k The dimension of the key;

[0184] The feedforward neural network processes the attention output through a linear transformation and activation function as shown in Equation 18:

[0185] FFN(x) = max(0, xW1+b1)W2+b2, Formula 18;

[0186] Where W1 and W2 are the weight matrices of the feedforward neural network, b1 and b2 are the bias terms, and max(0, x) represents the ReLU activation function;

[0187] Layer normalization and residual connections are performed using Equations 19 and 20 to stabilize the training process and improve model performance.

[0188] LayerNorm(x+Attention(Q, K, V)), Equation 19;

[0189] LayerNorm(xFFN(x)), Formula 20;

[0190] Among them, LayerNorm represents the layer normalization operation;

[0191] In this application, the Transformer path has four layers, each using eight attention heads, and the hidden layer size of the feedforward neural network is 512. By combining the ConvLSTM and Transformer paths, VirIDNet can simultaneously extract both spatiotemporal and global features of the sequence. During multimodal feature extraction, the ConvLSTM and Transformer paths capture different types of information in the sequence, enabling the model to more comprehensively understand and represent sequence features. This combined approach not only leverages the advantages of ConvLSTM in capturing spatiotemporal dependencies but also utilizes the powerful ability of Transformer in capturing long-range dependencies, thereby improving the model's ability to process complex sequence data and the accuracy of feature representation.

[0192] Step S9 includes: concatenating the spatiotemporal features with the global features using formula 21 to obtain the high-dimensional feature vector Z:

[0193] Z = Concat(H) ConvLSTM H Transformer ), Formula 21;

[0194] Step S10 includes performing self-attention calculation on the high-dimensional feature vector, dynamically adjusting the contribution weights of each path using formula 22, and fusing spatiotemporal features with global features:

[0195] O attention =Attention(Z), Formula 22;

[0196] Step S11 includes further processing the feature vector output by the self-attention mechanism through several fully connected layers using Equation 23:

[0197] O fusion =Dense(O atention ), Formula 23;

[0198] Step S12 includes generating prediction results using the Softmax layer of Formula 24:

[0199]

[0200] By utilizing a self-attention mechanism, the contribution weights of each path are adaptively adjusted based on the features of the input sequence. The feature vectors generated by multimodal feature extraction are concatenated and then further processed through the self-attention mechanism to enhance the expressiveness and accuracy of feature fusion.

[0201] Step 13 includes defining the hyperparameter search space, including the hidden layer size of the ConvLSTM ranging from 50 to 150, with a stride of 10; the number of convolutional filters ranging from 16 to 64 for the first layer, with a stride of 16; from 32 to 128 for the second layer, with a stride of 32; and from 64 to 256 for the third layer, with a stride of 64; the dropout rate ranging from 0.3 to 0.5, with a stride of 0.1; and the learning rate ranging from 0.001 to 0.01, using a logarithmic scale for the search.

[0202] By iteratively searching multiple times, the accuracy of the validation set is optimized to obtain the optimal hyperparameter configuration;

[0203] Step 14 includes enhancing the model's ability to distinguish sequence features using a hybrid loss function based on Equation 25, which combines cross-entropy loss and contrastive loss:

[0204] L custom =αL cross _ entropy +(1-α)L contrasitve , Formula 25;

[0205] Among them, L cross_entropy L represents the cross-entropy loss. contrastive This represents the contrast loss, where α is the weighting coefficient.

[0206] Classification is performed using cross-entropy, formula 26:

[0207]

[0208] The similarity between samples is compared using Formula 27 to measure the loss:

[0209]

[0210] Where, d i This represents the Euclidean distance between samples, where m is the boundary threshold, and y... i For tags;

[0211] Combining the two can improve the model's discriminative ability;

[0212] The target labels are adjusted using the label smoothing algorithm in Formula 28 to reduce the model's sensitivity to noise in the training data.

[0213]

[0214] Among them, y true , where is the original label, ∈ is the smoothing factor, and K is the number of categories;

[0215] The target labels are adjusted from 0 and 1 to values ​​between 0 and 1, such as 0.9 and 0.1. Label smoothing can mitigate overfitting and improve the model's generalization ability.

[0216] Step S15 includes optimizing the model using mini-batch stochastic gradient descent (SGD), combined with a custom mixed loss function and label smoothing techniques to further improve the model's robustness and accuracy; monitoring the loss and accuracy on the validation set, and preventing overfitting through an early stopping strategy; and terminating training early when the validation set performance no longer improves. The optimizer is either the Adam or AdamW optimizer, with the corresponding learning rate set, a batch size of 200, and 20 training epochs.

[0217] To optimize the performance of the VirIDNet model, this application employs KerasTuner for Bayesian optimization, comprehensively tuning the model's key hyperparameters. Bayesian optimization is an efficient global optimization method, particularly suitable for high-dimensional spaces and computationally expensive black-box functions. Compared to traditional grid search and random search, Bayesian optimization can utilize prior knowledge and observational data to construct surrogate models (such as Gaussian processes) and select the next evaluation point by maximizing the expected improvement (EI) of the surrogate model, thereby effectively exploring and utilizing the search space.

[0218] Typically, classifier performance is evaluated by calculating a confusion matrix, which is based on four statistical values: True Positive Rate (TP), False Positive Rate (FP), True Negative Rate (TN), and False Negative Rate (FN). TP represents instances correctly labeled as positive; FP represents negative instances incorrectly labeled as positive; TN represents instances correctly labeled as negative; and FN represents positive instances incorrectly labeled as negative. Based on these four values, higher-level metrics such as True Positive Rate (TPR), False Positive Rate (FPR), Precision, Recall, and F1 Score can also be calculated.

[0219]

[0220] The performance of the proposed model can be evaluated by plotting the receiver operating characteristic (ROC) curve based on the TPR and FPR. The ROC curve is created by plotting the TPR against the FPR at various threshold settings. The area under the ROC curve (AUROC) is used to evaluate predictive performance; a higher AUROC value indicates better performance.

[0221] When dealing with highly imbalanced datasets, the precision-recall (PR) curve provides a more informative performance graph than the ROC curve. The area under the PR curve (AUPRC) is also used to evaluate predictive performance on imbalanced datasets.

[0222] To evaluate the performance of the proposed VirIDNet, experiments were conducted on the CAMI dataset, the NCBI_RefSeq test set, and a real human gut metagenomic dataset, and compared with other state-of-the-art methods (VirSorter, VirFinder, DeepVirFinder, CHEER, and DETIRE). Comparison metrics included recall, accuracy, and F1 score.

[0223] Please see Figures 4 to 9 This application significantly outperforms other methods in terms of recall, accuracy, and F1 score across three datasets. The high recall rate indicates that the proposed VirIDNet is highly sensitive in identifying genuine viral sequences, while the high accuracy and F1 score demonstrate that it accurately classifies viral sequences without generating excessive false positives.

[0224] In the above embodiments, although the invention has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. The embodiments of the invention are intended to cover all such substitutions, modifications, and variations falling within the broad scope of the appended claims.

[0225] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.

Claims

1. A multimodal attention deep learning method for enhancing virus identification in metagenomic data, characterized in that: Includes the following steps: S1. Extract a training dataset containing viral and host sequences from a genome database; S2. Perform one-hot encoding and segmentation on all viral and host sequences; S3. Construct the graph structure of the 3-mer fragments of each sequence, calculate the weight of each node, and obtain the graph structure features of the sequence; S4. The input sequence is mapped to a low-dimensional latent space by the encoder, and then the original sequence is reconstructed by the decoder to obtain the latent features of the sequence. S5. Align and stitch together the graph structure features and latent features; S6. The structural features and latent features of the spliced ​​and aligned structures are fused to obtain the fused features; S7. The fused features are processed by a convolutional long short-term memory network to obtain the spatiotemporal features of the sequence; S8. The fused features are processed using the Transformer model to obtain the global features of the sequence; S9. Combine the spatiotemporal features and the global features; S10. By dynamically adjusting the contribution weights of spatiotemporal features and global features, the spliced ​​spatiotemporal features and global features are fused. S11. The fused features are processed through several fully connected layers; S12. Input the fused features processed by several fully connected layers into the Softmax layer to generate prediction results; S13. Perform comprehensive optimization of the key hyperparameters from steps S3 to S12 using Bayesian optimization with Keras Tuner. S14. Reduce the sensitivity of steps S3 to S12 to training data noise by using a hybrid loss function and label smoothing algorithm; S15. Train steps S3 to S12 using the optimal hyperparameter configuration.

2. The multimodal attention deep learning method for enhancing virus identification in metagenomic data according to claim 1, characterized in that, Step S3 includes: each sequence's 3-mer segment is a node, and the co-occurrence relationship between segments is an edge; By introducing an attention mechanism, for each node i, the attention weight α between it and its neighbor node j is calculated using Equation 1. ij : Where W is the weight matrix, It is an attention vector. It is the set of neighbors of node i, and || represents the join operation; The calculated attention weight α ij The feature representation of weighted neighbor node j is used to update the feature representation h′ of node i using Equation 2. i : Where σ is the activation function.

3. The multimodal attention deep learning method for enhancing virus identification in metagenomic data according to claim 2, characterized in that, Step S4 includes the encoder converting the input sequence X into a low-dimensional representation using Equation 3. z=σ(W e X+b e ), Formula 3; Among them, W e It is the encoder's weight matrix, b e σ is the bias term, and σ is the activation function; The decoder uses Equation 4 to extract the feature vector Reconstructing the input sequence Among them, W d It is the weight matrix of the decoder, b d It is a bias term; The autoencoder is trained by minimizing the reconstruction error using Equation 5: Where N is the number of samples.

4. The multimodal attention deep learning method for enhancing virus identification in metagenomic data according to claim 3, characterized in that, Step S5 includes aligning the graph structure features and latent features using linear transformations via Equations 6 and 7: Z′ GAT =W GAT Z GAT +b GAT , Formula 6; Z′ Autoencoder =W Autoencoer Z Autoencoder +b Autoencoer , Formula 7; Among them, W GAT and W Autoencodr It is the weight matrix of the linear transformation, b GAT and b Auttoenoder It is a bias term.

5. A multimodal attention deep learning method for enhancing virus identification in metagenomic data according to claim 4, characterized in that, Step 6 includes fusing the aligned graph structure features and latent features using Equation 8 to obtain the high-dimensional feature vector Z. fusion : Z fusion = Concat(Z GAT , Z′ Autoencoder ), Equation 8; Using a self-attention mechanism, the high-dimensional feature vector is processed through Equations 9 and 10: O attention =Attention(Z) fusion ), Formula 9; Where Q, K, and V represent the query matrix, key matrix, and value matrix, respectively, and d k The dimension of the key.

6. The multimodal attention deep learning method for enhancing virus identification in metagenomic data according to claim 1, characterized in that, Step S7 includes inputting the fused features into Formula 11 and performing a series of convolution operations to extract the local spatial features of the sequence: O conv =ReLU(W conv *X+b conv ), Formula 11; Where * represents the convolution operation, W conv and b conv These are the weights and biases of the convolutional layer, respectively, and ReLU is the activation function. The extracted spatial features are input into the LSTM unit to process temporal information, including controlling the amount of input information through the input gate in Equation 12: Where σ is the sigmoid activation function, W xi W hi and W ci X is the weight matrix of the input gate. t It is the input at the current moment, H t-1 It is the hidden state from the previous moment, C t-1 It represents the cell state at the previous moment, b i It is a bias term. Represents the Hadamard product; Using Equations 13 and 14, the forget gate determines how much of the previous state is forgotten: Formula 15 determines how much of the previous state is forgotten: The final hidden state is Equation 16:

7. A multimodal attention deep learning method for enhancing virus identification in metagenomic data according to claim 6, characterized in that, Step S8 includes calculating the attention score among the query matrix, key matrix, and value matrix using Equation 17 to generate a feature representation containing global dependencies: Where Q, K, and V represent the query matrix, key matrix, and value matrix, respectively, and d k The dimension of the key; The feedforward neural network processes the attention output through a linear transformation and activation function as shown in Equation 18: FFN(x) = max(0, xW1+b1)W2+b2, Formula 18; Where W1 and W2 are the weight matrices of the feedforward neural network, b1 and b2 are the bias terms, and max(0, x) represents the ReLU activation function; Layer normalization and residual connections are performed using Equations 19 and 20 to stabilize the training process and improve model performance. LayerNorm(x+Attention(Q, K, V)), Equation 19; LayerNorm(x+FFN(x)), Formula 20; LayerNorm represents the layer normalization operation.

8. A multimodal attention deep learning method for enhancing virus identification in metagenomic data according to claim 1, characterized in that, Step S9 includes: concatenating the spatiotemporal features with the global features using formula 21 to obtain the high-dimensional feature vector Z: Z = Concat(H) ConvLSTM H Transformer ), Formula 21; Step S10 includes performing self-attention calculation on the high-dimensional feature vector, dynamically adjusting the contribution weights of each path using formula 22, and fusing spatiotemporal features with global features: O attention =Attention(Z), Formula 22; Step S11 includes further processing the feature vector output by the self-attention mechanism through several fully connected layers using Equation 23: O fusion = Dense(O atteniton ), Official 23; Step S12 includes generating prediction results using the Softmax layer of Formula 24:

9. A multimodal attention deep learning method for enhancing virus identification in metagenomic data according to claim 1, characterized in that, Step 13 includes: defining the hyperparameter search space, including the hidden layer size of the ConvLSTM ranging from 50 to 150, with a stride of 10; the number of convolutional filters ranging from 16 to 64 for the first layer, with a stride of 16; from 32 to 128 for the second layer, with a stride of 32; and from 64 to 256 for the third layer, with a stride of 64; the dropout rate ranging from 0.3 to 0.5, with a stride of 0.1; and the learning rate ranging from 0.001 to 0.01, using a logarithmic scale for the search. By iteratively searching multiple times, the accuracy of the validation set is optimized to obtain the optimal hyperparameter configuration; Step 14 includes enhancing the model's ability to distinguish sequence features using the mixture loss function in Equation 25: L custom =αL cross_entropy +(1-α)L contrastive , Formula 25; Among them, L cross_entropy L represents the cross-entropy loss. contrastive This represents the contrast loss, where α is the weighting coefficient. Classification is performed using cross-entropy, formula 26: The similarity between samples is compared using Formula 27 to measure the loss: Where, d i This represents the Euclidean distance between samples, where m is the boundary threshold, and y... i For tags; Combining the two can improve the model's discriminative ability; The target labels are adjusted using the label smoothing algorithm in Formula 28 to reduce the model's sensitivity to noise in the training data. Among them, y true The original labels are ∈, the smoothing factor is K, and the number of categories is K. The target label was adjusted from 0 and 1 to a value between 0 and 1.

10. A multimodal attention deep learning method for enhancing virus identification in metagenomic data according to claim 9, characterized in that, Step S15 includes optimizing the model using mini-batch stochastic gradient descent, combined with a custom hybrid loss function and label smoothing techniques to further improve the model's robustness and accuracy; monitoring the loss and accuracy on the validation set and preventing overfitting through an early stopping strategy; and terminating training early when the validation set performance no longer improves.