Skip to main content

Classification of drugs based on mechanism of action using machine learning techniques

Abstract

The mechanism of action is an important aspect of drug development. It can help scientists in the process of drug discovery. This paper provides a machine learning model to predict the mechanism of action of a drug. The machine learning models used in this paper are Binary Relevance K Nearest Neighbors (Type A and Type B), Multi-label K-Nearest Neighbors and a custom neural network. These machine learning models are evaluated using the mean column-wise log loss. The custom neural network model had the best accuracy with a log loss of 0.01706. This neural network model is integrated into a web application using Flask framework. A user can upload a custom testing features dataset, which contains the gene expression and the cell viability levels. The web application will output the top classes of drugs, along with the scatter plots for each of the drug.

Introduction

The term “mechanism of action” (MoA) refers to how a medicine or other substance causes an effect in the body. A drug’s mechanism of action, for example, could be how it affects a specific target in a cell, such as an enzyme, or how it impacts a cell function, such as cell proliferation. Knowing a drug’s mechanism of action can provide information about the drug's safety and how it affects the body [1].

The majority of medications work by interacting with proteins in the host or pathogen. Drug targets include a variety of proteins, and the name receptor is only used when the interaction results in a signal transmission cascade. A receptor is a molecule or polymeric structure that identifies and binds an endogenous substance on the surface or inside a cell. When a substance elicits a detectable physiological or pharmacological response characteristic of the receptor, it is said to be an agonist. Some medications may be unable to initiate any action on their own after binding to a receptor site, but they can prevent the action of other agonists. These are called Antagonists [2].

Understanding a biologically active compound's mechanism of action entails not only identifying the target but also investigating the biological chemistry that occurs before or after target binding. Many genes are involved in a drug's mechanism of action, and so have an impact on sensitivity. The mechanism of action of a small molecule encompasses both the intracellular target(s) and the activities that occur before and after target engagement [3].

Because of the high level of intricacy in the interactions between the Tuberculosis medicine and Mycobacterium tuberculosis, Tuberculosis treatment requires an adequate cognizance of MOA, which is critical for the successful delivery of drug candidates. Several methods were outlined for investigating tuberculosis drug MoA’s and provided guidance for future tuberculosis drug development. In the context of Mycobacterium tuberculosis pathogenesis, they evaluated diverse platforms for their strengths and limitations in Tuberculosis drug MOA elucidation [4].

Bioinformatics is a science that uses several layers of information such as image-based data, pathways and gene expression to aid in the understanding of Mechanisms of Action. In order to comprehend MoA, it is necessary to analyse the complicated responses of the human biological system to drug treatments. The impact of bio-informatics on drug discovery and several Bioinformatic methods for the comprehension of Mechanisms of Action were discussed [5].

This paper discusses about the various machine learning models and their accuracies. Further, a web application is developed using the Flask web framework. The machine learning model which has the best accuracy is utilized for developing this web application. This web application can be helpful for the scientists in the drug discovery process.

The rest of this paper is organized as follows. In Sect. 2, a literature survey of mechanism of action is described. In Sect. 3, the methodology is shown. In Sect. 4, the pre-processing of the dataset is presented. In Sect. 5, the evaluation of the machine learning model is elucidated. In Sect. 6, various machine learning models and their results are presented. In Sect. 7, the architecture of the web application is shown. In Sect. 8, the snapshots of the running web application is presented. Finally, Sect. 9 concludes this paper.

Literature survey of mechanism of action

Some drugs’s mechanism of action are unrevealed. Meanwhile, several drugs’ mechanism of action have been already discovered. For example, Aspirin’s mechanism of action involves irreversible inhibition of the enzyme cyclooxygenase, which reduces inflammation and pain by decreasing the formation of thromboxanes and prostaglandins.

Different drugs can have different mechanism of action. A literature survey of mechanism of action of various drugs are described in Table 1.

Table 1 Literature survey of mechanism of action

Methodology

