When SMILES have Language: Drug Classification using Text Classification Methods on Drug SMILES Strings

Azmine Toushik Wasi, Šerbetar Karlo, Raima Islam, Taki Hasan Rafi, Dong-Kyu Chae

Introduction

In drug discovery, classifying molecules into therapeutic categories—such as anti-infectives or central nervous system drugs—is a foundational task. Traditionally, researchers rely on complex chemical representations like molecular graphs, 3D structural data, or hand-engineered "fingerprints" that encode specific chemical properties. While effective, these methods often require significant domain expertise and heavy computational resources.

This paper asks a provocative question: What if we ignore the "chemistry" and treat SMILES strings as plain text? By treating SMILES (Simplified Molecular Input Line Entry System) strings as natural language sentences and applying a simple bag-of-n-grams approach, the authors demonstrate that standard Natural Language Processing (NLP) tools can achieve classification performance remarkably competitive with specialized molecular fingerprinting methods.

Methodology: SMILES as a "Sentence"

The core "aha moment" of this research is the analogy that atoms and bonds are words, and the sequential arrangement of the SMILES string forms a coherent sentence. The researchers propose a pipeline that mirrors classic text classification.

Model Pipeline
  1. Representation: The input is a standard SMILES string, where atoms and bonds are represented by characters (e.g., C, N, =, ().
  2. Tokenization: Instead of traditional words, the model uses a bag-of-n-grams approach. The authors experimented with $n$ values ranging from 1 to 5 (e.g., a 3-gram might be a sequence like C4N).
  3. Vocabulary Management: To handle the vast number of possible n-grams, they select the top $K$ most frequent tokens (finding $K=1250$ to be optimal) and map all others to an "Unknown" (UNK) token.
  4. Classification: The resulting frequency-based vectors are fed into a standard Multilayer Perceptron (MLP) to predict the drug class.

This "simple" approach was compared against three industry-standard molecular fingerprints: Atom Pair, MACCS, and Morgan fingerprints. The study utilized a drug dataset from Meyer et al. (2019), containing drugs categorized into 12 classes. The dataset presents a realistic challenge due to significant class imbalance (e.g., "anti-infective" drugs are 83 times more common than "urological" drugs).

Key Results and Insights

The simple NLP approach held its own against sophisticated chemical baselines, proving that complex problems can sometimes be addressed with simpler perspectives.

Performance Comparison Table
  • The 3-Gram Sweet Spot: Among the n-gram models, the 3-gram configuration performed the best, achieving 73.7% accuracy and an ROC-AUC of 0.848. This suggests that sequences of three characters in a SMILES string capture enough local chemical context—like specific functional groups or small rings—to be highly informative.
  • Parity with Fingerprints: The gold standard, the Morgan Fingerprint + MLP, achieved 80.0% accuracy and an ROC-AUC of 0.876. While specialized fingerprints still provide the best overall performance, a basic bag-of-words model—which knows nothing about valence electrons or aromaticity—getting within 6-7% accuracy is a significant finding for model efficiency.
  • Context Sensitivity: The authors noted a fascinating correlation: their optimal settings ($K=1250, n=3$) mirror the standard parameters of Morgan fingerprints. Furthermore, unlike some fingerprints that only check for the presence of a substructure, n-grams are sensitive to the order of characters, allowing them to capture a different type of contextual chemical information.

Limitations and Future Work

The authors acknowledge that the skewed distribution of drug classes in their dataset likely affected the scores. Future work will explore oversampling, undersampling, or synthetic data generation to create more robust classifiers.

Additionally, this study utilized very basic NLP techniques. Moving toward more advanced architectures, like Transformers or pre-trained Large Language Models (LLMs) fine-tuned on chemical strings, could potentially close the performance gap with fingerprint-based methods. Finally, there is a strong opportunity to use NLP interpretability tools to identify which specific "n-gram words" are most influential in predicting a drug's class, potentially revealing novel chemical insights.

Summary updated

BibTeX
@inproceedings{wasi2024when,
  author = {Azmine Toushik Wasi and Šerbetar Karlo and Raima Islam and Taki Hasan Rafi and Dong-Kyu Chae},
  title = {{When SMILES have Language: Drug Classification using Text Classification Methods on Drug SMILES Strings}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=VUYCyH8fCw},
}
Figure