Abstract
Motivation
Predicting microbe–drug associations (MDgAs) is critical for understanding the role of microbes in drug metabolism, exploring their interactions with host physiology, and advancing personalized therapy. However, traditional methods face challenges in dealing with data sparsity, information imbalance, and the extraction of complex biological knowledge, which limit the accurate prediction of microbe–drug associations. Therefore, developing a computational model that can efficiently integrate multi-source data and address the challenges of data sparsity and information imbalance is essential.
Results
The paper proposes a model that integrates knowledge graphs and contrastive learning. By constructing both local and non-local association graphs, the model effectively captures the complex relationships between microbes and drugs. We preprocess and model the embedding representations of microbes and drugs, and design a multi-level interactive contrastive learning mechanism to optimize the information flow both within and outside the graph. Experimental results show that our model significantly outperforms existing methods in metrics such as AUC and AUPR, providing an efficient solution for predicting microbe–drug associations.
Availability and implementation
The source code is available at: https://github.com/SJshujuan/KGCLMDA. The code used in this study is also available on Zenodo: https://doi.org/10.5281/zenodo.16754402.
1 Introduction
Microorganisms, among the most abundant and diverse life forms on Earth, play a critical role in human health and disease regulation (The Human Microbiome Project Consortium 2012). The human body is home to trillions of microorganisms, including bacteria, archaea, fungi, protozoa, and viruses, all of which together form the human microbiome (Gevers et al. 2012). These microorganisms inhabit various sites within the body and influence health in numerous ways (Sommer and Bäckhed 2013, Kumar and Chordia 2017). In particular, the microbiome and mucosal surfaces cooperate to defend against harmful pathogens (Macpherson and Harris 2004). For example, microorganisms aid in the synthesis of glycogen and the production of essential vitamins, which are crucial for immune system function (Kau et al. 2011). The gut microbiota is not only critical for metabolizing dietary polysaccharides but also for synthesizing essential vitamins, supporting immune development, and defending against pathogens (Durack and Lynch 2019, Zimmermann et al. 2019). Additionally, disruptions in the balance of microbial communities within the body can contribute to conditions such as diabetes (Wen et al. 2008), inflammatory bowel diseases (Durack and Lynch 2019), and cancer (Schwabe and Jobin 2013).
Various organisms, including bacteria, fungi, and plants, produce secondary metabolites, commonly referred to as natural products. These natural products have long served as an important source for drug development, with many of these compounds being developed for therapeutic use and showing significant potential for treating human diseases (Pham et al. 2019). Recently, as the diversity of drugs explored in medical research has expanded, microbial resistance to these drugs has become a growing concern (Zhu et al. 2019, Long et al. 2020). Traditional laboratory experiments are both expensive and time-consuming. As the issue of microbial resistance continues to escalate, there is an increasing need for efficient computational models to uncover potential microbe–drug interactions related to drug resistance.
In recent years, the rapid development of bioinformatics has led to the creation of several high-quality databases. For example, the MDAD database focuses on microbe–drug interactions, providing data on microbial sensitivity and resistance to drugs (Sun et al. 2018). The aBiofilm database documents the effects of antimicrobial agents on microbial biofilms, supporting research on biofilm-related infections (Rajput et al. 2018). The DrugVirus database covers interactions between viruses and antiviral drugs, offering resistance data (Andersen et al. 2020). Additionally, DRKG supports drug repositioning and disease treatment research (Ioannidis et al. 2022); VMH and HMDB provide research data on microbial-host metabolic networks and human metabolites, respectively (Wishart et al. 2018, Noronha et al. 2019); MPIDB specializes in microbe-protein interaction data (Goll et al. 2008); and NCBI offers extensive data resources for life science re-search (Wheeler et al. 2008). Based on these databases, researchers have developed various computational approaches to predict potential interactions between biological entities, which can be mainly categorized into four types: network-based methods, matrix factorization techniques, ma-chine learning methods, and deep learning approaches.
In the context of network-based approaches, Zhu et al. (2019) introduced the HMDAKATZ model, which combines microbial similarity using the GIP kernel and drug chemical structure similarity to predict microbe–drug interactions. Dong et al. (2023) introduced the DAEMDA model, integrating a dual-channel attention mechanism and graph neural networks to improve the prediction accuracy of miRNA-disease associations. In terms of matrix factorization methods, the MDSVDNV model designed by Tan et al. (2023)effectively predicts microbe–drug associations through the combination of Singular Value Decomposition (SVD) and Node2Vec, while preserving key features and reducing redundancy. Li et al. (2024) introduced the GSL-DTI model, which leverages automatic graph structure learning to build a drug-protein pair (DPP) network, enhancing the accuracy of drug-target interaction predictions. Regarding machine learning, Anahtar et al. (2021) explored its application in antibiotic resistance, but performance was limited due to the constraints of the training dataset.
Deep learning methods have demonstrated widespread application potential in the prediction field. For instance, DMGL-MDA addresses the issue of over-smoothing by combining dual-modal embedding with Graph Attention Networks (GAT) and Graph Transformers (GT); however, its scalability and computational complexity remain challenges when handling large-scale datasets (Zhu et al. 2024). In contrast, OGNNMDA network hierarchy through an ordered message-passing mechanism, improving embedding capacity, but still relies on known similarity matrices, which limits its adaptability to novel microbe–drug associations.(Zhao et al. 2024). MGAVAEMDA balances feature learning and model complexity by integrating variational autoencoders with random forests, achieving effective feature fusion; however, it fails to fully address redundancy issues in high-dimensional feature spaces (Wang et al. 2024). GARFMDA improves prediction interpretability and accuracy by combining graph attention networks with a bilayer random forest, but still faces high computational costs in the feature selection process (Kuang et al. 2024). In comparison, KGCLMDA (the model proposed in this study) introduces enhanced graph convolution and variational autoencoders, reducing model complexity while improving prediction accuracy. Notably, KGCLMDA overcomes the limitations of existing methods in handling high-dimensional data and complex microbe–drug networks, achieving superior performance across multiple evaluation metrics.
In the field of microbe–drug association prediction, particularly for anti-biotic resistance prediction, traditional methods are often constrained by data scarcity, information imbalance, and inadequate knowledge extraction. To address these challenges, we propose a model that integrates TransE preprocessing, multi-head attention, and multi-level contrastive learning. First, we use TransE to preprocess microbes and drugs, embed-ding them into a low-dimensional space to capture their latent semantic relationships. Next, we construct local graphs focusing on direct interactions between microbes and drugs, extracting first-order collaborative filtering signals from the microbe–drug interaction matrix and expanding these relationships through knowledge graph propagation. We then build non-local graphs by propagating higher-order collaborative filtering signals and external knowledge graph information to further enhance the representations of microbes and drugs. In the graph encoding phase, a multi-head attention mechanism is employed to model the relation-ships from multiple perspectives, capturing multi-level information. Finally, we apply intra- and inter-graph contrastive learning to deeply integrate direct and indirect associations, significantly improving prediction accuracy and robustness in complex, high-noise, and data-sparse conditions. Our model effectively overcomes the limitations of traditional methods, providing a novel solution for microbe–drug association prediction with significant applications in antibiotic resistance prediction.
2 Materials and methods
We collected known microbe–drug associations from the MDAD and aBiofilm databases, integrating 2470 clinically or experimentally validated interactions between 1373 drugs and 173 microbes, and 2884 verified associations involving 140 microbes and 1720 drugs. To gain deeper insights into microbes, drugs, and related entities, we constructed a comprehensive knowledge graph by integrating information from multiple data sources, including studies by Jiang et al. (2023), MEGARes, DrugVirus, NMDC, and HMDB. The final knowledge graph comprises 81 829 entities, 407 270 triples, and 42 relation types. To resolve annotation conflicts across databases, we prioritized associations with higher experimental validation frequency and retained only those supported by at least two independent studies. Missing attributes of microbes or drugs were imputed using relational context from the knowledge graph, such as metabolic pathway membership and involvement in biological processes. Our model framework is illustrated in Fig. 1. To further illustrate the operational mechanism of multi-level contrastive learning in the model, Fig. 2 presents the multi-level contrastive mechanism for predicting potential microbe–drug associations.
Figure 1.
Model framework diagram. (A) Construction of the microbe–drug interaction matrix using known interactions from MDAD and aBiofilm datasets, enriched with multi-source knowledge from various databases. (B) The model architecture utilizes TransE, multi-head attention, and contrastive learning to capture both local and non-local relationships in the microbe–drug network. (C) Performance evaluation demonstrating the model’s effectiveness across varying learning rates and regularization parameters.
Figure 2.

