<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kexin Huang on Medium]]></title>
        <description><![CDATA[Stories by Kexin Huang on Medium]]></description>
        <link>https://medium.com/@cosamhkx?source=rss-8d894493ebb1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*8npFWXjXAj7vEofGQZdf-g.jpeg</url>
            <title>Stories by Kexin Huang on Medium</title>
            <link>https://medium.com/@cosamhkx?source=rss-8d894493ebb1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 10 Nov 2026 05:42:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cosamhkx/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Drug Discovery with Deep Learning Under 10 Lines of Codes.]]></title>
            <link>https://medium.com/data-science/drug-discovery-with-deep-learning-under-10-lines-of-codes-742ee306732a?source=rss-8d894493ebb1------2</link>
            <guid isPermaLink="false">https://medium.com/p/742ee306732a</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[drugs]]></category>
            <category><![CDATA[drug-discovery]]></category>
            <category><![CDATA[toolkit]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Kexin Huang]]></dc:creator>
            <pubDate>Thu, 09 Jul 2020 03:45:20 GMT</pubDate>
            <atom:updated>2020-07-10T20:37:42.644Z</atom:updated>
            <content:encoded><![CDATA[<h3>Drug Discovery with Deep Learning. Under 10 Lines of Codes.</h3><h4>Introduce DeepPurpose, a deep learning-based toolkit for drug-target interaction prediction, drug repurposing, and virtual screening.</h4><p><strong>TL;DR</strong>: Deep learning is revolutionizing the drug discovery industry. In this post, I show how to use the DeepPurpose toolkit to unlock 50+ models for Drug-Target Interaction (DTI) prediction, a fundamental task in drug discovery, using only a few lines of code in a scikit-learn fashion. DeepPurpose also enables an easy interface to do two important applications of DTI prediction: virtual screening and drug repurposing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dQbISeNFYvNA-xZh" /><figcaption>Photo by <a href="https://unsplash.com/@joshstyle?utm_source=medium&amp;utm_medium=referral">JOSHUA COLEMAN</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Introduction</strong></p><p>Discover a new drug takes more than<strong> 10 years</strong> and costs higher than <strong>$2.6 billion </strong>[1]. Recently, many AI for drug discovery startups emerge and have successfully applied deep learning techniques to aid drug discovery research and greatly shorten time/save cost [2,3]. Thus, it is a very exciting and booming field 💥!</p><p>However, the interest within the data scientist community in deep learning for drug discovery, although growing quickly, is still far behind other deep learning applications such as NLP and images. One possible reason is that the lack of open-sourced tools prevents many data scientists to probe into this exciting domain. Existing toolkits such as DeepChem, OpenChem, MoleculeNet and etc., have democratized the use of deep learning for life sciences greatly. In this post, I describe a new addition called DeepPurpose that works specifically for drug-target interaction prediction, a fundamental task for the drug discovery process. All data scientists love scikit-learn. Thus, we design DeepPurpose as a scikit-learn-fashion framework that wraps 50+ models in less than 10 lines 😇!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n52wD5dEEFlR0s2hkDM-0w.png" /><figcaption>DeepPurpose logo. Image by authors.</figcaption></figure><p><strong>Background</strong></p><p>Let’s start with some biochemistry concepts. A major category of disease is usually attributed to the target protein in the disease pathway. A drug is discovered to modulate the target protein. Through this modulation of disease responsible protein, the disease can be cured. One of the major paradigms of the drug action mechanism is the ‘Lock-And-Key’ theory [4]. A protein is a “ lock” 🔒 and drug discovery is to find the right “key” 🔑 to unlock the target (i.e., the right drug to modulate the protein). This fitness is called binding affinity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*RaBe2THhiQmHic2lyR4b7Q.png" /><figcaption>“Lock and Key” theory of drug-target interactions. Image permission granted by Christopher Vakoc.</figcaption></figure><p>Drug-target interaction (DTI) measures the binding affinity of drug molecules to the protein targets. Thus, we can easily imagine that an accurate DTI deep learning model can greatly benefit the drug discovery process [5]. More specifically, virtual screening and drug repurposing are two main applications based on DTI. Virtual screening helps identify ligand candidates that can bind to the protein of interest, whereas drug repurposing finds new therapeutic purposes for existing drugs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KRJUvk0smZqC3MXmoWrxQA.png" /><figcaption>Tasks illustration. Image by authors.</figcaption></figure><p><strong>DeepPurpose Overview</strong></p><p>DeepPurpose formulates DTI models as an encoder-decoder framework, which includes a majority of previous works [6,7,8,9,10] and much more. Two encoders generate embeddings for drug and protein respectively and then they are concatenated into a decoder, where it predicts the binding affinity score.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-14Iw7DV_4CBjFDNqjxIBw.png" /><figcaption>An encoder-decoder framework. Image by authors.</figcaption></figure><p>DeepPurpose uses the most accessible input data format. The input is a drug target pair, where the drug uses the simplified molecular-input line-entry system (SMILES) string and the target uses the amino acid sequence. The output is a score indicating the binding activity of the drug-target pair.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*thhCLRIW64GpzFapZf7IKg.png" /><figcaption>Drug and target protein representation. Image by authors.</figcaption></figure><p>For drugs, we provide 8 encoders: four classic cheminformatics fingerprints (Morgan, Pubchem, Daylight, and RDKit 2D) with Deep Neural Network (DNN) on top of them; 1D Convolutional Neural Network (CNN) on SMILES string characters; Recurrent Neural Network on top of CNN to leverage the sequential order; Transformer encoder on sub-structure partition fingerprint [11]; and Message passing neural network on the molecular graphs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NEOC-fcD_OfavI9zknfHeQ.png" /><figcaption>Drug encoders. Images by authors.</figcaption></figure><p>For the target protein, we have 7 encoders: DNN on top of four classic computational biology fingerprints (AAC, PseAAC, Conjoint Triad, Quasi-sequence); CNN on the amino acid sequence; RNN on top of CNN; and transformer on the sub-sequence fingerprint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-IrPze0xwrNo19hmri339g.png" /><figcaption>Target encoders. Images by authors.</figcaption></figure><p>In combination, there are 56 (8 times 7) drug-target encoding models! Also, most of the models are novel 🆕!</p><p><strong>DeepPurpose Framework</strong></p><p>Now after we have a conceptual overview of DTI and DeepPurpose, I begin to introduce the DeepPurpose programming framework. This framework consists of several steps where each step consists of one line of code:</p><ul><li>Data loading</li><li>Encoder specification</li><li>Data encoding and split</li><li>Model configuration generation</li><li>Model initialization</li><li>Model training</li><li>Repurposing/Screening</li><li>Model saving and loading</li></ul><p>Let’s go over each step! For a better learning experience, it is recommended to follow these steps in your own Jupyter notebook file or going over the <a href="https://github.com/kexinhuang12345/DeepPurpose/blob/master/Tutorial_1_DTI_Prediction.ipynb">blog post notebook</a>. To install DeepPurpose, you can use the <a href="https://mybinder.org/v2/gh/kexinhuang12345/DeepPurpose/master">DeepPurpose Binder cloud notebook</a> (<em>simply clicking the link!</em>) or use the local DeepPurpose environment. The instructions for the installation can be found <a href="https://github.com/kexinhuang12345/DeepPurpose#install--usage">here</a>, where you can also find <a href="https://youtu.be/bqinehjnWvE">video installation tutorials</a>.</p><p><strong>Data loading</strong></p><p>DeepPurpose takes in a NumPy array of drug’s SMILES strings (X_drugs), a NumPy array of target protein’s amino acid sequence (X_targets), and a NumPy array of labels (y), which can either be binary 0/1 indicating interaction outcome or a real number indicating binding affinity value. The input drug and target arrays should be paired, i.e. y[0] is the score for X_drugs[0] and X_targets[0]. DeepPurpose will <em>automatically</em> switch between the binary classification task or regression task depending on the dataset.</p><p>Besides transforming into NumPy arrays through some data wrangling on your own, DeepPurpose also provides benchmark dataset loaders (DAVIS/KIBA/BindingDB) to ease preprocessing. For example, in this post, we will use the DAVIS dataset:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/320d2b78b92cf50045fd34bb6040e729/href">https://medium.com/media/320d2b78b92cf50045fd34bb6040e729/href</a></iframe><p>You can also load your own dataset from txt file using thedataset.read_file_training_dataset_drug_target_pairs function, where each line is a drug SMILES string, a target amino acid sequence, and the binding score.</p><p><strong>Encoder specification</strong></p><p>After we obtain the required data format, we need to first specify the encoder to use for drug and protein. Here we try MPNN for the drug and CNN for the target. <strong>Note that you can switch encoder just by changing the encoding name. </strong>The full list of encoders is listed <a href="https://github.com/kexinhuang12345/DeepPurpose#encodings">here</a>.</p><p>(If you are using CPU to run this blog post, you will find that MPNN and CNN are a bit large, you can try smaller encoders such as Morgan for drugs and Conjoint_triad<em> </em>for proteins.)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c8519b1e554d73d221434622474e9aba/href">https://medium.com/media/c8519b1e554d73d221434622474e9aba/href</a></iframe><p><strong>Data encoding and split</strong></p><p>Now, we need to prepare the data encoding scheme for different encoders, using the utils.data_process function. In this function, we can specify train/validation/test split fractions, random seed to ensure the same data split for reproducibility, and also supports data splitting methods such as cold_drug and cold_protein, which splits on drug/proteins for model robustness evaluation to test unseen drug/proteins. The function outputs train, validation, and test set Pandas data frames.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4dfb9919bd2e471e4c89cb67b2c55067/href">https://medium.com/media/4dfb9919bd2e471e4c89cb67b2c55067/href</a></iframe><p><strong>Model configuration generation</strong></p><p>Now, we initialize a model with its configuration. You can modify almost any hyper-parameters (e.g., learning rate, epoch, batch size), model parameters (e.g. hidden dimensions, filter size) in this function. The supported configurations are listed here in this <a href="https://github.com/kexinhuang12345/DeepPurpose/blob/e169e2f550694145077bb2af95a4031abe400a77/DeepPurpose/utils.py#L486">link</a>.</p><p>For this blog post, we specify the epoch size to be 3 so that you can run on both CPUs &amp; GPUs quickly and can proceed to the next steps. For reference parameters, check out the notebooks in the <a href="https://github.com/kexinhuang12345/DeepPurpose/tree/master/DEMO">DEMO</a> folder.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/daaf45d28a4be548a635babd24c42576/href">https://medium.com/media/daaf45d28a4be548a635babd24c42576/href</a></iframe><p><strong>Model initialization</strong></p><p>Next, we initialize a model using the above configuration:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ce524436ecf46ce930b9af4bc002889d/href">https://medium.com/media/ce524436ecf46ce930b9af4bc002889d/href</a></iframe><p><strong>Model training</strong></p><p>Now, it is ready to train by simply typing the model.train function!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6efdfe1456e8c9c56ae1a87e34c362cd/href">https://medium.com/media/6efdfe1456e8c9c56ae1a87e34c362cd/href</a></iframe><p>The training loss curve will be automatically printed out. Also, if the task is a binary classification task, the test set ROC-AUC and PR-AUC curves will also be printed out.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*scaoavLTkZUt12ZP_fqCcQ.png" /><figcaption>Automatically generated loss curve. Image by authors.</figcaption></figure><p><strong>Repurposing/Screening</strong></p><p>After we trained the model, we can simply repurpose and screen using the models.repurpose and models.virtual_screening functions:</p><p>For example, suppose we want to do repurposing from a set of antiviral drugs for a COVID-19 target 3CL protease. We have provided the corresponding data in the dataset wrappers.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fe5540fc7edf293c494a85e07cbabddd/href">https://medium.com/media/fe5540fc7edf293c494a85e07cbabddd/href</a></iframe><p>A ranked list of drug candidates are automatically generated and printed out:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*He2PKkDFruZ4oMUdwoJBLw.png" /><figcaption>Automatically generated a ranked list of repurposing results. Image by authors.</figcaption></figure><p>Next, we showcase how to do virtual screening on a sample of data from the BindingDB dataset and then use the virtual_screening function to generate a list of drug-target pairs that have high binding affinities. If no drug/target names are provided, the index of the drug/target list is used instead. A similar looking ranked list would be generated.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a1617fc4240d62e618061fdd5a40b174/href">https://medium.com/media/a1617fc4240d62e618061fdd5a40b174/href</a></iframe><p><strong>Model saving and loading</strong></p><p>At last, saving and loading models are also really easy. The loading function also automatically detects if the model is trained on multiple GPUs. An example to save and load the model we just trained:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3bf295a0b6d91aaf599891c2eaaf4ec3/href">https://medium.com/media/3bf295a0b6d91aaf599891c2eaaf4ec3/href</a></iframe><p>We have also provided a list of pretrained model, you can find all available ones under the <a href="https://github.com/kexinhuang12345/DeepPurpose#pretrained-models">list</a>. For example, to load an MPNN+CNN model pretrained on BindingDB Kd dataset:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/467607d402ccef3f24a4055e306e7a1d/href">https://medium.com/media/467607d402ccef3f24a4055e306e7a1d/href</a></iframe><p>That’s it! You can now train a state-of-the-art deep learning model for the drug-target interaction prediction task 👏!</p><p>DeepPurpose also supports many more functionalities, for example, this <a href="https://github.com/kexinhuang12345/DeepPurpose/blob/master/DEMO/Drug_Property_Pred-Ax-Hyperparam-Tune.ipynb">demo</a> shows how to use the Ax platform to do the latest hyperparameter tuning methods such as Bayesian Optimization on DeepPurpose.</p><p>Last but not least, many real-world drug development involves assay data, which means the data only consists of a drug molecule and the binding score to the target or bacteria. This problem is also called a drug property prediction task. DeepPurpose also supports this task by using only the drug encoders to predict the binding score. The framework is very similar to DTI prediction, as illustrated here:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f034c82a693792c6b8759f6c2557563f/href">https://medium.com/media/f034c82a693792c6b8759f6c2557563f/href</a></iframe><p>For more detailed step-by-step instruction, you can find the notebook for this blog post here: [<a href="https://github.com/kexinhuang12345/DeepPurpose/blob/master/Tutorial_1_DTI_Prediction.ipynb">DTI Prediction</a>][<a href="https://github.com/kexinhuang12345/DeepPurpose/blob/master/Tutorial_2_Drug_Property_Pred_Assay_Data.ipynb">Drug Property Prediction</a>].</p><p>This wraps up our blog post on DeepPurpose and DTI prediction! I hope you like it and become interested in the exciting intersection of deep learning and drug discovery if you haven’t already! We also call for data scientists to contribute to this open-sourced project!</p><p><strong>To learn more, here is the </strong><a href="http://arxiv.org/abs/2004.08919"><strong>paper</strong></a><strong> and </strong><a href="https://github.com/kexinhuang12345/DeepPurpose"><strong>Github repository</strong></a><strong>, please star, share, and contribute!</strong></p><p><strong>This is joint work with Tianfan Fu, Lucas Glass, Marinka Zitnik, Cao Xiao, and Jimeng Sun.</strong></p><p><strong>If you have any questions or feedback, feel free to reach me at <em>kexinhuang@hsph.harvard.edu</em>; or simply PM me on Twitter </strong><a href="https://twitter.com/KexinHuang5"><strong><em>@KexinHuang5</em></strong></a><strong>!</strong></p><p><strong>Reference</strong></p><p>[1] Mullard, A. New drugs cost US$2.6 billion to develop. <em>Nature Reviews Drug Discovery </em>(2014).</p><p>[2] Fleming, Nic. How artificial intelligence is changing drug discovery. <em>Nature</em> (2018).</p><p>[3] Smalley, E. AI-powered drug discovery captures pharma interest. <em>Nature Biotechnology</em> (2017).</p><p>[4] Gschwend DA, Good AC, Kuntz ID. Molecular docking towards drug discovery. <em>Journal of Molecular Recognition: An Interdisciplinary Journal </em>(1996).</p><p>[5] Mayr, Andreas, et al. Large-scale comparison of machine learning methods for drug target prediction on ChEMBL. <em>Chemical science </em>(2018).</p><p>[6] Öztürk H, Özgür A, Ozkirimli E. DeepDTA: deep drug-target binding affinity prediction. <em>Bioinformatics </em>(2018).</p><p>[7] Nguyen, Thin, Hang Le, and Svetha Venkatesh. GraphDTA: prediction of drug–target binding affinity using graph convolutional networks. <em>BioRxiv</em> (2019).</p><p>[8] Tsubaki, Masashi, Kentaro Tomii, and Jun Sese. Compound–protein interaction prediction with end-to-end learning of neural networks for graphs and sequences. <em>Bioinformatics </em>(2019).</p><p>[9] Lee, Ingoo, Jongsoo Keum, and Hojung Nam. DeepConv-DTI: Prediction of drug-target interactions via deep learning with convolution on protein sequences. <em>PLoS computational biology</em> (2019).</p><p>[10] Chen, Xing, et al. Drug–target interaction prediction: databases, web servers and computational models. <em>Briefings in bioinformatics </em>(2016).</p><p>[11] Huang K, Xiao C, Hoang T, Glass L, Sun J. CASTER: Predicting Drug Interactions with Chemical Substructure Representation. <em>AAAI</em> (2020).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=742ee306732a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/drug-discovery-with-deep-learning-under-10-lines-of-codes-742ee306732a">Drug Discovery with Deep Learning Under 10 Lines of Codes.</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>