Serialization and de-serialization is used in order to avoid training the model using the training dataset every time a fresh testing dataset is submitted to the web application.

As shown in the Fig. 1, in the first step, the model is trained using the training dataset. This model is saved into a file, which is present in the HDF5 format [12]. HDF5 stands for Hierarchical Data Format 5. This process is called serialization and this is done using the keras built-in module “save”. The model's architecture, weights, training setup (loss and optimizer), and optimizer state are all contained in this serialized file.

Fig. 1
figure 1

Methodology of the machine learning model

Later, this file is de-serialized and it is supplied into the Flask web application. This process is called de-serialization and this is done using the keras built-in module “load_model”. In this way, whenever a new testing dataset is uploaded in the web application, training the model with the training dataset every single time can be avoided (the model uses the serialized file to load the pre-trained model’s configuration).

Data pre-processing

A detailed analysis of this dataset and the methodology used has been provided in a previous paper [13]. The dataset is taken from kaggle [14]. As shown in Fig. 2, first, the given dataset is divided into the training dataset and the testing dataset. Furthermore, the training dataset and the testing dataset have been divided into the features dataset and the target dataset.

Fig. 2
figure 2

Splitting of the dataset

Both the training features dataset and the training target dataset consists of 23,814 training samples. Also, both the testing features dataset and the testing target dataset consists of 3982 testing samples. In the data pre-processing stage, the categorical values of the attributes are mapped into numerical values as shown in Table 2.

Table 2 Mapping of the attribute’s values

Evaluation of the machine learning model

The accuracy of the machine learning model is evaluated by applying log loss function for each drug-MoA annotation pair. The mean column-wise log loss is used for the evaluation of the model.

For every sample id “sig_id”, the probability that the sample had a positive response needs to be predicted for each MoA target. A positive response means that a drug belongs to a particular class of drug (i.e. target). A lesser value of log loss (i.e. score) indicates better accuracy.

The formula for the evaluation of the machine learning model is shown in Eq. (1) [15].

$${\text{score}}=-\frac{1}{M}\sum_{m=1}^{M}\frac{1}{N}\sum_{i=1}^{N}\left[{y}_{i,m}\mathrm{log}\left({\stackrel{{}}{y}}_{i,m}\right)+\left(1-{y}_{i,m}\right)\mathrm{log}\left(1-{\stackrel{{}}{y}}_{i,m}\right)\right],$$
(1)

where: N is the number of sig_id observations in the test data (i = 1,2,…,N). M is the number of scored MoA targets (m = 1,2,…,M). \({\hat{y}}_{i,m}\) is the predicted probability of a positive MoA response for a sample id (sig_id). \({y}_{i,m}\) is the ground truth, 1 for a positive response, 0 otherwise. log() is the natural base e logarithm.

Models and results

In the dataset, there could be numerous Mechanism of Action’s (MoA’s) for each of the drug. Thus, this machine learning problem belongs to multi-label classification. The machine models tested in this paper are BRkNN (Binary Relevance K Nearest Neighbors), ML-KNN (Multi-label K-Nearest Neighbors) and a custom Neural Network.

BRKNN (binary relevance K nearest neighbors)

BRkNN is a variant of the k-Nearest Neighbors (kNN) method that is essentially equal to combining Binary Relevance (BR) with the kNN algorithm. BRkNN extends the kNN method to make independent predictions for each label [16].

Based on the assessment of each label's confidence score, BRKNN is classified into two types: BRkNN-a and BRkNN-b.

BRkNN-a (type A)

BRkNN-a determines whether BRkNN returns the empty set if none of the labels appear in at least half of the k nearest neighbours. If this criterion is met, the label with the highest confidence is outputted [16]. For this model, Fig. 3 and Table 3 shows the graph and prediction scores, respectively.

Fig. 3
figure 3

Graph representing the accuracy of the BRkNN-a model

Table 3 Prediction scores of the BRkNN-a model

