← Back to News

MolMap: Transforming Molecular Fingerprints into 2D Feature Maps for Deep Learning

Wanxiang Shen November 2024

One of the fundamental challenges in computational drug discovery is how to represent a molecule in a way that a deep learning model can effectively learn from. While molecular fingerprints have served the field for decades, their 1D vector structure loses spatial and grouping information that could be crucial for property prediction.

The Core Idea

MolMap addresses this by learning to arrange molecular descriptors and fingerprint bits into a structured 2D grid — a "feature map" — where chemically related features are placed in proximity. This transforms the problem from 1D signal regression to a 2D image-like task, naturally enabling convolutional neural networks to learn hierarchical patterns.

How It Works

The key steps are:

  1. Compute a large set of molecular descriptors using RDKit and Mordred
  2. Calculate pairwise feature correlations across a reference dataset
  3. Use dimensionality reduction (UMAP/t-SNE) to embed features into 2D space
  4. Assign features to a regular grid via the Jonker-Volgenant algorithm
  5. Train a CNN on the resulting feature maps
Python
import molmap
import numpy as np

# Initialize MolMap with a reference dataset
mp = molmap.MolMap(ftype='descriptor', fmap_type='grid')
mp.fit(reference_smiles_list, method='umap')

# Transform a molecule
smiles = 'CCO'  # ethanol
feature_map = mp.transform(smiles)
print(feature_map.shape)  # (N, M, C) — a 2D image

Results

MolMap achieved state-of-the-art performance across multiple MoleculeNet benchmarks when we first published in Nature Machine Intelligence (2021). It has since been integrated into ZairaChem's automated drug discovery pipeline, demonstrating its real-world utility.

Availability

MolMap is open-source. You can install it via pip and find the source code on our GitHub. We welcome contributions and bug reports.

Wanxiang Shen
Wanxiang Shen

Assistant Professor at AIDDPM Lab, Zhejiang University. Lead developer of MolMap, AggMap, COMPASS, and Leadmaster. Research focuses on AI for drug discovery and precision medicine.

Resources

Wanxiang Shen
Wanxiang Shen
AIDDPM Lab, Zhejiang University