Host analysis method for antibiotic resistance genes based on explainable machine learning
By employing interpretability-based machine learning methods, a correlation model between antibiotic resistance genes and bacterial genera was constructed using the Pauta criterion, random forest, and CatBoost algorithms. This approach addresses the issues of inaccurate data processing and insufficient interpretability in traditional methods, enabling efficient and accurate host analysis of antibiotic resistance genes.
Patent Information
- Application Number
- CN202510284448.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-03-11
AI Technical Summary
Traditional methods for detecting antibiotic resistance genes are time-consuming, difficult to quantify the contributions of multiple bacterial genera, and easily affected by human factors, making it difficult to reveal deep-seated patterns and associations.
An interpretable machine learning approach was adopted, outliers were removed using the Pauta criterion, key bacterial genera were screened using the random forest algorithm, and a correlation model between antibiotic resistance genes and bacterial genera was constructed using the CatBoost regression algorithm. The contribution of bacterial genera was quantified by the Shap value, thus achieving interpretable analysis of bacterial genera.
This study improves the accuracy and efficiency of host analysis of antibiotic resistance genes, provides scientific evidence, reveals the complex relationship between antibiotic resistance genes and bacterial genera, and supports ecological risk assessment and management.
Smart Images

Figure CN120148651B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of bioinformatics, and particularly relates to a host analysis method for antibiotic resistance genes. BACKGROUND
[0002] Traditional methods for detecting antibiotic resistance genes mainly rely on culture medium detection, PCR (Polymerase Chain Reaction) and sequencing technology. These methods can detect and identify antibiotic resistance genes to some extent, but have some significant limitations. Culture medium detection methods are usually time-consuming and difficult to culture all types of bacteria. Although PCR and sequencing technology can provide more accurate gene information, it is difficult to accurately quantify the contribution of each genus to antibiotic resistance genes in a multi-genus environment.
[0003] In addition, traditional methods are easily affected by human factors during data analysis and interpretation, and lack precise quantitative standards. These limitations limit our understanding of the spread path and mechanism of antibiotic resistance genes.
[0004] With the rapid development of high-throughput sequencing technology, researchers can obtain massive amounts of genomic data. These data provide rich information resources for studying the spread of antibiotic resistance genes. However, how to extract useful information from these massive data and accurately analyze the relationship between antibiotic resistance genes and host bacteria is still a great challenge. Traditional bioinformatics analysis methods often appear to be inadequate when dealing with these complex data, making it difficult to reveal deep patterns and associations.
[0005] Machine learning, as a powerful data analysis tool, has been widely used in the field of environmental microorganisms in recent years. Machine learning algorithms have the ability to handle large-scale data and complex relationships, and can find potential patterns and associations in massive genomic data. For example, by building classification models and regression models, machine learning can help researchers analyze the spread path of antibiotic resistance genes, identify key host bacteria, and evaluate the contribution of different genera to antibiotic resistance genes. Compared with traditional methods, machine learning-based methods not only have significant improvements in accuracy and efficiency, but also provide more biological insights. SUMMARY
[0006] In view of the deficiencies in the prior art, the present application provides a host analysis method for antibiotic resistance genes based on explainable machine learning, which can analyze the correlation between multiple bacterial genera and antibiotic resistance genes, quantify the contribution of different genera to antibiotic resistance genes, and thus identify the host bacteria of antibiotic resistance genes, providing necessary technical support for ecological risk assessment and management of antibiotic resistance genes.
[0007] The object of the present application is achieved by a host analysis method for antibiotic resistance genes based on explainable machine learning, comprising the following steps:
[0008] Step 1) Genome data collection: a large amount of genome data of the same environment sample is collected, the antibiotic resistance genes, the species of bacterial genera and the relative abundance in the gene data are calculated and processed into a matrix, the relative abundance of the selected antibiotic resistance genes is analyzed using the Pauta criterion, and the training set and the test set are divided after removing outliers;
[0009] Step 2) Construction of analysis model:
[0010] 2-1) First, an initial correlation analysis model is established for the species matrix using the random forest algorithm;
[0011] 2-2) The mean square error increase percentage (%IncMSE) of each bacterial genus is calculated to measure the importance of the bacterial genus, and the formula is as follows:
[0012]
[0013] Wherein: MSE original is the mean square error when the feature value is not disturbed; MSE random is the mean square error after disturbing the feature value;
[0014] The relationship between the number of the most important bacterial genera used for fitting and the average cross-validation error is obtained by performing five 10-fold cross-validations, and the number of bacterial genera with the minimum average cross-validation error is selected as the ideal number of variables, and the final bacterial genus matrix is screened, and the cross-validation error formula is as follows:
[0015]
[0016] Wherein: k is the number of folds, which is 10; MSEi is the mean square error of the i-th fold;
[0017] 2-3) An antibiotic resistance gene-bacterial genus correlation model is established by the CatBoost regression algorithm, the optimal hyperparameters are selected using grid search, and an antibiotic resistance gene-bacterial genus correlation model based on the RF-CatBoost algorithm is constructed;
[0018] The prediction value of the RF-CatBoost model is the weighted sum of the predictions of each decision tree:
[0019]
[0020] Wherein, is the initial prediction value, which is usually the mean value of the target value; f m (x) is the output of the mth tree; is the learning rate; M is the number of trees;
[0021] 2-4) Verify the fitness, robustness and analytical ability of the model;
[0022] Step 3) Explainable correlation analysis: Quantify the contribution of different genera to antibiotic resistance genes in the model through Shap values, and judge the influence of genera on antibiotic resistance genes according to the difference of average Shap values of different genera; SHAP value is used to decompose the prediction result of the model into the contribution value of each feature, that is:
[0023]
[0024] wherein, is the predicted value of the model; is the benchmark value of the model, which is usually the average initial value; is the Shap value of the i-th genus, and the symbol x i represents the contribution of the genus to the model;
[0025] For genus x i , its SHAP value is defined as the weighted average marginal contribution of all possible subsets of genera:
[0026]
[0027] wherein, is a subset of genera, and ; is the model prediction value under the subset of genera ; is the model prediction value after adding genus x i to the subset ; n is the total number of genera, is the size of the subset ; is the coefficient for weighting the contribution of each subset.
[0028] Further, the environmental samples in step 1) include one or more of the following: activated sludge, sewage, river water, lake water, air, soil.
[0029] Further, the division of training set and test set in step 1) is as follows: arrange the processed data in ascending order of relative abundance of antibiotic resistance genes, and divide 5 data into a group, and put the fifth data of each group into the test set, and the remaining data constitutes the training set; The data in the training set is used for model establishment and internal verification, and the data in the test set is used for external verification and performance evaluation of the model.
[0030] Further, the grid search is used to select the optimal hyperparameters in step 2-3), specifically: the number of base decision trees, the maximum depth of each base decision tree, and the learning rate are grid searched to minimize the average absolute error, and the parameter combination with the minimum average absolute error is the optimal parameter combination.
[0031] Further, the Shap value is used to quantify the contribution of different genera to antibiotic resistance genes in step 3), specifically: the contribution value of each genus to the analysis result of antibiotic resistance genes is calculated through the output of the CatBoost model, the Shap value of each genus in all samples is extracted, the average value and distribution of the Shap value of each genus in different samples are calculated, and the genera are sorted according to the absolute average value of the Shap value to identify the genus with the largest contribution to antibiotic resistance genes.
[0032] Further, the difference in the average Shap value of different genera is used to judge the influence of the genera on antibiotic resistance genes in step 3), specifically: by analyzing the changes in the Shap value of each genus, the positive and negative effects of the genus on the model analysis result are evaluated, and the influence of different genera on antibiotic resistance genes is visualized, the influence mechanism of the genus is explained, and the role of a specific genus in the analysis of antibiotic resistance genes is clarified to assist research and decision-making in related fields.
[0033] Compared with the prior art, the beneficial effects of the present application are:
[0034] 1) In the data processing stage, the relative abundance of antibiotic resistance genes in the genomic data is analyzed by using the Pauta criterion to remove outliers. This process lays a high-quality data foundation for the training of subsequent models and directly affects the accuracy and robustness of the model. At the same time, the training set and test set of the data are strictly divided according to the distribution of the relative abundance of antibiotic resistance genes, ensuring the rationality of the data distribution and providing reliable support for the construction and verification of subsequent models.
[0035] 2) After data preprocessing, step 2-1) establishes a preliminary correlation model by using the random forest algorithm to screen the key genus matrix. The random forest algorithm not only effectively selects the most influential genera, but also significantly reduces the data dimension and reduces the risk of overfitting.
[0036] 3) In step 2-3), the correlation model between antibiotic resistance genes and bacterial genera was constructed by RF-CatBoost algorithm, and the performance of the model was fully verified by robustness and external validation in step 2-4). Then, step 3) used the Shap value method to deeply analyze the model, and quantitatively analyzed the contribution of different genera to antibiotic resistance genes. The Shap value results not only verified the rationality of the previous two steps of screening and modeling, but also provided scientific basis for the ecological mechanism of specific genera to antibiotic resistance genes.
[0037] 4) The application solves the problems of unscientific treatment of outliers, low efficiency of genus screening, and insufficient model interpretability in traditional bioinformatics methods by combining Pauta criteria, random forest and CatBoost algorithm. Especially by organically combining genus screening, model construction and interpretability analysis, the application can more comprehensively reveal the complex relationship between antibiotic resistance genes and bacterial genera. This multi-step linkage optimization strategy provides an innovative technical path for antibiotic resistance gene host analysis. BRIEF DESCRIPTION OF DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of the provided drawings.
[0039] Figure 1 Flowchart of the data set of the embodiments of the present application.
[0040] Figure 2 Fitting degree and verification result graph of the correlation model of the embodiments of the present application.
[0041] Figure 3 SHAP value graph of the correlation model of the embodiments of the present application.
[0042] Figure 4 SHAP value importance graph of the correlation model of the embodiments of the present application. DETAILED DESCRIPTION
[0043] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0044] AsFigure 1 The host analysis method for antibiotic resistance genes based on machine learning shown comprises the following steps.
[0045] Step 1) Genome data collection: 755 metagenome data of sludge samples in a sewage treatment plant are collected, including different biomass samples such as aerobic sludge, anaerobic sludge, biofilm, granular sludge, etc.; tetracycline antibiotic resistance gene annotation is selected as the analysis object in this embodiment, antibiotic resistance genes are obtained by using RGI software, and species distribution characteristics in the genome data are obtained by using Kaiju software, and antibiotic resistance genes and species annotation results are processed into a matrix by using a Python script; the relative abundance of the selected antibiotic resistance genes is analyzed and abnormal values are removed by using Pauta criteria; the collected data are arranged in ascending order according to the relative abundance of antibiotic resistance genes, and 5 data are grouped into a group, and the fifth data of each group are put into the test set, and the remaining data form the training set; the data in the training set are used for model establishment and internal validation, and the data in the test set are used for external validation and performance evaluation of the model.
[0046] Step 2) Construction of analysis model: the species genus matrix in the genome is used as the independent variable, and an initial correlation model is established based on the random forest algorithm; finally, the mean square error increase percentage (%IncMSE) of each descriptor is calculated to measure the importance of the descriptor, five 10-fold cross-validations are performed to obtain the relationship between the number of the most important descriptors used for fitting and the average cross-validation error, the number of descriptors with the minimum average cross-validation error is selected as the ideal number of variables, and the first 12 most important genera (Sutterella, Laribacter, Haliscomenobacter, Pusillimonas, Alcaligenes, Entomoplasma, Stenotrophomonas, Saprospira, Alicycliphilus, Arcticibacterium, Ilumatobacter, Thauera) can obtain ideal analysis results;
[0047] The final descriptor is used as the independent variable, and a tetracycline resistance gene-species genus correlation model is established by using the classification boosting (CatBoost) regression algorithm; grid search is performed on the iterations, depth and learning_rate hyperparameters to obtain the parameter combination with the minimum mean absolute error as the best parameter combination (iterations = 1000, depth = 6 and learning_rate = 0.05); the final genus is used as the independent variable, and the hyperparameter combination is set to the best parameter combination, and a TET resistance gene-species genus correlation model is established by using the classification boosting regression algorithm.
[0048] R2 tra represents the fitting degree of the model; Q2 BOOT represents the robustness of the model; R2 test represents the external analysis ability of the model; the judgment basis is: R 2 > 0.7, Q 2 > 0.6, R 2 - Q 2 < 0.3, CCC > 0.85; the specific parameters are as follows:
[0049] n tra = 584, R2 tra = 0.976, Q2 BOOT = 0.794; n ext = 147, R2 test =0.834.
[0050] Wherein, n tra and n ext are the number of genomes in the training set and the test set respectively, R2 tra is 0.976, indicating that the model has high linear fitting ability; the internal validation coefficient Q2 BOOT is 0.794, indicating that the correlation model has good robustness; the external validation R2 test = 0.834, indicating that the model has good external analysis ability. Figure 2 The fitting degree of the model and the verification results are given; specifically including:
[0051] 2-1) First, use the random forest algorithm to establish an initial correlation analysis model for the species genus matrix;
[0052] 2-2) Calculate the mean square error increase percentage (%IncMSE) of each genus to measure the importance of the genus, the formula is as follows:
[0053]
[0054] Wherein: MSE original is the mean square error when the feature value is not disturbed; MSE random is the mean square error after disturbing the feature value;
[0055] Perform five 10-fold cross-validation to obtain the relationship between the number of the most important genera for fitting and the average cross-validation error, select the number of genera with the minimum average cross-validation error as the ideal variable number, and screen the final genus matrix, the cross-validation error formula is as follows:
[0056]
[0057] Wherein: k is the number of folds, which is 10; MSEi is the mean square error of the ith fold;
[0058] 2-3) Establish antibiotic resistance gene-bacterial genus correlation model by CatBoost regression algorithm, select optimal hyperparameters using grid search, and construct antibiotic resistance gene-bacterial genus correlation model based on RF-CatBoost algorithm;
[0059] The predicted value of the RF-CatBoost model is the weighted sum of the predictions of each decision tree:
[0060]
[0061] Wherein, is the initial prediction value, usually the mean of the target value; f m (x) is the output of the mth tree; is the learning rate; M is the number of trees;
[0062] 2-4) Verify the fitting degree, robustness and analysis ability of the model.
[0063] Step 3) Explainable correlation analysis: use Shap values to characterize the contribution of different genera in the tetracycline resistance gene-species genus correlation model Figure 3 ). The results show that Stenotrophomonas, Haliscomenobacter, Alcaligenes, Sutterella and Entomoplasma have a contribution rate of more than 10% to the correlation model. The above five genera have a great influence on the composition of tetracycline resistance genes in sludge samples from sewage treatment plants. At the same time, the Shap value results also show that Stenotrophomonas, Alcaligenes and Sutterella have positive contribution to the composition of tetracycline resistance genes, therefore, Stenotrophomonas, Alcaligenes and Sutterella may be potential hosts of tetracycline resistance genes.
[0064] It should be noted that the purpose of SHAP value is to decompose the prediction result of the model into the contribution value of each feature (genus abundance in this patent), that is:
[0065]
[0066] Wherein, is the predicted value of the model; is the baseline value of the model, usually the average initial value; is the Shap value of the ith genus, indicating i the contribution of the genus to the model;
[0067] For genus x i The SHAP value of each genus is defined as the weighted average marginal contribution of all possible subsets of genera:
[0068]
[0069] where, is a subset of genera, and ; is the model prediction value under the subset of genera ; is the model prediction value after adding genus x i to the subset ; n is the total number of genera, is the size of the subset ; is the coefficient for weighting the contribution of each subset, ensuring balanced consideration of all possible subsets.
[0070] Considering the high dimensionality of bacterial communities, it is increasingly important to select the genera most relevant to the target antibiotic resistance gene from the genus set in order to identify the host of the antibiotic resistance gene for ecological risk assessment of antibiotic resistance genes; for large and complex genomic datasets, Procrustes analysis and network analysis based on Spearman correlation coefficients are commonly used to confirm the relationship between antibiotic resistance genes and bacterial communities, but Procrustes analysis cannot confirm the relevant genera of antibiotic resistance genes, and network analysis can only analyze the correlation of a single genus with antibiotic resistance genes, resulting in a higher false correlation in the analysis of the correlation between antibiotic resistance genes and genera in complex environmental samples; while the Shap value interpretation method can effectively operate on large data sets of nonlinear models, and the difference in the average Shap value of different genera can be used to judge the specific influence of the genus on the antibiotic resistance gene: by analyzing the changes in the Shap value of each genus, the positive and negative effects of the genus on the model analysis results can be evaluated, and the influence degree of different genera on the antibiotic resistance gene can be visualized, combined with the Shap value analysis results, the influence mechanism of the genus is explained, and the role of a specific genus in the analysis of antibiotic resistance genes is clarified, to assist research and decision-making in related fields.
[0071] The above description of the embodiments is only used to help understand the method of the present application and its core idea. It should be noted that for those skilled in the art, without departing from the principles of the present application, some improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A host analysis method for antibiotic resistance genes based on interpretable machine learning, characterized in that, Includes the following steps: Step 1) Genomic data collection: Collect a large amount of genomic data from the same environmental samples, calculate the types and relative abundance of antibiotic resistance genes, species and genera in the gene data and process them into a matrix, use the Pauta criterion to analyze the relative abundance of selected antibiotic resistance genes, remove outliers and divide the data into training set and test set. Step 2) Construction of the analysis model: 2-1) First, the random forest algorithm is used to establish an initial correlation analysis model for the species and genus matrix; 2-2) Calculate the percentage increase in mean squared error (%IncMSE) for each genus to measure the importance of the genus, using the following formula: ; Among them: MSE original The mean squared error without disrupting the eigenvalues; MSE random It is the mean square error after shuffling the eigenvalues; Five 10-fold cross-validations were performed to obtain the relationship between the number of most important genera used for fitting and the average cross-validation error. The number of genera with the smallest average cross-validation error was selected as the ideal number of variables, and the final genera matrix was obtained. The cross-validation error formula is as follows: ; Where: k is the fold number, which is 10; MSEi is the mean square error of the i-th fold; 2-3) An antibiotic resistance gene-bacterial genus correlation model was established using the CatBoost regression algorithm. The optimal hyperparameters were selected using grid search, and an antibiotic resistance gene-bacterial genus correlation model based on the RF-CatBoost algorithm was constructed. The predictions of the RF-CatBoost model are a weighted sum of the predictions from each decision tree: ; in, This is the initial predicted value, usually the mean of the target value; f m (x) is the output of the nth tree; It is the learning rate; M is the number of trees; 2-4) Verify the model's fit, robustness, and analytical capabilities; Step 3) Interpretable Correlation Analysis: The contribution of different bacterial genera to antibiotic resistance genes in the model is quantified by Shap values. The influence of bacterial genera on antibiotic resistance genes is determined based on the differences in average Shap values among different genera. Shap values are used to decompose the model's prediction results into the contribution value of each feature, i.e.: ; in, These are the model's predicted values; These are the baseline values of the model, usually the average initial values; It is the Shap value of the i-th genus, indicating x. i The contribution of fungal genera to the model; For genus x i Its SHAP value is defined as the weighted average marginal contribution of all possible subsets of fungal genera: ; in, It is a subset of the genus *Fungi*, and ; It is in the subset of the genus Fungi The model predictions are as follows; In a subset Add fungal genus x i The model predictions are as follows; n is the total number of bacterial genera. It is a subset Size; It is a weighted coefficient that calculates the contribution of each subset.
2. The host analysis method for antibiotic resistance genes based on interpretable machine learning according to claim 1, characterized in that, The environmental samples in step 1) include one or more of the following: activated sludge, wastewater, river water, lake water, air, and soil.
3. The host analysis method for antibiotic resistance genes based on interpretable machine learning according to claim 1, characterized in that, Step 1) involves dividing the training and test sets as follows: the processed data are arranged in ascending order of relative abundance of antibiotic resistance genes, with 5 data points grouped together. The fifth data point in each group is placed in the test set, and the remaining data form the training set. The data in the training set is used for model building and internal validation, while the data in the test set is used for external validation and performance evaluation of the model.
4. The host analysis method for antibiotic resistance genes based on interpretable machine learning according to claim 1, characterized in that, Step 2-3) uses grid search to select the optimal hyperparameters. Specifically, grid search is performed on the number of basic decision trees, the maximum depth of each basic decision tree, and the learning rate to find the optimal parameter combination that minimizes the mean absolute error.
5. The host analysis method for antibiotic resistance genes based on interpretable machine learning according to claim 1, characterized in that, Step 3) Quantifying the contribution of different genera to antibiotic resistance genes in the model using Shap values involves: calculating the contribution of each genera to the analysis results of antibiotic resistance genes using the output of the CatBoost model; extracting the Shap values of each genera in all samples; calculating the average Shap value and its distribution of each genera in different samples; and ranking the genera according to the absolute average of the Shap values to identify the genera that contribute the most to antibiotic resistance genes.
6. The host analysis method for antibiotic resistance genes based on interpretable machine learning according to claim 1, characterized in that, Step 3) determines the influence of bacterial genera on antibiotic resistance genes based on the differences in average Shap values of different genera. Specifically, by analyzing the changes in Shap values of each genera, the positive and negative impacts on the model analysis results are assessed, and the degree of influence of different genera on antibiotic resistance genes is visualized. Combined with the Shap value analysis results, the influence mechanism of bacterial genera is explained, and the role of specific bacterial genera in antibiotic resistance gene analysis is clarified to assist research and decision-making in related fields.
Citation Information
Patent Citations
Method for screening important characteristic genes related to drug resistance phenotype of bacteria based on machine learning
CN114067912A
Antibiotic-loaded bacterium outer membrane vesicle as well as preparation method and application thereof
CN115006367A