In the graph shown in Fig. 3, the X-axis represents the number of neighbours, and the Y-axis represents the public and private dataset score. The private dataset score improves from 3 neighbours until 5 neighbours. The public dataset score improves until from 3 neighbours until 10 neighbours. Afterwards, both of the scores decline as the number of neighbours increases.

BRkNN-b (type B)

First, BRkNN-b estimates the “s” (average size) of the label sets of the k nearest neighbors, and later, outputs the integer which is nearest to “s” labels, which is having the highest confidence [16]. For this model, Fig. 4 and Table 4 shows the graph and prediction scores, respectively. In the graph shown in Fig. 4, the X-axis represents the number of neighbors and the Y-axis represents the public and private dataset score. Both the private dataset score and the public dataset score improves from 3 neighbors until 2000 neighbors. 5000 neighbors yeilds a worse score. Afterwards, both of the scores remains constant. As seen from Table 4, the maximum difference between the public dataset score and private dataset score is 0.38482, which occurs when the number of neighbors is 30.

Fig. 4
figure 4

Graph representing the accuracy of the BRkNN-b model

Table 4 Prediction scores of the BRkNN-b model

ML-KNN (multi-label K-nearest neighbors)

The ML-KNN technique is based on the well-known k-Nearest Neighbor (kNN) algorithm. First, the k nearest neighbors in the training set are selected for each test instance. The maximum a posteriori (MAP) concept is then used to determine the label set for the test instance based on statistical information obtained from the label sets of the neighbouring examples [17]. For this model, Fig. 5 and Table 5 shows the graph and prediction scores, respectively. In the graph shown in Fig. 5, the X-axis represents the number of neighbors and the Y-axis represents the public and private dataset score. Both the private dataset score and the public dataset score improves from 3 neighbors until 20 neighbors. Afterwards, both of the scores declines as the number of neighbors increases.

Fig. 5
figure 5

Graph representing the accuracy of the ML-KNN model

Table 5 Prediction scores of the ML-KNN model

Custom neural network

A neural network is created using Keras [18,19,20]. Keras is a Python-based deep learning API that runs on top of TensorFlow. Since there are 875 input features in the dataset, the input layer units is 875. Similarly, there are 206 output targets, the output layer units is 206. Both the dropout layer 1 and dropout layer 2 have 0.5 as the dropout rate. The model is compiled using the binary cross-entropy loss function. The optimizer used is adam. The Neural network implementation code can be found in Github [21]. Figure 6 shows the layers of the neural network. Table 6 gives the description of the each of the layer used. Table 7 shows the activation functions used for the dense layers and the output layer. Figures 7 and 8 shows the graph for the sigmoid and RELU activation function, respectively. Figure 9 shows the accuracy graph. Table 8 shows the prediction scores for this model.

Fig. 6
figure 6

Layers of the custom neural network

Table 6 Description of the layers of the custom neural network
Table 7 Activation function used for the custom neural network
Fig. 7
figure 7

Graph for sigmoid activation function

Fig. 8
figure 8

Graph for RELU activation function

Fig. 9
figure 9

Graph representing the accuracy of the custom neural network

Table 8 Prediction scores of the custom neural network

In the graph shown in Fig. 9, the X-axis represents the epochs and the Y-axis represents the public and private dataset score. Both the private dataset score and the public dataset score improves from 15 epochs until 75 epochs. Afterwards, both of the scores declines as the number of epochs increases.

Since the Private Dataset Score is considered for scoring the final leader board, the best score for private dataset obtained with each of the models is considered. The summary of the best accuracy for each of the model is shown in the Table 9. As seen from the Table 9, the custom neural network with 75 epochs and 100 batch size performs the best.

Table 9 Summary of the best prediction scores for each of the model

Architecture of the web application

A web application is developed to visualize the Mechanism of Action of each of the drug. The source code for this web application can be found in Github [21]. This web application is developed using the Flask framework [22]. It also uses the Jinga Templating Engine [23].