Multi-level contrastive mechanism for predicting potential microbe–drug associations. The left part is the Local module, and the right part is the Non-Local module. Arrows represent positive pairs that strengthen associations, and dashed arrows represent negative pairs that suppress interference. Entity representations are optimized through hierarchical and cross-module interactions.
To predict potential microbe–drug relationships, we use known microbe–drug interactions and a knowledge graph to identify latent connections. We construct a complex model integrating deep learning for multi-level representation learning. Given as the set of drugs and as the set of microbes, we build a microbe–drug adjacency matrix , where if there is a known interaction between drug and microbe , and 0 otherwise. Additionally, the knowledge graph captures relationships between entities E via relations R. Our objective is to learn a function that predicts the potential association score between microbes and drugs, using A and G. The model is optimized to minimize the cross-entropy loss function:
| (1) |
2.1 Local graph construction
We construct the local graph by capturing both direct and indirect relationships between microbes and drugs, focusing on first-order interactions and their related knowledge graph information. First, we extract collaborative filtering signals between microbes m and drugs d from matrix A, defining the direct interaction sets as , These interactions provide the foundation for subsequent graph construction. Next, we map the collaborative filtering signals to the entity space in the knowledge graph through an entity alignment process, constructing the initial node sets for the local graph. The initial entity sets are defined as:
| (2) |
This process successfully maps the signals to entities in the knowledge graph. Finally, we propagate the initial entity sets through the structural relationships in the knowledge graph to generate multi-layered local graph structures. Specifically, the propagation process for microbes and drugs is as follows:
| (3) |
where represents the entity set after propagation at layer . The final entity set at layer L is:
| (4) |
2.2 Non-local graph construction
The non-local graph incorporates high-order collaborative filtering (CF) signals (e.g. microbe–drug–disease co-occurrence) and additional external knowledge graph (KG) facts to enhance the representations of microbes and drugs. The construction process is similar to that of the local graph but extends the information by aligning high-order CF drugs with the knowledge graph and propagating through the KG.
First, high-order drugs are obtained by propagating through the microbe–drug interactions. Specifically, the high-order drug set for microbe m is defined as:
| (5) |
Similarly, the set of similar microbes is defined by drugs interacted with and the propagation of similarity:
| (6) |
Next, these high-order drugs are aligned with entities in the knowledge graph to construct the initial entity sets. The initial entity sets for microbes and drugs are defined as:
| (7) |
Through propagation in the knowledge graph, we further construct the non-local graph. The propagated triple sets are represented as:
| (8) |
Finally, after multiple layers of propagation, the entity set at layer L reveals more complex latent relationships between microbes and drugs:
| (9) |
Through recursive propagation, the non-local graph captures complex indirect relationships, providing richer semantic information for microbe–drug association tasks.
2.3 Embedding representation
2.3.1 Pre-training embedding
To enhance the initial expressiveness of the model, we pretrain the knowledge graph using the TransE model to generate embedding representations for entities and relations. TransE maps the triples into a low-dimensional space and uses an additive structure to model the relationships between the triples:
| (10) |
where h, r and t represent the embeddings of the head entity, relation, and tail entity, respectively. To optimize the model, TransE employs a negative sampling strategy to generate false triples, which are used to train the model to distinguish between true and false relationships. The loss function is as follows:
| (11) |
Through this training process, the model effectively initializes the embedding representations, enhancing its expressiveness and accelerating convergence.
2.3.2 Graph encoding
To better integrate information from both local and non-local graphs, we adopt a multi-head attention mechanism to compute the weighted representation of each triple. In each layer, the embeddings of the head entity and relation are concatenated to form the query vector , while the embedding of the tail entity serves as both the key and value :
| (12) |
The similarity between the query and key vectors is computed, resulting in the attention weights :
| (13) |
Using these weights, we aggregate the tail entity information, yielding the output for each attention head. Finally, the outputs from all attention heads are concatenated and a linear transformation is applied to obtain the final embedding representation:
| (14) |
This approach effectively captures the complex relationships between entities, enhancing the richness of the embedding representations and providing more powerful feature representations for subsequent tasks.
2.4 Contrastive learning
In the task of predicting potential associations between microbes and drugs, the core objective of constructing a non-local graph is to capture high-order interaction relationships between microbes and drugs, and to extend these relationships by incorporating external knowledge graph information. This approach allows the non-local graph to help capture latent connections and contextual information between microbes and drugs. The non-local graph is primarily constructed through the propagation of high-order collaborative filtering (CF) signals and knowledge graph (KG) information to establish relationships between microbes and drugs. To construct the non-local graph, we first obtain high-order information by propagating the interaction relationships between microbes and drugs. The high-order drug set for a microbe m is represented as:
| (15) |
where represents the embedding of microorganism m in the initial layer (layer 0) of the local graph. denotes the embedding of microorganism m in the kth layer of the local graph for the positive sample, defined as the embedding of a layer adjacent to the current sample. On the other hand, indicates the embedding in the kth layer of the local graph for the negative sample, defined as the embedding of a randomly selected, non-adjacent layer within the same graph. Similarly, is the embedding in the initial layer of the non-local graph, is the embedding in the kth layer of the non-local graph for the positive sample, and is the embedding in the kth layer of the non-local graph for the negative sample. The temperature parameter τ controls the sharpness of the softmax distribution. It is chosen empirically, following standard practice in contrastive learning to balance the impact of positive and negative samples. In this work, we set τ = 0.1, as it has been shown in previous studies to yield optimal results in similar settings (Chen et al. 2020). This loss reflects intra-graph contrastive learning, where adjacent layers in the same graph are treated as positive samples, and randomly selected non-adjacent layers are treated as negatives.
Ultimately, the total intra-graph interactive contrastive loss is the sum of the contrastive losses for microbes and drugs:
| (16) |
This method effectively combines collaborative filtering signals and knowledge graph information, enhancing the prediction accuracy of potential associations between microbes and drugs.
While intra-graph contrastive learning can achieve coherent utilization of information within a single graph, the noisy nature of the non-local graph poses challenges for integrating information from local and non-local graphs. To reduce noise and extract meaningful information, we propose an inter-graph contrastive learning approach. In this method, any layer in the local graph serves as an anchor, with the corresponding layer in the non-local graph acting as positive sample pairs, and other layers as negative sample pairs. The contrastive loss for microbes is formulated as:
| (17) |
This loss captures inter-graph contrast, aligning representations of the same entity across local and non-local graphs to improve consistency and reduce graph-specific noise. The inter-graph contrastive loss is the sum of the contrastive losses for microbes and drugs:
| (18) |
Through this method, the local graph and the non-local graph can jointly extract useful information and reduce noise, thereby improving the accuracy of predicting associations between microbes and drugs.
2.5 The final association prediction
Finally, we concatenate the multi-layer embeddings from both the local and non-local graphs to form the final representation:
| (19) |
| (20) |
Then, we obtain the prediction results by calculating the matching score between the microbe m and the drug d:
| (21) |
To evaluate the effectiveness of the microbe–drug potential association prediction model, we implemented 5-fold cross-validation. The known associations were randomly divided into five subsets, and in each round of validation, one subset was used as the test set (containing an equal number of positive and negative samples), while the remaining subsets constituted the training set.
| (22) |
| (23) |
The model predicts scores for the test samples and compares them to a preset threshold to determine the results. Performance metrics include the area under the ROC curve (AUC) and the area under the PR curve (AUPR), which are used to evaluate the classification performance across different thresholds and the prediction efficacy in the context of imbalanced data, respectively.
By averaging the results of the 5-fold cross-validation, we can effectively reduce the potential impact of randomness due to the arbitrary division of the dataset, ensuring the reliability and robustness of the experimental results. All experiments were conducted on a high-performance computing server equipped with NVIDIA A100 GPUs. The model was trained using the Adam optimizer with a learning rate of 0.1, a batch size of 64, and for 200 epochs. An early stopping mechanism was applied, terminating training if the validation AUC did not improve for 10 consecutive epochs. The random seed was fixed at 42 to ensure reproducibility.
3 Results
3.1 Baseline comparison
We conducted 5-fold cross-validation on the MDAD and aBiofilm datasets to compare KGCLMDA with five baseline methods:
GCNMDA (Long et al. 2020): Combines GCN and CRF for better neighborhood aggregation.
GSAMDA (Tan et al. 2022): Uses GAT for node features and SAE for attributes to improve predictions.
MDASAE (Fan et al. 2023): Combines attention mechanisms and autoencoders to enhance feature extraction.
LRLSHMDA (Wang et al. 2017): Uses Gaussian kernel similarity and LRLS for topological feature mining.
NTSHMDA (Luo and Long 2018): Uses RWR and network similarity to predict complex associations.
The results in Tables 1–3 show that KGCLMDA outperforms the other methods in AUC and AUPR, improving AUC by 0.0305 (MDAD), 0.0269 (aBiofilm), and 0.0257(DrugVirus), and AUPR by 0.073 (MDAD), 0.0370 (aBiofilm), and 0.0502 (DrugVirus).
Table 1.
Performance comparison of baseline methods and KGGCLMDA on MDAD.
| Methods | AUC | AUPR |
|---|---|---|
| GCNMDA | 0.9282 | 0.9126 |
| GSAMDA | 0.9488 | 0.4520 |
| MDASAE | 0.9565 | 0.3655 |
| LRLSHMDA | 0.9400 | 0.6351 |
| NTSHMDA | 0.8484 | 0.1374 |
| KGCLMDA | 0.9870 | 0.9856 |
Table 2.
Performance comparison of baseline methods and KGGCLMDA on aBiofilm.
| Methods | AUC | AUPR |
|---|---|---|
| GCNMDA | 0.9549 | 0.9499 |
| GSAMDA | 0.9353 | 0.9317 |
| MDASAE | 0.9613 | 0.9536 |
| LRLSHMDA | 0.9512 | 0.6796 |
| NTSHMDA | 0.8629 | 0.1407 |
| KGCLMDA | 0.9882 | 0.9869 |
Table 3.
Performance comparison of baseline methods and KGGCLMDA on DrugVirus.
| Methods | AUC | AUPR |
|---|---|---|
| GCNMDA | 0.9330 | 0.9236 |
| GSAMDA | 0.9281 | 0.9137 |
| MDASAE | 0.9489 | 0.9312 |
| LRLSHMDA | 0.9356 | 0.6274 |
| NTSHMDA | 0.8357 | 0.1307 |
| KGCLMDA | 0.9746 | 0.9738 |
Figure 3 shows the PR and ROC curves for each method, and the results demonstrate that KGCLMDA outperforms the other methods on both datasets, achieving the highest AUPR and AUC values, highlighting its superiority in microbe–drug association prediction.
Figure 3.
Comparison of PR and ROC curves for different models on the aBiofilm and MDAD datasets.
3.2 Hyperparameter sensitivity analysis
In the hyperparameter sensitivity analysis, we examined how model performance changes with variations in the number of knowledge graph propagation n-layers, learning rate (lr), and contrastive learning hyperparameters (ssl_temp, ssl_reg, ssl_reg_inter). The results indicate that n-layers and lr are critical factors, and appropriate settings for ssl_temp and regularization improve model stability and prediction performance.
As shown in Fig. 4, KGCLMDA performs best on both the MDAD and aBiofilm datasets when the learning rate lr is set to 0.1 and n-layers is set to 3. Figures 5 and 6 show that the model achieves optimal performance on the aBiofilm and MDAD datasets when the hyperparameters are set to {ssl_temp = 0.1, ssl_reg = 1e-07, ssl_reg_inter = 1e-06} and {ssl_temp = 0.1, ssl_reg = 1e-05, ssl_reg_inter = 1e-05}, respectively. Figures 7 and 8 further confirm these optimal hyperparameter settings for AUPR performance.
Figure 4.
Performance evaluation of the model. (A) AUPR values of the model on the aBiofillm. (B) AUC values of the model on the aBiofilm. (C) AUPR values of the model on the MDAD. (D) AUC values of the model on the MDAD.
Figure 5.
AUC performance evaluation of the model on aBiofilm dataset under different hyperparameter settings. Subfigures A, B, C, and D respectively present results when ssl_temp is set to 0.05, 0.01, 0.2, and 0.5.
Figure 6.
AUC performance evaluation of the model on MDAD dataset under different hyperparameter settings. Subfigures A, B, C, and D respectively present results when ssl_temp is set to 0.05, 0.1, 0.2, and 0.5.
Figure 7.
AUPR performance evaluation of the model on aBiofilm dataset under different hyperparameter settings. Subfigures A, B, C, and D respectively present results when ssl_temp is set to 0.05, 0.1, 0.2, and 0.5.
Figure 8.
AUPR performance evaluation of the model on MDAD dataset under different hyperparameter settings. Subfigures A, B, C, and D respectively present results when ssl_temp is set to 0.05, 0.1, 0.2, and 0.5.
3.3 Ablation study
We conducted ablation studies to evaluate the impact of key components on model performance by modifying the model input, structure, or dataset. We created three variants by disabling one component each: (i) the first variant removes intra-layer contrastive learning (w/o intra), (ii) the second variant removes inter-layer contrastive learning (w/o inter), and (iii) the third variant removes the multi-layer attention mechanism (w/o Att). As shown in Fig. 9, KGCLMDA outperforms all variants, demonstrating that the combination of all components contributes to its superior performance.
Figure 9.
Ablation study. Subfigures A and B respectively present the ablation study results on MDAD and aBiofilm datasets.
3.4 Case study
To demonstrate the predictive performance of KGCLMDA, we conducted case studies on two drugs and two microorganisms. We selected the top 20 microorganisms and drugs predicted by KGCLMDA based on the MDAD database and verified their presence in the literature. The first drug is Moxifloxacin, a broad-spectrum fluoroquinolone effective against Gram-positive bacteria and anaerobes (Barman Balfour and Wiseman 1999), relevant in antibiotic-resistant infections (Loyola-Rodriguez et al. 2018). The second drug is Ciprofloxacin, a widely used fluoroquinolone that inhibits bacterial DNA gyrase and treats various infections (Campoli-Richards et al. 1988, Sharma et al. 2010). Tables 4 and 5 show that 17 and 18 of the top 20 predicted microorganisms for Moxifloxacin and Ciprofloxacin, respectively, are validated by the literature.
Table 4.
Top 20 predicted microbe candidates related to Moxifloxacin.
| Microbe | Evidence | Microbe | Evidence |
|---|---|---|---|
| Pseudomonas aeruginosa | PMID:31643179 | Vibrio harveyi | NA |
| Escherichia coli | PMID:36250047 | HIV-1 | PMID:18441333 |
| Staphylococcus aureus | PMID:31689174 | Haemophilus influenzae | NA |
| Streptococcus mutans | PMID:29392681 | Actinomyces oris | PMID:26538502 |
| Candida albicans | PMID:12121916 | Burkholderia cenocepacia | PMID:33120688 |
| Staphylococcus epidermis | PMID:11249827 | Enteric bacteria and other eubacteria | NA |
| Staphylococcus epidermidis | PMID:31516359 | Streptococcus pneumoniae | PMID:31542319 |
| Bacillus subtilis | PMID:30036828 | Listeria monocytogenes | PMID:28739228 |
| Enterococcus faecalis | PMID:31763048 | Burkholderia pseudomallei | PMID:15731198 |
| Salmonella enterica | PMID:22151215 | Stenotrophomonas maltophilia | PMID:31748318 |
Table 5.
Top 20 predicted microbe candidates related to Ciprofloxacin.
| Microbe | Evidence | Microbe | Evidence |
|---|---|---|---|
| Pseudomonas aeruginosa | PMID:30605076 | Haemophilus influenzae | NA |
| Staphylococcus aureus | PMID:36499677 | Salmonella enterica | PMID:26933017 |
| Candida albicans | PMID:35404123 | Streptococcus sanguis | PMID:11347679 |
| Streptococcus mutans | PMID:30468214 | Enteric bacteria and other eubacteria | PMID:274364661 |
| Staphylococcus epidermis | PMID:10632381 | Serratia marcescens | PMID:23751969 |
| Escherichia coli | PMID:2325984 | HIV-1 | PMID:9566552 |
| Staphylococcus epidermidis | PMID:28481197 | Actinomyces oris | NA |
| Vibrio harveyi | PMID:27247095 | Listeria monocytogenes | PMID:28355096 |
| Bacillus subtilis | PMID:33218776 | Burkholderia multivorans | PMID:19633000 |
| Enterococcus faecalis | PMID:27790716 | Streptococcus epidermidis | PMID:9111541 |
4 Conclusions
This paper proposes a novel method for predicting microbe–drug associations based on knowledge graphs and contrastive learning, named KGCLMDA (Knowledge Graph and Contrastive Learning Model). The method aims to predict potential microbe–drug associations by leveraging known microbe–drug interaction data and external knowledge graphs. The core objective of the research is to address the challenges of data scarcity, imbalanced information utilization, and insufficient knowledge extraction in traditional methods. Our model combines knowledge graph embedding and contrastive learning techniques, preprocessing and modeling the embedding representations of microbes and drugs, and integrating both local and non-local graph structures to effectively capture the direct and indirect relationships between microbes and drugs. Experimental results show that KGCLMDA significantly outperforms existing methods in metrics such as AUC and AUPR. This study provides an effective solution for microbe–drug association prediction and contributes to the fields of biomedical research and precision medicine.
Our approach constructs both local and non-local graphs to capture direct interactions between microbes and drugs, as well as indirect relationships related to microbial metabolic functions or drug chemical properties. First, we preprocess microbes and drugs using the TransE model, embedding them into a low-dimensional space to capture latent semantic relationships. Next, we incorporate a multi-head attention mechanism during graph encoding to compute weighted representations for each triple, enhancing the model’s ability to capture complex relationships. The contrastive learning mechanism is introduced to optimize embedding representations, performing contrastive learning both within and between layers, improving the learning of local relationships and the integration of non-local information. The contributions of this work are summarized as follows:
The KGCLMDA model is proposed, which combines knowledge graphs and contrastive learning for microbe–drug association prediction.
Local and non-local graphs are constructed to capture direct and indirect relationships between microbes and drugs.
A multi-level contrastive learning mechanism is integrated to improve the model’s predictive performance in data-sparse and noisy environments.
Experiments show that KGCLMDA exhibits superior performance in the task of microbe–drug association prediction and has practical application feasibility.
Although KGCLMDA has achieved promising results, there is still room for improvement. Future research can explore dynamic knowledge graphs to optimize prediction results as new data becomes available. Additionally, incorporating temporal information or patient-specific data could further enhance prediction accuracy, supporting personalized drug recommendations. This model offers new insights into microbe–drug interaction prediction, laying the foundation for applications in precision medicine, drug repositioning, and microbiome research, and is expected to drive the development of personalized healthcare.
Contributor Information
Meiling Liu, College of Computer and Control Engineering, Northeast Forestry University, Harbin, Heilongjiang, 150040, China.
Shujuan Su, College of Computer and Control Engineering, Northeast Forestry University, Harbin, Heilongjiang, 150040, China.
Guohua Wang, College of Computer and Control Engineering, Northeast Forestry University, Harbin, Heilongjiang, 150040, China.
Shan Huang, Department of Neurology, The Second Affiliated Hospital, Harbin Medical University, Harbin, Heilongjiang, 150081, China.
Author contributions
Meiling Liu (Conceptualization [equal], Data curation [equal], Methodology [equal], Project administration [equal], Resources [equal], Supervision [equal]), Shujuan Su (Software [equal], Validation [equal], Writing—original draft [equal]), Guohua Wang (Conceptualization [equal], Funding acquisition [equal], Resources [equal], Supervision [equal], Writing—review & editing [equal]), and Shan Huang (Conceptualization [equal], Formal analysis [equal], Methodology [equal], Resources [equal], Supervision [equal])
Conflict of interest: None declared.
Funding
This work was supported by the National Natural Science Foundation of China [62225109, 62450112, and 62472363] and the Heilongjiang Provincial Natural Science Foundation [ZD2024F001].
References
- Anahtar MN, Yang JH, Kanjilal S. Applications of machine learning to the problem of antimicrobial resistance: an emerging model for translational research. J Clin Microbiol 2021;59:e01260-20. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Andersen PI, Ianevski A, Lysvand H et al. Discovery and development of safe-in-man broad-spectrum antiviral agents. Int J Infect Dis 2020;93:268–76. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Balfour JA, Wiseman LR. Moxifloxacin. Drugs 1999;57:363–73; discussion 374. [DOI] [PubMed] [Google Scholar]
- Campoli-Richards DM, Monk JP, Price A et al. Ciprofloxacin. Drugs 1988;35:373–447. 10.2165/00003495-198835040-00003 [DOI] [PubMed] [Google Scholar]
- Chen T, Kornblith S, Norouzi M et al. A simple framework for contrastive learning of visual representations. In: International Conference on Machine Learning. PmLR, 2020, 1597–607.
- Dong X, Sun L, Li Y et al. DAEMDA: a method with dual-channel attention encoding for miRNA–disease association prediction. Bioinformatics 2023;39:66–73. 10.1093/bioinformatics/btz548 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Durack J, Lynch SV. The gut microbiome: relationships with disease and opportunities for therapy. J Exp Med 2019;216:20–40. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Fan L, Wang L, Zhu X. A novel microbe–drug association prediction model based on stacked autoencoder with multi-head attention mechanism. Sci Rep 2023;13:7396. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Gevers D, Knight R, Petrosino JF et al. The human microbiome project: a community resource for the healthy human microbiome. PLoS Biol 2012;10:e1001377. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Goll J, Rajagopala SV, Shiau SC et al. MPIDB: the microbial protein interaction database. Bioinformatics 2008;24:1743–4. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Ioannidis VN et al. DRKG—Drug repurposing knowledge graph for Covid-19. arXiv, arXiv:2010.09600, 2022, preprint: not peer reviewed.
- Jiang C, Tang M, Jin S et al. KGNMDA: a knowledge graph neural network method for predicting microbe-disease associations. IEEE/ACM Trans Comput Biol Bioinform 2023;20:1147–55. [DOI] [PubMed] [Google Scholar]
- Kau AL, Ahern PP, Griffin NW et al. Human nutrition, the gut microbiome and the immune system. Nature 2011;474:327–36. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Kuang H, Zhang Z, Zeng B et al. A novel microbe–drug association prediction model based on graph attention networks and bilayer random forest. BMC Bioinformatics 2024;25:78. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Kumar A, Chordia N. Role of microbes in human health. Appl Microbiol 2017;3:18. [Google Scholar]
- Li Y, Li J, Li Z et al. GSL-DTI: graph structure learning network for drug-target interaction prediction. Methods 2024;223:136–45. [DOI] [PubMed] [Google Scholar]
- Long Y, Wu M, Kwoh CK et al. Predicting human microbe–drug associations via graph convolutional network with conditional random field. Bioinformatics 2020;36:4918–27. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Loyola-Rodriguez JP, Ponce-Diaz ME, Loyola-Leyva A et al. Determination and identification of antibiotic-resistant oral streptococci isolated from active dental infections in adults. Acta Odontol Scand 2018;76:229–35. [DOI] [PubMed] [Google Scholar]
- Luo J, Long Y. NTSHMDA: prediction of human microbe-disease association based on random walk by integrating network topological similarity. IEEE/ACM Trans Comput Biol Bioinform 2018;17:1341–51. [DOI] [PubMed] [Google Scholar]
- Macpherson AJ, Harris NL. Interactions between commensal intestinal bacteria and the immune system. Nat Rev Immunol 2004;4:478–85. [DOI] [PubMed] [Google Scholar]
- Noronha A, Modamio J, Jarosz Y et al. The virtual metabolic human database: integrating human and gut microbiome metabolism with nutrition and disease. Nucleic Acids Res 2019;47:D614–24. 10.1093/nar/gky992 [DOI] [PMC free article] [PubMed] [Google Scholar]
- Pham JV, Yilma MA, Feliz A et al. A review of the microbial production of bioactive natural products and biologics. Front Microbiol 2019;10:1404. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Rajput A, Thakur A, Sharma S et al. aBiofilm: a resource of anti-biofilm agents and their potential implications in targeting antibiotic drug resistance. Nucleic Acids Res 2018;46:D894–900. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Schwabe RF, Jobin C. The microbiome and cancer. Nat Rev Cancer 2013;13:800–12. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Sharma PC, Jain A, Jain S et al. Ciprofloxacin: review on developments in synthetic, analytical, and medicinal aspects. J Enzyme Inhib Med Chem 2010;25:577–89. [DOI] [PubMed] [Google Scholar]
- Sommer F, Bäckhed F. The gut microbiota—masters of host development and physiology. Nat Rev Microbiol 2013;11:227–38. [DOI] [PubMed] [Google Scholar]
- Sun YZ, Zhang DH, Cai SB et al. MDAD: a special resource for microbe–drug associations. Front Cell Infect Microbiol 2018;8:424. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Tan H, Zhang Z, Liu X et al. MDSVDNV: predicting microbe–drug associations by singular value decomposition and Node2vec. Front Microbiol 2023;14:1303585. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Tan Y, Zou J, Kuang L et al. GSAMDA: a computational model for predicting potential microbe–drug associations based on graph attention network and sparse autoencoder. BMC Bioinformatics 2022;23:492. [DOI] [PMC free article] [PubMed] [Google Scholar]
- The Human Microbiome Project Consortium. Structure, function and diversity of the healthy human microbiome. Nature 2012;486:207–14. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Wang B, Ma F, Du X et al. Prediction of microbe–drug associations based on a modified graph attention variational autoencoder and random forest. Front Microbiol 2024;15:1394302. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Wang F, Huang ZA, Chen X et al. LRLSHMDA: Laplacian regularized least squares for human microbe–disease association prediction. Sci Rep 2017;7:7601. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Wen L, Ley RE, Volchkov PY et al. Innate immunity and intestinal microbiota in the development of Type 1 diabetes. Nature 2008;455:1109–13. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Wheeler DL, Barrett T, Benson DA et al. Database resources of the national center for biotechnology information. Nucleic Acids Res 2008;36:D13–21. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Wishart DS, Feunang YD, Marcu A et al. HMDB 4.0: the human metabolome database for 2018. Nucleic Acids Res 2018;46:D608–17. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Zhao J, Kuang L, Hu A et al. OGNNMDA: a computational model for microbe–drug association prediction based on ordered message-passing graph neural networks. Front Genet 2024;15:1370013. [DOI] [PMC free article] [PubMed] [Google Scholar]
- Zhu B, Yu HY, Du BX et al. DMGL-MDA: a dual-modal graph learning method for microbe–drug association prediction. Methods 2024;222:51–6. [DOI] [PubMed] [Google Scholar]
- Zhu L, Duan G, Yan C et al. Prediction of microbe-drug associations based on KATZ measure. In: 2019 IEEE International Conference on Bioinformatics and Biomedicine (BIBM). IEEE Press, New York, NY, USA. San Diego, CA, USA, 2019, 183–7.
- Zimmermann M, Zimmermann-Kogadeeva M, Wegmann R et al. Mapping human microbiome drug metabolism by gut bacteria and their genes. Nature 2019;570:462–7. [DOI] [PMC free article] [PubMed] [Google Scholar]