Figure 10 shows the architecture of the web application. The input is a CSV file, which contains gene expression and cell viability values of each drug. The output is the top classes of drugs (with the highest probability). The number of top MoA’s to be displayed in the output can be set using the variable NUMBER_OF_TOP_MOA.

Fig. 10
figure 10

Web application’s architecture

Running the web application

In Table 10, the testing dataset which is to be uploaded in the web application (testing_dataset.csv) is shown. For each of the drug present in the testing dataset, the top MoA’s for each of the drug is displayed. Along with it, a scatter plot is displayed for each of the drug. In order to visualize the scatter plot, an ID is given to each of the class of drug. The first class of drug (i.e. 5-alpha_reductase_inhibitor) is given ID 1, the second class of drug (i.e. 11-beta-hsd1_inhibitor) is given ID 2 and so on. This list of ID’s is stored in a python list (present in the flask application). The X-axis of the scatter plot represents the ID of the class of the drug, and the Y-axis represents the probability of the drug belonging to that class of the drug. The homepage of the web application is shown in Fig. 11. The top classes of drug is shown in Figs. 12 and 13. The scatter plot is shown in Figs. 14 and 15.

Table 10 Example testing dataset to be uploaded in the web application (contains two drugs)
Fig. 11
figure 11

Home page of the web application

Fig. 12
figure 12

Top classes of drug along with their probability (for the first drug)

Fig. 13
figure 13

Top classes of drug along with their probability (for the second drug)

Fig. 14
figure 14

Scatter plot (for the first drug)

Fig. 15
figure 15

Scatter plot (for the second drug)

Conclusion

Mechanism of drug can help scientists accelerate the drug discovery process. This paper discussed various machine learning models to predict the mechanism of action of a drug. Also, a Flask-based web application is introduced, through which a user can input a custom testing features data-set containing gene expression and cell viability levels. The output produced is the top classes of drugs, along with their scatter plot. This can help scientists to predict the Mechanism of Action and can help them in the discovery of new drugs.

Figure 16 and Table 11 shows a summary regarding the log loss of all the machine learning models used in this paper. Among these models, the custom neural network model performed the best.

Fig. 16
figure 16

Bar chart representing the log loss of machine learning models

Table 11 Log loss of all machine learning models

In the future, if a better-performing machine learning model is discovered, they can seamlessly integrate their machine learning model into the web application provided in this paper. Also, for a better visualization of the scatterplots, the web application can be extended to use interactive scatterplots using plotly, bokeh or any other plotting packages.

References

  1. Definition of mechanism of action, National Cancer Institute, https://www.cancer.gov/publications/dictionaries/cancer-terms/def/mechanism-of-action.

  2. Pierre-Louis T. Mechanism of drug action and pharmacokinetics/pharmacodynamics integration in dosage regimen optimization for veterinary medicine. Veterinary Pharmacology and Therapeutics. Wiley. p 1525, 2018, 9781118855829. hal-02787306.

  3. Palmer A. The many genes of drug mechanism. Nat Chem Biol. 2016;12:57–8. https://doi.org/10.1038/nchembio.2010.

    Article  Google Scholar 

  4. Yuan T, et al. The pursuit of mechanism of action: uncovering drug complexity in TB drug discovery. RSC chemical biology. 2021;2(2):423–40. https://doi.org/10.1039/d0cb00226g.

    Article  Google Scholar 

  5. Trapotsi M-A, Barrett I, Engkvist O, Bender A. Bioinformatic approaches in the understanding of mechanism of action (MoA). In: Plowright AT, editor. Target discovery and validation. https://doi.org/10.1002/9783527818242.ch11.

  6. Dyshlovoy SA, et al. Efficacy and mechanism of action of marine alkaloid 3,10-dibromofascaplysin in drug-resistant prostate cancer cells. Mar Drugs. 2020;18(12):609. https://doi.org/10.3390/md18120609.

    Article  Google Scholar 

  7. Vane JR, Botting RM. The mechanism of action of aspirin. Thromb Res. 2003;110(5–6):255–8. https://doi.org/10.1016/s0049-3848(03)00379-7.

    Article  Google Scholar 

  8. Li Y, et al. Research on the mechanism of action of a citrinin and anti-citrinin antibody based on mimotope X27. Toxins. 2020;12(10):655. https://doi.org/10.3390/toxins12100655.

    Article  Google Scholar 

  9. Fang X, et al. The mechanism of action of ramoplanin and enduracidin. Mol bioSystems. 2006;2(1):69–76. https://doi.org/10.1039/b515328j.

    Article  Google Scholar 

  10. Krause L, Shuster S. Mechanism of action of antipruritic drugs. Br Med J Clin Res Ed. 1983;287(6400):1199–200. https://doi.org/10.1136/bmj.287.6400.1199.

    Article  Google Scholar 

  11. Grinchii D, Eliyahu D. Mechanism of action of atypical antipsychotic drugs in mood disorders. Int J Mol Sci. 2020;21(24):9532. https://doi.org/10.3390/ijms21249532.

    Article  Google Scholar 

  12. Koranne, S. Hierarchical data format 5: HDF5. In: Handbook of open source tools. Springer, Boston, MA, 2011. p. 191–200. https://doi.org/10.1007/978-1-4419-7719-9_10.

  13. Puneeth GR, et al. Analysis of drug classification using mechanism of action. J Phys Conf Ser. 2021;1914(1):01204. https://doi.org/10.1088/1742-6596/1914/1/012034.

    Article  Google Scholar 

  14. Mechanism of Action Dataset, Kaggle, https://www.kaggle.com/c/lish-moa/data.

  15. Evaluation of the model, Kaggle, https://www.kaggle.com/c/lish-moa/overview/evaluation.

  16. Spyromitros E, Tsoumakas G, Vlahavas I. An empirical study of lazy multilabel classification algorithms. In: Darzentas J, Vouros GA, Vosinakis S, Arnellos A. editors, Artificial intelligence: theories, models and applications. SETN 2008. Lecture Notes in Computer Science, vol. 5138. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-87881-0_40.

  17. Min-Ling Z, Zhi-Hua Z. ML-KNN: a lazy learning approach to multi-label learning. Pattern Recogn. 2007;40(7):2038–48. https://doi.org/10.1016/j.patcog.2006.12.019.

    Article  MATH  Google Scholar 

  18. Szymański P, Kajdanowicz T. A Scikit-based python environment for performing multi-label classification. 2017, allrXiv:1702.01460. arXiv.org e-Print archive. hps://arxiv.org/abs/1702.01460.

  19. Ketkar N. Introduction to Keras. In: Deep learning with python. 2017. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-2766-4_7.

  20. Chollet F et al. Keras. GitHub. Retrieved from https://github.com/fchollet/keras. 2015.

  21. Source code for the MoA web application and the implementation of Neural network, GitHub. Retrieved from https://github.com/Puneethgr/mechanism-of-action.

  22. Flask Web Framework, Official Documentation, https://flask.palletsprojects.com/.

  23. Jinga Template, Official Documentation, https://jinja.palletsprojects.com/.

Download references

Author information

Affiliations

Authors

Contributions

HLG, CHA wrote the main manuscript text. PGR, SBR designed the model and applied suitable ML algorithms to draw the results. FF validated the data sets and results. HLG, CHA proof read the article before submitting. All authors read and approved the final manuscript.

Corresponding author

Correspondence to H. L. Gururaj.

Ethics declarations

Competing interests

The authors declare no competing interests.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Gururaj, H.L., Flammini, F., Kumari, H.A.C. et al. Classification of drugs based on mechanism of action using machine learning techniques. Discov Artif Intell 1, 13 (2021). https://doi.org/10.1007/s44163-021-00012-2

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s44163-021-00012-2

Keywords

  • Mechanism of action
  • Cell viability
  • Gene expression
  • Protein
  • Inhibitors